Skip to content

Commit c457955

Browse files
2 parents cceee87 + c2c9aca commit c457955

85 files changed

Lines changed: 5852 additions & 183 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,19 @@
122122
/modules/blake2b/ @BitGo/wallet-core @BitGo/wallet-core-india
123123
/modules/express/ @BitGo/wallet-core @BitGo/wallet-core-india
124124
/modules/express/src/lightning/ @BitGo/btc-team
125+
/modules/express/src/typedRoutes/api/v2/delegateResources.ts @BitGo/ethalt-team
126+
/modules/express/src/typedRoutes/api/v2/undelegateResources.ts @BitGo/ethalt-team
125127
/modules/express/test/unit/lightning/ @BitGo/btc-team
126128
/modules/express/test/unit/clientRoutes/lightning/ @BitGo/btc-team
129+
/modules/express/test/unit/clientRoutes/bulkResourceManagement.ts @BitGo/ethalt-team
127130
/modules/key-card/ @BitGo/wallet-core @BitGo/wallet-core-india
128131
/modules/sdk-api/ @BitGo/wallet-core @BitGo/wallet-core-india
129132
/modules/sdk-api/src/v1 @BitGo/btc-team
130133
/modules/sdk-api/test/unit/v1 @BitGo/btc-team
131134
/modules/sdk-core/ @BitGo/wallet-core @BitGo/wallet-core-india @BitGo/hsm @BitGo/coins
132135
/modules/sdk-core/src/bitgo/lightning/ @BitGo/btc-team
133136
/modules/sdk-core/test/unit/bitgo/lightning/ @BitGo/btc-team
137+
/modules/sdk-core/test/unit/bitgo/wallet/resourceManagement.ts @BitGo/ethalt-team
134138
/modules/sdk-lib-mpc/ @BitGo/wallet-core @BitGo/wallet-core-india @BitGo/hsm
135139
/modules/deser-lib/ @BitGo/wallet-core @BitGo/wallet-core-india @BitGo/hsm
136140
/modules/sdk-rpc-wrapper @BitGo/ethalt-team

modules/bitgo/test/v2/unit/internal/tssUtils/ecdsaMPCv2/signTxRequest.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
RequestTracer,
88
SignatureShareRecord,
99
SignatureShareType,
10+
TssTxRecipientSource,
1011
TxRequest,
1112
Wallet,
1213
} from '@bitgo/sdk-core';
@@ -199,6 +200,46 @@ describe('signTxRequest:', function () {
199200
nockPromises[2].isDone().should.be.true();
200201
});
201202

203+
it('successfully signs when recipientSource is explicit and txParams.recipients is non-empty', async function () {
204+
const nockPromises = [
205+
await nockTxRequestResponseSignatureShareRoundOne(bitgoParty, txRequest, bitgoGpgKey),
206+
await nockTxRequestResponseSignatureShareRoundTwo(bitgoParty, txRequest, bitgoGpgKey),
207+
await nockTxRequestResponseSignatureShareRoundThree(txRequest),
208+
await nockSendTxRequest(txRequest),
209+
];
210+
await Promise.all(nockPromises);
211+
212+
const userShare = fs.readFileSync(shareFiles[vector.party1]);
213+
const userPrvBase64 = Buffer.from(userShare).toString('base64');
214+
await tssUtils.signTxRequest({
215+
txRequest,
216+
prv: userPrvBase64,
217+
reqId,
218+
recipientSource: TssTxRecipientSource.Explicit,
219+
txParams: {
220+
recipients: [{ address: '0x0000000000000000000000000000000000000001', amount: '1' }],
221+
},
222+
});
223+
nockPromises[0].isDone().should.be.true();
224+
nockPromises[1].isDone().should.be.true();
225+
nockPromises[2].isDone().should.be.true();
226+
});
227+
228+
it('rejects when recipientSource is explicit and txParams.recipients is empty', async function () {
229+
const userShare = fs.readFileSync(shareFiles[vector.party1]);
230+
const userPrvBase64 = Buffer.from(userShare).toString('base64');
231+
// Cast bypasses the compile-time non-empty recipients constraint to exercise the runtime guard.
232+
await tssUtils
233+
.signTxRequest({
234+
txRequest,
235+
prv: userPrvBase64,
236+
reqId,
237+
recipientSource: TssTxRecipientSource.Explicit,
238+
txParams: { recipients: [] },
239+
} as any)
240+
.should.be.rejectedWith('recipientSource "explicit" requires txParams.recipients with at least one recipient.');
241+
});
242+
202243
it('successfully signs a txRequest with backup key for a dkls hot wallet with WP', async function () {
203244
const nockPromises = [
204245
await nockTxRequestResponseSignatureShareRoundOne(bitgoParty, txRequest, bitgoGpgKey, 1),

0 commit comments

Comments
 (0)