feat(dpp): add getters and setters for new shielded state transitions#3879
Conversation
The new shielded state-transition enums (ShieldTransition, UnshieldTransition, ShieldedTransferTransition, ShieldedWithdrawalTransition, ShieldFromAssetLockTransition and IdentityCreateFromShieldedPoolTransition) exposed their V0 struct fields publicly but the enum wrappers had no getters/setters for most of them, so callers could not mutate a transition through the enum (e.g. `transition.set_actions(..)` / `set_amount(..)`). Add full getters and setters for every field of all six transitions via their `*AccessorsV0` traits (creating the missing accessor modules for ShieldTransition and ShieldFromAssetLockTransition). Fields already exposed through shared traits are intentionally not duplicated to avoid method-call ambiguity on the enum: inputs/input_witnesses via StateTransitionWitnessSigned, user_fee_increase via StateTransitionHasUserFeeIncrease, asset_lock_proof via AssetLockProved and the ECDSA signature via StateTransitionSingleSigned. Add a getter/setter round-trip test for each transition. Closes #3871 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (14)
📝 WalkthroughWalkthroughThis PR implements getter and setter accessor methods across six shielded transition types (IdentityCreateFromShieldedPool, ShieldFromAssetLock, Shield, ShieldedTransfer, ShieldedWithdrawal, Unshield), following a consistent trait-based pattern. Each transition gains immutable and mutable access to Orchard proofs, serialized actions, anchors, and balance/fee parameters, with comprehensive unit tests validating field mutation behavior. ChangesShielded transition getter and setter accessors
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
✅ Review complete (commit a005f7c) |
thepastaclaw
left a comment
There was a problem hiding this comment.
Code Review
Purely additive PR adding getters and setters for six new shielded state-transition enum wrappers, following the existing *AccessorsV0 trait pattern. Both agent reviewers and CodeRabbit found no actionable issues. No consensus-critical paths, validation, or serialization touched.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v3.1-dev #3879 +/- ##
=============================================
- Coverage 87.22% 71.20% -16.03%
=============================================
Files 2641 20 -2621
Lines 328569 2837 -325732
=============================================
- Hits 286597 2020 -284577
+ Misses 41972 817 -41155
🚀 New features to boost your workflow:
|
|
✅ 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: "cef79a9c53d7af301aac7af5a0bf80deef569a9bc755f3290f9d3927527d1754"
)Xcode manual integration:
|
Issue being fixed or feature implemented
Resolves #3871.
rs-dpp4.0.0-rc.2 ships the new shielded state transitions with public fields on theirV0structs, but the enum wrappers had no accessors for most fields. As the issue reports, you could reachinputs/input_witnessesonShieldTransition(viaStateTransitionWitnessSigned) but could not get/setactions,amount,anchor,proof, etc. through the enum:What was done?
Added complete getters and setters for every field of all six new shielded transitions, following the existing
*AccessorsV0trait pattern (trait defined inaccessors/v0/mod.rs, implemented on the enum inaccessors/mod.rs):ShieldTransitionShieldTransitionAccessorsV0:actions,amount,anchor,proof,binding_signature,fee_strategy(+ setters)ShieldFromAssetLockTransitionShieldFromAssetLockTransitionAccessorsV0:actions,value_balance,anchor,proof,binding_signature,surplus_output(+ setters)UnshieldTransitionunshielding_amount,anchor,proof,binding_signatureShieldedTransferTransitionvalue_balance,anchor,proof,binding_signatureShieldedWithdrawalTransitionunshielding_amount,anchor,proof,binding_signature,core_fee_per_byte,poolingIdentityCreateFromShieldedPoolTransitionanchor,proof,binding_signatureFields already exposed through shared traits are intentionally not duplicated, to avoid method-call ambiguity on the enum:
inputs/input_witnesses→StateTransitionWitnessSigneduser_fee_increase→StateTransitionHasUserFeeIncreaseasset_lock_proof→AssetLockProvedsignature→StateTransitionSingleSignedHow Has This Been Tested?
test_getters_and_settersround-trip test to each transition'saccessors/mod.rs(6 tests) — asserts each getter reads the constructed value and each setter mutates it.cargo test -p dpp --all-features accessors::tests::test_getters_and_setters— all 6 pass.cargo check -p dpp --all-features --tests— clean.cargo clippy -p dpp --all-features --tests— clean.cargo fmt --allapplied.Breaking Changes
None. The changes are purely additive — new methods on the
*AccessorsV0traits whose only implementors are the enum wrappers in this crate. Downstream crates that call these accessors are unaffected.Checklist:
For repository code-owners and collaborators only
🤖 Generated with Claude Code
Summary by CodeRabbit
Tests
Refactor