Skip to content

test(dpp): improve address_funds state transition test coverage#3285

Merged
QuantumExplorer merged 2 commits into
v3.1-devfrom
test/dpp-address-funds-transitions-coverage
Mar 15, 2026
Merged

test(dpp): improve address_funds state transition test coverage#3285
QuantumExplorer merged 2 commits into
v3.1-devfrom
test/dpp-address-funds-transitions-coverage

Conversation

@QuantumExplorer

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Improve test coverage for the packages/rs-dpp/src/state_transition/state_transitions/address_funds/ module, targeting 93%+ coverage per file.

What was done?

Added comprehensive test suites for all three address_funds state transition types:

AddressFundingFromAssetLockTransitionV0 (15 new tests):

  • Structure validation: empty outputs, remainder count (0 and 2), too many inputs/outputs, witness count mismatch, output-also-input overlap, fee strategy validation (empty, too many, duplicates, out-of-bounds indices), input/output minimum amounts, output sum overflow, valid no-inputs case
  • StateTransitionLike trait: protocol version, type, modified data IDs, unique identifiers, user fee increase, signature getters/setters, witness signed operations, From conversion
  • Enum-level: default_versioned, field types, feature version

AddressCreditWithdrawalTransitionV0 (19 new tests):

  • Structure validation: empty inputs, too many inputs, witness count mismatch, output-also-input overlap, fee strategy validation (empty, too many, duplicates, out-of-bounds indices), input/output minimums, pooling validation, fibonacci core fee validation, output script validation (P2PKH/P2SH), input sum overflow, withdrawal balance mismatch, withdrawal below minimum, valid output change case
  • StateTransitionLike trait: protocol version, type, modified data IDs, unique identifiers mapping, user fee increase, witness operations, From conversion
  • Enum-level: default_versioned, field types, feature version, constants

AddressFundsTransferTransitionV0 (17 new tests):

  • Structure validation: empty inputs/outputs, too many inputs/outputs, witness count mismatch, output-also-input overlap, fee strategy validation (empty, too many, duplicates, out-of-bounds indices), input/output minimums, input/output sum overflow, balance mismatch, valid multi-input/multi-output case
  • StateTransitionLike trait: protocol version, type, modified data IDs, unique identifiers, user fee increase, witness operations, From conversion
  • Enum-level: default_versioned, field types, feature version

How Has This Been Tested?

All 166 address_funds tests pass:

cargo test -p dpp --all-features -- address_funds
# test result: ok. 166 passed; 0 failed; 0 ignored

Breaking Changes

None. Only test code was added.

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

Add comprehensive test suites for all three address_funds state
transition types: AddressFundingFromAssetLockTransition,
AddressCreditWithdrawalTransition, and AddressFundsTransferTransition.

Tests cover validate_structure validation logic (empty inputs/outputs,
max limits, witness count mismatches, fee strategy validation, amount
minimums, overflow checks, balance mismatches), StateTransitionLike
trait implementations, StateTransitionFieldTypes, FeatureVersioned,
default_versioned constructors, and accessor methods.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added this to the v3.1.0 milestone Mar 15, 2026
@coderabbitai

coderabbitai Bot commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

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

⌛ 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: 9aae0918-16f8-4a36-8e6f-936f328769eb

📥 Commits

Reviewing files that changed from the base of the PR and between d82ca97 and 74a060f.

📒 Files selected for processing (3)
  • packages/rs-dpp/src/state_transition/state_transitions/address_funds/address_credit_withdrawal_transition/v0/state_transition_validation.rs
  • packages/rs-dpp/src/state_transition/state_transitions/address_funds/address_funding_from_asset_lock_transition/v0/state_transition_validation.rs
  • packages/rs-dpp/src/state_transition/state_transitions/address_funds/address_funds_transfer_transition/v0/state_transition_validation.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test/dpp-address-funds-transitions-coverage
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@QuantumExplorer

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 15, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@codecov

codecov Bot commented Mar 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.10112% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.52%. Comparing base (d82ca97) to head (74a060f).
⚠️ Report is 11 commits behind head on v3.1-dev.

Files with missing lines Patch % Lines
...rawal_transition/v0/state_transition_validation.rs 98.60% 4 Missing ⚠️
..._lock_transition/v0/state_transition_validation.rs 99.26% 2 Missing ⚠️
...nsfer_transition/v0/state_transition_validation.rs 99.39% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           v3.1-dev    #3285      +/-   ##
============================================
+ Coverage     70.42%   70.52%   +0.10%     
============================================
  Files          3293     3293              
  Lines        262598   263553     +955     
============================================
+ Hits         184935   185873     +938     
- Misses        77663    77680      +17     
Components Coverage Δ
dpp 59.03% <99.10%> (+0.60%) ⬆️
drive 78.18% <ø> (-0.02%) ⬇️
drive-abci 82.92% <ø> (ø)
sdk 31.25% <ø> (ø)
dapi-client 39.08% <ø> (ø)
platform-version ∅ <ø> (∅)
platform-value 39.35% <ø> (ø)
platform-wallet 60.40% <ø> (ø)
drive-proof-verifier ∅ <ø> (∅)
🚀 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.

Remove trivial getter/setter and constant-assertion tests from mod.rs
and v0/state_transition_like.rs for all three address_funds transitions.
These tests only exercised auto-derived enum dispatch, hardcoded return
values, and simple field accessors that are already covered by
drive-abci strategy tests through the full state transition pipeline.

Retain all validate_structure unit tests in v0/state_transition_validation.rs
which exercise individual error branches (no inputs, too many inputs,
witness count mismatch, fee strategy validation, overflow, etc.) that
are NOT reached by strategy tests since those only create valid transitions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@QuantumExplorer QuantumExplorer merged commit 755cbe2 into v3.1-dev Mar 15, 2026
37 checks passed
@QuantumExplorer QuantumExplorer deleted the test/dpp-address-funds-transitions-coverage branch March 15, 2026 15:08
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.

1 participant