Repository navigation
fix(crypto-transaction): bind legacy second signature to signed transaction - #1522
Merged
sebastijankuzner merged 3 commits intoOct 9, 2026
Merged
sebastijankuzner merged 3 commits into
sebastijankuzner merged 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1522 +/- ##
===========================================
+ Coverage 80.31% 80.60% +0.29%
===========================================
Files 952 963 +11
Lines 17162 17601 +439
Branches 2599 2678 +79
===========================================
+ Hits 13784 14188 +404
- Misses 3373 3405 +32
- Partials 5 8 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
oXtxNt9U
force-pushed
the
fix/crypto-transaction/bind-legacy-second-signature
branch
from
October 7, 2026 03:32
d6520e8 to
2f6387c
Compare
sebastijankuzner
deleted the
fix/crypto-transaction/bind-legacy-second-signature
branch
October 9, 2026 13:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The legacy second signature (LSS) signed the same digest as the primary signature and covered neither the sender nor the primary signature. So an LSS was also a valid transaction from the second key's own address, it could be reused by other wallets sharing that second key, and any ordinary signature by the second key over the same body could be used as an LSS. Its last byte (the recovery id) was also never checked, so anyone could make 256 valid variants of an LSS under one transaction hash.
Fixes
keccak256(0x8f ‖ "MAINSAIL_LSS_V1" ‖ txHash), wheretxHashis the hash of the primary-signed transaction. This binds it to the sender and the primary signature, and the0x8fprefix means it can never match a transaction or signed-message preimage. The builder now requires the primary signature first.Tests
Note
LSS producers (TS, PHP and Python SDKs) must sign the new digest, where
txHashis the standard hash of the 9-field signed transaction (minimal r/s, without the LSS), and emit a recovery id of 0 or 1.Breaking
TransactionBuilder.legacySecondSign*must be called aftersign*(throwsMissingTransactionSignatureErrorotherwise).legacySecondSigntakes the signed transaction;verifyLegacySecondSignaturetakesTransactionDataand uses itshash.Checklist