evtforward

package
v0.77.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2024 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultKeepHashesDuration = 24 * 2 * time.Hour
)

Variables

View Source
var (
	// ErrEvtAlreadyExist we have already handled this event.
	ErrEvtAlreadyExist = errors.New("event already exist")
	// ErrPubKeyNotAllowlisted this pubkey is not part of the allowlist.
	ErrPubKeyNotAllowlisted = errors.New("pubkey not allowlisted")
)

Functions

This section is empty.

Types

type Commander

type Commander interface {
	Command(ctx context.Context, cmd txn.Command, payload proto.Message, f func(string, error), bo *backoff.ExponentialBackOff)
	CommandSync(ctx context.Context, cmd txn.Command, payload proto.Message, f func(string, error), bo *backoff.ExponentialBackOff)
}

type Config

type Config struct {
	// Level specifies the logging level of the Event Forwarder engine.
	Level                                    encoding.LogLevel `long:"log-level"`
	RetryRate                                encoding.Duration `long:"retry-rate"`
	KeepHashesDurationForTestOnlyDoNotChange encoding.Duration
	// a list of allowlisted blockchain queue public keys
	BlockchainQueueAllowlist []string `description:" " long:"blockchain-queue-allowlist"`
	// Ethereum groups the configuration related to Ethereum implementation of
	// the Event Forwarder.
	Ethereum   ethereum.Config   `group:"Ethereum"   namespace:"ethereum"`
	EVMBridges []ethereum.Config `group:"EVMBridges" namespace:"evmbridges"`
	EthCall    ethcall.Config    `group:"EthCall"    namespace:"ethcall"`
}

Config represents governance specific configuration.

func NewDefaultConfig

func NewDefaultConfig() Config

NewDefaultConfig creates an instance of the package specific configuration.

type EVMEngine added in v0.77.0

type EVMEngine interface {
	VerifyHeartbeat(context context.Context, height uint64, chainID string, contract string, blockTime uint64) error
	UpdateStartingBlock(string, uint64)
}

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine(log *logging.Logger, config ethereum.Config) *Engine

func (*Engine) ReloadConf

func (e *Engine) ReloadConf(config ethereum.Config)

ReloadConf updates the internal configuration of the Event Forwarder engine.

func (*Engine) SetupEthereumEngine

func (e *Engine) SetupEthereumEngine(
	client ethereum.Client,
	forwarder ethereum.Forwarder,
	config ethereum.Config,
	ethCfg *types.EthereumConfig,
	assets ethereum.Assets,
) error

func (*Engine) SetupSecondaryEthereumEngine added in v0.76.0

func (e *Engine) SetupSecondaryEthereumEngine(
	client ethereum.Client,
	forwarder ethereum.Forwarder,
	config ethereum.Config,
	ethCfg *types.EVMChainConfig,
	assets ethereum.Assets,
) error

func (*Engine) Start

func (e *Engine) Start()

func (*Engine) Stop

func (e *Engine) Stop()

func (*Engine) UpdateCollateralStartingBlock added in v0.69.0

func (e *Engine) UpdateCollateralStartingBlock(b uint64)

func (*Engine) UpdateMultisigControlStartingBlock

func (e *Engine) UpdateMultisigControlStartingBlock(b uint64)

func (*Engine) UpdateStakingStartingBlock

func (e *Engine) UpdateStakingStartingBlock(b uint64)

func (*Engine) UpdateStartingBlock added in v0.77.0

func (e *Engine) UpdateStartingBlock(address string, block uint64)

func (*Engine) VerifyHeartbeat added in v0.77.0

func (e *Engine) VerifyHeartbeat(ctx context.Context, height uint64, chainID string, contract string, blockTime uint64) error

type Forwarder

type Forwarder struct {
	// contains filtered or unexported fields
}

Forwarder receive events from the blockchain queue and will try to send them to the vega chain. this will select a node in the network to forward the event.

func New

func New(log *logging.Logger,
	cfg Config,
	cmd Commander,
	timeService TimeService,
	top ValidatorTopology,
) *Forwarder

New creates a new instance of the event forwarder.

func (*Forwarder) Ack

func (f *Forwarder) Ack(evt *commandspb.ChainEvent) bool

Ack will return true if the event is newly acknowledged. If the event already exist and was already acknowledged, this will return false.

func (*Forwarder) Forward

func (f *Forwarder) Forward(ctx context.Context, evt *commandspb.ChainEvent, pubkey string) error

Forward will forward a ChainEvent to the tendermint network. We expect the pubkey to be an ed25519, hex encoded, key.

func (*Forwarder) ForwardFromSelf

func (f *Forwarder) ForwardFromSelf(evt *commandspb.ChainEvent)

ForwardFromSelf will forward event seen by the node itself, not from an external service like the eef for example.

func (*Forwarder) GetState

func (f *Forwarder) GetState(k string) ([]byte, []types.StateProvider, error)

func (*Forwarder) Keys

func (f *Forwarder) Keys() []string

func (*Forwarder) LoadState

func (f *Forwarder) LoadState(ctx context.Context, p *types.Payload) ([]types.StateProvider, error)

func (*Forwarder) Namespace

func (f *Forwarder) Namespace() types.SnapshotNamespace

func (*Forwarder) OnTick

func (f *Forwarder) OnTick(ctx context.Context, t time.Time)

func (*Forwarder) ReloadConf

func (f *Forwarder) ReloadConf(cfg Config)

ReloadConf updates the internal configuration of the Event Forwarder engine.

func (*Forwarder) Stopped

func (f *Forwarder) Stopped() bool

type NoopEngine

type NoopEngine struct {
	// contains filtered or unexported fields
}

NoopEngine can be use as a stub for the Engine. It does nothing.

func NewNoopEngine

func NewNoopEngine(log *logging.Logger, config ethereum.Config) *NoopEngine

func (*NoopEngine) ReloadConf

func (e *NoopEngine) ReloadConf(_ ethereum.Config)

func (*NoopEngine) SetupEthereumEngine

func (e *NoopEngine) SetupEthereumEngine(
	_ ethereum.Client,
	_ ethereum.Forwarder,
	_ ethereum.Config,
	_ *types.EthereumConfig,
	_ ethereum.Assets,
) error

func (*NoopEngine) SetupSecondaryEthereumEngine added in v0.76.0

func (e *NoopEngine) SetupSecondaryEthereumEngine(
	_ ethereum.Client,
	_ ethereum.Forwarder,
	_ ethereum.Config,
	_ *types.EVMChainConfig,
	_ ethereum.Assets,
) error

func (*NoopEngine) Start

func (e *NoopEngine) Start()

func (*NoopEngine) Stop

func (e *NoopEngine) Stop()

func (*NoopEngine) UpdateCollateralStartingBlock added in v0.69.0

func (e *NoopEngine) UpdateCollateralStartingBlock(b uint64)

func (*NoopEngine) UpdateMultisigControlStartingBlock

func (e *NoopEngine) UpdateMultisigControlStartingBlock(b uint64)

func (*NoopEngine) UpdateStakingStartingBlock

func (e *NoopEngine) UpdateStakingStartingBlock(b uint64)

func (*NoopEngine) UpdateStartingBlock added in v0.77.0

func (e *NoopEngine) UpdateStartingBlock(_ string, _ uint64)

func (*NoopEngine) VerifyHeartbeat added in v0.77.0

func (e *NoopEngine) VerifyHeartbeat(_ context.Context, _ uint64, _ string, _ string, _ uint64) error

type TimeService

type TimeService interface {
	GetTimeNow() time.Time
}

type Tracker added in v0.77.0

type Tracker struct {
	// contains filtered or unexported fields
}

func NewTracker added in v0.77.0

func NewTracker(log *logging.Logger, witness Witness, ts TimeService) *Tracker

func (*Tracker) GetState added in v0.77.0

func (t *Tracker) GetState(_ string) ([]byte, []types.StateProvider, error)

func (*Tracker) Keys added in v0.77.0

func (t *Tracker) Keys() []string

func (*Tracker) LoadState added in v0.77.0

func (t *Tracker) LoadState(ctx context.Context, payload *types.Payload) ([]types.StateProvider, error)

func (*Tracker) Namespace added in v0.77.0

func (t *Tracker) Namespace() types.SnapshotNamespace

func (*Tracker) OnStateLoaded added in v0.77.0

func (t *Tracker) OnStateLoaded(_ context.Context) error

func (*Tracker) OnTick added in v0.77.0

func (t *Tracker) OnTick(ctx context.Context, tt time.Time)

func (*Tracker) ProcessHeartbeat added in v0.77.0

func (t *Tracker) ProcessHeartbeat(address, chainID string, height uint64, blockTime uint64) error

func (*Tracker) RegisterForwarder added in v0.77.0

func (t *Tracker) RegisterForwarder(fwd EVMEngine, chainID string, addresses ...string)

func (*Tracker) Stopped added in v0.77.0

func (t *Tracker) Stopped() bool

func (*Tracker) UpdateContractBlock added in v0.77.0

func (t *Tracker) UpdateContractBlock(address, chainID string, height uint64)

UpdateContractBlock if an external engine has processed a chain-event for the contract at this address then the last-seen block for the contract is updated.

type ValidatorTopology

type ValidatorTopology interface {
	SelfNodeID() string
	AllNodeIDs() []string
}

type Witness added in v0.77.0

type Witness interface {
	StartCheck(validators.Resource, func(interface{}, bool), time.Time) error
	RestoreResource(validators.Resource, func(interface{}, bool)) error
}

Directories

Path Synopsis
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL