Skip to content

refactor(abstract-substrate): extract MPCv2 helpers into SubstrateCoin - #9408

Open
vibhavgo wants to merge 1 commit into
masterfrom
feat/abstract-substrate/WCI-1239
Open

refactor(abstract-substrate): extract MPCv2 helpers into SubstrateCoin#9408
vibhavgo wants to merge 1 commit into
masterfrom
feat/abstract-substrate/WCI-1239

Conversation

@vibhavgo

@vibhavgo vibhavgo commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Extracts isMpcv2SigningMaterial() and addSubstrateRecoverySignature() as protected methods on SubstrateCoin so DOT (WCI-1227) and POLYX (WCI-1228) can call shared helpers rather than duplicating ~40 lines of identical MPCv2 signing logic.

Linear: WCI-1239

Changes

  • Add protected isMpcv2SigningMaterial() — detects MPCv2 vs MPCv1 keycard by inverting isEddsaMpcV1SigningMaterial
  • Add protected addSubstrateRecoverySignature() — dispatches MPCv1/MPCv2 signing; MPCv2 path prepends 0x00 Ed25519 discriminant required by Substrate MultiSignature enum
  • Refactor recover() to delegate to both helpers; MPCv1 path unchanged
  • Add unit tests in modules/abstract-substrate/test/unit/abstractSubstrateCoin.ts using Ttao as the concrete SubstrateCoin subclass

Test Plan

  • npx mocha in modules/abstract-substrate — 6 passing
  • yarn unit-test in modules/sdk-coin-tao — 91 passing, no regressions
  • yarn unit-test in modules/sdk-coin-polyx — 252 passing, no regressions

@linear-code

linear-code Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

WCI-1239

Add protected isMpcv2SigningMaterial() and addSubstrateRecoverySignature()
to SubstrateCoin so DOT and POLYX can call shared methods rather than
duplicating ~40 lines of identical MPCv2 signing logic. Refactors
recover() to delegate to these helpers; MPCv1 path unchanged.

Ticket: WCI-1239
@vibhavgo
vibhavgo force-pushed the feat/abstract-substrate/WCI-1239 branch from 3fbbf21 to 9c6f68e Compare August 4, 2026 10:48
@vibhavgo
vibhavgo marked this pull request as ready for review August 4, 2026 11:20
@vibhavgo
vibhavgo requested a review from a team as a code owner August 4, 2026 11:20
@vibhavgo
vibhavgo requested a review from Marzooqa August 4, 2026 11:21
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