Skip to content

feat(sdk-coin-near): support MPCv2 consolidation recovery - #9560

Closed
Marzooqa wants to merge 1 commit into
masterfrom
marzooqakather498/wci-1233-sdk-coin-near-mpcv2-recoverconsolidations-sdk-hot-path
Closed

feat(sdk-coin-near): support MPCv2 consolidation recovery#9560
Marzooqa wants to merge 1 commit into
masterfrom
marzooqakather498/wci-1233-sdk-coin-near-mpcv2-recoverconsolidations-sdk-hot-path

Conversation

@Marzooqa

Copy link
Copy Markdown
Contributor

What

  • Detect MPCv2 signing material once before NEAR consolidation scans, mirroring the precomputedMaterial pattern used by IOTA/DOT/SUI (WCI-1235, WCI-1236, WCI-1234).
  • recover() and recoverNearToken() accept an optional precomputedMaterial and thread it into signRecoveryTransaction(), which reuses it instead of re-detecting the keycard version when supplied.
  • recoverConsolidations() detects signing material once before the scan loop and passes it into each recover() call.

Why

  • MPCv2 signed consolidations must sweep to the correct base address without decrypting the keycard once per scanned receive index.
  • Covers the SDK hot signed path only (caller passes walletPassphrase), per ticket scope. WRW always strips walletPassphrase, so WRW consolidation is unaffected. Near.recover() MPCv2 support itself is already in place (WCI-1223).

Test plan

  • MPCv2 signed NEAR consolidation across two funded indexes — sweeps to the MPCv2-derived base address
  • MPCv2 unsigned consolidation (no passphrase) — cold path unchanged
  • getEddsaSigningMaterial called exactly once regardless of scan range (spy assertion)
  • MPCv1 regression — base address and signing unchanged
  • yarn unit-test (171 passing), tsc --noEmit, eslint all clean

TICKET: WCI-1233

🤖 Generated with Claude Code

Add MPCv2 signed hot recovery support to recoverConsolidations(), following
the same precomputedMaterial pattern used by IOTA/DOT/SUI:

- recover() accepts an optional precomputedMaterial param and threads it
  through recoverNearToken()/signRecoveryTransaction() instead of
  re-detecting the keycard version per call
- signRecoveryTransaction() reuses precomputedMaterial when supplied,
  otherwise detects the keycard version once via getEddsaSigningMaterial()
- recoverConsolidations() detects signing material once before the scan
  loop and passes it into each recover() call, avoiding re-decryption per
  index; base address (index 0) is derived once via the shared
  EDDSAMethods.getInitializedMpcInstance() derivation used elsewhere
- Add MPCv2 consolidation test coverage (signed sweep across two funded
  indexes, unsigned cold sweep, detection called exactly once) plus an
  MPCv1 regression test

This covers the SDK hot signed path only, per ticket scope; WRW always
strips walletPassphrase so WRW consolidation is unaffected.

TICKET: WCI-1233
@linear-code

linear-code Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

WCI-1233

@Marzooqa

Copy link
Copy Markdown
Contributor Author

Closing: this ticket assumes Near.recoverConsolidations() already exists (following the SOL/WCI-496 pattern), but it does not exist in sdk-coin-near yet. Wiring in MPCv2 support meant building the base recoverConsolidations() method from scratch, which is a larger scope than the ticket describes. Not proceeding with this PR as-is.

@Marzooqa Marzooqa closed this Aug 25, 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