feat(sdk): add client-side validate_structure() to remaining state transitions#3098
Conversation
…ansitions Add client-side structure validation to 6 state transition SDK construction methods, following the pattern established in PR dashpay#3096. This ensures invalid transitions are caught early on the client side before being submitted. State transitions updated: - AddressCreditWithdrawalTransition - AddressFundingFromAssetLockTransition - AddressFundsTransferTransition - IdentityCreateFromAddressesTransition - IdentityCreditTransferToAddressesTransition - IdentityTopUpFromAddressesTransition Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis pull request adds structural validation to state transition construction methods across six v0 implementation files. After constructing each transition, Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
✨ Finishing Touches
🧪 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 |
Issue Being Fixed
Follow-up to #3096 per shumkov's review comment: add client-side structure validation to the remaining state transitions for consistent SDK behavior.
What Was Done
Added
validate_structure()calls to 6 state transition SDK construction methods, following the same pattern established in #3096. This ensures invalid transitions are caught early on the client side before being submitted to the network.State transitions updated:
AddressCreditWithdrawalTransitiontry_from_inputs_with_signerinput_witnessessetAddressFundingFromAssetLockTransitiontry_from_asset_lock_with_signerinput_witnessessetAddressFundsTransferTransitiontry_from_inputs_with_signerinput_witnessessetIdentityCreateFromAddressesTransitiontry_from_inputs_with_signerinput_witnessessetIdentityCreditTransferToAddressesTransitiontry_from_identity.into()conversionIdentityTopUpFromAddressesTransitiontry_from_inputs_with_signerinput_witnessessetPattern used (same as #3096):
Notes:
input_witnesses, validation is called after witnesses are populated (sincevalidate_structure()checksinputs.len() == input_witnesses.len())IdentityCreditTransferToAddressesTransition, the V0 struct is validated before the.into()conversion since it doesn't have witnessesIdentityCreateFromAddressesTransitionalready had public key validation from feat(sdk): add client-side validation to state transition construction methods #3096; this adds the full structure validation on topBuild output
cargo check -p dpp --features state-transition-signing,state-transition-validation— zero errors, zero warnings.Summary by CodeRabbit