From dfbcd47cc1a91e852c3b702dc91f2740535c0726 Mon Sep 17 00:00:00 2001 From: mrdanish26 Date: Thu, 16 Apr 2026 14:22:05 -0700 Subject: [PATCH] Revert "#8462 from BWAL-375-mpcv2-sign-tx-require-txparams" This reverts commit 1b9c75be4a4fed69330668e369c27512dfa8d099, reversing changes made to 26a1c8e1b83e1cc1eca51b7b6891e1408bee0b75. WAL-375 TICKET: WAL-375 --- .../test/v2/unit/internal/tssUtils/ecdsa.ts | 35 ------------------- .../tssUtils/ecdsaMPCv2/signTxRequest.ts | 34 ------------------ .../bitgo/pendingApproval/pendingApproval.ts | 4 +-- .../src/bitgo/utils/tss/baseTSSUtils.ts | 10 ++---- .../sdk-core/src/bitgo/utils/tss/baseTypes.ts | 7 +--- .../src/bitgo/utils/tss/ecdsa/ecdsa.ts | 11 ++---- .../src/bitgo/utils/tss/ecdsa/ecdsaMPCv2.ts | 11 ++---- 7 files changed, 8 insertions(+), 104 deletions(-) diff --git a/modules/bitgo/test/v2/unit/internal/tssUtils/ecdsa.ts b/modules/bitgo/test/v2/unit/internal/tssUtils/ecdsa.ts index c898bc261a..6e9574b491 100644 --- a/modules/bitgo/test/v2/unit/internal/tssUtils/ecdsa.ts +++ b/modules/bitgo/test/v2/unit/internal/tssUtils/ecdsa.ts @@ -747,7 +747,6 @@ describe('TSS Ecdsa Utils:', async function () { backupNShare: backupKeyShare.nShares[1], }), reqId, - txParams: { recipients: [{ address: '0xrecipient', amount: '1000' }] }, }); signedTxRequest.unsignedTxs.should.deepEqual(txRequest.unsignedTxs); const userGpgActual = sendShareSpy.getCalls()[0].args[10] as string; @@ -765,46 +764,12 @@ describe('TSS Ecdsa Utils:', async function () { backupNShare: backupKeyShare.nShares[1], }), reqId, - txParams: { recipients: [{ address: '0xrecipient', amount: '1000' }] }, }); signedTxRequest.unsignedTxs.should.deepEqual(txRequest.unsignedTxs); const userGpgActual = sendShareSpy.getCalls()[0].args[10] as string; userGpgActual.should.startWith('-----BEGIN PGP PUBLIC KEY BLOCK-----'); }); - it('signTxRequest should fail when txParams is missing', async function () { - await tssUtils - .signTxRequest({ - txRequest, - prv: JSON.stringify({ - pShare: userKeyShare.pShare, - bitgoNShare: bitgoKeyShare.nShares[1], - backupNShare: backupKeyShare.nShares[1], - }), - reqId, - }) - .should.be.rejectedWith( - 'Recipient details are required to verify this transaction before signing. Pass txParams with at least one recipient.' - ); - }); - - it('signTxRequest should fail when txParams has empty recipients', async function () { - await tssUtils - .signTxRequest({ - txRequest, - prv: JSON.stringify({ - pShare: userKeyShare.pShare, - bitgoNShare: bitgoKeyShare.nShares[1], - backupNShare: backupKeyShare.nShares[1], - }), - reqId, - txParams: { recipients: [] }, - }) - .should.be.rejectedWith( - 'Recipient details are required to verify this transaction before signing. Pass txParams with at least one recipient.' - ); - }); - it('signTxRequest should fail with wrong recipient', async function () { // To generate these Hex values, we used the bitgo-ui to create a transaction and then // used the `signableHex` and `serializedTxHex` values from the prebuild. diff --git a/modules/bitgo/test/v2/unit/internal/tssUtils/ecdsaMPCv2/signTxRequest.ts b/modules/bitgo/test/v2/unit/internal/tssUtils/ecdsaMPCv2/signTxRequest.ts index 5442f4d3b7..9b2a43be4e 100644 --- a/modules/bitgo/test/v2/unit/internal/tssUtils/ecdsaMPCv2/signTxRequest.ts +++ b/modules/bitgo/test/v2/unit/internal/tssUtils/ecdsaMPCv2/signTxRequest.ts @@ -193,7 +193,6 @@ describe('signTxRequest:', function () { txRequest, prv: userPrvBase64, reqId, - txParams: { recipients: [{ address: '0xrecipient', amount: '1000' }] }, }); nockPromises[0].isDone().should.be.true(); nockPromises[1].isDone().should.be.true(); @@ -216,7 +215,6 @@ describe('signTxRequest:', function () { prv: backupPrvBase64, mpcv2PartyId: 1, reqId, - txParams: { recipients: [{ address: '0xrecipient', amount: '1000' }] }, }); nockPromises[0].isDone().should.be.true(); nockPromises[1].isDone().should.be.true(); @@ -238,7 +236,6 @@ describe('signTxRequest:', function () { txRequest, prv: userPrvBase64, reqId, - txParams: { recipients: [{ address: '0xrecipient', amount: '1000' }] }, }); nockPromises[0].isDone().should.be.true(); nockPromises[1].isDone().should.be.true(); @@ -260,7 +257,6 @@ describe('signTxRequest:', function () { txRequest, prv: userPrvBase64, reqId, - txParams: { recipients: [{ address: '0xrecipient', amount: '1000' }] }, }); nockPromises[0].isDone().should.be.true(); nockPromises[1].isDone().should.be.true(); @@ -281,41 +277,11 @@ describe('signTxRequest:', function () { txRequest, prv: userPrvBase64, reqId, - txParams: { recipients: [{ address: '0xrecipient', amount: '1000' }] }, }) .should.be.rejectedWith('Too many requests, slow down!'); nockPromises[0].isDone().should.be.true(); nockPromises[1].isDone().should.be.false(); }); - - it('rejects signTxRequest when txParams is missing', async function () { - const userShare = fs.readFileSync(shareFiles[vector.party1]); - const userPrvBase64 = Buffer.from(userShare).toString('base64'); - await tssUtils - .signTxRequest({ - txRequest, - prv: userPrvBase64, - reqId, - }) - .should.be.rejectedWith( - 'Recipient details are required to verify this transaction before signing. Pass txParams with at least one recipient.' - ); - }); - - it('rejects signTxRequest when txParams has empty recipients', async function () { - const userShare = fs.readFileSync(shareFiles[vector.party1]); - const userPrvBase64 = Buffer.from(userShare).toString('base64'); - await tssUtils - .signTxRequest({ - txRequest, - prv: userPrvBase64, - reqId, - txParams: { recipients: [] }, - }) - .should.be.rejectedWith( - 'Recipient details are required to verify this transaction before signing. Pass txParams with at least one recipient.' - ); - }); }); export function getBitGoPartyGpgKeyPrv(key: openpgp.SerializedKeyPair): DklsTypes.PartyGpgKey { diff --git a/modules/sdk-core/src/bitgo/pendingApproval/pendingApproval.ts b/modules/sdk-core/src/bitgo/pendingApproval/pendingApproval.ts index 9de0f72079..ebf7e898ff 100644 --- a/modules/sdk-core/src/bitgo/pendingApproval/pendingApproval.ts +++ b/modules/sdk-core/src/bitgo/pendingApproval/pendingApproval.ts @@ -246,9 +246,7 @@ export class PendingApproval implements IPendingApproval { } const decryptedPrv = await this.wallet.getPrv({ walletPassphrase }); - const pendingApprovalRecipients = this._pendingApproval.info?.transactionRequest?.recipients; - const txParams = pendingApprovalRecipients?.length ? { recipients: pendingApprovalRecipients } : undefined; - const txRequest = await this.tssUtils!.recreateTxRequest(txRequestId, decryptedPrv, reqId, txParams); + const txRequest = await this.tssUtils!.recreateTxRequest(txRequestId, decryptedPrv, reqId); if (txRequest.apiVersion === 'lite') { if (!txRequest.unsignedTxs || txRequest.unsignedTxs.length === 0) { throw new Error('Unexpected error, no transactions found in txRequest.'); diff --git a/modules/sdk-core/src/bitgo/utils/tss/baseTSSUtils.ts b/modules/sdk-core/src/bitgo/utils/tss/baseTSSUtils.ts index ca9d96a791..de7fd8bfdd 100644 --- a/modules/sdk-core/src/bitgo/utils/tss/baseTSSUtils.ts +++ b/modules/sdk-core/src/bitgo/utils/tss/baseTSSUtils.ts @@ -39,7 +39,6 @@ import { TxRequest, TxRequestVersion, } from './baseTypes'; -import { TransactionParams } from '../../baseCoin/iBaseCoin'; import { GShare, SignShare } from '../../../account-lib/mpc/tss'; import { RequestTracer } from '../util'; import { envRequiresBitgoPubGpgKeyConfig, getBitgoMpcGpgPubKey } from '../../tss/bitgoPubKeys'; @@ -534,16 +533,11 @@ export default class BaseTssUtils extends MpcUtils implements ITssUtil * @param {RequestTracer} reqId id tracer. * @returns {Promise} */ - async recreateTxRequest( - txRequestId: string, - decryptedPrv: string, - reqId: IRequestTracer, - txParams?: TransactionParams - ): Promise { + async recreateTxRequest(txRequestId: string, decryptedPrv: string, reqId: IRequestTracer): Promise { await this.deleteSignatureShares(txRequestId, reqId); // after delete signatures shares get the tx without them const txRequest = await getTxRequest(this.bitgo, this.wallet.id(), txRequestId, reqId); - return await this.signTxRequest({ txRequest, prv: decryptedPrv, reqId, txParams }); + return await this.signTxRequest({ txRequest, prv: decryptedPrv, reqId }); } /** diff --git a/modules/sdk-core/src/bitgo/utils/tss/baseTypes.ts b/modules/sdk-core/src/bitgo/utils/tss/baseTypes.ts index d1dfb1b3d4..719ffd4507 100644 --- a/modules/sdk-core/src/bitgo/utils/tss/baseTypes.ts +++ b/modules/sdk-core/src/bitgo/utils/tss/baseTypes.ts @@ -759,12 +759,7 @@ export interface ITssUtils { deleteSignatureShares(txRequestId: string): Promise; // eslint-disable-next-line @typescript-eslint/no-explicit-any sendTxRequest(txRequestId: string): Promise; - recreateTxRequest( - txRequestId: string, - decryptedPrv: string, - reqId: IRequestTracer, - txParams?: TransactionParams - ): Promise; + recreateTxRequest(txRequestId: string, decryptedPrv: string, reqId: IRequestTracer): Promise; getTxRequest(txRequestId: string): Promise; supportedTxRequestVersions(): TxRequestVersion[]; } diff --git a/modules/sdk-core/src/bitgo/utils/tss/ecdsa/ecdsa.ts b/modules/sdk-core/src/bitgo/utils/tss/ecdsa/ecdsa.ts index 1e45de5ebc..32e185d3b8 100644 --- a/modules/sdk-core/src/bitgo/utils/tss/ecdsa/ecdsa.ts +++ b/modules/sdk-core/src/bitgo/utils/tss/ecdsa/ecdsa.ts @@ -47,7 +47,6 @@ import { } from '../../../tss/types'; import { BaseEcdsaUtils } from './base'; import { IRequestTracer } from '../../../../api'; -import { InvalidTransactionError } from '../../../errors'; const encryptNShare = ECDSAMethods.encryptNShare; @@ -746,12 +745,6 @@ export class EcdsaUtils extends BaseEcdsaUtils { const unsignedTx = txRequest.apiVersion === 'full' ? txRequest.transactions![0].unsignedTx : txRequest.unsignedTxs[0]; - if (!params.txParams?.recipients?.length) { - throw new InvalidTransactionError( - 'Recipient details are required to verify this transaction before signing. Pass txParams with at least one recipient.' - ); - } - // For ICP transactions, the HSM signs the serializedTxHex, while the user signs the signableHex separately. // Verification cannot be performed directly on the signableHex alone. However, we can parse the serializedTxHex // to regenerate the signableHex and compare it against the provided value for verification. @@ -759,14 +752,14 @@ export class EcdsaUtils extends BaseEcdsaUtils { if (this.baseCoin.getConfig().family === 'icp') { await this.baseCoin.verifyTransaction({ txPrebuild: { txHex: unsignedTx.serializedTxHex, txInfo: unsignedTx.signableHex }, - txParams: params.txParams, + txParams: params.txParams || { recipients: [] }, wallet: this.wallet, walletType: this.wallet.multisigType(), }); } else { await this.baseCoin.verifyTransaction({ txPrebuild: { txHex: unsignedTx.signableHex }, - txParams: params.txParams, + txParams: params.txParams || { recipients: [] }, wallet: this.wallet, walletType: this.wallet.multisigType(), }); diff --git a/modules/sdk-core/src/bitgo/utils/tss/ecdsa/ecdsaMPCv2.ts b/modules/sdk-core/src/bitgo/utils/tss/ecdsa/ecdsaMPCv2.ts index 4a623111ef..55f1d9b725 100644 --- a/modules/sdk-core/src/bitgo/utils/tss/ecdsa/ecdsaMPCv2.ts +++ b/modules/sdk-core/src/bitgo/utils/tss/ecdsa/ecdsaMPCv2.ts @@ -32,7 +32,6 @@ import { verifyBitGoMessagesAndSignaturesRoundOne, verifyBitGoMessagesAndSignaturesRoundTwo, } from '../../../tss/ecdsa/ecdsaMPCv2'; -import { InvalidTransactionError } from '../../../errors'; import { KeyCombined } from '../../../tss/ecdsa/types'; import { generateGPGKeyPair } from '../../opengpgUtils'; import { @@ -737,12 +736,6 @@ export class EcdsaMPCv2Utils extends BaseEcdsaUtils { const unsignedTx = txRequest.apiVersion === 'full' ? txRequest.transactions![0].unsignedTx : txRequest.unsignedTxs[0]; - if (!params.txParams?.recipients?.length) { - throw new InvalidTransactionError( - 'Recipient details are required to verify this transaction before signing. Pass txParams with at least one recipient.' - ); - } - // For ICP transactions, the HSM signs the serializedTxHex, while the user signs the signableHex separately. // Verification cannot be performed directly on the signableHex alone. However, we can parse the serializedTxHex // to regenerate the signableHex and compare it against the provided value for verification. @@ -750,14 +743,14 @@ export class EcdsaMPCv2Utils extends BaseEcdsaUtils { if (this.baseCoin.getConfig().family === 'icp') { await this.baseCoin.verifyTransaction({ txPrebuild: { txHex: unsignedTx.serializedTxHex, txInfo: unsignedTx.signableHex }, - txParams: params.txParams, + txParams: params.txParams || { recipients: [] }, wallet: this.wallet, walletType: this.wallet.multisigType(), }); } else { await this.baseCoin.verifyTransaction({ txPrebuild: { txHex: unsignedTx.signableHex }, - txParams: params.txParams, + txParams: params.txParams || { recipients: [] }, wallet: this.wallet, walletType: this.wallet.multisigType(), });