From b876c9dfba7776286eebcc6bd5cb9e3bdbfe19ce Mon Sep 17 00:00:00 2001 From: hailin Date: Wed, 31 Dec 2025 09:06:59 -0800 Subject: [PATCH] fix(co-sign): use actual signer count instead of keygen N in NewParameters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../services/service-party-app/tss-party/main.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/backend/mpc-system/services/service-party-app/tss-party/main.go b/backend/mpc-system/services/service-party-app/tss-party/main.go index a03618b7..287fb233 100644 --- a/backend/mpc-system/services/service-party-app/tss-party/main.go +++ b/backend/mpc-system/services/service-party-app/tss-party/main.go @@ -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)