Skip to content

feat(sdk-lib-mpc): EddsaRetrofitData type + DKG retrofit constructor + getFirstMessage routing - #9481

Open
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
masterfrom
WCI-1261-EddsaRetrofitData-DKG-constructor
Open

feat(sdk-lib-mpc): EddsaRetrofitData type + DKG retrofit constructor + getFirstMessage routing#9481
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
masterfrom
WCI-1261-EddsaRetrofitData-DKG-constructor

Conversation

@bitgo-ai-agent-dev

@bitgo-ai-agent-dev bitgo-ai-agent-dev Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

What

  • Add optional `retrofitData?: EddsaRetrofitData` 4th parameter to the `DKG`
    constructor in `modules/sdk-lib-mpc/src/tss/eddsa-mps/dkg.ts`.
  • Store `retrofitData` as a private field on the instance.
  • In `getFirstMessage()`, branch on `this.retrofitData`: when set, call
    `wasm.ed25519_dkg_round0_import` with the party's clamped scalar,
    aggregate public key, and chain code; otherwise fall through to the
    existing `ed25519_dkg_round0_process` path.
  • Export `EddsaRetrofitData` as a named type from `eddsa-mps/index.ts` so
    callers can import it directly without going through the `MPSTypes` namespace.
  • Bump `@bitgo/wasm-mps` from `1.10.0` → `1.12.0` (exports
    `ed25519_dkg_round0_import` with a proper TypeScript signature — no
    `as any` cast needed) and update `yarn.lock` accordingly.
  • Extend `generateEdDsaDKGKeyShares` in `util.ts` to accept per-party
    `retrofitData` params and forward them to the `DKG` constructor.
  • Add three retrofit DKG tests in `test/unit/tss/eddsa/dkg.ts`:
    • routing test (all parties agree on public key after retrofit DKG)
    • differentiation test (retrofit vs fresh DKG produce distinct keys)
    • determinism test (same `retrofitData` inputs produce same public key)

Why

  • Parties migrating from MPCv1 (Zengo) to MPCv2 (Silence Labs MPS) already
    hold a valid EdDSA scalar (`pShare.u`). Generating fresh key material would
    produce a new public key, breaking wallet continuity.
  • `ed25519_dkg_round0_import` accepts the existing scalar and seeds a
    retrofit DKG ceremony that produces MPCv2 shares for the same aggregate
    public key, enabling transparent migration without user action.
  • Rounds 1 and 2 (`handleIncomingMessages`) are unchanged — both paths
    produce identical `dkgStateBytes` format, so no downstream code changes.

Test plan

  • `yarn workspace @bitgo/sdk-lib-mpc test` — all existing + new DKG tests pass.
  • TypeScript compiles cleanly in `modules/sdk-lib-mpc`.

Ticket: WCI-1261

@linear-code

linear-code Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

WCI-1261

@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from e79929c to 990112e Compare August 12, 2026 07:05
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from 990112e to 54a371c Compare August 12, 2026 07:22
@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from 54a371c to 045559a Compare August 12, 2026 07:22
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from 045559a to e94d057 Compare August 12, 2026 08:30
@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from e94d057 to cf3cb10 Compare August 12, 2026 08:31
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from cf3cb10 to b5193dd Compare August 12, 2026 10:53
@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from b5193dd to fdf95f7 Compare August 12, 2026 10:53
Base automatically changed from WCI-1263-getMpcV2RetrofitDataFromMpcV1Key-EdDSA to master August 13, 2026 06:24
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from fdf95f7 to d219ede Compare August 13, 2026 06:27
@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch 2 times, most recently from 8f72917 to 58ebac8 Compare August 13, 2026 06:49
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from 58ebac8 to 8d67c7c Compare August 13, 2026 07:24
@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch 2 times, most recently from 9ad91ef to 20b67fd Compare August 13, 2026 08:39
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from 20b67fd to 9ade6eb Compare August 13, 2026 10:16
@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from 9ade6eb to 61fb76a Compare August 13, 2026 10:16
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from 61fb76a to 20a5005 Compare August 13, 2026 12:21
…+ getFirstMessage routing

Add optional retrofitData parameter to the DKG constructor so parties
can seed a retrofit DKG ceremony from their existing MPCv1 scalar
instead of generating fresh key material.

- Import and store EddsaRetrofitData on the DKG class instance.
- Constructor gains a 4th optional param: retrofitData?: EddsaRetrofitData.
- getFirstMessage branches on this.retrofitData: when set it calls
  wasm.ed25519_dkg_round0_import passing the party's clamped scalar,
  aggregate public key, and chain code; otherwise falls through to the
  existing ed25519_dkg_round0_process path.
- Export EddsaRetrofitData as a named type from eddsa-mps/index.ts.
- Bump @bitgo/wasm-mps 1.11.0 -> 1.12.0 which exports
  ed25519_dkg_round0_import with a proper TypeScript signature.
- getSession/restoreSession now round-trip retrofitData so a
  persisted session correctly resumes the retrofit path.
- retrofitData is cleared after getFirstMessage consumes it to
  bound the lifetime of the private scalar.
- generateEdDsaDKGKeyShares in util.ts accepts per-party
  retrofitData params forwarded to the DKG constructor.
- Add retrofit DKG tests: routing, determinism, session persistence,
  and full end-to-end restore round-trip.

Ticket: WCI-1261
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from 20a5005 to 6117b6d Compare August 13, 2026 14:30
@Marzooqa
Marzooqa marked this pull request as ready for review August 13, 2026 15:59
@Marzooqa
Marzooqa requested review from a team as code owners August 13, 2026 15:59
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.

0 participants