Skip to content

test(dpp): improve coverage for token config validation, cbor utils, and identity factory#3381

Merged
QuantumExplorer merged 1 commit into
v3.1-devfrom
test/dpp-coverage-gaps
Mar 18, 2026
Merged

test(dpp): improve coverage for token config validation, cbor utils, and identity factory#3381
QuantumExplorer merged 1 commit into
v3.1-devfrom
test/dpp-coverage-gaps

Conversation

@QuantumExplorer

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Improve unit test coverage for several DPP modules that previously had 0% code coverage.

What was done?

Added 85 unit tests across four DPP modules:

  • Token configuration update validation (validate_token_configuration_update/v0/mod.rs): 16 tests covering identical config validation, immutable field protection (base_supply), convention changes with various permission levels, max_supply changes, manual minting/burning rule changes, freeze/unfreeze rules, destroy frozen funds rules, emergency action rules, main control group modifications, and marketplace trade mode changes.

  • CBOR value map helpers (cbor_value/map.rs): 39 tests covering all CborBTreeMapHelper trait methods including string, integer, bool, identifier, array, and map accessors with present/absent/wrong-type scenarios, plus remove_optional_integer and remove_integer.

  • CBOR value conversions (cbor_value/mod.rs): 19 tests covering get_key_from_cbor_map, CborMapExtension methods (as_u16, as_u8, as_bool, as_bytes, as_string, as_u64), cbor_value_to_json_value, cbor_value_into_json_value, cbor_map_to_json_map, and cbor_map_into_json_map for all CBOR types and error cases.

  • Identity factory (identity/identity_factory.rs): 11 tests covering factory creation, identity creation with valid/invalid protocol versions, identity field verification (id, balance, revision, public keys), chain asset lock proof creation, and edge cases.

How Has This Been Tested?

All 85 new tests pass via cargo test -p dpp. Full DPP test suite (1004 tests) passes with no regressions.

Breaking Changes

None. This PR only adds #[cfg(test)] modules at the bottom of existing files.

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

…and identity factory

Add unit tests for four DPP modules that previously had 0% code coverage:

- Token configuration update validation (v0): 16 tests covering identical
  configs, immutable field changes (base_supply), convention changes with
  various permission levels, max_supply, manual minting/burning rules,
  freeze/unfreeze rules, destroy frozen funds, emergency action rules,
  main control group modifications, and marketplace trade mode changes.

- CBOR value map helpers (CborBTreeMapHelper): 39 tests covering all trait
  methods including string, integer, bool, identifier, array, and map
  accessors with present/absent/wrong-type scenarios.

- CBOR value conversions (mod.rs): 30 tests covering get_key_from_cbor_map,
  CborMapExtension methods, cbor_value_to_json_value,
  cbor_value_into_json_value, cbor_map_to_json_map, and
  cbor_map_into_json_map for all CBOR types and error cases.

- Identity factory: 11 tests covering factory creation, identity creation
  with valid/invalid versions, identity field verification (id, balance,
  revision, public keys), chain asset lock proof creation, and edge cases.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Mar 18, 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 21 minutes and 35 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: bf725b72-1c1b-4d91-9011-56065efb06cb

📥 Commits

Reviewing files that changed from the base of the PR and between dd2ae23 and 58c01eb.

📒 Files selected for processing (4)
  • packages/rs-dpp/src/data_contract/associated_token/token_configuration/methods/validate_token_configuration_update/v0/mod.rs
  • packages/rs-dpp/src/identity/identity_factory.rs
  • packages/rs-dpp/src/util/cbor_value/map.rs
  • packages/rs-dpp/src/util/cbor_value/mod.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/dpp-coverage-gaps
📝 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.

@github-actions github-actions Bot added this to the v3.1.0 milestone Mar 18, 2026
@codecov

codecov Bot commented Mar 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.21229% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.19%. Comparing base (2fb112c) to head (58c01eb).
⚠️ Report is 14 commits behind head on v3.1-dev.

Files with missing lines Patch % Lines
...hods/validate_token_configuration_update/v0/mod.rs 95.84% 16 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           v3.1-dev    #3381      +/-   ##
============================================
+ Coverage     75.87%   76.19%   +0.32%     
============================================
  Files          2912     2914       +2     
  Lines        283860   284993    +1133     
============================================
+ Hits         215375   217150    +1775     
+ Misses        68485    67843     -642     
Components Coverage Δ
dpp 67.30% <98.21%> (+1.59%) ⬆️
drive 81.66% <ø> (+0.01%) ⬆️
drive-abci 85.98% <ø> (-0.01%) ⬇️
sdk 31.25% <ø> (ø)
dapi-client 79.06% <ø> (ø)
platform-version ∅ <ø> (∅)
platform-value 58.46% <ø> (ø)
platform-wallet 60.40% <ø> (ø)
drive-proof-verifier 48.00% <ø> (ø)
🚀 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 c51cbc9 into v3.1-dev Mar 18, 2026
39 checks passed
@QuantumExplorer QuantumExplorer deleted the test/dpp-coverage-gaps branch March 18, 2026 17:55
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