Documentation ¶
Index ¶
- Constants
- Variables
- func IsLaterThan(incoming gethTypes.Log, existing gethTypes.Log) bool
- func NewDB(sqlxDB *sqlx.DB, oracleSpecID int32, lggr logger.Logger, cfg pg.QConfig) *db
- func ValidatedOracleSpecToml(chainSet evm.ChainSet, tomlString string) (job.Job, error)
- func ValidatedOracleSpecTomlCfg(configFn func(id *big.Int) (config2.ChainScopedConfig, error), ...) (job.Job, error)
- type Config
- type ConfigOverriderImpl
- type ContractFlags
- type Delegate
- func (d *Delegate) AfterJobCreated(spec job.Job)
- func (d *Delegate) BeforeJobCreated(spec job.Job)
- func (d *Delegate) BeforeJobDeleted(spec job.Job)
- func (d *Delegate) JobType() job.Type
- func (d *Delegate) OnDeleteJob(spec job.Job, q pg.Queryer) error
- func (d *Delegate) ServicesForSpec(jb job.Job) (services []job.ServiceCtx, err error)
- type OCRContractConfigSubscription
- type OCRContractTracker
- func (t *OCRContractTracker) Close() error
- func (t *OCRContractTracker) ConfigFromLogs(ctx context.Context, changedInBlock uint64) (c ocrtypes.ContractConfig, err error)
- func (t *OCRContractTracker) HandleLog(lb log.Broadcast)
- func (t *OCRContractTracker) JobID() int32
- func (t *OCRContractTracker) LatestBlockHeight(ctx context.Context) (blockheight uint64, err error)
- func (t *OCRContractTracker) LatestConfigDetails(ctx context.Context) (changedInBlock uint64, configDigest ocrtypes.ConfigDigest, err error)
- func (t *OCRContractTracker) LatestRoundRequested(_ context.Context, lookback time.Duration) (configDigest ocrtypes.ConfigDigest, epoch uint32, round uint8, err error)
- func (t *OCRContractTracker) OnNewLongestChain(_ context.Context, h *evmtypes.Head)
- func (t *OCRContractTracker) Start(context.Context) error
- func (t *OCRContractTracker) SubscribeToNewConfigs(context.Context) (ocrtypes.ContractConfigSubscription, error)
- type OCRContractTrackerDB
- type OCRContractTransmitter
- func (oc *OCRContractTransmitter) ChainID() *big.Int
- func (oc *OCRContractTransmitter) FromAddress() gethCommon.Address
- func (oc *OCRContractTransmitter) LatestRoundRequested(ctx context.Context, lookback time.Duration) (configDigest ocrtypes.ConfigDigest, epoch uint32, round uint8, err error)
- func (oc *OCRContractTransmitter) LatestTransmissionDetails(ctx context.Context) (configDigest ocrtypes.ConfigDigest, epoch uint32, round uint8, ...)
- func (oc *OCRContractTransmitter) Transmit(ctx context.Context, report []byte, rs, ss [][32]byte, vs [32]byte) error
- type OCRValidationConfig
- type ValidationConfig
Constants ¶
const ConfigOverriderPollInterval = 30 * time.Second
const InitialHibernationStatus = false
InitialHibernationStatus - hibernation state set until the first successful update from the chain
Variables ¶
var ( OCRContractConfigSet = getEventTopic("ConfigSet") OCRContractLatestRoundRequested = getEventTopic("RoundRequested") )
Functions ¶
func IsLaterThan ¶
IsLaterThan returns true if the first log was emitted "after" the second log from the blockchain's point of view
func ValidatedOracleSpecToml ¶
ValidatedOracleSpecToml validates an oracle spec that came from TOML
Types ¶
type ConfigOverriderImpl ¶
type ConfigOverriderImpl struct { utils.StartStopOnce DeltaCFromAddress time.Duration // contains filtered or unexported fields }
func NewConfigOverriderImpl ¶
func NewConfigOverriderImpl( logger logger.Logger, contractAddress ethkey.EIP55Address, flags *ContractFlags, pollTicker utils.TickerBase, ) (*ConfigOverriderImpl, error)
func (*ConfigOverriderImpl) Close ¶
func (c *ConfigOverriderImpl) Close() error
func (*ConfigOverriderImpl) ConfigOverride ¶
func (c *ConfigOverriderImpl) ConfigOverride() *ocrtypes.ConfigOverride
type ContractFlags ¶
type ContractFlags struct {
flags_wrapper.FlagsInterface
}
ContractFlags wraps the a contract
func NewFlags ¶
func NewFlags(addrHex string, ethClient evmclient.Client) (*ContractFlags, error)
NewFlags constructs a new Flags from a flags contract address
func (*ContractFlags) Contract ¶
func (f *ContractFlags) Contract() flags_wrapper.FlagsInterface
Contract returns the flags contract
func (*ContractFlags) ContractExists ¶
func (f *ContractFlags) ContractExists() bool
ContractExists returns whether a flag contract exists
type Delegate ¶
type Delegate struct {
// contains filtered or unexported fields
}
func NewDelegate ¶
func NewDelegate( db *sqlx.DB, jobORM job.ORM, keyStore keystore.Master, pipelineRunner pipeline.Runner, peerWrapper *ocrcommon.SingletonPeerWrapper, monitoringEndpointGen telemetry.MonitoringEndpointGenerator, chainSet evm.ChainSet, lggr logger.Logger, cfg Config, mailMon *utils.MailboxMonitor, ) *Delegate
func (*Delegate) AfterJobCreated ¶
func (*Delegate) BeforeJobCreated ¶
func (*Delegate) BeforeJobDeleted ¶
func (*Delegate) ServicesForSpec ¶
ServicesForSpec returns the OCR services that need to run for this job
type OCRContractConfigSubscription ¶
type OCRContractConfigSubscription OCRContractTracker
OCRContractConfigSubscription only exists to comply with the ContractConfigSubscription interface, it's just a simple shell around OCRContractTracker that defines two methods
func (*OCRContractConfigSubscription) Close ¶
func (sub *OCRContractConfigSubscription) Close()
Close is a no-op since Subscribing/Unsubscribing is handled in the Start/Close methods of the OCRContractTracker
func (*OCRContractConfigSubscription) Configs ¶
func (sub *OCRContractConfigSubscription) Configs() <-chan ocrtypes.ContractConfig
Configs complies with ContractConfigSubscription interface
type OCRContractTracker ¶
type OCRContractTracker struct { utils.StartStopOnce // contains filtered or unexported fields }
OCRContractTracker complies with ContractConfigTracker interface and handles log events related to the contract more generally
func NewOCRContractTracker ¶
func NewOCRContractTracker( contract *offchain_aggregator_wrapper.OffchainAggregator, contractFilterer *offchainaggregator.OffchainAggregatorFilterer, contractCaller *offchainaggregator.OffchainAggregatorCaller, ethClient evmclient.Client, logBroadcaster log.Broadcaster, jobID int32, logger logger.Logger, db *sqlx.DB, ocrDB OCRContractTrackerDB, cfg ocrcommon.Config, q pg.QConfig, headBroadcaster httypes.HeadBroadcaster, mailMon *utils.MailboxMonitor, ) (o *OCRContractTracker)
NewOCRContractTracker makes a new OCRContractTracker
func (*OCRContractTracker) Close ¶
func (t *OCRContractTracker) Close() error
Close should be called after teardown of the OCR job relying on this tracker
func (*OCRContractTracker) ConfigFromLogs ¶
func (t *OCRContractTracker) ConfigFromLogs(ctx context.Context, changedInBlock uint64) (c ocrtypes.ContractConfig, err error)
ConfigFromLogs queries the eth node for logs for this contract
func (*OCRContractTracker) HandleLog ¶
func (t *OCRContractTracker) HandleLog(lb log.Broadcast)
HandleLog complies with LogListener interface It is not thread safe
func (*OCRContractTracker) JobID ¶
func (t *OCRContractTracker) JobID() int32
JobID complies with LogListener interface
func (*OCRContractTracker) LatestBlockHeight ¶
func (t *OCRContractTracker) LatestBlockHeight(ctx context.Context) (blockheight uint64, err error)
LatestBlockHeight queries the eth node for the most recent header
func (*OCRContractTracker) LatestConfigDetails ¶
func (t *OCRContractTracker) LatestConfigDetails(ctx context.Context) (changedInBlock uint64, configDigest ocrtypes.ConfigDigest, err error)
LatestConfigDetails queries the eth node
func (*OCRContractTracker) LatestRoundRequested ¶
func (t *OCRContractTracker) 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 (*OCRContractTracker) OnNewLongestChain ¶
func (t *OCRContractTracker) OnNewLongestChain(_ context.Context, h *evmtypes.Head)
OnNewLongestChain conformed to HeadTrackable and updates latestBlockHeight
func (*OCRContractTracker) Start ¶
func (t *OCRContractTracker) Start(context.Context) error
Start must be called before logs can be delivered It ought to be called before starting OCR
func (*OCRContractTracker) SubscribeToNewConfigs ¶
func (t *OCRContractTracker) SubscribeToNewConfigs(context.Context) (ocrtypes.ContractConfigSubscription, error)
SubscribeToNewConfigs returns the tracker aliased as a ContractConfigSubscription
type OCRContractTrackerDB ¶
type OCRContractTrackerDB interface { SaveLatestRoundRequested(tx pg.Queryer, rr offchainaggregator.OffchainAggregatorRoundRequested) error LoadLatestRoundRequested() (rr offchainaggregator.OffchainAggregatorRoundRequested, err error) }
type OCRContractTransmitter ¶
type OCRContractTransmitter struct {
// contains filtered or unexported fields
}
func NewOCRContractTransmitter ¶
func NewOCRContractTransmitter( address gethCommon.Address, contractCaller *offchainaggregator.OffchainAggregatorCaller, contractABI abi.ABI, transmitter ocrcommon.Transmitter, logBroadcaster log.Broadcaster, tracker *OCRContractTracker, chainID *big.Int, effectiveTransmitterAddress gethCommon.Address, ) *OCRContractTransmitter
func (*OCRContractTransmitter) ChainID ¶
func (oc *OCRContractTransmitter) ChainID() *big.Int
func (*OCRContractTransmitter) FromAddress ¶
func (oc *OCRContractTransmitter) FromAddress() gethCommon.Address
func (*OCRContractTransmitter) LatestRoundRequested ¶
func (oc *OCRContractTransmitter) LatestRoundRequested(ctx 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 (*OCRContractTransmitter) LatestTransmissionDetails ¶
func (oc *OCRContractTransmitter) LatestTransmissionDetails(ctx context.Context) (configDigest ocrtypes.ConfigDigest, epoch uint32, round uint8, latestAnswer ocrtypes.Observation, latestTimestamp time.Time, err error)