test: cover shielded queries and low-cov modules in drive/drive-abci#3511
Conversation
Add 110 new unit tests across 29 files. The biggest single target
is the drive-abci shielded query subtree, which was 0% covered with
834 uncovered lines.
Per-target breakdown (previous coverage → now exercised):
- rs-drive-abci/query/shielded/ (0% → covered, 9 submodules, 45 tests):
- anchors: DecodingError, empty-state happy path, prove branch.
- most_recent_anchor: DecodingError, absent-element zero-sentinel
fallback, prove branch.
- pool_state: DecodingError, unwrap_or(0) on missing key, prove
branch.
- encrypted_notes: DecodingError, non-aligned start_index
InvalidArgument, empty-state chunk iteration, count clamping
(count==0 and count>max both clamp to max).
- nullifiers: DecodingError, empty-list InvalidArgument, bad-length
nullifier InvalidArgument, count-too-large InvalidLimit, unspent
is_spent=false, prove branch.
- nullifiers_branch_state: DecodingError, depth-below-min and
depth-above-max InvalidInput, unsupported-token-pool-type
NotSupported, unknown-pool-type InvalidInput, missing-checkpoint
CheckpointNotFound, empty pool_identifier normalized to None,
branch_query on empty tree returns drive-layer error.
- nullifiers_trunk_state: DecodingError, no-checkpoint validation,
unsupported-token-pool-type, unknown-pool-type, with-checkpoint
proof + metadata.
- recent_compacted_nullifier_changes + recent_nullifier_changes:
DecodingError, dispatcher V0 wrapping, empty-state non-prove,
empty-state prove, large start_block_height (no matches).
- rs-drive-abci/query/system/ (70% → covered, 14 tests): epoch_infos
start_epoch too high, count overflow, empty prove; finalized_epoch
range validation including equal-indexes-without-both-included;
version_upgrade_vote_status bad start_pro_tx_hash length,
count>=u16::MAX, empty-hash None path; current_quorums_info
default; status fields at genesis; path_elements InvalidLimit +
prove.
- rs-drive-abci/query/voting/ (72% → covered, 16 tests):
invalid-contract-id/identity-id/contestant-id across 4 submodules,
DataContractNotFound, offset_out_of_bounds, vote_polls_by_end_date
start>end / equal-times-not-both-included / limit==0 /
offset_out_of_bounds / RequestingProofWithOffset.
- rs-drive-abci/platform_types/validator_set/ (37% → covered,
10 tests): update_difference quorum_hash/core_height/
threshold_public_key mismatch, missing-member CorruptedCachedState,
banned-validator-skipped, identical-sets emit non-banned, banned
identical-sets emit nothing; to_update + to_update_owned ban
filtering preserves quorum_hash + threshold_public_key.
- rs-drive/util/operations/ (39% → covered, 13 tests):
apply_batch_low_level empty-batch short-circuit, leftovers-only
partition skips grove, mixed ops (full partition + append),
round-trip via grove_get_raw_optional_item; grovedb empty-ops
BatchIsEmpty; partial-batch deprecated path;
commit_transaction_v0 / rollback / drop_cache; public dispatcher
routing.
- rs-drive/prove/prove_multiple_state_transition_results/
(0% → covered, 12 tests): empty-input PathQuery::merge
InvalidInput, single-balance proof verification, deterministic
output, non-existent-identity absence proof, all four
IdentityProveRequestType arms (FullIdentity/Balance/Keys/Revision),
historical vs non-historical contract partition branches,
historical=None defaults to false, token balance+info+status arms
combined, multi-query happy path, public dispatcher routing.
All tests pass. No production bugs surfaced.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 1 minutes and 14 seconds. ⌛ 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 (29)
✨ 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 |
Review GateCommit:
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## v3.1-dev #3511 +/- ##
============================================
+ Coverage 85.78% 86.38% +0.60%
============================================
Files 2474 2474
Lines 275963 277856 +1893
============================================
+ Hits 236728 240020 +3292
+ Misses 39235 37836 -1399
🚀 New features to boost your workflow:
|
Issue being fixed or feature implemented
Fifth PR in the push toward 90% global coverage (now 85.76% after #3503, #3504, #3505, #3506).
Biggest single gap: the entire packages/rs-drive-abci/src/query/shielded/ tree was 0% covered with 834 uncovered lines across 9 sibling query dispatchers. This PR covers it end-to-end plus several mid-tier low-coverage files.
What was done?
110 new unit tests across 29 files.
Shielded query subtree (now fully covered)
unwrap_or(0)on missing key, prove branch.start_index→ InvalidArgument, empty-state chunk iteration (None => breakarm),count==0andcount>maxclamping.is_spent=false, prove branch.pool_identifiernormalized to None, empty-tree branch_query surfaces drive-layer error.start_block_height(no matches).rs-drive-abci/query/system
epoch_infos:start_epochtoo high, count overflow, empty prove.finalized_epoch_infos: range validation including equal-indexes-without-both-included.version_upgrade_vote_status: badstart_pro_tx_hashlength,count>=u16::MAX, empty-hash None.current_quorums_info: default at genesis.status: version / protocol / software / chain / time fields.path_elements: InvalidLimit + prove.rs-drive-abci/query/voting
DataContractNotFoundfor missing contracts.offset_out_of_boundson u16::MAX+1.vote_polls_by_end_date_query:start>end, equal-times-not-both-included,limit==0,offset_out_of_bounds,RequestingProofWithOffseterror.rs-drive-abci/platform_types/validator_set
update_differencemismatch errors (quorum_hash, core_height, threshold_public_key), missing-memberCorruptedCachedState, banned-validator-skipped, identical-sets emit non-banned members, banned identical-sets emit nothing.to_update/to_update_ownedban filtering preserves quorum_hash and threshold_public_key; all-banned produces empty.rs-drive/util/operations
apply_batch_low_level_drive_operations: empty-batch short-circuit, leftovers-only partition skips grove, mixed ops (full partition + append), round-trip persistence viagrove_get_raw_optional_item.apply_batch_grovedb_operationsempty →BatchIsEmpty.apply_partial_batch_low_level_drive_operationsdeprecated path.commit_transaction_v0/rollback_transaction_v0/drop_cache_v0.rs-drive/prove/prove_multiple_state_transition_results
PathQuery::mergeInvalidInput.GroveDb::verify_queryroundtrip.IdentityProveRequestTypearms (FullIdentity / Balance / Keys / Revision).Either::Right) + non-historical (Either::Left) partition branches.historical=Nonedefaults toSome(false)(covers.unwrap_or(false)).How Has This Been Tested?
cargo test -p drive-abci --lib 'query::shielded'— 45 passcargo test -p drive-abci --lib 'query::system'— 31 passcargo test -p drive-abci --lib 'query::voting'— 16 passcargo test -p drive-abci --lib 'platform_types::validator_set'— 10 passcargo test -p drive --lib 'util::operations'— 13 pass (within the 309-test util module)cargo test -p drive --lib 'prove::prove_multiple'— 12 passcargo check --tests -p drive -p drive-abci— cleancargo fmt -p drive -p drive-abci— cleanNo production bugs surfaced.
Breaking Changes
None. Tests only.
Checklist
For repository code-owners and collaborators only