feat: add external signer support for ECDSA and EdDSA TSS key generation#9128
feat: add external signer support for ECDSA and EdDSA TSS key generation#9128danielpeng1 wants to merge 1 commit into
Conversation
|
@claude review this; verify that the |
|
Claude finished @danielpeng1's task —— View job Code Review: External Signer Support for TSS Key GenerationCompleted comprehensive review of the external signer implementation for MPC/TSS wallet generation. This is a well-architected feature that adds callback-based key generation while maintaining backward compatibility. Todo List:
Review SummaryOverall Assessment: ✅ Approved - This is a well-implemented, non-breaking feature that successfully adds external signer support for TSS wallet generation. Key Strengths
Implementation QualityECDSA MPCv2 Implementation (
EdDSA Implementation (
Wallet Entry Point (
|
| params.walletVersion !== undefined && | ||
| !(params.walletVersion === 3 || params.walletVersion === 5 || params.walletVersion === 6) | ||
| ) { | ||
| throw new Error('EVM TSS wallets are only supported for wallet version 3, 5 and 6'); |
There was a problem hiding this comment.
the EVM guard allows version 3 but EVM coins are ECDSA, so any EVM wallet with version 3 always hits the rejection below. should the EVM guard be walletVersion === 5 || walletVersion === 6 only?
| backupToBitgoKeyShare: ExternalSignerKeyShare; | ||
| userState: ExternalSignerMpcState; | ||
| backupState: ExternalSignerMpcState; | ||
| backupCounterPartyKeyShare: ExternalSignerKeyShare; |
There was a problem hiding this comment.
nit: reads as 'backup's counterparty share' rather than 'the share backup provides to user.' backupToUserCounterPartyKeyShare would clarify direction.
|
|
||
| export type EddsaKeyGenFinalizeResult = { | ||
| commonKeychain: string; | ||
| counterpartyKeyShare?: ExternalSignerKeyShare; |
There was a problem hiding this comment.
nit: optional in the type but required when source is 'user'. no type-level indication of when it's required vs. omittable.
| send.firstCall.args[0].type.should.equal('advanced'); | ||
| }); | ||
|
|
||
| it('should default EVM walletVersion to 5 when TSS settings specify MPCv2', async function () { |
There was a problem hiding this comment.
nit: the three integration-style tests here repeat the full callback stub setup. moving to beforeEach would cut ~80 lines.
Add external-signer callback support for MPC/TSS wallet generation, in particular enabling
advanced-walletsto delegate DKG orchestration to the SDK.createKeychainsWithExternalSignerruns the full DKG in four steps; handles init, round 2, round 3, and finalize; the SDK talks to BitGo between each step (same flow as AWM today).createKeychainsWithExternalSignerruns init, then finalize for user, then finalize for backup — user finalize must pass a counterparty share to backup finalize (same as AWM’sv1.mpc.key.*API).generateWalletWithExternalSignernow supports TSS; it picks ECDSA vs EdDSA from the coin and creates the wallet end-to-end (keychains +/wallet/add).EcdsaMPCv2KeyGenCallbacks,EddsaKeyGenCallbacks, etc.).createKeychainCallback, we treat it as on- chain even when the coin defaults to TSS; you can’t mix on- chain and MPC callbacks in one call.generateWalletand on-chain external signer are unchanged since the TSS path only runs when MPC callbacks are passed.Tests
ecdsaMPCv2.ts: callback ordering, round-response/state threading, common-keychain and session-ID mismatch rejectioneddsaExternalSigner.ts: sequential finalize order, counterparty context, missing share and common-keychain mismatch rejectionwalletsExternalSigner.ts: TSS routing and validation (missing callbacks, enterprise, custodial, EVM version, MPCv1 v3), on -chain-on- TSS-coin routing,type/walletVersionforwarding, mutual-exclusion of callback setsTicket: WCN-682