Repository navigation
fix(sdk)!: getSignableBytes is not compatible with sign and verify - #3048
Conversation
📝 WalkthroughWalkthroughThe pull request removes the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
|
@coderabbitai / shumkov
where does this happen in the PR? it's in description, but I don't see it |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain
🏁 Script executed: Length of output: 1239 🏁 Script executed: Length of output: 248
Based on the actual changes in this PR:
The PR description statement about "Added missing toStateTransition() to DataContractCreateTransition, DataContractUpdateTransition, and BatchTransition" does not match the actual changes made. 🧠 Learnings used |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 1999
Based on the git diff, this PR only modifies:
The only mention of const st = transition.toStateTransition();
expect(st.getSignableBytes().length).to.equal(229);There are no changes to:
The PR description appears to contain outdated or incorrect information. The actual changes are focused solely on removing the 🧠 Learnings used |
Issue being fixed or feature implemented
getSignableBytes()on WASM transition types (IdentityUpdate, IdentityCreate, IdentityTopUp, CreditWithdrawal, IdentityCreditTransfer, MasternodeVote) returned incorrect signable bytes — missing the 2-byteStateTransitionenum variant index prefix. This caused signature verification failures on Platform when consumers usedgetSignableBytes()to compute key self-signatures (e.g. "ecdsa signing error signature failed verification").What was done?
Removed duplicate
getSignableBytesfrom all specific transition types (was redundant withtoStateTransition().getSignableBytes())Added missing
toStateTransition()toDataContractCreateTransition,DataContractUpdateTransition, andBatchTransitionHow Has This Been Tested?
cargo check -p wasm-dpp2compiles cleanly with no errors or warningsBreaking Changes
The bytes returned by
getSignableBytes()on individual transition types now include theStateTransitionenum variant index prefix (2 bytes). Any consumer that was relying on the previous (incorrect) inner-only bytes will see different output. This is a correctness fix — the previous output was wrong and would fail platform signature verification.Checklist:
Summary by CodeRabbit
Release Notes
Refactor
getSignableBytes()method from identity transition types (create, credit withdrawal, credit transfer, masternode vote, top-up, and update transitions). Applications relying on this method must be updated to use alternative approaches for obtaining signable bytes.Tests