Documentation ¶
Index ¶
- Constants
- func MessageEventsForTransaction(ctx context.Context, ethConn connectors.Connector, contract eth_common.Address, ...) (uint64, []*common.MessagePublication, error)
- func PadAddress(address common.Address) vaa.Address
- type Block
- type Blocks
- type BlocksByTimestamp
- func (bts *BlocksByTimestamp) AddBatch(blocks Blocks)
- func (bts *BlocksByTimestamp) AddLatest(logger *zap.Logger, timestamp uint64, blockNum uint64)
- func (bts *BlocksByTimestamp) GetRange() (firstBlockNum, firstBlockTime, lastBlockNum, lastBlockTime uint64)
- func (bts *BlocksByTimestamp) LookUp(timestamp uint64) (uint64, uint64, bool)
- type EthCallDataIntf
- type EvmCallData
- type Watcher
- type WatcherConfig
- func (wc *WatcherConfig) Create(msgC chan<- *common.MessagePublication, ...) (interfaces.L1Finalizer, supervisor.Runnable, error)
- func (wc *WatcherConfig) GetChainID() vaa.ChainID
- func (wc *WatcherConfig) GetNetworkID() watchers.NetworkID
- func (wc *WatcherConfig) RequiredL1Finalizer() watchers.NetworkID
- func (wc *WatcherConfig) SetL1Finalizer(l1finalizer interfaces.L1Finalizer)
Constants ¶
const (
BTS_MAX_BLOCKS = 10000
)
const CCQ_BACKFILL_DELAY = 100 * time.Millisecond
const CCQ_MAX_BATCH_SIZE = int64(1000)
const CCQ_TIMESTAMP_RANGE_IN_SECONDS = uint64(30 * 60)
const MaxWaitConfirmations = 60
MaxWaitConfirmations is the maximum number of confirmations to wait before declaring a transaction abandoned.
Variables ¶
This section is empty.
Functions ¶
func MessageEventsForTransaction ¶
func MessageEventsForTransaction( ctx context.Context, ethConn connectors.Connector, contract eth_common.Address, chainId vaa.ChainID, tx eth_common.Hash) (uint64, []*common.MessagePublication, error)
MessageEventsForTransaction returns the lockup events for a given transaction. Returns the block number and a list of MessagePublication events.
Types ¶
type BlocksByTimestamp ¶
type BlocksByTimestamp struct {
// contains filtered or unexported fields
}
func NewBlocksByTimestamp ¶
func NewBlocksByTimestamp(maxCacheSize int, unsafeDevMode bool) *BlocksByTimestamp
NewBlocksByTimestamp creates an empty cache of blocks by timestamp.
func (*BlocksByTimestamp) AddBatch ¶
func (bts *BlocksByTimestamp) AddBatch(blocks Blocks)
AddBatch adds a batch of blocks to the cache. This is meant to be used for backfilling the cache. It makes sure there are no duplicate blocks and regenerates the cache in the correct order by timestamp.
func (*BlocksByTimestamp) AddLatest ¶
func (bts *BlocksByTimestamp) AddLatest(logger *zap.Logger, timestamp uint64, blockNum uint64)
AddLatest adds a block to the end of the cache. This is meant to be used in the normal scenario when a new latest block is received. If the specified timestamp or block number is less than the latest in the cache (most likely a rollback), the cache will be truncated and the new value inserted.
func (*BlocksByTimestamp) GetRange ¶
func (bts *BlocksByTimestamp) GetRange() (firstBlockNum, firstBlockTime, lastBlockNum, lastBlockTime uint64)
GetRange returns the range covered by the cache for debugging purposes.
func (*BlocksByTimestamp) LookUp ¶
func (bts *BlocksByTimestamp) LookUp(timestamp uint64) (uint64, uint64, bool)
LookUp searches the cache for the specified timestamp and returns the blocks surrounding that timestamp. It also returns true if the results are complete or false if they are not. The following rules apply: - If timestamp is less than the first timestamp in the cache, it returns (0, <theFirstBlockInTheCache>, false) - If timestamp is greater than or equal to the last timestamp in the cache, it returns (<theLastBlockInTheCache>, 0, false) - If timestamp exactly matches one in the cache, it returns (<theLastBlockForThatTimestamp>, <theFirstBlockForTheNextTimestamp>, true) - If timestamp is not in the cache, but there are blocks around it, it returns (<theLastBlockForThePreviousTimestamp>, <theFirstBlockForTheNextTimestamp>, false)
type EthCallDataIntf ¶
type EthCallDataIntf interface {
CallDataList() []*query.EthCallData
}
type EvmCallData ¶
type EvmCallData struct { To eth_common.Address Data string CallResult *eth_hexutil.Bytes // contains filtered or unexported fields }
EvmCallData contains the details of a single call in the batch.
func (EvmCallData) String ¶
func (ecd EvmCallData) String() string
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
func NewEthWatcher ¶
func NewEthWatcher( url string, contract eth_common.Address, networkName string, chainID vaa.ChainID, msgC chan<- *common.MessagePublication, setC chan<- *common.GuardianSet, obsvReqC <-chan *gossipv1.ObservationRequest, queryReqC <-chan *query.PerChainQueryInternal, queryResponseC chan<- *query.PerChainQueryResponseInternal, unsafeDevMode bool, ccqBackfillCache bool, ) *Watcher
func (*Watcher) GetLatestFinalizedBlockNumber ¶
GetLatestFinalizedBlockNumber() implements the L1Finalizer interface and allows other watchers to get the latest finalized block number from this watcher.
func (*Watcher) QueryHandler ¶
func (w *Watcher) QueryHandler(ctx context.Context, queryRequest *query.PerChainQueryInternal)
QueryHandler is the top-level query handler. It breaks out the requests based on the type and calls the appropriate handler.
func (*Watcher) SetL1Finalizer ¶
func (w *Watcher) SetL1Finalizer(l1Finalizer interfaces.L1Finalizer)
SetL1Finalizer is used to set the layer one finalizer.
type WatcherConfig ¶
type WatcherConfig struct { NetworkID watchers.NetworkID // human readable name ChainID vaa.ChainID // ChainID Rpc string // RPC URL Contract string // hex representation of the contract address GuardianSetUpdateChain bool // if `true`, we will retrieve the GuardianSet from this chain and watch this chain for GuardianSet updates L1FinalizerRequired watchers.NetworkID // (optional) CcqBackfillCache bool // contains filtered or unexported fields }
func (*WatcherConfig) Create ¶
func (wc *WatcherConfig) Create( msgC chan<- *common.MessagePublication, obsvReqC <-chan *gossipv1.ObservationRequest, queryReqC <-chan *query.PerChainQueryInternal, queryResponseC chan<- *query.PerChainQueryResponseInternal, setC chan<- *common.GuardianSet, env common.Environment, ) (interfaces.L1Finalizer, supervisor.Runnable, error)
func (*WatcherConfig) GetChainID ¶
func (wc *WatcherConfig) GetChainID() vaa.ChainID
func (*WatcherConfig) GetNetworkID ¶
func (wc *WatcherConfig) GetNetworkID() watchers.NetworkID
func (*WatcherConfig) RequiredL1Finalizer ¶
func (wc *WatcherConfig) RequiredL1Finalizer() watchers.NetworkID
func (*WatcherConfig) SetL1Finalizer ¶
func (wc *WatcherConfig) SetL1Finalizer(l1finalizer interfaces.L1Finalizer)