Documentation ¶
Index ¶
- func IsLaterThan(incoming gethTypes.Log, existing gethTypes.Log) bool
- func NewRoundRequestedDB(sqldb *sql.DB, oracleSpecID int32, lggr logger.Logger) *requestRoundDB
- type ConfigTracker
- func (c *ConfigTracker) Close() error
- func (c *ConfigTracker) Connect(*evmtypes.Head) error
- func (c *ConfigTracker) LatestBlockHeight(ctx context.Context) (blockHeight uint64, err error)
- func (c *ConfigTracker) LatestConfig(ctx context.Context, changedInBlock uint64) (ocrtypes.ContractConfig, error)
- func (c *ConfigTracker) LatestConfigDetails(ctx context.Context) (changedInBlock uint64, configDigest ocrtypes.ConfigDigest, err error)
- func (c *ConfigTracker) Notify() <-chan struct{}
- func (c *ConfigTracker) OnNewLongestChain(_ context.Context, h *evmtypes.Head)
- func (c *ConfigTracker) Start() error
- type ContractTransmitter
- func (oc *ContractTransmitter) FromAccount() ocrtypes.Account
- func (oc *ContractTransmitter) LatestConfigDigestAndEpoch(ctx context.Context) (ocrtypes.ConfigDigest, uint32, error)
- func (oc *ContractTransmitter) Transmit(ctx context.Context, reportCtx ocrtypes.ReportContext, report ocrtypes.Report, ...) error
- type OCR2Spec
- type RelayConfig
- type Relayer
- type RequestRoundDB
- type RequestRoundTracker
- func (t *RequestRoundTracker) Close() error
- func (t *RequestRoundTracker) HandleLog(lb log.Broadcast)
- func (t *RequestRoundTracker) IsV2Job() bool
- func (t *RequestRoundTracker) JobID() int32
- func (t *RequestRoundTracker) LatestRoundRequested(_ context.Context, lookback time.Duration) (configDigest ocrtypes.ConfigDigest, epoch uint32, round uint8, err error)
- func (t *RequestRoundTracker) Start() error
- type Transmitter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsLaterThan ¶
IsLaterThan returns true if the first log was emitted "after" the second log from the blockchain's point of view
Types ¶
type ConfigTracker ¶ added in v1.3.0
type ConfigTracker struct { utils.StartStopOnce // contains filtered or unexported fields }
ConfigTracker tracks the config of any contract implementing OCR2Abstract.
func NewConfigTracker ¶ added in v1.3.0
func NewConfigTracker(lggr logger.Logger, contractABI abi.ABI, client evmclient.Client, addr common.Address, chainType config.ChainType, headBroadcaster httypes.HeadBroadcaster) *ConfigTracker
NewConfigTracker builds a new config tracker
func (*ConfigTracker) Close ¶ added in v1.3.0
func (c *ConfigTracker) Close() error
Close cancels and requests and unsubscribes from the head broadcaster
func (*ConfigTracker) Connect ¶ added in v1.3.0
func (c *ConfigTracker) Connect(*evmtypes.Head) error
Connect conforms to HeadTrackable
func (*ConfigTracker) LatestBlockHeight ¶ added in v1.3.0
func (c *ConfigTracker) LatestBlockHeight(ctx context.Context) (blockHeight uint64, err error)
LatestBlockHeight returns the latest blockheight either from the cache or falling back to querying the node.
func (*ConfigTracker) LatestConfig ¶ added in v1.3.0
func (c *ConfigTracker) LatestConfig(ctx context.Context, changedInBlock uint64) (ocrtypes.ContractConfig, error)
LatestConfig queries an OCR2Abstract contract for the latest config contents.
func (*ConfigTracker) LatestConfigDetails ¶ added in v1.3.0
func (c *ConfigTracker) LatestConfigDetails(ctx context.Context) (changedInBlock uint64, configDigest ocrtypes.ConfigDigest, err error)
LatestConfigDetails queries an OCR2Abstract contract for the latest config details
func (*ConfigTracker) Notify ¶ added in v1.3.0
func (c *ConfigTracker) Notify() <-chan struct{}
Notify not implemented
func (*ConfigTracker) OnNewLongestChain ¶ added in v1.3.0
func (c *ConfigTracker) OnNewLongestChain(_ context.Context, h *evmtypes.Head)
OnNewLongestChain conformed to HeadTrackable and updates latestBlockHeight
func (*ConfigTracker) Start ¶ added in v1.3.0
func (c *ConfigTracker) Start() error
Start starts the config tracker in particular subscribing to the head broadcaster.
type ContractTransmitter ¶
type ContractTransmitter struct {
// contains filtered or unexported fields
}
func NewOCRContractTransmitter ¶
func NewOCRContractTransmitter( address gethcommon.Address, caller contractReader, contractABI abi.ABI, transmitter Transmitter, lggr logger.Logger, ) *ContractTransmitter
func (*ContractTransmitter) FromAccount ¶
func (oc *ContractTransmitter) FromAccount() ocrtypes.Account
FromAccount returns the account from which the transmitter invokes the contract
func (*ContractTransmitter) LatestConfigDigestAndEpoch ¶
func (oc *ContractTransmitter) LatestConfigDigestAndEpoch(ctx context.Context) (ocrtypes.ConfigDigest, uint32, error)
LatestConfigDigestAndEpoch retrieves the latest config digest and epoch from the OCR2 contract. It is plugin independent, in particular avoids use of the plugin specific generated evm wrappers by using the evm client Call directly for functions/events that are part of OCR2Abstract.
func (*ContractTransmitter) Transmit ¶
func (oc *ContractTransmitter) Transmit(ctx context.Context, reportCtx ocrtypes.ReportContext, report ocrtypes.Report, signatures []ocrtypes.AttributedOnchainSignature) error
Transmit sends the report to the on-chain smart contract's Transmit method.
type RelayConfig ¶
type Relayer ¶
type Relayer struct {
// contains filtered or unexported fields
}
func (*Relayer) NewOCR2Provider ¶
func (r *Relayer) NewOCR2Provider(externalJobID uuid.UUID, s interface{}) (types2.OCR2ProviderCtx, error)
NewOCR2Provider provides all evm specific implementations of OCR2 components including components generic across all plugins and ones specific to plugins.
type RequestRoundDB ¶ added in v1.3.0
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 ¶ added in v1.3.0
type RequestRoundTracker struct { utils.StartStopOnce // contains filtered or unexported fields }
RequestRoundTracker subscribes to new request round logs.
func NewRequestRoundTracker ¶ added in v1.3.0
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, ) (o *RequestRoundTracker)
NewRequestRoundTracker makes a new RequestRoundTracker
func (*RequestRoundTracker) Close ¶ added in v1.3.0
func (t *RequestRoundTracker) Close() error
Close should be called after teardown of the OCR job relying on this tracker
func (*RequestRoundTracker) HandleLog ¶ added in v1.3.0
func (t *RequestRoundTracker) HandleLog(lb log.Broadcast)
HandleLog complies with LogListener interface It is not thread safe
func (*RequestRoundTracker) IsV2Job ¶ added in v1.3.0
func (t *RequestRoundTracker) IsV2Job() bool
IsV2Job complies with LogListener interface
func (*RequestRoundTracker) JobID ¶ added in v1.3.0
func (t *RequestRoundTracker) JobID() int32
JobID complies with LogListener interface
func (*RequestRoundTracker) LatestRoundRequested ¶ added in v1.3.0
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 ¶ added in v1.3.0
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) error FromAddress() gethcommon.Address }