test(sdk): add proof-vector regression corpus for drive-proof-verifier - #4345
Conversation
|
🔍 Review in progress — actively reviewing now (commit 968d12b) |
|
Warning Review limit reached
Next review available in: 1 minute Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdded shared proof-vector loading infrastructure and mock-gated regression tests for identity, quorum signatures, documents, and contested vote states. ChangesProof verifier regression corpus
Estimated code review effort: 3 (Moderate) | ~30 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v4.2-dev #4345 +/- ##
=========================================
Coverage 87.62% 87.62%
=========================================
Files 2704 2704
Lines 345206 345206
=========================================
+ Hits 302473 302474 +1
+ Misses 42733 42732 -1
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/rs-drive-proof-verifier/tests/vectors_contested.rs (1)
161-164: 🎯 Functional Correctness | 🔵 Trivial | 🏗️ Heavy liftAssert the expected finalization block data.
This assertion accepts any nonzero
time_ms. A wrong finalization timestamp, height, epoch, or chain-lock height can pass the regression test. Add expected finalization metadata to the finished manifest and assert the complete returned block data.🤖 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/rs-drive-proof-verifier/tests/vectors_contested.rs` around lines 161 - 164, Update the finished manifest and the assertion near finalization_block to define expected finalization metadata, then assert the complete returned block data rather than only checking finalization_block.time_ms > 0. Verify the expected timestamp, height, epoch, and chain-lock height against the returned finalization block while preserving the existing presence validation.
🤖 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.
Inline comments:
In `@packages/rs-drive-proof-verifier/tests/vectors_identity.rs`:
- Around line 156-164: Run cargo fmt on
packages/rs-drive-proof-verifier/tests/vectors_identity.rs, ensuring the result
field in the GetIdentityContractNonceResponse construction is wrapped
consistently with the equivalent proof responses in that file.
---
Nitpick comments:
In `@packages/rs-drive-proof-verifier/tests/vectors_contested.rs`:
- Around line 161-164: Update the finished manifest and the assertion near
finalization_block to define expected finalization metadata, then assert the
complete returned block data rather than only checking
finalization_block.time_ms > 0. Verify the expected timestamp, height, epoch,
and chain-lock height against the returned finalization block while preserving
the existing presence validation.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 807e12f2-00fe-4089-b46b-682d545fb796
📒 Files selected for processing (71)
packages/rs-drive-proof-verifier/Cargo.tomlpackages/rs-drive-proof-verifier/tests/common/mod.rspackages/rs-drive-proof-verifier/tests/vectors/README.mdpackages/rs-drive-proof-verifier/tests/vectors/contested-vote-state-absent/manifest.jsonpackages/rs-drive-proof-verifier/tests/vectors/contested-vote-state-absent/proof.hexpackages/rs-drive-proof-verifier/tests/vectors/contested-vote-state-absent/quorum_pubkey.hexpackages/rs-drive-proof-verifier/tests/vectors/contested-vote-state-absent/signature.hexpackages/rs-drive-proof-verifier/tests/vectors/contested-vote-state-active/manifest.jsonpackages/rs-drive-proof-verifier/tests/vectors/contested-vote-state-active/proof.hexpackages/rs-drive-proof-verifier/tests/vectors/contested-vote-state-active/quorum_pubkey.hexpackages/rs-drive-proof-verifier/tests/vectors/contested-vote-state-active/signature.hexpackages/rs-drive-proof-verifier/tests/vectors/contested-vote-state-finished/manifest.jsonpackages/rs-drive-proof-verifier/tests/vectors/contested-vote-state-finished/proof.hexpackages/rs-drive-proof-verifier/tests/vectors/contested-vote-state-finished/quorum_pubkey.hexpackages/rs-drive-proof-verifier/tests/vectors/contested-vote-state-finished/signature.hexpackages/rs-drive-proof-verifier/tests/vectors/dashpay-contacts-incoming/manifest.jsonpackages/rs-drive-proof-verifier/tests/vectors/dashpay-contacts-incoming/proof.hexpackages/rs-drive-proof-verifier/tests/vectors/dashpay-contacts-incoming/quorum_pubkey.hexpackages/rs-drive-proof-verifier/tests/vectors/dashpay-contacts-incoming/signature.hexpackages/rs-drive-proof-verifier/tests/vectors/dashpay-profile/manifest.jsonpackages/rs-drive-proof-verifier/tests/vectors/dashpay-profile/proof.hexpackages/rs-drive-proof-verifier/tests/vectors/dashpay-profile/quorum_pubkey.hexpackages/rs-drive-proof-verifier/tests/vectors/dashpay-profile/signature.hexpackages/rs-drive-proof-verifier/tests/vectors/dpns-domain-exact/manifest.jsonpackages/rs-drive-proof-verifier/tests/vectors/dpns-domain-exact/proof.hexpackages/rs-drive-proof-verifier/tests/vectors/dpns-domain-exact/quorum_pubkey.hexpackages/rs-drive-proof-verifier/tests/vectors/dpns-domain-exact/signature.hexpackages/rs-drive-proof-verifier/tests/vectors/dpns-domain-prefix/manifest.jsonpackages/rs-drive-proof-verifier/tests/vectors/dpns-domain-prefix/proof.hexpackages/rs-drive-proof-verifier/tests/vectors/dpns-domain-prefix/quorum_pubkey.hexpackages/rs-drive-proof-verifier/tests/vectors/dpns-domain-prefix/signature.hexpackages/rs-drive-proof-verifier/tests/vectors/identity-balance-corrupted-proof/manifest.jsonpackages/rs-drive-proof-verifier/tests/vectors/identity-balance-corrupted-proof/proof.hexpackages/rs-drive-proof-verifier/tests/vectors/identity-balance-corrupted-proof/quorum_pubkey.hexpackages/rs-drive-proof-verifier/tests/vectors/identity-balance-corrupted-proof/signature.hexpackages/rs-drive-proof-verifier/tests/vectors/identity-balance/manifest.jsonpackages/rs-drive-proof-verifier/tests/vectors/identity-balance/proof.hexpackages/rs-drive-proof-verifier/tests/vectors/identity-balance/quorum_pubkey.hexpackages/rs-drive-proof-verifier/tests/vectors/identity-balance/signature.hexpackages/rs-drive-proof-verifier/tests/vectors/identity-contract-nonce/manifest.jsonpackages/rs-drive-proof-verifier/tests/vectors/identity-contract-nonce/proof.hexpackages/rs-drive-proof-verifier/tests/vectors/identity-contract-nonce/quorum_pubkey.hexpackages/rs-drive-proof-verifier/tests/vectors/identity-contract-nonce/signature.hexpackages/rs-drive-proof-verifier/tests/vectors/identity-keys/manifest.jsonpackages/rs-drive-proof-verifier/tests/vectors/identity-keys/proof.hexpackages/rs-drive-proof-verifier/tests/vectors/identity-keys/quorum_pubkey.hexpackages/rs-drive-proof-verifier/tests/vectors/identity-keys/signature.hexpackages/rs-drive-proof-verifier/tests/vectors/identity-nonce/manifest.jsonpackages/rs-drive-proof-verifier/tests/vectors/identity-nonce/proof.hexpackages/rs-drive-proof-verifier/tests/vectors/identity-nonce/quorum_pubkey.hexpackages/rs-drive-proof-verifier/tests/vectors/identity-nonce/signature.hexpackages/rs-drive-proof-verifier/tests/vectors/quorum-sig-tampered-signature/manifest.jsonpackages/rs-drive-proof-verifier/tests/vectors/quorum-sig-tampered-signature/proof.hexpackages/rs-drive-proof-verifier/tests/vectors/quorum-sig-tampered-signature/quorum_pubkey.hexpackages/rs-drive-proof-verifier/tests/vectors/quorum-sig-tampered-signature/signature.hexpackages/rs-drive-proof-verifier/tests/vectors/quorum-sig-valid/manifest.jsonpackages/rs-drive-proof-verifier/tests/vectors/quorum-sig-valid/proof.hexpackages/rs-drive-proof-verifier/tests/vectors/quorum-sig-valid/quorum_pubkey.hexpackages/rs-drive-proof-verifier/tests/vectors/quorum-sig-valid/signature.hexpackages/rs-drive-proof-verifier/tests/vectors/quorum-sig-wrong-block-id-hash/manifest.jsonpackages/rs-drive-proof-verifier/tests/vectors/quorum-sig-wrong-block-id-hash/proof.hexpackages/rs-drive-proof-verifier/tests/vectors/quorum-sig-wrong-block-id-hash/quorum_pubkey.hexpackages/rs-drive-proof-verifier/tests/vectors/quorum-sig-wrong-block-id-hash/signature.hexpackages/rs-drive-proof-verifier/tests/vectors/quorum-sig-wrong-quorum-key/manifest.jsonpackages/rs-drive-proof-verifier/tests/vectors/quorum-sig-wrong-quorum-key/proof.hexpackages/rs-drive-proof-verifier/tests/vectors/quorum-sig-wrong-quorum-key/quorum_pubkey.hexpackages/rs-drive-proof-verifier/tests/vectors/quorum-sig-wrong-quorum-key/signature.hexpackages/rs-drive-proof-verifier/tests/vectors_contested.rspackages/rs-drive-proof-verifier/tests/vectors_documents.rspackages/rs-drive-proof-verifier/tests/vectors_identity.rspackages/rs-drive-proof-verifier/tests/vectors_quorum_sig.rs
b7acc65 to
2028d5e
Compare
drive-proof-verifier had no integration tests: its verification pipeline (grovedb proof replay + tenderdash quorum-signature check) was exercised only indirectly through rs-sdk's mock replay. Add a corpus of 16 fixture directories generated from a real Drive state (platform v4.0.0 fixtures, protocol version 12) driving 19 test cases through the crate's real public FromProof entry points, with a per-case manifest.json plus proof/signature/quorum-key blobs and a loader that synthesizes the DAPI response protobuf from components. Positive cases assert decoded values against the manifest (balances, nonces, key bytes and ordering, contender tallies, winners, proof-of- absence), and every quorum-sig positive runs a genuine BLS check with real fixture key material: all drive fixtures commit to one root hash, which is exactly the app hash the fixture quorum signature signs. Negative cases each change exactly one ingredient so none can pass for the wrong reason: a bit-flipped proof fails at the grovedb layer, a tampered signature at point decompression, a wrong quorum key and a wrong block-id hash at signature verification, and tampering any signed ResponseMetadata field (height, time_ms, core_chain_locked_height) breaks the signature - pinning that the StateId digest really covers the metadata. Never a panic. The documents-family cases pin the DriveDocumentQuery shape (root hash and serialized payloads byte-for-byte) and clean decode failure on the fixture's placeholder payloads; the coverage matrix in tests/vectors/ README.md states exactly what each family reaches. The same fixtures are replayed byte-exact by Dash Core's platform GUI implementation, so drift between what Drive proves and what any client verifies fails loudly here.
2028d5e to
968d12b
Compare
Issue being fixed or feature implemented
drive-proof-verifieris the trust boundary for every Platform client that verifies proofs — yet it has no integration tests: its pipeline (grovedb proof replay + tenderdash quorum-signature check) is exercised only indirectly through rs-sdk's mock replay. Nothing in the repo pins that a proof generated by a real Drive state verifies through the crate's public entry points, or that tampering any single ingredient breaks verification at the intended layer.Second standalone slice of #4335 (after #4344); independent of both — test-only, no API changes,
Cargo.lockuntouched apart from dev-deps.What was done?
A corpus of 16 fixture directories generated from a real Drive state (platform v4.0.0 fixtures, protocol version 12), driving 19 test cases through the crate's real public
FromProofentry points. Each case is a self-contained directory:manifest.json(request params, block metadata, expected outcome, pinned root hash) +proof.hex/signature.hex/quorum_pubkey.hex. A loader synthesizes the DAPI response protobuf from components; aVectorContextProviderserves the per-case quorum key and errors on any unknown quorum, so a loader bug cannot vacuously pass.Designed for the "is this test actually testing something" question:
is_ok(): balances, nonces, key bytes and ordering, contender tallies, winner identities, andOk(None)proof-of-absence — all against the manifest.ResponseMetadatafield (height,time_ms,core_chain_locked_height) breaks the signature — pinning that the StateId digest genuinely covers the metadata a client acts on. Never a panic.DriveDocumentQueryshape (root hash + serialized payloads byte-for-byte) and clean decode failure on the fixture's placeholder payloads; the coverage matrix intests/vectors/README.mdstates per-family what is and isn't exercised, including that these four stop before the signature layer. A real-document fixture for one true end-to-end documents positive is called out as regeneration follow-up.The same fixtures are replayed byte-exact by Dash Core's platform GUI implementation (PastaPastaPasta/dash#67), so this corpus doubles as a cross-implementation anchor: drift between what Drive proves and what any client verifies fails loudly here.
Suite is gated behind the existing
mocksfeature:cargo test -p drive-proof-verifier --features mocks.How Has This Been Tested?
cargo test -p drive-proof-verifier --features mocks: 261 existing lib tests + 19 new vector tests + doctests, all passing on currentv4.2-dev.cargo fmt --checkandcargo clippy -p drive-proof-verifier --all-features --all-targets -- -D warningsclean.Breaking Changes
None. Test-only; dev-dependency additions to
rs-drive-proof-verifieronly.Checklist:
🤖 Generated with Claude Code
Summary by CodeRabbit
Tests
Documentation