Repository navigation
fix(bulk-append): reject short completed chunk proofs - #729
QuantumExplorer wants to merge 2 commits into
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #729 +/- ##
===========================================
+ Coverage 91.42% 91.43% +0.01%
===========================================
Files 236 236
Lines 67053 67147 +94
===========================================
+ Hits 61305 61399 +94
Misses 5748 5748
🚀 New features to boost your workflow:
|
e9ce676 to
af1c808
Compare
|
This is Claude (AI-assisted review). Closing in favor of #740, which adds a code comment instead of the runtime check. Rationale: the completed-chunk-length validation here is cryptographically redundant. A completed chunk's contents are already bound to the state root (the MMR recomputes It only differs from the genuinely-needed #740 documents this at the verification site so future audits don't re-flag it. |
…ded (#740) Document at the verification site that the "validate completed chunk blob holds exactly chunk_item_count entries" check (issue #688) is intentionally omitted because completed chunk content is already bound to the state root via leaf_hash -> mmr_root -> state_root, and every caller compares the computed root against a trusted value. Prevents future (AI) audits from re-flagging it. Closes the need for PR #729. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
* fix(proof): bound bulk-append extraction before the root is bound The V1 BulkAppendTree / CommitmentTree lower-layer verifier took total_count and height from element bytes carried in the proof, computed an unbound root, and extracted values before its caller compared the root with a trusted one. A 9-byte fixed-format chunk blob can declare 2^20 zero-sized entries, and under a forged height of 1 every blob's positions overlapped the query window, so a proof of a few KB made the verifier decode 2^20 entries per blob and return one row per blob per queried position (520,256 duplicate rows for 64 blobs over an 8192-position window). Incomplete fix of #856 (#872). - deserialize_completed_chunk_blob refuses a completed-chunk blob whose entry count is not exactly 2^height, before allocating. A resource bound, not the soundness length check rejected in #688 / #729. - BulkAppendTreeProofResult::values_in_ranges extracts only the query's position intervals, skips chunks no interval touches without decoding them, and refuses repeated, descending or buffer-reaching chunk indices. The GroveDB glue passes the exact PositionIntervals instead of a bounding span. - The MMR, dense, bulk and commitment-tree lower layers bind their computed root to the parent row's value hash before extracting rows. Client-side verifier only; honest proofs never trigger the refusals, so no GroveVersion gate. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(proof): check bulk completeness before decoding; limit-aware extraction Code-review follow-up. The exact chunk count still let a broad query over a forged total_count extract 2^height values per carried chunk (a 1 KB proof gave about 4M values) before completeness or the row limit applied. - Completeness is checked first, on the spans the proof's chunk indices and buffer entries cover (proved_position_spans, missing_from_spans), without decoding anything. - values_in_ranges_directed walks the query's intervals in its direction, stops at the row limit, and copies only the entries it returns (completed_chunk_entries). Variable-format blobs are parsed once, via a walker shared with the general decoder. - A bad chunk blob in a proof result is reported as InvalidProof. - Each lower-layer arm binds its root to the parent exactly once; the MMR, dense, bulk and commitment-tree verifiers bind before reporting any row. The V1 trunk verifier shares ParentCommitment::check. - Tests: incomplete forged chunks refused before decoding, limited queries decode only what they report, deterministic signals instead of 1 s timing asserts, shared blob and CT-root helpers. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(proof): cover element-only binding of MMR and dense lower layers A subset query that stops at an MMR or dense tree consumes the lower layer for its root alone. Pin that the honest element verifies there and that a lower root the parent row does not commit to is refused; codecov flagged the dense root-only bind as uncovered. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
Fixes #688.
Verification