fix(abstract-substrate): remove double Ed25519 prefix in MPCv2 recovery - #9557
Merged
Merged
Conversation
addSubstrateRecoverySignature wrapped the raw 64-byte MPCv2 signature with 0x00. Transaction.constructSignedPayload already prepends that discriminant. The resulting on-wire signature was shifted by one byte, dropping the last byte of sigma. The chain rejected the extrinsic with `1010: Bad signature`. Fix: pass rawSig through untouched, mirroring MPCv1 and sdk-coin-dot. Verified on Bittensor testnet (finney). Block hash below. 0x3c5605b939d2cc403211f0d32c88fe1bc4125e2632da4ffa4957eff41c8dcf06 Update the MPCv2 unit test which pinned the buggy behavior. Ticket: WCI-1454
vibhavgo
force-pushed
the
fix/sdk-abstract-substrate/mpcv2-recovery
branch
from
August 25, 2026 07:56
8e94603 to
06ec943
Compare
vibhavgo
marked this pull request as ready for review
August 25, 2026 08:24
Marzooqa
approved these changes
Aug 25, 2026
yashvanthbl137-crypto
approved these changes
Aug 25, 2026
Contributor
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
Fixes MPCv2 non-BitGo recovery for Substrate-based EDDSA coins (TAO, POLYX).
addSubstrateRecoverySignaturewas double-prefixing the Ed25519 MultiSignature discriminant, corrupting the on-wire signature by one byte and causing the chain to reject the extrinsic with1010: Bad signature.Linear: WCI-1454
Root cause
addSubstrateRecoverySignaturewrapped the raw 64-byte MPCv2 signature with0x00before callingtxBuilder.addSignature:But
Transaction.constructSignedPayload(called duringbuild()) already prepends0x00:Result: polkadot-js's
MultiSignaturedecoder consumed0x00as the Ed25519 discriminant, then read the next 64 bytes as the signature — which were[0x00][R (32B)][first 31 bytes of sigma]. The last byte ofsigmawas dropped; the chain re-verified against the true 64-byte signature and rejected.MPCv1 was unaffected because its branch already passed the raw 64-byte sig through untouched.
sdk-coin-dotimplements the same helper correctly (seedot.tsL744 — with a comment explicitly warning against double-prefixing).Changes
modules/abstract-substrate/src/abstractSubstrateCoin.ts: MPCv2 branch ofaddSubstrateRecoverySignaturenow passesrawSigdirectly, mirroring MPCv1 andsdk-coin-dot. Removed the unusedED25519_MULTI_SIGNATURE_PREFIXconstant. Updated the doc comment to explain the invariant.modules/abstract-substrate/test/unit/abstractSubstrateCoin.ts: updated the MPCv2 unit test which previously pinned the buggy behavior (sig[0] === 0x00,sig.slice(1) === rawSig) — it now assertssig.length === 64andsig === rawSig.Scope of impact
Coins that extend
SubstrateCoinfrom@bitgo/abstract-substrate:sdk-coin-taosdk-coin-polyxsdk-coin-dotaddRecoverySignaturethat was already correctTest Plan
yarn nyc mochainmodules/abstract-substrate).Status: Ready → Broadcast → InBlock → Finalized0x3c5605b939d2cc403211f0d32c88fe1bc4125e2632da4ffa4957eff41c8dcf06Made with Cursor