feat(sdk-coin-polyx): add MPCv2 signed hot recovery - #9483
feat(sdk-coin-polyx): add MPCv2 signed hot recovery#9483ralph-bitgo[bot] wants to merge 1 commit into
Conversation
2f801bc to
dc26b6c
Compare
16e2240 to
edbf701
Compare
edbf701 to
88f5e93
Compare
Phase 1 — Summary
Changed files: 2 (+154 / -44)
flowchart TD
A["recover()"] --> B{isUnsignedSweep?}
B -- yes --> C[return unsigned tx]
B -- no --> D[assert userKey / backupKey / walletPassphrase]
D --> E["getEddsaSigningMaterial(userKey, passphrase)"]
E --> F{signingMaterial.version}
F -- v2 --> G["signSubstrateMpcV2Recovery()"]
G --> H["addSignature([0x00] + rawSig)"]
F -- v1 --> I["bitgo.decrypt(backupKey)"]
I --> J["EDDSAMethods.getTSSSignature()"]
J --> K["addSignature(signatureHex)"]
H --> L["txBuilder.build()"]
K --> L
Phase 2 — Ticket AlignmentTicket: WCI-1228 PR title ( Phase 3 — Index AnalysisNo new database queries introduced. Phase 4 — Type SafetyScanned all added lines (
Test stub uses the correct safe pattern: Phase 5 — MPCv2 Correctness & Test QualityCorrectness
Test Quality
Consistency vs DOT (PR #9484 as canonical reference)
Summary of ❌ /
|
88f5e93 to
ce5c0c3
Compare
Detect CBOR (MPCv2) vs JSON (MPCv1) keycards in Polyx.recover() using the shared getEddsaSigningMaterial/signSubstrateMpcV2Recovery helpers from SubstrateCoin. Fixes missing 0x00 Ed25519 discriminant prefix on MPCv2 signatures. Uses assert() for guards in newly introduced recovery code. Ticket: WCI-1228
ce5c0c3 to
fb53e52
Compare
What
isMpcv2SigningMaterial()andaddRecoverySignature()private methods toPolyxinmodules/sdk-coin-polyx/src/polyx.ts.Polyx.recover()now detects once whether the keycard is MPCv1 (JSON) or MPCv2 (CBOR) and dispatches signing accordingly, reusing the sharedgetEddsaSigningMaterial/signEddsaMpcV2RecoveryTxhelpers from@bitgo/sdk-core(extracted in WCI-1276). No new params — detection is automatic, and the existing MPCv1 / unsigned-sweep behavior is unchanged.bitgoKeyvs keycardcommonKeyChainthrows, and guard-clause/error-path coverage for missinguserKey/backupKey/walletPassphraseand decrypt failures.Why
POLYX wallets are migrating from the Zengo to the Silence Labs EdDSA MPCv2 implementation, but
Polyx.recover()only understood the legacy MPCv1 JSON keycard format — customers with MPCv2 keycards could not perform hot wallet recovery. This mirrors the MPCv2 recovery support already shipped for SOL (WCI-398) and TON (WCI-1225), reusing the shared sdk-core helpers instead of duplicating the signing logic, per WCI-1228.Test plan
yarn unit-test --scope @bitgo/sdk-coin-polyx— 259 passing, 2 pending, 0 failingnix develop . --command npx lerna run build --scope @bitgo/sdk-coin-polyx --include-dependencies— builds cleaneslinton changed files — no errorsTicket: WCI-1228