Skip to content

test: cover shielded queries and low-cov modules in drive/drive-abci#3511

Merged
QuantumExplorer merged 1 commit into
v3.1-devfrom
test/coverage-shielded-queries-and-lowcov
Apr 21, 2026
Merged

test: cover shielded queries and low-cov modules in drive/drive-abci#3511
QuantumExplorer merged 1 commit into
v3.1-devfrom
test/coverage-shielded-queries-and-lowcov

Conversation

@QuantumExplorer
Copy link
Copy Markdown
Member

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.

Target Prev cov Missed Tests added
rs-drive-abci/query/shielded/ (9 submodules) 0% 834 45
rs-drive-abci/query/system/ 70% 408 14
rs-drive-abci/query/voting/ 72% 298 16
rs-drive-abci/platform_types/validator_set/ 37% 129 10
rs-drive/util/operations/ 39% 185 13
rs-drive/prove/prove_multiple_state_transition_results/ 0% 132 12

Shielded query subtree (now fully covered)

  • 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 (None => break arm), count==0 and count>max clamping.
  • nullifiers: empty-list InvalidArgument, bad-length nullifier InvalidArgument, count-too-large InvalidLimit, unspent is_spent=false, prove branch.
  • nullifiers_branch_state: depth below min / above max, unsupported-token-pool-type NotSupported, unknown-pool-type InvalidInput, missing-checkpoint CheckpointNotFound, empty pool_identifier normalized to None, empty-tree branch_query surfaces drive-layer error.
  • nullifiers_trunk_state: no-checkpoint validation, unsupported + unknown pool types, with-checkpoint proof + metadata.
  • recent_compacted_nullifier_changes + recent_nullifier_changes: DecodingError, dispatcher V0 wrapping, empty-state non-prove + prove, large start_block_height (no matches).

rs-drive-abci/query/system

  • epoch_infos: start_epoch too high, count overflow, empty prove.
  • finalized_epoch_infos: range validation including equal-indexes-without-both-included.
  • version_upgrade_vote_status: bad start_pro_tx_hash length, 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

  • Invalid contract_id / identity_id / contestant_id error paths across 4 submodules.
  • DataContractNotFound for missing contracts.
  • offset_out_of_bounds on u16::MAX+1.
  • vote_polls_by_end_date_query: start>end, equal-times-not-both-included, limit==0, offset_out_of_bounds, RequestingProofWithOffset error.

rs-drive-abci/platform_types/validator_set

  • update_difference mismatch errors (quorum_hash, core_height, threshold_public_key), missing-member CorruptedCachedState, banned-validator-skipped, identical-sets emit non-banned members, banned identical-sets emit nothing.
  • to_update / to_update_owned ban 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 via grove_get_raw_optional_item.
  • apply_batch_grovedb_operations empty → BatchIsEmpty.
  • apply_partial_batch_low_level_drive_operations deprecated path.
  • commit_transaction_v0 / rollback_transaction_v0 / drop_cache_v0.
  • Public dispatcher wiring.

rs-drive/prove/prove_multiple_state_transition_results

  • Empty input → PathQuery::merge InvalidInput.
  • Single-balance proof + GroveDb::verify_query roundtrip.
  • Deterministic output for equal inputs.
  • Non-existent identity absence proof verifies.
  • All four IdentityProveRequestType arms (FullIdentity / Balance / Keys / Revision).
  • Historical contract (Either::Right) + non-historical (Either::Left) partition branches.
  • historical=None defaults to Some(false) (covers .unwrap_or(false)).
  • Token balance + info + status arms combined.
  • Multi-query happy path (identities + both contract types + all token arms).

How Has This Been Tested?

  • cargo test -p drive-abci --lib 'query::shielded'45 pass
  • cargo test -p drive-abci --lib 'query::system'31 pass
  • cargo test -p drive-abci --lib 'query::voting'16 pass
  • cargo test -p drive-abci --lib 'platform_types::validator_set'10 pass
  • cargo test -p drive --lib 'util::operations'13 pass (within the 309-test util module)
  • cargo test -p drive --lib 'prove::prove_multiple'12 pass
  • cargo check --tests -p drive -p drive-abci — clean
  • cargo fmt -p drive -p drive-abci — clean

No production bugs surfaced.

Breaking Changes

None. Tests only.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

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>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

Warning

Rate limit exceeded

@QuantumExplorer has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 1 minutes and 14 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2abf9957-e844-4ccf-ab2a-44dac42e5f0f

📥 Commits

Reviewing files that changed from the base of the PR and between 2fb0822 and 72e176c.

📒 Files selected for processing (29)
  • packages/rs-drive-abci/src/platform_types/validator_set/v0/mod.rs
  • packages/rs-drive-abci/src/query/shielded/anchors/mod.rs
  • packages/rs-drive-abci/src/query/shielded/encrypted_notes/mod.rs
  • packages/rs-drive-abci/src/query/shielded/most_recent_anchor/mod.rs
  • packages/rs-drive-abci/src/query/shielded/nullifiers/mod.rs
  • packages/rs-drive-abci/src/query/shielded/nullifiers/v0/mod.rs
  • packages/rs-drive-abci/src/query/shielded/nullifiers_branch_state/mod.rs
  • packages/rs-drive-abci/src/query/shielded/nullifiers_branch_state/v0/mod.rs
  • packages/rs-drive-abci/src/query/shielded/nullifiers_trunk_state/mod.rs
  • packages/rs-drive-abci/src/query/shielded/nullifiers_trunk_state/v0/mod.rs
  • packages/rs-drive-abci/src/query/shielded/pool_state/mod.rs
  • packages/rs-drive-abci/src/query/shielded/recent_compacted_nullifier_changes/mod.rs
  • packages/rs-drive-abci/src/query/shielded/recent_compacted_nullifier_changes/v0/mod.rs
  • packages/rs-drive-abci/src/query/shielded/recent_nullifier_changes/mod.rs
  • packages/rs-drive-abci/src/query/shielded/recent_nullifier_changes/v0/mod.rs
  • packages/rs-drive-abci/src/query/system/current_quorums_info/v0/mod.rs
  • packages/rs-drive-abci/src/query/system/epoch_infos/v0/mod.rs
  • packages/rs-drive-abci/src/query/system/finalized_epoch_infos/v0/mod.rs
  • packages/rs-drive-abci/src/query/system/path_elements/v0/mod.rs
  • packages/rs-drive-abci/src/query/system/status/v0/mod.rs
  • packages/rs-drive-abci/src/query/system/version_upgrade_vote_status/v0/mod.rs
  • packages/rs-drive-abci/src/query/voting/contested_resource_identity_votes/v0/mod.rs
  • packages/rs-drive-abci/src/query/voting/contested_resource_vote_state/v0/mod.rs
  • packages/rs-drive-abci/src/query/voting/contested_resource_voters_for_identity/v0/mod.rs
  • packages/rs-drive-abci/src/query/voting/contested_resources/v0/mod.rs
  • packages/rs-drive-abci/src/query/voting/vote_polls_by_end_date_query/v0/mod.rs
  • packages/rs-drive/src/prove/prove_multiple_state_transition_results/v0/mod.rs
  • packages/rs-drive/src/util/operations/mod.rs
  • packages/rs-drive/src/util/operations/tests.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/coverage-shielded-queries-and-lowcov

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added this to the v3.1.0 milestone Apr 21, 2026
@thepastaclaw
Copy link
Copy Markdown
Collaborator

thepastaclaw commented Apr 21, 2026

Review Gate

Commit: 72e176cf

  • Debounce: 25m ago (need 30m)

  • CI checks: builds passed, 0/2 tests passed

  • CodeRabbit review: comment found

  • Off-peak hours: off-peak (01:39 PM PT Tuesday)

  • Run review now (check to override)

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

❌ Patch coverage is 97.41152% with 49 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.38%. Comparing base (2fb0822) to head (72e176c).
⚠️ Report is 1 commits behind head on v3.1-dev.

Files with missing lines Patch % Lines
...elded/recent_compacted_nullifier_changes/v0/mod.rs 87.50% 7 Missing ⚠️
...ive-abci/src/query/shielded/encrypted_notes/mod.rs 93.68% 6 Missing ⚠️
.../prove_multiple_state_transition_results/v0/mod.rs 98.36% 6 Missing ⚠️
...es/rs-drive-abci/src/query/shielded/anchors/mod.rs 90.74% 5 Missing ⚠️
...-abci/src/query/shielded/most_recent_anchor/mod.rs 90.90% 5 Missing ⚠️
.../query/shielded/recent_nullifier_changes/v0/mod.rs 90.74% 5 Missing ⚠️
...drive-abci/src/query/shielded/nullifiers/v0/mod.rs 95.40% 4 Missing ⚠️
...rs-drive-abci/src/query/shielded/pool_state/mod.rs 92.30% 4 Missing ⚠️
...rc/query/shielded/nullifiers_trunk_state/v0/mod.rs 96.20% 3 Missing ⚠️
...rs-drive-abci/src/query/shielded/nullifiers/mod.rs 93.75% 2 Missing ⚠️
... and 2 more
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     
Components Coverage Δ
dpp 84.12% <ø> (+0.02%) ⬆️
drive 85.84% <98.36%> (+0.45%) ⬆️
drive-abci 88.90% <97.18%> (+1.40%) ⬆️
sdk ∅ <ø> (∅)
dapi-client ∅ <ø> (∅)
platform-version ∅ <ø> (∅)
platform-value 92.10% <ø> (ø)
platform-wallet ∅ <ø> (∅)
drive-proof-verifier 55.66% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@QuantumExplorer QuantumExplorer merged commit f038dac into v3.1-dev Apr 21, 2026
70 of 72 checks passed
@QuantumExplorer QuantumExplorer deleted the test/coverage-shielded-queries-and-lowcov branch April 21, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants