evtforward

package
v0.73.0-preview.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

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"`
	// 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"`
	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 Engine

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

func NewEngine

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

func (*Engine) ReloadConf

func (e *Engine) ReloadConf(config 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) 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)

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(_ 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 Config) *NoopEngine

func (*NoopEngine) ReloadConf

func (e *NoopEngine) ReloadConf(_ Config)

func (*NoopEngine) SetupEthereumEngine

func (e *NoopEngine) SetupEthereumEngine(
	_ ethereum.Client,
	_ ethereum.Forwarder,
	_ ethereum.Config,
	_ *types.EthereumConfig,
	_ 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)

type TimeService

type TimeService interface {
	GetTimeNow() time.Time
}

type ValidatorTopology

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

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