Skip to content

fix(drive): unify shielded per-action processing fee across all protocol versions#3877

Merged
QuantumExplorer merged 1 commit into
v3.1-devfrom
fix/shielded-per-action-fee-uniform
Jun 13, 2026
Merged

fix(drive): unify shielded per-action processing fee across all protocol versions#3877
QuantumExplorer merged 1 commit into
v3.1-devfrom
fix/shielded-per-action-fee-uniform

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Jun 13, 2026

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

The shielded per-action processing fee (shielded_per_action_processing_fee) was only calibrated to its real value — 22,000,000 credits, pricing the ~1.1 ms/action Halo 2 verification CPU — in validation v8 (#3800). Validation v1–v7 still carried a 3,000,000 placeholder.

This skew is a live hazard for any client whose protocol-version view lags the network. The SDK auto-detect ratchet seeds at an older protocol version and only advances after it parses a metadata-bearing platform response. A wallet computing the ShieldFromAssetLock pool fee while still seeded below v12 uses the 3M constant, so it reserves lock_value − (proof_fee + actions × 3M + albc) instead of the 22M-priced amount consensus actually charges. The transition then under-funds by 19M × num_actions and is rejected with IdentityAssetLockTransactionOutPointNotEnoughBalanceError.

Observed on testnet (4.0.0-rc.2): shielding 0.1 tDASH built a valid 2-action bundle but was rejected — credits_required: 10,038,000,000 vs credits_left: 10,000,000,000. The 38M shortfall is exactly 2 actions × 19M, the v8 bump the client never saw (its shielded sync queries were failing UNIMPLEMENTED against stale evonodes, so no v12 metadata ever arrived to advance the ratchet).

What was done?

Set shielded_per_action_processing_fee to 22_000_000 in validation versions v1 through v7 (v8 already had it), making the constant uniform across every protocol version. Each changed site carries a comment explaining why a frozen older version's constant is being updated.

Because the per-action fee is now version-invariant, a client that computes the fee under any protocol version reserves the consensus-correct amount — the version-skew can no longer produce a wrong reservation. This is a more robust fix than forcing every fee-sensitive client path to refresh its protocol version before building.

How Has This Been Tested?

  • cargo check -p platform-version — clean.
  • cargo test -p dpp --lib compute_minimum_shielded_fee — all 4 shielded-fee tests pass (incl. compute_minimum_shielded_fee_v0_equals_historical_formula, which reads the constant dynamically via PlatformVersion::latest()).
  • cargo fmt applied.
  • Verified no test or fixture hardcodes the old 3_000_000 value; the only references are the version constants themselves and the formula that reads them generically.

Breaking Changes

None to any deployed network. The shielded family does not activate until platform v12 (validation v8), which already used 22M — so no block under any protocol version has ever priced a shielded action at the old 3M placeholder. Re-validating historical blocks is unaffected (they contain no shielded transitions), and the live network's fee is unchanged. This is why the change is not marked consensus-breaking (fix:, not fix!:).

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

  • Bug Fixes
    • Updated shielded action processing fees across protocol versions v1–v7 to ensure correct fee reservation for clients using stale protocol versions.
    • Corrected masternode vote state transition nonce validation in protocol version v5.

…col versions

The shielded per-action processing fee was only calibrated to its real value
(22M credits, the ~1.1 ms/action Halo 2 verification cost) in validation v8
(#3800); validation v1-v7 kept a 3M placeholder. The shielded family does not
activate until platform v12 (validation v8), so no block under an earlier
protocol version has ever priced a shielded action — making the v1-v7 value a
dormant placeholder, not deployed consensus behavior.

Unify all versions to 22M so a client computing the pool fee under a stale
protocol version (e.g. an SDK whose auto-detect ratchet hasn't yet observed
v12 metadata) still reserves the consensus-correct amount. Without this, a
ShieldFromAssetLock built with the 3M constant under-reserves by 19M/action
and is rejected by consensus with OutPointNotEnoughBalance (observed on
testnet: required 10,038,000,000 vs 10,000,000,000 reserved for a 2-action
bundle).

The live network value (v8 = 22M) is unchanged, so this alters no deployed
consensus outcome.

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

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 68373008-4e60-489e-bb8d-bb77b25b3924

📥 Commits

Reviewing files that changed from the base of the PR and between 29afa55 and cdb9b30.

📒 Files selected for processing (7)
  • packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_validation_versions/v1.rs
  • packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_validation_versions/v2.rs
  • packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_validation_versions/v3.rs
  • packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_validation_versions/v4.rs
  • packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_validation_versions/v5.rs
  • packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_validation_versions/v6.rs
  • packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_validation_versions/v7.rs

📝 Walkthrough

Walkthrough

The pull request updates protocol validation configurations across seven ABCI validation version files (v1–v7). The primary change unifies the shielded_per_action_processing_fee constant from 3,000,000 to 22,000,000 with supporting documentation explaining fee pinning behavior. Additionally, v5 enables nonce validation for masternode vote state transitions.

Changes

Protocol Fee and Validation Updates

Layer / File(s) Summary
Shielded per-action processing fee update (v1–v7)
packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_validation_versions/v1.rs, v2.rs, v3.rs, v4.rs, v5.rs, v6.rs, v7.rs
Updated shielded_per_action_processing_fee from 3,000,000 to 22,000,000 across all seven protocol versions with inline documentation clarifying that shielded actions activate at v12 and that pinning the per-action fee ensures clients on stale versions reserve the consensus-correct amount.
Masternode vote state transition nonce validation (v5)
packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_validation_versions/v5.rs
Changed the nonce field for masternode_vote_state_transition from Some(0) to Some(1) to enable nonce validation in protocol version 5.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • dashpay/platform#3800: The main PR updates the shielded per-action processing fee constants that feed into compute_minimum_shielded_fee(...) for correct fee deduction in Unshield and ShieldedWithdrawal operations.
  • dashpay/platform#3845: Adds FFI-based shielded fee estimation that depends on the updated consensus-pinned shielded_per_action_processing_fee constants for accurate fee outputs.

Suggested reviewers

  • shumkov
  • lklimek
  • llbartekll

Poem

🐰 Seven versions dance in line,
Each one marked with a fee so fine—
From three to twenty-two they spring,
While masternode nonces their bells now ring!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: unifying the shielded per-action processing fee across all protocol versions from varying values to a consistent 22,000,000.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 fix/shielded-per-action-fee-uniform

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.

@thepastaclaw

thepastaclaw commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

✅ Review complete (commit cdb9b30)

@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.

Approved

@QuantumExplorer
QuantumExplorer merged commit 65042eb into v3.1-dev Jun 13, 2026
15 checks passed
@QuantumExplorer
QuantumExplorer deleted the fix/shielded-per-action-fee-uniform branch June 13, 2026 09:10

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code Review

Narrow, correct fix unifying the dormant placeholder shielded_per_action_processing_fee (3M → 22M) in validation versions v1-v7 to match v8. Shielded transitions activate only at platform v12 (validation v8, already 22M), so no historical block ever priced a shielded action under the old constant — change is not consensus-affecting. The fix closes a real stale-protocol-version client-side under-reservation hazard documented in the commit message with an observed testnet failure mode.

@github-actions

Copy link
Copy Markdown
Contributor

✅ DashSDKFFI.xcframework built for this PR.

SwiftPM (host the zip at a stable URL, then use):

.binaryTarget(
  name: "DashSDKFFI",
  url: "https://your.cdn.example/DashSDKFFI.xcframework.zip",
  checksum: "1ce84a2ea7f0e5f0282a7a9fa003e3e9a07918a76831c9a35a2ffd1460d5be09"
)

Xcode manual integration:

  • Download 'DashSDKFFI.xcframework' artifact from the run link above.
  • Drag it into your app target (Frameworks, Libraries & Embedded Content) and set Embed & Sign.
  • If using the Swift wrapper package, point its binaryTarget to the xcframework location or add the package and place the xcframework at the expected path.

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