Skip to content

chore: tidy follow-ups from the shielded withdrawal fee review#3802

Merged
QuantumExplorer merged 1 commit into
v3.1-devfrom
claude/shielded-withdrawal-fee-review-nits
Jun 6, 2026
Merged

chore: tidy follow-ups from the shielded withdrawal fee review#3802
QuantumExplorer merged 1 commit into
v3.1-devfrom
claude/shielded-withdrawal-fee-review-nits

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Jun 6, 2026

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Post-merge cleanup of the low/nit items surfaced by the final review of #3800 (already merged into v3.1-dev). All four are low/nit hygiene with no consensus impact — none was merge-blocking, so they are split into this small follow-up rather than reopening #3800.

What was done?

  • Compile-time guard on MIN_WITHDRAWAL_AMOUNTfix(drive): charge fees for unshield and shielded withdrawal #3800 moved the consensus withdrawal floor into the versioned system_limits.min_withdrawal_amount, leaving the dpp MIN_WITHDRAWAL_AMOUNT const as the v11 baseline that must stay in sync with SYSTEM_LIMITS_V1. Added const _: () = assert!(MIN_WITHDRAWAL_AMOUNT == 190_000) on both definitions so a future dashcore ASSET_UNLOCK_TX_SIZE change breaks the build (a prompt to re-sync) instead of silently drifting the doc comment.
  • Refreshed stale 190_000 test references in the address-withdrawal validator tests to the v12 floor (1_000_000), and lifted the valid-path helper input above the floor (2_000_000) so the happy path is genuinely above-floor rather than sitting on the boundary.
  • Corrected stale "above MIN_WITHDRAWAL_AMOUNT" comments in the shielded-withdrawal integration tests (the 1_000_000 recipient is now at the v12 floor).
  • Locked the builders' returned fee against the wallet's independently-reserved exact_fee via debug_assert_eq! at all three shielded operation sites (fix(drive): charge fees for unshield and shielded withdrawal #3800 made the builders return the applied fee; nothing asserted it).

How Has This Been Tested?

cargo clippy --all-features --all-targets -- -D warnings clean across dpp / platform-wallet / drive-abci. Suites pass with 0 failures: dpp address_credit_withdrawal 25, platform-wallet shielded 23 (the live debug_assert confirms fee_used == exact_fee), drive-abci shielded_withdrawal 20.

Breaking Changes

None. No consensus or public-API behavior change (the const _ guard is compile-time only; the debug_assert is debug-build only).

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

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Added compile-time assertions to ensure withdrawal amount constants remain synchronized across the system.
    • Enhanced fee verification in shielded spend operations to validate calculated fees match reserved amounts.
  • Tests

    • Updated validation test cases and comments to reflect current withdrawal amount thresholds.

Fast-follows from the final delta review (all low/nit, no consensus impact):
- L1: add a compile-time guard `const _: () = assert!(MIN_WITHDRAWAL_AMOUNT == 190_000)` on
  both dpp withdrawal consts, so a future dashcore ASSET_UNLOCK_TX_SIZE change breaks the build
  (a prompt to re-sync SYSTEM_LIMITS_V1.min_withdrawal_amount) instead of silently drifting.
- N1: refresh stale 190_000 references in the address-withdrawal validator tests to the v12
  floor (1_000_000) and lift the valid-helper input above the floor (2_000_000) so the happy
  path is genuinely above-floor, not sitting on the boundary.
- N2: correct the stale "above MIN_WITHDRAWAL_AMOUNT" comments in the shielded integration
  tests (the 1_000_000 recipient is now AT the v12 floor, not above it).
- N3: lock the builders' new returned fee against the wallet's independently-reserved
  exact_fee via debug_assert_eq! at all three shielded operation sites.

Verified: clippy --all-features --all-targets -D warnings clean; dpp address_credit_withdrawal
25, platform-wallet shielded 23 (the live debug_assert confirms fee_used == exact_fee),
drive-abci shielded_withdrawal 20 pass, 0 failures.

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

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0785fa2c-e7f6-4ead-82b2-5fb48dd3234b

📥 Commits

Reviewing files that changed from the base of the PR and between 5281936 and 228c144.

📒 Files selected for processing (5)
  • packages/rs-dpp/src/state_transition/state_transitions/address_funds/address_credit_withdrawal_transition/mod.rs
  • 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/identity/identity_credit_withdrawal_transition/mod.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/shielded_withdrawal/tests.rs
  • packages/rs-platform-wallet/src/wallet/shielded/operations.rs

📝 Walkthrough

Walkthrough

This PR adds compile-time assertions enforcing that MIN_WITHDRAWAL_AMOUNT stays synchronized with its computed fee value, updates withdrawal validation tests and comments to reference the v12 minimum boundary, and captures builder-computed fees in shielded wallet operations to verify they match reserved amounts.

Changes

Withdrawal Amount Assertions and Fee Synchronization

Layer / File(s) Summary
MIN_WITHDRAWAL_AMOUNT compile-time guards
packages/rs-dpp/src/state_transition/state_transitions/address_funds/address_credit_withdrawal_transition/mod.rs, packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/mod.rs
Adds matching const compile-time assertions to enforce MIN_WITHDRAWAL_AMOUNT == 190_000 in both address and identity withdrawal transitions, failing the build if the computed value changes due to asset unlock transaction size or fee-rate adjustments.
Withdrawal validation test updates and comments
packages/rs-dpp/src/state_transition/state_transitions/address_funds/address_credit_withdrawal_transition/v0/state_transition_validation.rs, packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/shielded_withdrawal/tests.rs
Updates valid_withdrawal_transition() helper to use input amount 2,000,000, rewrites withdrawal-below-minimum test comments to reference v12 min_withdrawal_amount (1,000,000), and adjusts shielded withdrawal test comments to align unshielding_amount descriptions with the v12 minimum floor.
Fee capture and assertion in shielded wallet operations
packages/rs-platform-wallet/src/wallet/shielded/operations.rs
Captures builder-returned fee_used in unshield, transfer, and withdraw operations and adds debug_assert_eq! checks verifying that the builder-computed fee matches the wallet's reserved exact_fee for the same action count.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

ready for final review

Suggested reviewers

  • shumkov
  • thepastaclaw

Poem

🐰 A withdrawal's bound must hold,
MIN_WITHDRAWAL_AMOUNT, true and bold!
Compile-time checks keep values tight,
Fee assertions shine so bright,
Constants sync'd—a hop delight!

🚥 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 accurately reflects the main purpose of the PR—implementing post-merge cleanup and follow-up improvements following a shielded withdrawal fee review.
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.

✏️ 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 claude/shielded-withdrawal-fee-review-nits

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 6, 2026

Copy link
Copy Markdown
Collaborator

✅ Review complete (commit 228c144)

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

okay

@QuantumExplorer
QuantumExplorer merged commit ac335c6 into v3.1-dev Jun 6, 2026
14 of 15 checks passed
@QuantumExplorer
QuantumExplorer deleted the claude/shielded-withdrawal-fee-review-nits branch June 6, 2026 23:54

@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

Both agents reviewed the same diff and reported no findings. The PR is a small, well-scoped follow-up cleanup: compile-time assertions pinning MIN_WITHDRAWAL_AMOUNT, test comment refreshes to v12 floor, and debug_assert_eq! on shielded fee invariants. No consensus impact, no public API changes.

@codecov

codecov Bot commented Jun 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.16%. Comparing base (5281936) to head (228c144).
⚠️ Report is 1 commits behind head on v3.1-dev.

Additional details and impacted files
@@              Coverage Diff              @@
##           v3.1-dev    #3802       +/-   ##
=============================================
+ Coverage     69.91%   87.16%   +17.25%     
=============================================
  Files            19     2627     +2608     
  Lines          2712   321557   +318845     
=============================================
+ Hits           1896   280299   +278403     
- Misses          816    41258    +40442     
Components Coverage Δ
dpp 87.68% <100.00%> (∅)
drive 86.07% <ø> (∅)
drive-abci 89.48% <ø> (∅)
sdk ∅ <ø> (∅)
dapi-client ∅ <ø> (∅)
platform-version ∅ <ø> (∅)
platform-value 92.17% <ø> (∅)
platform-wallet ∅ <ø> (∅)
drive-proof-verifier 47.85% <ø> (∅)
🚀 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.

@github-actions

github-actions Bot commented Jun 7, 2026

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: "bfa5983c63a27f54153af3aa21043fffe5db62f4b2fd1bbe42ea2c6a33d851c1"
)

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