fix(co-sign): use actual signer count instead of keygen N in NewParameters

The tss.NewParameters() expects the party count to match the number of
parties in peerCtx. For signing, this should be len(sortedPartyIDs)
(actual signing participants), not thresholdN (original keygen parties).

This fixes the "U doesn't equal T" error in round 9 when doing 3-of-5
co-managed signing with parties at indices 2,3,4.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-31 09:06:59 -08:00
parent b231667aba
commit b876c9dfba
1 changed files with 10 additions and 5 deletions

View File

@ -595,12 +595,17 @@ func executeSign(
sortedPartyIDs := tss.SortPartyIDs(tssPartyIDs)
// Create peer context and parameters
// For co-managed signing: user says "3-of-5" meaning 3 signers needed
// tss-lib threshold parameter t means t+1 signers required
// So we pass thresholdT-1 to get the correct number of signers
// Example: user wants 3 signers -> pass threshold=2 -> tss-lib needs 2+1=3 signers
// For signing, the first parameter to NewParameters must be the number of parties
// actually participating in the signing (len(sortedPartyIDs)), NOT the original keygen N.
// The threshold parameter is the minimum signers minus 1 (tss-lib convention: t means t+1 required)
//
// For co-managed signing with 3-of-5:
// - thresholdN = 5 (original keygen parties) - NOT used here
// - thresholdT = 3 (signers needed)
// - len(sortedPartyIDs) = 3 (actual signing participants)
// - threshold param = thresholdT - 1 = 2 (tss-lib needs 2+1=3 signers)
peerCtx := tss.NewPeerContext(sortedPartyIDs)
params := tss.NewParameters(tss.S256(), peerCtx, selfTSSID, thresholdN, thresholdT-1)
params := tss.NewParameters(tss.S256(), peerCtx, selfTSSID, len(sortedPartyIDs), thresholdT-1)
// Create channels
outCh := make(chan tss.Message, thresholdT*10)