Skip to content

test(dpp): improve coverage for distribution functions, config, core scripts, and asset lock proofs#3450

Merged
QuantumExplorer merged 1 commit into
v3.1-devfrom
test/dpp-validation-serialization
Apr 7, 2026
Merged

test(dpp): improve coverage for distribution functions, config, core scripts, and asset lock proofs#3450
QuantumExplorer merged 1 commit into
v3.1-devfrom
test/dpp-validation-serialization

Conversation

@QuantumExplorer
Copy link
Copy Markdown
Member

@QuantumExplorer QuantumExplorer commented Apr 7, 2026

Summary

Adds 146 tests across 6 files in rs-dpp covering validation and serialization logic.

File Tests What's covered
distribution_function/mod.rs 38 All 8 function variants, Display, constants, equality
data_contract/config/mod.rs 28 default_for_version, getters/setters, V0↔V1 conversions
identity/core_script.rs 25 P2PKH/P2SH structure, Base64/Hex encoding, random generation
contender/mod.rs 22 Construction, accessors, serialization round-trips
asset_lock_proof/mod.rs 20 AssetLockProofType TryFrom, identifier creation, Value conversions
distribution_recipient.rs 30 All recipient types, resolution for PreProgrammed/Perpetual, Display

Test plan

  • cargo test -p dpp --lib — 2165 passed
  • cargo fmt --all clean
  • CI

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Tests
    • Added comprehensive test coverage for core data contract and identity validation components, including distribution functions, token recipients, contract configurations, core scripts, asset lock proofs, and voting contenders. These internal test suites enhance reliability and maintainability.

…scripts, and asset lock proofs

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 Apr 7, 2026
@thepastaclaw
Copy link
Copy Markdown
Collaborator

thepastaclaw commented Apr 7, 2026

Review Gate

Commit: c5ba4073

  • Debounce: 51m ago (need 30m)

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

  • CodeRabbit review: no comment yet

  • Off-peak hours: off-peak (04:48 PM PT Tuesday)

  • Run review now (check to override)

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 7, 2026

Codecov Report

❌ Patch coverage is 98.40637% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.99%. Comparing base (0c72404) to head (c5ba407).
⚠️ Report is 6 commits behind head on v3.1-dev.

Files with missing lines Patch % Lines
...erpetual_distribution/distribution_function/mod.rs 97.86% 9 Missing ⚠️
...n_perpetual_distribution/distribution_recipient.rs 95.36% 9 Missing ⚠️
packages/rs-dpp/src/data_contract/config/mod.rs 98.92% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           v3.1-dev    #3450      +/-   ##
============================================
+ Coverage     81.35%   82.99%   +1.64%     
============================================
  Files          2852     2621     -231     
  Lines        291561   270434   -21127     
============================================
- Hits         237188   224447   -12741     
+ Misses        54373    45987    -8386     
Components Coverage Δ
dpp 76.10% <98.40%> (+1.72%) ⬆️
drive 83.71% <ø> (+0.20%) ⬆️
drive-abci 86.74% <ø> (+0.04%) ⬆️
sdk ∅ <ø> (∅)
dapi-client ∅ <ø> (∅)
platform-version ∅ <ø> (∅)
platform-value 92.00% <ø> (ø)
platform-wallet ∅ <ø> (∅)
drive-proof-verifier 55.66% <ø> (+0.40%) ⬆️
🚀 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 59f233f into v3.1-dev Apr 7, 2026
38 checks passed
@QuantumExplorer QuantumExplorer deleted the test/dpp-validation-serialization branch April 7, 2026 23:49
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 8, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0158f8db-e1ca-44d2-81fc-55a3b9aa43a2

📥 Commits

Reviewing files that changed from the base of the PR and between 1d01943 and c5ba407.

📒 Files selected for processing (6)
  • packages/rs-dpp/src/data_contract/associated_token/token_perpetual_distribution/distribution_function/mod.rs
  • packages/rs-dpp/src/data_contract/associated_token/token_perpetual_distribution/distribution_recipient.rs
  • packages/rs-dpp/src/data_contract/config/mod.rs
  • packages/rs-dpp/src/identity/core_script.rs
  • packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs
  • packages/rs-dpp/src/voting/contender_structs/contender/mod.rs

📝 Walkthrough

Walkthrough

The PR adds comprehensive #[cfg(test)] test suites to six files across the DPP codebase, covering construction, serialization/deserialization, field accessors, conversions, display formatting, and equality semantics for types including DistributionFunction, TokenDistributionRecipient, DataContractConfig, CoreScript, AssetLockProof, and Contender. No production logic changes.

Changes

Cohort / File(s) Summary
Token Distribution
packages/rs-dpp/src/data_contract/associated_token/token_perpetual_distribution/distribution_function/mod.rs, packages/rs-dpp/src/data_contract/associated_token/token_perpetual_distribution/distribution_recipient.rs
Added test modules validating variant construction, display formatting, derived trait behaviors (equality, cloning, ordering), and accessor methods. Also covers conversion paths for distribution recipients across PreProgrammed and Perpetual types.
Data Contract Configuration
packages/rs-dpp/src/data_contract/config/mod.rs
Added test module covering default version selection, version getters/setters, trait conversions between V0/V1 variants, field mutation behaviors, and platform-version-dependent config downgrading logic.
Identity Components
packages/rs-dpp/src/identity/core_script.rs, packages/rs-dpp/src/identity/state_transition/asset_lock_proof/mod.rs
Added test modules for CoreScript byte construction, P2PKH/P2SH script generation, Base64/Hex encoding round-trips, and randomized script validation; plus AssetLockProof type parsing, chain proof behavior, serialization conversions, and error handling.
Voting
packages/rs-dpp/src/voting/contender_structs/contender/mod.rs
Added test module validating ContenderV0 construction, conversions to Contender, optional field accessors (take/get), serialization round-trips, and equality semantics based on identity and vote tally.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 With whiskers twitching and nose held high,
I've hopped through tests that make code fly,
Construction, conversion, display so fine,
Seventeen-forty-five new test cases shine!
Coverage bouncing from token to vote,
All the assertions in my coding moat. 🥕✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/dpp-validation-serialization

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.

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