evm

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OCRContractConfigSet = getEventTopic("ConfigSet")
)

Functions

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 NewContractDB

func NewContractDB(sqldb *sql.DB, oracleSpecID int32, lggr logger.Logger) *contractDB

NewDB returns a new DB scoped to this oracleSpecID

Types

type ContractTracker

type ContractTracker struct {
	utils.StartStopOnce
	// contains filtered or unexported fields
}

ContractTracker complies with ContractConfigTracker interface and handles log events related to the contract more generally

func NewOCRContractTracker

func NewOCRContractTracker(
	contract *offchain_aggregator_wrapper.OffchainAggregator,
	contractFilterer *ocr2aggregator.OCR2AggregatorFilterer,
	contractCaller *ocr2aggregator.OCR2AggregatorCaller,
	ethClient evmclient.Client,
	logBroadcaster log.Broadcaster,
	jobID int32,
	logger logger.Logger,
	db *sqlx.DB,
	odb OCRContractTrackerDB,
	chain ocrcommon.Config,
	headBroadcaster httypes.HeadBroadcaster,
) (o *ContractTracker)

NewOCRContractTracker makes a new ContractTracker

func (*ContractTracker) Close

func (t *ContractTracker) Close() error

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

func (*ContractTracker) Connect

func (t *ContractTracker) Connect(*evmtypes.Head) error

Connect conforms to HeadTrackable

func (*ContractTracker) HandleLog

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

HandleLog complies with LogListener interface It is not thread safe

func (*ContractTracker) IsV2Job

func (t *ContractTracker) IsV2Job() bool

IsV2Job complies with LogListener interface

func (*ContractTracker) JobID

func (t *ContractTracker) JobID() int32

JobID complies with LogListener interface

func (*ContractTracker) LatestBlockHeight

func (t *ContractTracker) LatestBlockHeight(ctx context.Context) (blockheight uint64, err error)

LatestBlockHeight queries the eth node for the most recent header

func (*ContractTracker) LatestConfig

func (t *ContractTracker) LatestConfig(ctx context.Context, changedInBlock uint64) (ocrtypes.ContractConfig, error)

Return the latest configuration

func (*ContractTracker) LatestConfigDetails

func (t *ContractTracker) LatestConfigDetails(ctx context.Context) (changedInBlock uint64, configDigest ocrtypes.ConfigDigest, err error)

LatestConfigDetails queries the eth node

func (*ContractTracker) LatestRoundRequested

func (t *ContractTracker) 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 (*ContractTracker) Notify

func (t *ContractTracker) Notify() <-chan struct{}

Notify returns a channel that can wake up the contract tracker to let it know when a new config is available

func (*ContractTracker) OnNewLongestChain

func (t *ContractTracker) OnNewLongestChain(_ context.Context, h *evmtypes.Head)

OnNewLongestChain conformed to HeadTrackable and updates latestBlockHeight

func (*ContractTracker) Start

func (t *ContractTracker) Start() error

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

type ContractTransmitter

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

func NewOCRContractTransmitter

func NewOCRContractTransmitter(
	address gethCommon.Address,
	contractCaller *ocr2aggregator.OCR2AggregatorCaller,
	contractABI abi.ABI,
	transmitter Transmitter,
	tracker *ContractTracker,
	lggr logger.Logger,
) *ContractTransmitter

func (*ContractTransmitter) FromAccount

func (oc *ContractTransmitter) FromAccount() ocrtypes.Account

func (*ContractTransmitter) LatestConfigDigestAndEpoch

func (oc *ContractTransmitter) LatestConfigDigestAndEpoch(ctx context.Context) (ocrtypes.ConfigDigest, uint32, error)

func (*ContractTransmitter) LatestRoundRequested

func (oc *ContractTransmitter) LatestRoundRequested(ctx context.Context, lookback time.Duration) (ocrtypes.ConfigDigest, uint32, uint8, 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 (*ContractTransmitter) LatestTransmissionDetails

func (oc *ContractTransmitter) LatestTransmissionDetails(ctx context.Context) (ocrtypes.ConfigDigest, uint32, uint8, *big.Int, time.Time, error)

func (*ContractTransmitter) Transmit

type OCR2Spec

type OCR2Spec struct {
	ID            int32
	ContractID    string
	TransmitterID null.String // Will be null for bootstrap jobs
	IsBootstrap   bool
	ChainID       *big.Int
}

type OCRContractTrackerDB

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

type RelayConfig

type RelayConfig struct {
	ChainID *utils.Big `json:"chainID"`
}

type Relayer

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

func NewRelayer

func NewRelayer(db *sqlx.DB, chainSet evm.ChainSet, lggr logger.Logger) *Relayer

func (*Relayer) Close

func (r *Relayer) Close() error

Close does noop: no persistent subservices to close on relay close

func (*Relayer) Healthy

func (r *Relayer) Healthy() error

Healthy does noop: always healthy

func (*Relayer) NewOCR2Provider

func (r *Relayer) NewOCR2Provider(externalJobID uuid.UUID, s interface{}) (types2.OCR2Provider, error)

func (*Relayer) Ready

func (r *Relayer) Ready() error

Ready does noop: always ready

func (*Relayer) Start

func (r *Relayer) Start() error

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

type Transmitter

type Transmitter interface {
	CreateEthTransaction(ctx context.Context, toAddress gethCommon.Address, payload []byte) error
	FromAddress() gethCommon.Address
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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