Documentation
¶
Index ¶
- Constants
- type ChainClient
- type ChainStore
- func (cs *ChainStore) DeleteCompletedEvents(updatedBefore interface{}) (int64, error)
- func (cs *ChainStore) DeleteTerminalEvents(updatedBefore interface{}) (int64, error)
- func (cs *ChainStore) GetChainHeight() (uint64, error)
- func (cs *ChainStore) GetConfirmedEvents(limit int) ([]store.Event, error)
- func (cs *ChainStore) GetExpiredEvents(currentBlock uint64, limit int) ([]store.Event, error)
- func (cs *ChainStore) GetPendingEvents(limit int) ([]store.Event, error)
- func (cs *ChainStore) InsertEventIfNotExists(event *store.Event) (bool, error)
- func (cs *ChainStore) UpdateChainHeight(blockHeight uint64) error
- func (cs *ChainStore) UpdateEventStatus(eventID string, oldStatus, newStatus string) (int64, error)
- func (cs *ChainStore) UpdateVoteTxHash(eventID string, voteTxHash string) error
- type EventCleaner
- type EventProcessor
- type OutboundEvent
- type OutboundTxBuilder
- type UnSignedOutboundTxReq
- type UniversalTx
Constants ¶
const ( EventTypeKeygen = "KEYGEN" EventTypeKeyrefresh = "KEYREFRESH" EventTypeQuorumChange = "QUORUM_CHANGE" EventTypeSign = "SIGN" EventTypeInbound = "INBOUND" EventTypeOutbound = "OUTBOUND" )
Event type enum values for event classification. These constants define the types of events that can be processed.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainClient ¶
type ChainClient interface {
// Start initializes and starts the chain client
Start(ctx context.Context) error
// Stop gracefully shuts down the chain client
Stop() error
// IsHealthy checks if the chain client is operational
IsHealthy() bool
// GetTxBuilder returns the OutboundTxBuilder for this chain
// Returns an error if txBuilder is not supported for this chain (e.g., Push chain)
GetTxBuilder() (OutboundTxBuilder, error)
}
ChainClient defines the interface for chain-specific implementations
type ChainStore ¶ added in v0.0.13
type ChainStore struct {
// contains filtered or unexported fields
}
ChainStore provides database operations for chain state and events
func NewChainStore ¶ added in v0.0.13
func NewChainStore(database *db.DB) *ChainStore
NewChainStore creates a new chain store
func (*ChainStore) DeleteCompletedEvents ¶ added in v0.0.13
func (cs *ChainStore) DeleteCompletedEvents(updatedBefore interface{}) (int64, error)
DeleteCompletedEvents deletes completed events updated before the given time
func (*ChainStore) DeleteTerminalEvents ¶ added in v0.0.13
func (cs *ChainStore) DeleteTerminalEvents(updatedBefore interface{}) (int64, error)
DeleteTerminalEvents deletes events in terminal states (COMPLETED, REVERTED, EXPIRED) that were updated before the given time
func (*ChainStore) GetChainHeight ¶ added in v0.0.13
func (cs *ChainStore) GetChainHeight() (uint64, error)
GetChainHeight returns the last processed block height for the chain Creates a new entry with height 0 if it doesn't exist
func (*ChainStore) GetConfirmedEvents ¶ added in v0.0.13
func (cs *ChainStore) GetConfirmedEvents(limit int) ([]store.Event, error)
GetConfirmedEvents fetches confirmed events ordered by creation time
func (*ChainStore) GetExpiredEvents ¶ added in v0.0.13
GetExpiredEvents returns events that have expired (expiry_block_height <= currentBlock) and are still in a non-terminal state (PENDING, CONFIRMED, BROADCASTED, IN_PROGRESS)
func (*ChainStore) GetPendingEvents ¶ added in v0.0.13
func (cs *ChainStore) GetPendingEvents(limit int) ([]store.Event, error)
GetPendingEvents fetches pending events ordered by creation time
func (*ChainStore) InsertEventIfNotExists ¶ added in v0.0.13
func (cs *ChainStore) InsertEventIfNotExists(event *store.Event) (bool, error)
InsertEventIfNotExists inserts an event if it doesn't already exist (by EventID) Returns (true, nil) if a new event was inserted, (false, nil) if it already existed, or (false, error) if insertion failed
func (*ChainStore) UpdateChainHeight ¶ added in v0.0.13
func (cs *ChainStore) UpdateChainHeight(blockHeight uint64) error
UpdateChainHeight updates the last processed block height for the chain Creates a new entry if it doesn't exist
func (*ChainStore) UpdateEventStatus ¶ added in v0.0.13
func (cs *ChainStore) UpdateEventStatus(eventID string, oldStatus, newStatus string) (int64, error)
UpdateEventStatus updates the status of an event by event ID
func (*ChainStore) UpdateVoteTxHash ¶ added in v0.0.13
func (cs *ChainStore) UpdateVoteTxHash(eventID string, voteTxHash string) error
UpdateVoteTxHash updates the vote_tx_hash field for an event
type EventCleaner ¶ added in v0.0.13
type EventCleaner struct {
// contains filtered or unexported fields
}
EventCleaner handles periodic cleanup of old confirmed events for a chain
func NewEventCleaner ¶ added in v0.0.13
func NewEventCleaner( database *db.DB, cleanupInterval time.Duration, retentionPeriod time.Duration, chainID string, logger zerolog.Logger, ) *EventCleaner
NewEventCleaner creates a new event cleaner for a chain
func (*EventCleaner) Start ¶ added in v0.0.13
func (ec *EventCleaner) Start(ctx context.Context) error
Start begins the periodic cleanup process
func (*EventCleaner) Stop ¶ added in v0.0.13
func (ec *EventCleaner) Stop()
Stop gracefully stops the event cleaner
type EventProcessor ¶ added in v0.0.13
type EventProcessor struct {
// contains filtered or unexported fields
}
EventProcessor processes events from the chain's database and votes on them
func NewEventProcessor ¶ added in v0.0.13
func NewEventProcessor( signer *pushsigner.Signer, database *db.DB, chainID string, logger zerolog.Logger, ) *EventProcessor
NewEventProcessor creates a new event processor
func (*EventProcessor) IsRunning ¶ added in v0.0.13
func (ep *EventProcessor) IsRunning() bool
IsRunning returns whether the processor is currently running
func (*EventProcessor) Start ¶ added in v0.0.13
func (ep *EventProcessor) Start(ctx context.Context) error
Start begins processing events
func (*EventProcessor) Stop ¶ added in v0.0.13
func (ep *EventProcessor) Stop() error
Stop gracefully stops the event processor
type OutboundEvent ¶ added in v0.0.13
type OutboundEvent struct {
TxID string `json:"tx_id"` // bytes32 hex-encoded (0x...)
UniversalTxID string `json:"universal_tx_id"` // bytes32 hex-encoded (0x...)
}
OutboundEvent represents an outbound observation event from the gateway contract Event structure: - txID at 1st indexed position (bytes32) - universalTxID at 2nd indexed position (bytes32)
type OutboundTxBuilder ¶ added in v0.0.13
type OutboundTxBuilder interface {
// GetOutboundSigningRequest creates a signing request from outbound event data
// signerAddress is the address that will sign the transaction (TSS address) - used to fetch nonce
GetOutboundSigningRequest(ctx context.Context, data *uetypes.OutboundCreatedEvent, gasPrice *big.Int, signerAddress string) (*UnSignedOutboundTxReq, error)
// BroadcastOutboundSigningRequest assembles and broadcasts a signed transaction from the signing request, event data, and signature
BroadcastOutboundSigningRequest(ctx context.Context, req *UnSignedOutboundTxReq, data *uetypes.OutboundCreatedEvent, signature []byte) (string, error)
}
OutboundTxBuilder builds and broadcasts transactions for outbound transfers
type UnSignedOutboundTxReq ¶ added in v0.0.13
type UnSignedOutboundTxReq struct {
SigningHash []byte // Hash to be signed by TSS
Signer string // TSS Address | evm - used for nonce calculation | svm - unused
Nonce uint64 // evm - TSS Address nonce | svm - PDA nonce
GasPrice *big.Int // evm - Gas price used | svm - Prioritization fee
}
UnSignedOutboundTxReq contains the request for signing an outbound transaction
type UniversalTx ¶
type UniversalTx struct {
SourceChain string `json:"sourceChain"`
LogIndex uint `json:"logIndex"`
Sender string `json:"sender"`
Recipient string `json:"recipient"`
Token string `json:"bridgeToken"`
Amount string `json:"bridgeAmount"` // uint256 as decimal string
Payload uetypes.UniversalPayload `json:"universalPayload"`
VerificationData string `json:"verificationData"`
RevertFundRecipient string `json:"revertFundRecipient,omitempty"`
RevertMsg string `json:"revertMsg,omitempty"` // hex-encoded bytes (0x…)
TxType uint `json:"txType"` // enum backing uint as decimal string
}
UniversalTx Payload