Skip to content

fix: verify EdDSA TSS transactions before signing - #9813

Merged
danielpeng1 merged 2 commits into
masterfrom
WCN-2113/eddsa-tss-verify-before-sign
Sep 29, 2026
Merged

danielpeng1 merged 2 commits into
masterfrom
WCN-2113/eddsa-tss-verify-before-sign

Conversation

@danielpeng1

@danielpeng1 danielpeng1 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Align EdDSA MPCv1 TSS transaction signing with other TSS drivers by verifying transactions locally before signing.

  • Call verifyTransaction in EdDSA MPCv1 signRequestBase via resolveEffectiveTxParams for tx requests
  • Apply the same check in signEddsaTssUsingExternalSigner (after deleteSignatureShares / tx resolve) and in Express createCommitmentShareFromTxRequest / createGShareFromTxRequest
  • Fail closed when verifyTxParams is set but prebuild lacks usable bytes; verify TSS tx requests by id and sign the same resolved request via resolvedTxRequestForSigning
  • Pass verifyTxParams / buildParams into the external-signer path for intent-aware verification

Tests:

  • EdDSA MPCv1 signTxRequest guard tests (intent recipients, malicious empty intent, deactivate allowlist)
  • signEddsaTssUsingExternalSigner guard test (rejects before external callbacks)
  • Wallet signTransaction test when verifyTxParams cannot run
  • Updated signTxRequest fixtures/stubs for verification

TICKET: WCN-2113

@danielpeng1 danielpeng1 self-assigned this Sep 24, 2026
@linear-code

linear-code Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

WCN-2113

@danielpeng1
danielpeng1 force-pushed the WCN-2113/eddsa-tss-verify-before-sign branch from 3cdb8f0 to 3f0cd37 Compare September 24, 2026 19:19
@danielpeng1
danielpeng1 force-pushed the WCN-2113/eddsa-tss-verify-before-sign branch from 3f0cd37 to c88d36d Compare September 24, 2026 19:30
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Unit tests are failing on Node 26.x (Current release line, non-blocking). This is not an LTS version yet, so it does not block merge, but it signals an incompatibility to fix before Node 26.x becomes LTS.

View run

@danielpeng1

Copy link
Copy Markdown
Contributor Author

@claude review

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @danielpeng1's task —— View job


Code Review for EdDSA TSS Verification PR

Todo List:

  • Read and analyze all changed files
  • Review core implementation in wallet.ts and eddsa.ts
  • Analyze test coverage and quality
  • Check for security, performance, and code quality issues
  • Provide comprehensive review feedback

Summary

This PR successfully implements EdDSA MPCv1 TSS transaction verification to align with other TSS drivers. The implementation adds verifyTransaction calls in both the wallet signing path and EdDSA signing utilities, with appropriate test coverage. The approach is sound and maintains backward compatibility.

Key Implementation Analysis

✅ Core Changes

modules/sdk-core/src/bitgo/wallet/wallet.ts (lines 2391-2426)

  • Enhances signTransaction to support TSS verification via verifyTxParams
  • Properly handles both onchain (txHex) and TSS (txRequestId) verification paths
  • Implements fail-closed behavior with clear error messages
  • Adds resolvedTxRequestForSigning to avoid TOCTOU issues

modules/sdk-core/src/bitgo/utils/tss/eddsa/eddsa.ts (lines 770-777)

  • Adds verification in signRequestBase for transaction requests
  • Uses resolveEffectiveTxParams for proper parameter resolution
  • Maintains existing message signing flow without verification

✅ Test Coverage

The test additions are comprehensive:

  • Guard tests for malicious empty intents and recipient verification
  • Verification failure scenarios for missing txHex/txRequestId
  • Intent recipient validation using resolveEffectiveTxParams
  • Allowlisted intent types (deactivate) that don't require recipients

Security & Design Review

✅ Security Strengths

  1. Fail-closed approach: Throws clear errors when verification cannot proceed
  2. TOCTOU mitigation: Uses resolvedTxRequestForSigning to sign the same txRequest that was verified
  3. Input validation: Proper checks for required transaction components
  4. Comprehensive verification: Covers both wallet-level and TSS utility-level signing

✅ Code Quality

  1. Clear error messages: InvalidTransactionError with descriptive text
  2. Proper type safety: Uses type guards and assertions appropriately
  3. Consistent patterns: Follows existing verification patterns in other TSS drivers
  4. Clean separation: Verification logic is well-isolated from signing logic

⚠️ Minor Considerations

  1. Error handling consistency: The wallet path throws InvalidTransactionError while EdDSA utils may throw assertion errors. Consider standardizing error types for consistency.

  2. Performance: The TSS path now requires an additional getTxRequest call for verification. This is acceptable for security but worth noting for performance-sensitive applications.

  3. Test data quality: The updated test fixtures use real Solana transaction data, which improves test realism but increases maintenance if the format changes.

Specific Code Comments

wallet.ts:2404-2409 - Good implementation of fail-closed verification:

} else {
  throw new InvalidTransactionError(
    'verifyTxParams was provided but txPrebuild does not include txHex or a TSS txRequestId.'
  );
}

eddsa.ts:772-777 - Proper integration with existing verification infrastructure:

await this.baseCoin.verifyTransaction({
  txPrebuild: { txHex: unsignedTx.serializedTxHex ?? unsignedTx.signableHex },
  txParams: resolveEffectiveTxParams(txRequestResolved, txParams, this.baseCoin.getChain()),
  wallet: this.wallet,
  walletType: this.wallet.multisigType(),
});

Test Quality Assessment

The test additions demonstrate thorough edge case coverage:

  • Tests verify guard behavior against malicious transactions
  • Validates proper parameter resolution through resolveEffectiveTxParams
  • Ensures allowlisted intent types work correctly
  • Confirms verification is called with expected parameters

Overall Assessment

This is a well-implemented security enhancement that successfully aligns EdDSA MPCv1 TSS with other TSS drivers. The implementation is secure, maintainable, and properly tested. The fail-closed approach and TOCTOU mitigation demonstrate good security engineering practices.

Recommendation: ✅ Approve - This PR enhances security without breaking existing functionality and follows established patterns in the codebase.


Job Run | Branch: WCN-2113/eddsa-tss-verify-before-sign

@danielpeng1
danielpeng1 marked this pull request as ready for review September 24, 2026 19:58
@danielpeng1
danielpeng1 requested review from a team as code owners September 24, 2026 19:58
Comment thread modules/sdk-core/src/bitgo/wallet/wallet.ts
@danielpeng1
danielpeng1 force-pushed the WCN-2113/eddsa-tss-verify-before-sign branch from 898c39b to a65ebf6 Compare September 24, 2026 21:27
@danielpeng1
danielpeng1 force-pushed the WCN-2113/eddsa-tss-verify-before-sign branch from a65ebf6 to a402a27 Compare September 25, 2026 20:05
@danielpeng1
danielpeng1 merged commit fe1a6c8 into master Sep 29, 2026
27 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.

3 participants