Skip to content

feat(platform)!: revise shielded identity-create denominations in protocol version 13 - #4206

Merged
QuantumExplorer merged 5 commits into
v4.1-devfrom
claude/shielded-balance-transition-amounts-da0109
Jul 23, 2026
Merged

feat(platform)!: revise shielded identity-create denominations in protocol version 13#4206
QuantumExplorer merged 5 commits into
v4.1-devfrom
claude/shielded-balance-transition-amounts-da0109

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Jul 23, 2026

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

IdentityCreateFromShieldedPool (Type 20) transitions must spend one of a fixed set of exit denominations from the shielded pool. For protocol version 13 the set is revised: 0.03 and 0.25 DASH are added, and 0.3 DASH is retired.

What was done?

Consensus (PV13):

  • Updated shielded_identity_create_denominations in DRIVE_ABCI_VALIDATION_VERSIONS_V9 (used only by PV13) to [0.03, 0.1, 0.25, 0.5, 1] DASH in credits. The v8 set (0.1 / 0.3 / 0.5 / 1) is unchanged for protocol version 12 chain replay.
  • Updated the PV13 changelog doc comments in v13.rs and v9.rs to record the revision.
  • Tests: should_accept_each_member_denomination now iterates the new set, and a new should_reject_retired_denomination test asserts 0.3 DASH is rejected at latest. Sighash-distinctness and drive conversion tests that used 0.3 DASH as an arbitrary value now use 0.25 DASH so they don't reference a retired denomination.

Example-app pickers (protocol-version-gated):
The iOS and Android example apps hardcode the denomination set (there is no FFI getter), so they now gate it on the network's reported protocol version instead of assuming one set: the pre-v13 set (with 0.3) is offered until the network reports PV13, then the revised set (with 0.03/0.25). An unknown version (refresh pending/failed) falls back to the pre-v13 set, matching every currently deployed network.

  • iOS: AppState stores the version learned by the existing refreshProtocolVersion proven ratchet (reset on network switch, stale-SDK guarded); CreateIdentityView picks the set from it, and the submit gate requires the chosen denomination to still be in the live set.
  • Kotlin: dash_sdk_refresh_protocol_version is newly bridged through JNI and surfaced as SystemQueries.refreshProtocolVersion(); the app's AppState refreshes on every SDK (re)build, and CreateIdentityScreen gates the picker the same way, re-snapping a picked denomination if the set changes under it.
  • The SDK-side builder (rs-dpp shielded builder) and wallet note selection (rs-platform-wallet) read the set from the platform version and follow automatically; docstrings in rs-unified-sdk-jni, the Kotlin SDK, and the Swift TEST_PLAN.md were updated.

How Has This Been Tested?

  • cargo test -p dpp identity_create_from_shielded / denomination / sighash — all pass, including the new retired-denomination rejection test.
  • cargo test -p drive identity_create_from_shielded — conversion/conservation tests pass.
  • cargo test -p drive-abci identity_create_from_shielded_pool — execution-path tests pass (they use 0.1 DASH, a member of both sets).
  • cargo test -p platform-wallet select — note-selection membership gate tests pass.
  • cargo check -p drive-abci, cargo check -p rs-unified-sdk-jni, and cargo fmt --all clean.
  • Kotlin: ./gradlew :sdk:compileDebugKotlin :app:compileDebugKotlin clean.
  • iOS: SwiftExampleApp builds clean for the iPhone 16 simulator.

Breaking Changes

Consensus change gated on protocol version 13 (not yet activated): the accepted exit-denomination set for Type-20 transitions changes. A 0.3 DASH transition valid under PV12 is rejected once v13 activates; 0.03 and 0.25 DASH become valid. PV12 validation is untouched, and the example-app pickers follow the network's reported version, so 0.3 remains offered until activation.

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

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Shielded identity creation now adapts available funding denominations to the connected network’s protocol version.
    • Added protocol-version refresh and visibility in the Kotlin and Swift example apps.
    • Updated denomination validation to prevent selecting retired options after network changes.
  • Documentation

    • Updated SDK documentation and QA guidance for protocol-version-specific denominations.
  • Tests

    • Added coverage confirming retired denominations are rejected and current v13 denominations are accepted.

…tocol version 13

Protocol version 13 revises the fixed exit-denomination set for
IdentityCreateFromShieldedPool (Type 20) transitions: 0.03 and 0.25 DASH
are added and 0.3 DASH is retired, giving 0.03 / 0.1 / 0.25 / 0.5 / 1
DASH. The v8 set (0.1 / 0.3 / 0.5 / 1) is unchanged for protocol
version 12 chain replay.

The builder and wallet note selection read the set from the platform
version, so they follow automatically; the hardcoded pickers in the
Swift and Kotlin example apps and the docstrings that spell the set out
are updated to match.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added this to the v4.1.0 milestone Jul 23, 2026
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@QuantumExplorer, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 23 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0d5bcd8a-90c8-4533-a88c-298983fcdbed

📥 Commits

Reviewing files that changed from the base of the PR and between f06d4d9 and 0f2d4bb.

📒 Files selected for processing (4)
  • packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/ffi/FundingNative.kt
  • packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt
  • packages/rs-dpp/src/state_transition/state_transitions/shielded/identity_create_from_shielded_pool_transition/v0/state_transition_validation.rs
  • packages/rs-unified-sdk-jni/src/funding.rs
📝 Walkthrough

Walkthrough

The change adds protocol-version refresh APIs and observable app state, updates v13 shielded identity denomination rules, and makes Kotlin and Swift identity-creation denomination selection and submission validation depend on the active protocol version.

Changes

Protocol-gated shielded identity creation

Layer / File(s) Summary
Protocol refresh API and application state
packages/kotlin-sdk/sdk/..., packages/rs-unified-sdk-jni/src/queries.rs, packages/kotlin-sdk/KotlinExampleApp/..., packages/swift-sdk/SwiftExampleApp/...
Adds protocol-version refresh through the native and Kotlin query layers, exposes refreshed state in both example apps, and ignores stale refresh results after SDK changes.
Protocol denomination rules and validation
packages/rs-platform-version/..., packages/rs-dpp/..., packages/rs-drive/..., packages/rs-platform-wallet/..., packages/*sdk/...
Updates the v13 denomination set to include 0.03 and 0.25 DASH, retires 0.3 DASH, and revises related tests and documentation.
Kotlin version-aware denomination picker
packages/kotlin-sdk/KotlinExampleApp/.../CreateIdentityScreen.kt
Selects denominations by protocol version, revalidates amounts after changes, and supplies the active set to the funding picker.
Swift version-aware denomination validation
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/CreateIdentityView.swift, packages/swift-sdk/SwiftExampleApp/TEST_PLAN.md
Selects protocol-specific denominations, updates picker messaging, validates submission membership, and documents the revised QA coverage.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AppState
  participant SystemQueries
  participant NativeQueries
  participant Network
  participant CreateIdentityView
  AppState->>SystemQueries: refresh protocol version
  SystemQueries->>NativeQueries: request protocol version
  NativeQueries->>Network: fetch current version
  Network-->>NativeQueries: version
  NativeQueries-->>SystemQueries: version result
  SystemQueries-->>AppState: publish current version
  AppState-->>CreateIdentityView: update protocol-version state
  CreateIdentityView->>CreateIdentityView: select active denomination set
Loading

Possibly related PRs

  • dashpay/platform#3838: Introduced the Swift shielded-balance flow and denomination picker evolved by this change.
  • dashpay/platform#3887: Updated related Swift QA coverage for shielded identity denomination selection.

Suggested reviewers: shumkov, llbartekll, zocolini, lklimek

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: protocol-version-13 shielded identity-create denomination updates.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/shielded-balance-transition-amounts-da0109

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.

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.34884% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.51%. Comparing base (552abfc) to head (0f2d4bb).
⚠️ Report is 18 commits behind head on v4.1-dev.

Files with missing lines Patch % Lines
..._pool_transition/v0/state_transition_validation.rs 95.12% 2 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##           v4.1-dev    #4206       +/-   ##
=============================================
+ Coverage     65.42%   87.51%   +22.09%     
=============================================
  Files            26     2666     +2640     
  Lines          2707   336904   +334197     
=============================================
+ Hits           1771   294837   +293066     
- Misses          936    42067    +41131     
Components Coverage Δ
dpp 88.48% <95.23%> (∅)
drive 86.24% <100.00%> (∅)
drive-abci 89.58% <ø> (∅)
sdk ∅ <ø> (∅)
dapi-client ∅ <ø> (∅)
platform-version ∅ <ø> (∅)
platform-value 92.90% <ø> (∅)
platform-wallet ∅ <ø> (∅)
drive-proof-verifier 49.79% <ø> (∅)
🚀 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.

…ocol version

The example-app denomination pickers hardcoded a single set, but the
exit-denomination set changes at protocol version 13 (0.03 and 0.25 DASH
added, 0.3 DASH retired). Offer the pre-v13 set until the network
reports protocol version 13, then the revised set:

- iOS: AppState now stores the version learned by the existing
  refreshProtocolVersion ratchet (reset on network switch, stale-SDK
  guarded), and CreateIdentityView picks the set from it. The submit
  gate also requires the chosen denomination to still be in the live
  set in case a refresh retires it mid-session.
- Kotlin: bridge dash_sdk_refresh_protocol_version through JNI (it was
  never exposed), surface it as SystemQueries.refreshProtocolVersion,
  refresh on every SDK (re)build in the app's AppState, and gate the
  CreateIdentityScreen picker the same way, re-snapping a picked
  denomination if the set changes under it.

An unknown version (refresh pending or failed) falls back to the
pre-v13 set, matching every currently deployed network.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/rs-dpp/src/state_transition/state_transitions/shielded/identity_create_from_shielded_pool_transition/v0/state_transition_validation.rs (1)

210-218: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Pin these tests to explicit protocol versions.

Both tests use PlatformVersion::latest(), so they validate whichever version is currently newest rather than specifically proving the PV13 set. Use explicit PV13 fixtures and add a PV12 acceptance check for 0.3 DASH to preserve the replay contract.

Also applies to: 229-242

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/rs-dpp/src/state_transition/state_transitions/shielded/identity_create_from_shielded_pool_transition/v0/state_transition_validation.rs`
around lines 210 - 218, Update the denomination validation tests
should_accept_each_member_denomination and the related test around the second
denomination case to use an explicit PV13 fixture instead of
PlatformVersion::latest(). Add a separate PV12 acceptance assertion for the 0.3
DASH denomination, preserving the existing PV13 coverage and replay behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt`:
- Around line 1330-1335: Update the public API documentation at
PlatformWalletManager.kt:1330-1335, FundingNative.kt:119-123, and
funding.rs:655-657 to state that callers must select denominations supported by
the active platform version, documenting PV12 as 0.1/0.3/0.5/1.0 DASH and PV13
as 0.03/0.1/0.25/0.5/1.0 DASH. Keep the comments consistent across all three
sites.

---

Nitpick comments:
In
`@packages/rs-dpp/src/state_transition/state_transitions/shielded/identity_create_from_shielded_pool_transition/v0/state_transition_validation.rs`:
- Around line 210-218: Update the denomination validation tests
should_accept_each_member_denomination and the related test around the second
denomination case to use an explicit PV13 fixture instead of
PlatformVersion::latest(). Add a separate PV12 acceptance assertion for the 0.3
DASH denomination, preserving the existing PV13 coverage and replay behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5987775e-8fc9-4d7d-bd22-c1d685d905dd

📥 Commits

Reviewing files that changed from the base of the PR and between 9bfcf6c and f06d4d9.

📒 Files selected for processing (18)
  • packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/state/AppState.kt
  • packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/CreateIdentityScreen.kt
  • packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/ffi/FundingNative.kt
  • packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/ffi/QueriesNative.kt
  • packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/queries/PlatformQueries.kt
  • packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt
  • packages/rs-dpp/src/shielded/sighash.rs
  • packages/rs-dpp/src/state_transition/state_transitions/shielded/identity_create_from_shielded_pool_transition/v0/mod.rs
  • packages/rs-dpp/src/state_transition/state_transitions/shielded/identity_create_from_shielded_pool_transition/v0/state_transition_validation.rs
  • packages/rs-drive/src/state_transition_action/action_convert_to_operations/shielded/identity_create_from_shielded_pool_transition.rs
  • packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_validation_versions/v9.rs
  • packages/rs-platform-version/src/version/v13.rs
  • packages/rs-platform-wallet/src/wallet/shielded/note_selection.rs
  • packages/rs-unified-sdk-jni/src/funding.rs
  • packages/rs-unified-sdk-jni/src/queries.rs
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/AppState.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/CreateIdentityView.swift
  • packages/swift-sdk/SwiftExampleApp/TEST_PLAN.md

@QuantumExplorer QuantumExplorer left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed

QuantumExplorer and others added 3 commits July 23, 2026 09:10
Address review feedback: the membership tests validated whatever
PlatformVersion::latest() resolves to, so they'd silently drift when a
later version revises the set. Pin the v13 acceptance/rejection tests to
PV13, and add PV12-pinned tests proving the replay contract: the
original set (including the 0.3 DASH retired at v13) stays accepted
under PV12, and the v13 additions (0.03, 0.25) are rejected there.

Also make the denomination docstrings in the Kotlin SDK and JNI layer
version-aware (both sets, keyed to the active protocol version) instead
of listing only the v13 set.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@QuantumExplorer
QuantumExplorer merged commit b4736e3 into v4.1-dev Jul 23, 2026
36 checks passed
@QuantumExplorer
QuantumExplorer deleted the claude/shielded-balance-transition-amounts-da0109 branch July 23, 2026 02:24
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