Repository navigation
COINS-1797: BTC sweeps fail with 'pub triple is required' - #9960
Conversation
The wasm-utxo rewrite of abstract-utxo explainTransaction requires the wallet pub triple to classify change outputs, where the previous utxolib path treated pubs as optional. The /sweepWallet prebuild response carries no pubs and Wallet.sweep passed neither pubs nor wallet, so every UTXO sweep through bitgo-express >= 16.0.0 failed with "pub triple is required". Hoist the keychain fetch that sweep already performs for signing above the explain call and pass the pubs to both explainTransaction and signTransaction, keeping the request count unchanged. Ticket: COINS-1797
|
@claude review |
|
Claude finished @Ranjna-G's task —— View job Code Review Complete ✅Todo List:
Code Review SummaryThis PR successfully addresses the "pub triple is required" error in UTXO wallet sweeps by providing the necessary wallet public keys to the ✅ StrengthsProblem Resolution
Code Quality
Testing
🔍 Technical Analysiswallet.ts Changes (modules/sdk-core/src/bitgo/wallet/wallet.ts:1170-1193)// BEFORE: explainTransaction called without pubs
const transaction = await this.baseCoin.explainTransaction(response);
// AFTER: keychains fetched early and pubs provided
const keychains: Keychain[] = await this.baseCoin.keychains().getKeysForSigning({ wallet: this, reqId });
const pubs = keychains.map((keychain) => {
assert(keychain.pub);
return keychain.pub;
});
const transaction = await this.baseCoin.explainTransaction({ ...response, pubs });Analysis:
Test Implementation (modules/abstract-utxo/test/unit/sweep.ts)The test file demonstrates strong testing practices:
💡 Minor Observations
🚀 RecommendationAPPROVE - This is a well-implemented fix that:
The implementation correctly addresses the wasm-utxo explain requirement for wallet public keys and should resolve the sweep failures across all UTXO coins (BTC, BCH, LTC, DOGE) on bitgo-express >= 16.0.0. |
|
|
Summary
Wallet.sweepnow supplies the wallet pub triple when explaining the/sweepWalletprebuild, fixingpub triple is requiredfailures that broke every UTXO sweep (BTC, BCH, LTC, DOGE, …) on bitgo-express >= 16.0.0.Linear: COINS-1797
Changes
modules/sdk-core/src/bitgo/wallet/wallet.ts)pubstoexplainTransaction: the wasm-utxo explain requires the wallet pub triple to classify change outputs, and the/sweepWalletprebuild response carries nopubs— sweep previously passed neither pubs nor walletpubsinto the signing params soWallet.signTransactionskips its internal keychain re-fetch — total keychain requests unchanged (3 GETs per sweep)as any(typed asKeychain[])modules/abstract-utxo/test/unit/sweep.ts: end-to-end sweep regression test (prebuild → explain → destination validation → sign → send, asserting exactly one keychain fetch) plus a destination-mismatch guard testTest Plan
cd modules/abstract-utxo && npx mocha test/unit/sweep.ts→ 2 passing; verified red withpub triple is requiredwhen the fix is reverted and sdk-core dist rebuilt@bitgo/public-typesKeyBulkUpdate*,@bitgo/sdk-lib-mpcMpsDerive), verified identical with the fix revertedCloses COINS-1797