fix(co-sign): allow signing sessions with t participants instead of n
- Modify ValidateSessionCreation to differentiate between keygen and sign sessions - For keygen: require participantCount == threshold.N() (all parties must participate) - For sign: require participantCount == threshold.T() (only t parties needed) - This fixes "session is full" error when creating signing session with 3 parties but n=5 🤖 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
042212eae6
commit
2a95dd107f
|
|
@ -27,9 +27,23 @@ func (s *SessionCoordinatorService) ValidateSessionCreation(
|
|||
return entities.ErrInvalidSessionType
|
||||
}
|
||||
|
||||
// Allow either exact participant count (pre-registered) or 0 (dynamic joining)
|
||||
if participantCount != 0 && participantCount != threshold.N() {
|
||||
return entities.ErrSessionFull
|
||||
// Validate participant count based on session type
|
||||
// For keygen: all n parties must participate (participantCount == n or 0 for dynamic)
|
||||
// For sign: only t parties participate (participantCount == t or 0 for dynamic)
|
||||
if participantCount != 0 {
|
||||
if sessionType == entities.SessionTypeSign {
|
||||
// Signing session: participant count should equal threshold t
|
||||
// (the minimum number of parties needed to sign)
|
||||
if participantCount != threshold.T() {
|
||||
return entities.ErrSessionFull
|
||||
}
|
||||
} else {
|
||||
// Keygen session: participant count should equal threshold n
|
||||
// (all parties must participate in key generation)
|
||||
if participantCount != threshold.N() {
|
||||
return entities.ErrSessionFull
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if sessionType == entities.SessionTypeSign && len(messageHash) == 0 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue