fix(sdk-core): route EdDSA MPCv2 hot wallets to full apiVersion#8720
Open
bitgo-ai-agent-dev[bot] wants to merge 1 commit intomasterfrom
Open
fix(sdk-core): route EdDSA MPCv2 hot wallets to full apiVersion#8720bitgo-ai-agent-dev[bot] wants to merge 1 commit intomasterfrom
bitgo-ai-agent-dev[bot] wants to merge 1 commit intomasterfrom
Conversation
2b3c88b to
d62a9e9
Compare
- getTxRequestApiVersion: add || wallet.multisigTypeVersion() === 'MPCv2' to the 'full' branch so EdDSA MPCv2 hot wallets are not incorrectly routed to 'lite', which causes signRequestBase to fail with "Missing signableHex in unsignedTx" at runtime. - validateTxRequestApiVersion: merge ECDSA and MPCv2 check so that passing apiVersion: 'lite' on any MPCv2 wallet throws immediately. - baseTSSUtils.supportedTxRequestVersions: return ['full'] (not ['lite', 'full']) for EdDSA MPCv2 hot wallets; v1 hot wallets unchanged. - Tests: add multisigTypeVersion to all txRequest wallet stubs; add two new cases (MPCv2 throws on 'lite', MPCv2 defaults to 'full'); add EddsaMPCv2Utils.supportedTxRequestVersions test for MPCv2 hot wallet returning ['full']. Ticket: WCI-156 Session-Id: ac2678cb-270b-48ab-851f-7787f697cba9 Task-Id: 77a26d69-dcc5-43cf-b339-dace5e08c890
d62a9e9 to
7bf0b12
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes 3 gaps that prevent the hot-wallet EdDSA MPCv2 signing flow (
sendCoins→signTransactionTss→EddsaMPCv2Utils.signTxRequest) from working correctly. All changes are inmodules/sdk-core.1.
getTxRequestApiVersion(txRequest.ts)EdDSA MPCv2 hot wallets were falling through to the
wallet.type() === 'hot'branch and getting'lite'.EddsaMPCv2Utils.signRequestBaserequiresapiVersion: 'full'to accesstxRequest.transactions[0].unsignedTx; the'lite'response omits that field, causing an assertion failure. Fix: add|| wallet.multisigTypeVersion() === 'MPCv2'to the existing ECDSA'full'branch.2.
validateTxRequestApiVersion(txRequest.ts)A caller explicitly passing
apiVersion: 'lite'on an EdDSA MPCv2 wallet received no validation error, silently propagating the wrong version. Fix: merge ECDSA and MPCv2 into a single guard that asserts'full'for both, with an updated error message.3.
supportedTxRequestVersions(baseTSSUtils.ts)The EdDSA hot-wallet branch returned
['lite', 'full']regardless of MPCv2 version. EdDSA MPCv2 only supports'full'. Fix: checkmultisigTypeVersion() === 'MPCv2'and return['full']; v1 hot wallets are unchanged.Tests
modules/sdk-core/test/unit/bitgo/utils/txRequest.ts: addedmultisigTypeVersionto all wallet stubs; new cases for MPCv2+hot+'lite'→ throws and MPCv2+hot+undefined→'full'; updated EdDSA v1 stub with explicitmultisigTypeVersion: () => undefined.modules/bitgo/test/v2/unit/internal/tssUtils/eddsa.ts: new testEddsaMPCv2Utils.supportedTxRequestVersionsreturns['full']for MPCv2 hot wallet; updated v1 hot wallet test with explicitmultisigTypeVersion: undefined.What does NOT change
wallet.tsconstructor,signTransactionTssrouting,signMessageTss,getUserPrvAsync,sendSignatureShareV2— all already correct for EdDSA MPCv2.Ticket: WCI-156