Skip to content

feat(sdk-coin-sui): add MPCv2 signed hot recovery support - #9495

Closed
ralph-bitgo[bot] wants to merge 1 commit into
masterfrom
WCI-1234-sui-mpcv2-recover-consolidations-pt1
Closed

feat(sdk-coin-sui): add MPCv2 signed hot recovery support#9495
ralph-bitgo[bot] wants to merge 1 commit into
masterfrom
WCI-1234-sui-mpcv2-recover-consolidations-pt1

Conversation

@ralph-bitgo

@ralph-bitgo ralph-bitgo Bot commented Aug 13, 2026

Copy link
Copy Markdown

Stack

This PR is part 1 of 2 in a stack. Review and merge in order:

  1. feat(sdk-coin-sui): add MPCv2 signed hot recovery support #9495 — MPCv2 signed hot recovery in recover() (base: master) ← you are here
  2. feat(sdk-coin-sui): add MPCv2 support to recoverConsolidations #9496 — MPCv2 support in recoverConsolidations() (base: this branch)

What

  • Add getEddsaSigningMaterial/signSuiMpcV2Recovery protected helpers on Sui that detect keycard format (MPCv1 JSON vs MPCv2 CBOR) and dispatch signing accordingly.
  • signRecoveryTransaction() (used by both native SUI transfer and token recovery) now branches on signingMaterial.version: MPCv2 keycards route through signEddsaMpcV2RecoveryTx, with the raw 64-byte signature wrapped in SUI's existing 0x00-flag + signature + pubkey envelope before being attached to the transaction builder; MPCv1 keycards keep the existing EDDSAMethods.getTSSSignature flow.
  • Replace ad-hoc if (!x) throw guards with assert() per code-quality guidance in the ticket.

Why

MPCv2 hot wallets could not recover funds via WRW: Sui.recover() only understood the MPCv1 JSON keycard format and had no path for MPCv2 CBOR keycards. This mirrors the pattern already landed for DOT (WCI-1227) and unblocks WCI-1234 (recoverConsolidations() MPCv2 support), which depends on this dispatch existing in recover().

Test plan

  • Added MPCv2 unit tests for native transfer recovery (signature verified against derived pubkey via nacl.sign.detached.verify)
  • Added MPCv2 unit tests for token recovery (same signature verification)
  • Added regression test confirming MPCv1 keycards still route through getTSSSignature
  • Added test asserting a mismatched bitgoKey vs. keycard commonKeyChain throws
  • yarn unit-test passes (206/206) and yarn lint is clean

Ticket: WCI-1224

Detect keycard format (MPCv1 JSON vs MPCv2 CBOR) in Sui.recover() and its
private helpers (recoverSuiToken, signRecoveryTransaction) via the shared
getEddsaSigningMaterial helper, and dispatch MPCv2 keycards to
signEddsaMpcV2RecoveryTx instead of the MPCv1-only EDDSAMethods.getTSSSignature
path. The raw 64-byte signature is wrapped in SUI's existing 0x00-flag +
signature + pubkey envelope before being attached to the transaction builder,
so both native transfer and token recovery route through the same dispatch.

MPCv2 hot wallets could not recover funds via WRW: recover() only understood
the MPCv1 JSON keycard format and threw when handed an MPCv2 CBOR keycard.
This mirrors the pattern already landed for DOT (WCI-1227) and unblocks
WCI-1234 (recoverConsolidations MPCv2 support), which depends on this
dispatch existing in recover().

Ticket: WCI-1224
Session-Id: bf130f11-6bd0-4a91-88c6-a9138ecc96ab
Task-Id: 179247fb-4ff6-49f3-9849-df120620c98b
@linear-code

linear-code Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

WCI-1234

@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1234-sui-mpcv2-recover-consolidations-pt1 branch from e321956 to 0d0eb03 Compare August 13, 2026 12:19
@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1234-sui-mpcv2-recover-consolidations-pt1 branch from 0d0eb03 to fecc42c Compare August 13, 2026 12:19
@ralph-bitgo

ralph-bitgo Bot commented Aug 13, 2026

Copy link
Copy Markdown
Author

Closing as duplicate of #9493 — both implement MPCv2 signed hot recovery for WCI-1224. Keeping #9493 since it was opened first; rebasing the recoverConsolidations stack (#9496 / WCI-1234) onto that branch instead.

@ralph-bitgo ralph-bitgo Bot closed this Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant