fix(drive): preserve typed proof query fields#4156
Conversation
📝 WalkthroughWalkthroughThe changes add strict validation for JavaScript purpose values and query pagination, preserve pagination through gRPC conversions, and replace manual CBOR query traversal with typed deserialization and comprehensive boundary tests. ChangesQuery pagination handling
Purpose value validation
Estimated code review effort: 3 (Moderate) | ~25 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
|
🕓 Ready for review — 17 ahead in queue (commit 61e96e4) |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v4.1-dev #4156 +/- ##
============================================
- Coverage 87.43% 87.43% -0.01%
============================================
Files 2646 2646
Lines 333981 333994 +13
============================================
+ Hits 292023 292033 +10
- Misses 41958 41961 +3
🚀 New features to boost your workflow:
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/wasm-drive-verify/src/voting/verify_identity_votes_given_proof.rs (1)
214-319: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winThorough boundary/defaulting tests for the typed decoder.
Coverage of pagination boundaries, malformed optional fields, and defaulting is solid. As noted above, all fixtures use
json!(vec![u8; N]), which encodes bytes as a CBOR array of integers rather than a native CBOR byte string — consider adding one fixture that encodesidentity_id/start_atas an actual CBOR byte string to close that gap, once the wire-format question above is resolved.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/wasm-drive-verify/src/voting/verify_identity_votes_given_proof.rs` around lines 214 - 319, The typed decoder tests only cover byte arrays represented as CBOR integer arrays, not native CBOR byte strings. After resolving the wire-format decision, update the fixtures used by valid_query and start_at coverage to include actual CBOR byte-string values for identity_id and start_at, while preserving the existing boundary, malformed-field, and defaulting assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/wasm-drive-verify/src/voting/verify_identity_votes_given_proof.rs`:
- Around line 214-319: The typed decoder tests only cover byte arrays
represented as CBOR integer arrays, not native CBOR byte strings. After
resolving the wire-format decision, update the fixtures used by valid_query and
start_at coverage to include actual CBOR byte-string values for identity_id and
start_at, while preserving the existing boundary, malformed-field, and
defaulting assertions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c09d5423-af90-420e-b6a2-842929fc566a
📒 Files selected for processing (3)
packages/rs-drive-proof-verifier/src/from_request.rspackages/wasm-drive-verify/src/identity/verify_identities_contract_keys.rspackages/wasm-drive-verify/src/voting/verify_identity_votes_given_proof.rs
Summary
Compatibility
This changes only client-side request/proof-query reconstruction. It does not change consensus or require a protocol activation. Malformed or out-of-range request fields now fail before proof verification.
Validation
cargo test -p drive-proof-verifier --lib(242 passed)cargo test -p wasm-drive-verify --lib(11 passed)wasm32-unknown-unknownbuildsSummary by CodeRabbit