feat(sdk-coin-sol): add MPCv2 support to recoverConsolidations#9116
Conversation
47d069c to
fd91225
Compare
|
Claude finished @vibhavgo's task —— View job Code Review: MPCv2 Support for recoverConsolidations
SummaryThis PR successfully implements MPCv2 support for Positive Aspects✅ Excellent Performance OptimizationThe core optimization in ✅ Correct MPCv2 Address DerivationLines ✅ Smart Threading PatternThe ✅ Comprehensive Test CoverageThe 336 lines of new tests cover all critical scenarios:
✅ Type SafetyThe addition of Technical Implementation ReviewAddress Derivation Logic (
|
- Detect MPCv2 once at the top of recoverConsolidations instead of relying on per-iteration keycard decryption in recover(). This avoids decrypting the same keycard N times across the scan loop. - For MPCv2 wallets, derive the base destination address (index 0) using deriveUnhardenedMps instead of MPC.deriveUnhardened, so funds are swept to the correct MPCv2 address. - Thread multisigTypeVersion='MPCv2' into each recover() call so recover() short-circuits isMpcv2SigningMaterial and skips redundant detection. - Add multisigTypeVersion field to SolRecoveryOptions interface to support pre-resolved route threading. - Add unit tests for MPCv2 signed native SOL and SPL token consolidation, single-detection assertion, unsigned cold path regression, and MPCv1 signed consolidation regression. Ticket: WCI-496 Session-Id: 71c94edb-c9b3-41bf-9ddb-e895b1efb51a Task-Id: 1e1b82e3-1575-4f53-b072-ce133a0dce65
fd91225 to
f40fe4c
Compare
What
recoverConsolidationsviaEDDSAUtils.isEddsaMpcV1SigningMaterialinstead of per-iteration keycard decryption inrecover()deriveUnhardenedMpsinstead ofMPC.deriveUnhardened, preventing funds from being swept to an inaccessible addressmultisigTypeVersion: 'MPCv2' as constinto eachrecover()call sorecover()short-circuitsisMpcv2SigningMaterialand skips redundant detection on every loop iterationmultisigTypeVersion?: 'MPCv2'toSolRecoveryOptionsinterface to support pre-resolved route threadingWhy
recoverConsolidationswould have its funds swept to an address derived via legacyMPC.deriveUnhardened— the wrong address for MPCv2, making the funds unrecoverable without a separate recovery operationrecover()(decrypting the same keycard N times across the scan loop) is wasteful and slow for wallets scanning many indexesTest plan
yarn run unit-test --scope @bitgo/sdk-coin-sol— all 606 tests passeslint src/sol.ts test/unit/sol.ts— 0 errorsTicket: WCI-496