fix(proto): add party_index to JoinSessionResponse for correct index assignment

The JoinSessionResponse from coordinator was missing party_index field,
causing message router to try finding self's index in OtherParties (which
only contains other parties). This resulted in incorrect party index
assignment leading to "duplicate indexes" error in TSS keygen.

Changes:
- Add party_index field to coordinator's JoinSessionResponse proto
- Coordinator now includes PartyIndex in gRPC response
- Message router uses party_index from coordinator instead of searching

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-06 00:08:47 -08:00
parent b51d5687b2
commit 78119bc6a4
3 changed files with 6 additions and 4 deletions

View File

@ -82,6 +82,7 @@ message JoinSessionResponse {
bool success = 1;
SessionInfo session_info = 2;
repeated PartyInfo other_parties = 3;
int32 party_index = 4; // This party's assigned index
}
// SessionInfo contains session information

View File

@ -518,6 +518,9 @@ func (s *MessageRouterServer) JoinSession(
}
}
// Use party_index directly from coordinator response
resp.PartyIndex = coordResp.PartyIndex
if len(coordResp.OtherParties) > 0 {
resp.OtherParties = make([]*pb.PartyInfo, len(coordResp.OtherParties))
for i, p := range coordResp.OtherParties {
@ -525,16 +528,13 @@ func (s *MessageRouterServer) JoinSession(
PartyId: p.PartyId,
PartyIndex: p.PartyIndex,
}
// Find this party's index
if p.PartyId == req.PartyId {
resp.PartyIndex = p.PartyIndex
}
}
}
logger.Info("Proxied JoinSession to coordinator",
zap.String("session_id", req.SessionId),
zap.String("party_id", req.PartyId),
zap.Int32("party_index", resp.PartyIndex),
zap.Bool("success", resp.Success))
return resp, nil

View File

@ -251,6 +251,7 @@ func (s *SessionCoordinatorServer) JoinSession(
Status: output.SessionInfo.Status,
},
OtherParties: otherParties,
PartyIndex: int32(output.PartyIndex),
}, nil
}