Documentation
¶
Index ¶
- Constants
- func CalculateThreshold(numParticipants int) int
- type Coordinator
- func (c *Coordinator) GetCurrentTSSKey(ctx context.Context) (string, string, error)
- func (c *Coordinator) GetEligibleUV(protocolType string) []*types.UniversalValidator
- func (c *Coordinator) GetLatestBlockNum(ctx context.Context) (uint64, error)
- func (c *Coordinator) GetMultiAddrsFromPeerID(ctx context.Context, peerID string) ([]string, error)
- func (c *Coordinator) GetPartyIDFromPeerID(ctx context.Context, peerID string) (string, error)
- func (c *Coordinator) GetPeerIDFromPartyID(ctx context.Context, partyID string) (string, error)
- func (c *Coordinator) GetTSSAddress(ctx context.Context) (string, error)
- func (c *Coordinator) HandleACK(ctx context.Context, senderPeerID string, eventID string) error
- func (c *Coordinator) IsPeerCoordinator(ctx context.Context, peerID string) (bool, error)
- func (c *Coordinator) Start(ctx context.Context)
- func (c *Coordinator) Stop()
- type Message
- type ProtocolType
- type SendFunc
Constants ¶
const ( // PerChainCap is the max in-flight SIGN events per destination chain (default 16; below EVM mempool accountqueue 64). PerChainCap = 16 // ConsecutiveWaitThreshold: after this many consecutive polls where a chain has in-flight events, // use finalized nonce to recover from stuck nonces (~200s at 10s poll). ConsecutiveWaitThreshold = 20 )
Variables ¶
This section is empty.
Functions ¶
func CalculateThreshold ¶
CalculateThreshold calculates the threshold as > 2/3 of participants. Formula: threshold = floor((2 * n) / 3) + 1 This ensures threshold > 2/3 * n
Types ¶
type Coordinator ¶
type Coordinator struct {
// contains filtered or unexported fields
}
Coordinator handles coordinator logic for TSS events.
func NewCoordinator ¶
func NewCoordinator( eventStore *eventstore.Store, pushCore *pushcore.Client, keyshareManager *keyshare.Manager, chains *chains.Chains, validatorAddress string, coordinatorRange uint64, pollInterval time.Duration, send SendFunc, logger zerolog.Logger, ) *Coordinator
NewCoordinator creates a new coordinator.
func (*Coordinator) GetCurrentTSSKey ¶ added in v0.0.13
GetCurrentTSSKey gets the current TSS key ID and public key from pushCore.
func (*Coordinator) GetEligibleUV ¶
func (c *Coordinator) GetEligibleUV(protocolType string) []*types.UniversalValidator
GetEligibleUV returns ALL eligible validators for the given protocol type (no random selection). Used by the session manager to check whether a setup-message sender is eligible to participate. For SIGN coordinator setup the coordinator calls getSignParticipants (random threshold subset).
func (*Coordinator) GetLatestBlockNum ¶
func (c *Coordinator) GetLatestBlockNum(ctx context.Context) (uint64, error)
GetLatestBlockNum gets the latest block number from pushCore.
func (*Coordinator) GetMultiAddrsFromPeerID ¶
GetMultiAddrsFromPeerID gets the multiaddrs for a given peerID. Uses cached allValidators for performance.
func (*Coordinator) GetPartyIDFromPeerID ¶
GetPartyIDFromPeerID gets the partyID (validator address) for a given peerID. Uses cached allValidators for performance.
func (*Coordinator) GetPeerIDFromPartyID ¶
GetPeerIDFromPartyID gets the peerID for a given partyID (validator address). Uses cached allValidators for performance.
func (*Coordinator) GetTSSAddress ¶ added in v0.0.13
func (c *Coordinator) GetTSSAddress(ctx context.Context) (string, error)
GetTSSAddress returns the TSS ECDSA address derived from the current TSS public key (compressed secp256k1).
func (*Coordinator) HandleACK ¶
HandleACK processes an ACK message from a participant. This is called by the session manager when coordinator receives an ACK.
func (*Coordinator) IsPeerCoordinator ¶
IsPeerCoordinator reports whether the given peerID is the coordinator for the current block. Used by the session manager to validate that an incoming setup message comes from the coordinator.
func (*Coordinator) Start ¶
func (c *Coordinator) Start(ctx context.Context)
Start starts the coordinator loop.
type Message ¶
type Message struct {
Type string `json:"type"` // "setup", "ack", "begin", "step"
EventID string `json:"eventId"`
Payload []byte `json:"payload"`
Participants []string `json:"participants"` // Array of PartyIDs (validator addresses) participating in this process
// UnSignedOutboundTxReq is included for SIGN protocol setup messages.
// Participants use this to verify the signing hash before proceeding.
UnSignedOutboundTxReq *common.UnSignedOutboundTxReq `json:"unsigned_outbound_tx_req,omitempty"`
}
Message represents a simple message with type, eventId, payload, and participants.
type ProtocolType ¶
type ProtocolType string
ProtocolType enumerates the supported DKLS protocol flows.
const ( ProtocolKeygen ProtocolType = "KEYGEN" ProtocolKeyrefresh ProtocolType = "KEYREFRESH" ProtocolQuorumChange ProtocolType = "QUORUM_CHANGE" ProtocolSign ProtocolType = "SIGN" )