evm

package
v2.7.1-mercury-20231108 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: MIT Imports: 65 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConfigSet Common to all OCR2 evm based contracts: https://github.com/smartcontractkit/libocr/blob/master/contract2/dev/OCR2Abstract.sol
	ConfigSet common.Hash
)
View Source
var ErrCorruptEVMChain = errors.New("corrupt evm chain")
View Source
var ErrNoChains = errors.New("no EVM chains loaded")

ErrNoChains indicates that no EVM chains have been started

Functions

func AccountToAddress

func AccountToAddress(accounts []types.Account) (addresses []common.Address, err error)

func FilterNamesFromRelayArgs

func FilterNamesFromRelayArgs(args relaytypes.RelayArgs) (filterNames []string, err error)

func IsLaterThan

func IsLaterThan(incoming gethTypes.Log, existing gethTypes.Log) bool

IsLaterThan returns true if the first log was emitted "after" the second log from the blockchain's point of view

func NewConfigPoller

func NewConfigPoller(lggr logger.Logger, client client.Client, destChainPoller logpoller.LogPoller, aggregatorContractAddr common.Address, configStoreAddr *common.Address) (evmRelayTypes.ConfigPoller, error)

func NewKeepersOCR3ContractTransmitter added in v2.5.0

func NewKeepersOCR3ContractTransmitter(ocr2ContractTransmitter ocrtypes.ContractTransmitter) *ocr3keeperProviderContractTransmitter

func NewLegacyChainsFromRelayerExtenders added in v2.5.0

func NewLegacyChainsFromRelayerExtenders(exts EVMChainRelayerExtenderSlicer) *evmchain.LegacyChains

func NewMercuryProvider

func NewMercuryProvider(
	configWatcher *configWatcher,
	transmitter mercury.Transmitter,
	reportCodecV1 relaymercuryv1.ReportCodec,
	reportCodecV2 relaymercuryv2.ReportCodec,
	reportCodecV3 relaymercuryv3.ReportCodec,
	lggr logger.Logger,
) *mercuryProvider

func NewOCRContractTransmitter

func NewOCRContractTransmitter(
	address gethcommon.Address,
	caller contractReader,
	contractABI abi.ABI,
	transmitter Transmitter,
	lp logpoller.LogPoller,
	lggr logger.Logger,
	reportToEvmTxMeta ReportToEthMetadata,
) (*contractTransmitter, error)

func NewRoundRequestedDB

func NewRoundRequestedDB(sqldb *sql.DB, oracleSpecID int32, lggr logger.Logger) *requestRoundDB

NewDB returns a new DB scoped to this oracleSpecID

func OnchainPublicKeyToAddress

func OnchainPublicKeyToAddress(publicKeys []types.OnchainPublicKey) (addresses []common.Address, err error)

Types

type CSAETHKeystore added in v2.5.0

type CSAETHKeystore interface {
	CSA() keystore.CSA
	Eth() keystore.Eth
}

type ChainRelayerExt added in v2.5.0

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

implements OneChain

func (*ChainRelayerExt) Chain added in v2.5.0

func (s *ChainRelayerExt) Chain() evmchain.Chain

func (*ChainRelayerExt) Close added in v2.5.0

func (s *ChainRelayerExt) Close() (err error)

func (*ChainRelayerExt) GetChainStatus added in v2.6.0

func (s *ChainRelayerExt) GetChainStatus(ctx context.Context) (relaytypes.ChainStatus, error)

func (*ChainRelayerExt) HealthReport added in v2.5.0

func (s *ChainRelayerExt) HealthReport() map[string]error

func (*ChainRelayerExt) ID added in v2.6.0

func (s *ChainRelayerExt) ID() string

func (*ChainRelayerExt) ListNodeStatuses added in v2.6.0

func (s *ChainRelayerExt) ListNodeStatuses(ctx context.Context, pageSize int32, pageToken string) (stats []relaytypes.NodeStatus, nextPageToken string, total int, err error)

func (*ChainRelayerExt) Name added in v2.5.0

func (s *ChainRelayerExt) Name() string

func (*ChainRelayerExt) Ready added in v2.5.0

func (s *ChainRelayerExt) Ready() (err error)

func (*ChainRelayerExt) Start added in v2.5.0

func (s *ChainRelayerExt) Start(ctx context.Context) error

func (*ChainRelayerExt) Transact added in v2.6.0

func (s *ChainRelayerExt) Transact(ctx context.Context, from, to string, amount *big.Int, balanceCheck bool) error

type ChainRelayerExtenders added in v2.5.0

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

func NewChainRelayerExtenders added in v2.5.0

func NewChainRelayerExtenders(ctx context.Context, opts evmchain.ChainRelayExtenderConfig) (*ChainRelayerExtenders, error)

func (*ChainRelayerExtenders) AppConfig added in v2.5.0

func (c *ChainRelayerExtenders) AppConfig() evmchain.AppConfig

func (*ChainRelayerExtenders) Len added in v2.5.0

func (c *ChainRelayerExtenders) Len() int

func (*ChainRelayerExtenders) Slice added in v2.5.0

type ContractTransmitter

type ContractTransmitter interface {
	services.ServiceCtx
	ocrtypes.ContractTransmitter
}

type DKGProvider

type DKGProvider interface {
	relaytypes.Plugin
}

DKGProvider provides all components needed for a DKG plugin.

type EVMChainRelayerExtender added in v2.5.0

type EVMChainRelayerExtender interface {
	loop.RelayerExt
	Chain() evmchain.Chain
}

type EVMChainRelayerExtenderSlicer added in v2.5.0

type EVMChainRelayerExtenderSlicer interface {
	Slice() []EVMChainRelayerExtender
	Len() int
	AppConfig() evmchain.AppConfig
}

type LoopRelayAdapter added in v2.5.0

type LoopRelayAdapter interface {
	loop.Relayer
	Chain() evm.Chain
}

type LoopRelayer added in v2.5.0

type LoopRelayer struct {
	loop.Relayer
	// contains filtered or unexported fields
}

func NewLoopRelayServerAdapter added in v2.6.0

func NewLoopRelayServerAdapter(r *Relayer, cs EVMChainRelayerExtender) *LoopRelayer

func (*LoopRelayer) Chain added in v2.5.0

func (la *LoopRelayer) Chain() evm.Chain

type OCR2KeeperProvider

type OCR2KeeperProvider interface {
	relaytypes.Plugin
}

OCR2KeeperProvider provides all components needed for a OCR2Keeper plugin.

type OCR2KeeperProviderOpts

type OCR2KeeperProviderOpts struct {
	RArgs      relaytypes.RelayArgs
	PArgs      relaytypes.PluginArgs
	InstanceID int
}

OCR2KeeperProviderOpts is the custom options to create a keeper provider

type OCR2KeeperRelayer

type OCR2KeeperRelayer interface {
	NewOCR2KeeperProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (OCR2KeeperProvider, error)
}

OCR2KeeperRelayer contains the relayer and instantiating functions for OCR2Keeper providers.

func NewOCR2KeeperRelayer

func NewOCR2KeeperRelayer(db *sqlx.DB, chain evm.Chain, pr pipeline.Runner, spec job.Job, lggr logger.Logger) OCR2KeeperRelayer

NewOCR2KeeperRelayer is the constructor of ocr2keeperRelayer

type OCR2VRFProvider

type OCR2VRFProvider interface {
	relaytypes.Plugin
}

OCR2VRFProvider provides all components needed for a OCR2VRF plugin.

type OCR2VRFRelayer

type OCR2VRFRelayer interface {
	NewDKGProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (DKGProvider, error)
	NewOCR2VRFProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (OCR2VRFProvider, error)
}

OCR2VRFRelayer contains the relayer and instantiating functions for OCR2VRF providers.

func NewOCR2VRFRelayer

func NewOCR2VRFRelayer(db *sqlx.DB, chain evm.Chain, lggr logger.Logger, ethKeystore keystore.Eth) OCR2VRFRelayer

type Relayer

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

func NewRelayer

func NewRelayer(lggr logger.Logger, chain evm.Chain, opts RelayerOpts) (*Relayer, error)

func (*Relayer) Close

func (r *Relayer) Close() error

func (*Relayer) HealthReport

func (r *Relayer) HealthReport() (report map[string]error)

func (*Relayer) Name

func (r *Relayer) Name() string

func (*Relayer) NewConfigProvider

func (r *Relayer) NewConfigProvider(args relaytypes.RelayArgs) (relaytypes.ConfigProvider, error)

func (*Relayer) NewFunctionsProvider added in v2.5.0

func (r *Relayer) NewFunctionsProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.FunctionsProvider, error)

func (*Relayer) NewMedianProvider

func (r *Relayer) NewMedianProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.MedianProvider, error)

func (*Relayer) NewMercuryProvider

func (r *Relayer) NewMercuryProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.MercuryProvider, error)

func (*Relayer) Ready

func (r *Relayer) Ready() error

Ready does noop: always ready

func (*Relayer) Start

func (r *Relayer) Start(context.Context) error

Start does noop: no subservices started on relay start, but when the first job is started

type RelayerOpts added in v2.6.0

type RelayerOpts struct {
	*sqlx.DB
	pg.QConfig
	CSAETHKeystore
	pg.EventBroadcaster
}

func (RelayerOpts) Validate added in v2.6.0

func (c RelayerOpts) Validate() error

type ReportToEthMetadata added in v2.1.0

type ReportToEthMetadata func([]byte) (*txmgr.TxMeta, error)

type RequestRoundDB

type RequestRoundDB interface {
	SaveLatestRoundRequested(tx pg.Queryer, rr ocr2aggregator.OCR2AggregatorRoundRequested) error
	LoadLatestRoundRequested() (rr ocr2aggregator.OCR2AggregatorRoundRequested, err error)
}

RequestRoundDB stores requested rounds for querying by the median plugin.

type RequestRoundTracker

type RequestRoundTracker struct {
	services.StateMachine
	// contains filtered or unexported fields
}

RequestRoundTracker subscribes to new request round logs.

func NewRequestRoundTracker

func NewRequestRoundTracker(
	contract *offchain_aggregator_wrapper.OffchainAggregator,
	contractFilterer *ocr2aggregator.OCR2AggregatorFilterer,
	ethClient evmclient.Client,
	logBroadcaster log.Broadcaster,
	jobID int32,
	lggr logger.Logger,
	db *sqlx.DB,
	odb RequestRoundDB,
	chain ocrcommon.Config,
	qConfig pg.QConfig,
) (o *RequestRoundTracker)

NewRequestRoundTracker makes a new RequestRoundTracker

func (*RequestRoundTracker) Close

func (t *RequestRoundTracker) Close() error

Close should be called after teardown of the OCR job relying on this tracker

func (*RequestRoundTracker) HandleLog

func (t *RequestRoundTracker) HandleLog(lb log.Broadcast)

HandleLog complies with LogListener interface It is not thread safe

func (*RequestRoundTracker) IsV2Job

func (t *RequestRoundTracker) IsV2Job() bool

IsV2Job complies with LogListener interface

func (*RequestRoundTracker) JobID

func (t *RequestRoundTracker) JobID() int32

JobID complies with LogListener interface

func (*RequestRoundTracker) LatestRoundRequested

func (t *RequestRoundTracker) LatestRoundRequested(_ context.Context, lookback time.Duration) (configDigest ocrtypes.ConfigDigest, epoch uint32, round uint8, err error)

LatestRoundRequested returns the configDigest, epoch, and round from the latest RoundRequested event emitted by the contract. LatestRoundRequested may or may not return a result if the latest such event was emitted in a block b such that b.timestamp < tip.timestamp - lookback.

If no event is found, LatestRoundRequested should return zero values, not an error. An error should only be returned if an actual error occurred during execution, e.g. because there was an error querying the blockchain or the database.

As an optimization, this function may also return zero values, if no RoundRequested event has been emitted after the latest NewTransmission event.

func (*RequestRoundTracker) Start

func (t *RequestRoundTracker) Start() error

Start must be called before logs can be delivered It ought to be called before starting OCR

type Transmitter

type Transmitter interface {
	CreateEthTransaction(ctx context.Context, toAddress gethcommon.Address, payload []byte, txMeta *txmgr.TxMeta) error
	FromAddress() gethcommon.Address
}

Jump to

Keyboard shortcuts

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