Documentation ¶
Index ¶
- Variables
- type Assets
- type Client
- type Config
- type Contract
- type Engine
- func (e *Engine) ReloadConf(cfg Config)
- func (e *Engine) Start()
- func (e *Engine) Stop()
- func (e *Engine) UpdateCollateralStartingBlock(b uint64)
- func (e *Engine) UpdateMultiSigControlStartingBlock(b uint64)
- func (e *Engine) UpdateStakingStartingBlock(b uint64)
- func (e *Engine) UpdateStartingBlock(address string, block uint64)
- func (e *Engine) VerifyHeartbeat(ctx context.Context, height uint64, chainID string, address string, ...) error
- type Filterer
- type Forwarder
- type LogFilterer
- func (f *LogFilterer) CurrentHeight(ctx context.Context) uint64
- func (f *LogFilterer) FilterCollateralEvents(ctx context.Context, startAt, stopAt uint64, cb OnEventFound)
- func (f *LogFilterer) FilterMultisigControlEvents(ctx context.Context, startAt, stopAt uint64, cb OnEventFound)
- func (f *LogFilterer) FilterStakingEvents(ctx context.Context, startAt, stopAt uint64, cb OnEventFound)
- func (f *LogFilterer) FilterVestingEvents(ctx context.Context, startAt, stopAt uint64, cb OnEventFound)
- func (f *LogFilterer) GetEthTime(ctx context.Context, atBlock uint64) (uint64, error)
- func (f *LogFilterer) VerifyClient(ctx context.Context) error
- type OnEventFound
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidHeartbeat = errors.New("forwarded heartbeat is invalid")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Level specifies the logging level of the Ethereum implementation of the // Event Forwarder. Level encoding.LogLevel `long:"log-level"` MaxEthereumBlocks uint64 `long:"max-ethereum-blocks"` PollEventRetryDuration encoding.Duration ChainID string SkipClientVerification bool HeartbeatIntervalForTestOnlyDoNotChange encoding.Duration }
func NewDefaultConfig ¶ added in v0.55.0
func NewDefaultConfig() Config
type Contract ¶ added in v0.77.0
type Contract struct { types.EthereumContract // contains filtered or unexported fields }
Contract wrapper around EthereumContract to keep track of the block heights we've checked.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func NewEngine ¶
func NewEngine( cfg Config, log *logging.Logger, filterer Filterer, forwarder Forwarder, stakingDeployment types.EthereumContract, vestingDeployment types.EthereumContract, multiSigDeployment types.EthereumContract, collateralDeployment types.EthereumContract, chainID string, blockTime time.Duration, ) *Engine
func (*Engine) ReloadConf ¶
func (*Engine) Start ¶
func (e *Engine) Start()
Start starts the polling of the Ethereum bridges, listens to the events they emit and forward it to the network.
func (*Engine) Stop ¶
func (e *Engine) Stop()
Stop stops the engine, its polling and event forwarding.
func (*Engine) UpdateCollateralStartingBlock ¶ added in v0.69.0
func (*Engine) UpdateMultiSigControlStartingBlock ¶
func (*Engine) UpdateStakingStartingBlock ¶
func (*Engine) UpdateStartingBlock ¶ added in v0.77.0
UpdateStartingBlock sets the height that we should starting looking for new events from for the given bridge contract address.
func (*Engine) VerifyHeartbeat ¶ added in v0.77.0
func (e *Engine) VerifyHeartbeat(ctx context.Context, height uint64, chainID string, address string, blockTime uint64) error
VerifyHeart checks that the block height of the heartbeat exists and contains the correct block time. It also checks that this node has checked the logs of the given contract address up to at least the given height.
type Filterer ¶
type Filterer interface { FilterCollateralEvents(ctx context.Context, startAt, stopAt uint64, cb OnEventFound) FilterStakingEvents(ctx context.Context, startAt, stopAt uint64, cb OnEventFound) FilterVestingEvents(ctx context.Context, startAt, stopAt uint64, cb OnEventFound) FilterMultisigControlEvents(ctx context.Context, startAt, stopAt uint64, cb OnEventFound) CurrentHeight(context.Context) uint64 GetEthTime(ctx context.Context, atBlock uint64) (uint64, error) }
type Forwarder ¶
type Forwarder interface {
ForwardFromSelf(*commandspb.ChainEvent)
}
type LogFilterer ¶
type LogFilterer struct {
// contains filtered or unexported fields
}
LogFilterer wraps the Ethereum event filterers to return Vega events.
func NewLogFilterer ¶
func NewLogFilterer( cfg Config, log *logging.Logger, ethClient Client, collateralBridge types.EthereumContract, stakingBridge types.EthereumContract, vestingBridge types.EthereumContract, multiSigControl types.EthereumContract, assets Assets, chainID string, ) (*LogFilterer, error)
func (*LogFilterer) CurrentHeight ¶
func (f *LogFilterer) CurrentHeight(ctx context.Context) uint64
func (*LogFilterer) FilterCollateralEvents ¶
func (f *LogFilterer) FilterCollateralEvents(ctx context.Context, startAt, stopAt uint64, cb OnEventFound)
FilterCollateralEvents retrieves the events from the collateral bridge on Ethereum starting at startAt, transform them into ChainEvent, and pass it to the OnEventFound callback. The properties startAt and stopAt are inclusive.
func (*LogFilterer) FilterMultisigControlEvents ¶
func (f *LogFilterer) FilterMultisigControlEvents(ctx context.Context, startAt, stopAt uint64, cb OnEventFound)
func (*LogFilterer) FilterStakingEvents ¶
func (f *LogFilterer) FilterStakingEvents(ctx context.Context, startAt, stopAt uint64, cb OnEventFound)
FilterStakingEvents retrieves the events from the staking bridge on Ethereum starting at startAt, transform them into ChainEvent, and pass it to the OnEventFound callback. The properties startAt and stopAt are inclusive.
func (*LogFilterer) FilterVestingEvents ¶
func (f *LogFilterer) FilterVestingEvents(ctx context.Context, startAt, stopAt uint64, cb OnEventFound)
FilterVestingEvents retrieves the events from the vesting bridge on Ethereum starting at startAt, transform them into ChainEvent, and pass it to the OnEventFound callback. The properties startAt and stopAt are inclusive.
func (*LogFilterer) GetEthTime ¶ added in v0.77.0
func (*LogFilterer) VerifyClient ¶ added in v0.76.0
func (f *LogFilterer) VerifyClient(ctx context.Context) error
VerifyClient checks that the configured RPC node is able to properly query contract logs.
type OnEventFound ¶
type OnEventFound func(*commandspb.ChainEvent, uint64)