Skip to content

feat(sdk-lib-mpc): add executeTillRound handler util#8762

Merged
vibhavgo merged 1 commit into
masterfrom
WCI-386/eddsa-util-helper
May 14, 2026
Merged

feat(sdk-lib-mpc): add executeTillRound handler util#8762
vibhavgo merged 1 commit into
masterfrom
WCI-386/eddsa-util-helper

Conversation

@vibhavgo
Copy link
Copy Markdown
Contributor

@vibhavgo vibhavgo commented May 13, 2026

Description

Adds an executeTillRound orchestration utility for the EdDSA MPSv2 DSG protocol, mirroring DklsUtils.executeTillRound for ECDSA DKLS. Also exposes getPartyIdx and getOtherPartyIdx accessors on the DSG class to support index-free wiring inside the utility.

  • Add executeTillRound to modules/sdk-lib-mpc/src/tss/eddsa-mps/util.ts; accepts two un-initialized DSG instances plus key shares, message, and derivation path, calls initDsg internally using getPartyIdx(), and drives all 3 interactive rounds (WaitMsg1 -> WaitMsg2 -> WaitMsg3 -> Complete)
  • Return intermediate DeserializedMessages[] for rounds 1-2 and the final 64-byte Ed25519 signature Buffer for round 3
  • Add getPartyIdx() and getOtherPartyIdx() accessors to DSG class
  • Add unit tests in modules/sdk-lib-mpc/test/unit/tss/eddsa/eddsa-utils.ts covering executeTillRound: per-pair signatures across all three 2-of-3 party combinations (0+1, 0+2, 1+2), root-key signature verification via getCommonKeychain(), derived-path (m/0/0) key isolation check, intermediate round return-type assertions, and out-of-range round error handling
  • Migrate existing dsg.ts callers from the local runEdDsaDSG test helper to MPSUtil.executeTillRound and remove runEdDsaDSG from test/unit/tss/eddsa/util.ts
  • Add dsg.ts protocol test asserting wasm-mps rejects cross-message signing with the wrapped "round WaitMsg2: Protocol Error" failure

Issue Number

WCI-386

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Unit tests added in modules/sdk-lib-mpc/test/unit/tss/eddsa/eddsa-utils.ts under the executeTillRound describe block, plus a cross-message protocol test in dsg.ts. Tests cover:

  • Per-pair signature production for all three 2-of-3 party combinations (0+1, 0+2, 1+2), each verifying under the DKG public key
  • Round 3 returns a 64-byte signature that verifies under the root public key from getCommonKeychain()
  • Round 3 with derivation path m/0/0 produces a signature that does not verify under the root public key, confirming key derivation occurred
  • Rounds 1 and 2 return DeserializedMessages[][] and not a Buffer
  • Round values 0 and 4 throw Invalid round number
  • Cross-message signing fails at round WaitMsg2 with the wrapped "Protocol Error" from wasm-mps
  • Existing dsg.ts protocol, derivation-path, and session-management tests migrated to executeTillRound and continue to pass

Run with:
yarn run unit-test --scope @bitgo/sdk-lib-mpc -- -- --grep "executeTillRound"

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My code compiles correctly for both Node and Browser environments
  • I have commented my code, particularly in hard-to-understand areas
  • My commits follow Conventional Commits and I have properly described any BREAKING CHANGES
  • The ticket or github issue was included in the commit message as a reference
  • I have made corresponding changes to the documentation and on any new/updated functions and/or methods - jsdoc
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 13, 2026

WCI-386

@vibhavgo vibhavgo marked this pull request as ready for review May 13, 2026 09:31
@vibhavgo vibhavgo requested review from a team as code owners May 13, 2026 09:31
@vibhavgo vibhavgo requested review from mrdanish26 and ranga-r2 May 13, 2026 09:31
@Marzooqa Marzooqa self-requested a review May 13, 2026 13:58
Comment thread modules/sdk-lib-mpc/test/unit/tss/eddsa/dsg.ts Outdated
Comment thread modules/sdk-lib-mpc/test/unit/tss/eddsa/dsg.ts Outdated
Comment thread modules/sdk-lib-mpc/test/unit/tss/eddsa/dsg.ts Outdated
Comment thread modules/sdk-lib-mpc/test/unit/tss/eddsa/dsg.ts Outdated
Comment thread modules/sdk-lib-mpc/test/unit/tss/eddsa/dsg.ts Outdated
Adds an executeTillRound orchestration utility for the EdDSA MPSv2 DSG
protocol, mirroring DklsUtils.executeTillRound for ECDSA DKLS. Also
exposes getPartyIdx and getOtherPartyIdx accessors on the DSG class
to support index-free wiring inside the utility.

- Add executeTillRound to modules/sdk-lib-mpc/src/tss/eddsa-mps/util.ts;
  accepts two un-initialized DSG instances plus key shares, message, and
  derivation path, calls initDsg internally using getPartyIdx(), and
  drives all 3 interactive rounds (WaitMsg1 -> WaitMsg2 -> WaitMsg3 -> Complete)
- Return intermediate DeserializedMessages[][] for rounds 1-2 and the
  final 64-byte Ed25519 signature Buffer for round 3
- Add getPartyIdx() and getOtherPartyIdx() accessors to DSG class
- Add unit tests in modules/sdk-lib-mpc/test/unit/tss/eddsa/eddsa-utils.ts
  for executeTillRound: per-pair signatures across all three 2-of-3 party
  combinations (0+1, 0+2, 1+2), root-key verification via getCommonKeychain(),
  derived-path (m/0/0) key isolation check, intermediate round return-type
  assertions, and out-of-range round error handling
- Migrate existing dsg.ts callers from the local runEdDsaDSG test helper to
  MPSUtil.executeTillRound and remove runEdDsaDSG from test/unit/tss/eddsa/util.ts
- Add dsg.ts protocol test asserting wasm-mps rejects cross-message signing
  with the wrapped "round WaitMsg2: Protocol Error" failure

Ticket: WCI-386
@vibhavgo vibhavgo force-pushed the WCI-386/eddsa-util-helper branch from 7c3783d to 02a232a Compare May 13, 2026 17:39
@vibhavgo vibhavgo requested a review from Marzooqa May 13, 2026 17:53
Copy link
Copy Markdown
Contributor

@Marzooqa Marzooqa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation is correct, well-tested, and consistent with the ECDSA DKLS pattern. Two minor test-only nits as follow-ups — no public API impact.

Comment thread modules/sdk-lib-mpc/test/unit/tss/eddsa/eddsa-utils.ts
Comment thread modules/sdk-lib-mpc/test/unit/tss/eddsa/dsg.ts
@vibhavgo vibhavgo merged commit 2dba4cc into master May 14, 2026
25 checks passed
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.

2 participants