test(drive): cover multi-range and paginated compacted balance proofs - #4208
Conversation
The two-proof compacted address-balance envelope shipped without regression coverage for the scenario that sank the original chained-proof fix: two or more compacted ranges sorting at/below the queried height, which is the normal paginated-sync shape (the gRPC handler passes an explicit limit and the SDK pages in a loop). Add three honest-roundtrip regression tests to the verifier: - multiple_ranges_below_query_height_verify: three ranges at/below the bound; verification must succeed and surface only the containing range with its stored changes. - containing_range_with_lower_and_higher_ranges: the forward scan starts at the authenticated containing range and continues through later ranges while wholly-lower ranges stay excluded. - caller_limit_paginates_across_ranges: three limit-1 pages, resuming past the last returned range, ending on an empty fallback-key page. Also port the store_compacted_entry helper that inserts exact-range entries directly, bypassing compaction, so tests control tree shape. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis change adds test-only helpers and regression tests for compacted address-balance verification. The tests cover containing-range selection, forward scanning across ranges, and limited pagination without modifying production verification logic. ChangesCompacted balance verification tests
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v4.1-dev #4208 +/- ##
==========================================
Coverage 87.51% 87.51%
==========================================
Files 2666 2667 +1
Lines 336904 337576 +672
==========================================
+ Hits 294837 295427 +590
- Misses 42067 42149 +82
🚀 New features to boost your workflow:
|
Issue being fixed or feature implemented
The compacted address-balance proof was reworked in #4165 into a two-proof envelope (authenticated descending predecessor + separately verified forward scan, root-bound to each other). That shipped without regression coverage for the exact scenario that sank the earlier chained-single-proof attempt in #3792: two or more compacted ranges sorting at/below the queried height, which is the normal paginated-sync shape — the gRPC handler passes an explicit limit and the SDK pages in a loop. All existing verify tests pass
limit: Noneand set up at most one compacted range below the bound.What was done?
Test-only. Added three honest-roundtrip regression tests to
verify_compacted_address_balance_changes/v0:multiple_ranges_below_query_height_verify— three ranges(1,64) (65,128) (129,192), query from 150: verification must succeed (the case the chained approach could not satisfy) and return only the containing range with its stored changes.containing_range_with_lower_and_higher_ranges— a fourth range(193,256)above the bound: the forward scan starts at the authenticated containing range and continues through later ranges in order, while wholly-lower ranges stay excluded.caller_limit_paginates_across_ranges— threelimit: Some(1)pages resuming past the last returned range, ending on an empty page that exercises the non-containing-predecessor fallback key under a limit.Also ported the
store_compacted_entrytest helper (direct grovedb insert, bypassing compaction) from the #3792 branch so tests can build exact tree shapes.How Has This Been Tested?
cargo test -p drive --features fixtures-and-mocks --lib verify_compacted— 10 passed, 0 failed (3 new).cargo clippy -p drive --features fixtures-and-mocks --lib --testsclean;cargo fmt --allapplied.Breaking Changes
None — test-only.
Checklist:
For repository code-owners and collaborators only
🤖 Generated with Claude Code
Summary by CodeRabbit