feat(sdk): add client-side validate_structure() to remaining state transitions#3100
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>
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughRuntime structure validation is added to six state transition v0 implementations. Each transition's Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 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 |
Summary
Add client-side
validate_structure()calls to 6 remaining state transition SDK construction methods. This follows the pattern established in #3096 (which added it toIdentityCreate,IdentityUpdate, andIdentityCreateFromAddresses).Per shumkov's review comment: extend validation to all state transitions for consistent SDK behavior.
Changes
Each state transition's
try_from_*construction method now callsvalidate_structure()on the fully-constructed transition struct before returning, giving SDK users immediate error feedback instead of waiting for network rejection.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
Same pattern as #3096:
Build
cargo check -p dpp --features state-transition-signing,state-transition-validationpasses clean (zero warnings).Summary by CodeRabbit
Release Notes