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:
parent
b231667aba
commit
b876c9dfba
|
|
@ -595,12 +595,17 @@ func executeSign(
|
||||||
sortedPartyIDs := tss.SortPartyIDs(tssPartyIDs)
|
sortedPartyIDs := tss.SortPartyIDs(tssPartyIDs)
|
||||||
|
|
||||||
// Create peer context and parameters
|
// Create peer context and parameters
|
||||||
// For co-managed signing: user says "3-of-5" meaning 3 signers needed
|
// For signing, the first parameter to NewParameters must be the number of parties
|
||||||
// tss-lib threshold parameter t means t+1 signers required
|
// actually participating in the signing (len(sortedPartyIDs)), NOT the original keygen N.
|
||||||
// So we pass thresholdT-1 to get the correct number of signers
|
// The threshold parameter is the minimum signers minus 1 (tss-lib convention: t means t+1 required)
|
||||||
// Example: user wants 3 signers -> pass threshold=2 -> tss-lib needs 2+1=3 signers
|
//
|
||||||
|
// 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)
|
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
|
// Create channels
|
||||||
outCh := make(chan tss.Message, thresholdT*10)
|
outCh := make(chan tss.Message, thresholdT*10)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue