@@ -517,8 +517,14 @@ export class SubstrateCoin extends BaseCoin {
517517
518518 /**
519519 * Adds an MPCv1 or MPCv2 signature to a Substrate transaction builder.
520- * MPCv2 signatures are prefixed with ED25519_MULTI_SIGNATURE_PREFIX (Ed25519 discriminant
521- * in the Substrate MultiSignature enum).
520+ *
521+ * Both branches hand off the raw 64-byte Ed25519 signature untouched.
522+ * Transaction#constructSignedPayload already prepends the 0x00 type-tag
523+ * (the Substrate MultiSignature enum discriminant for Ed25519) to whatever
524+ * signature buffer is passed to addSignature, so wrapping the signature
525+ * here would produce a double discriminant, corrupting the on-wire sig
526+ * bytes and causing the chain to reject the extrinsic with `1010: Bad
527+ * signature`.
522528 */
523529 protected async addSubstrateRecoverySignature (
524530 txBuilder : NativeTransferBuilder ,
@@ -530,7 +536,6 @@ export class SubstrateCoin extends BaseCoin {
530536 bitgoKey : string ,
531537 accountId : string
532538 ) : Promise < void > {
533- const ED25519_MULTI_SIGNATURE_PREFIX = 0x00 ;
534539 const substrateKeyPair = new SubstrateKeyPair ( { pub : accountId } ) ;
535540
536541 if ( signingMaterial . version === 'v2' ) {
@@ -543,8 +548,7 @@ export class SubstrateCoin extends BaseCoin {
543548 derivationPath : currPath ,
544549 bitgo : this . bitgo ,
545550 } ) ;
546- const substrateSig = Buffer . concat ( [ Buffer . from ( [ ED25519_MULTI_SIGNATURE_PREFIX ] ) , rawSig ] ) ;
547- txBuilder . addSignature ( { pub : substrateKeyPair . getKeys ( ) . pub } , substrateSig ) ;
551+ txBuilder . addSignature ( { pub : substrateKeyPair . getKeys ( ) . pub } , rawSig ) ;
548552 } else {
549553 const userSigningMaterial = JSON . parse ( signingMaterial . userPrv ) as EDDSAMethodTypes . UserSigningMaterial ;
550554 const backupPrv = await decryptKeychainPrivateKey ( this . bitgo , { encryptedPrv : backupKey } , walletPassphrase ) ;
0 commit comments