offchainreporting

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: 43 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigOverriderPollInterval = 30 * time.Second
View Source
const InitialHibernationStatus = false

InitialHibernationStatus - hibernation state set until the first successful update from the chain

Variables

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

Functions

func IsLaterThan added in v0.10.3

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 NewDB

func NewDB(sqldb *sql.DB, oracleSpecID int32, lggr logger.Logger) *db

NewDB returns a new DB scoped to this oracleSpecID

func ValidatedOracleSpecToml added in v0.9.10

func ValidatedOracleSpecToml(chainSet evm.ChainSet, tomlString string) (job.Job, error)

ValidatedOracleSpecToml validates an oracle spec that came from TOML

Types

type ConfigOverriderImpl added in v0.10.14

type ConfigOverriderImpl struct {
	utils.StartStopOnce

	DeltaCFromAddress time.Duration
	// contains filtered or unexported fields
}

func NewConfigOverriderImpl added in v0.10.14

func NewConfigOverriderImpl(
	logger logger.Logger,
	contractAddress ethkey.EIP55Address,
	flags *ContractFlags,
	pollTicker utils.TickerBase,
) (*ConfigOverriderImpl, error)

func (*ConfigOverriderImpl) Close added in v0.10.14

func (c *ConfigOverriderImpl) Close() error

func (*ConfigOverriderImpl) ConfigOverride added in v0.10.14

func (c *ConfigOverriderImpl) ConfigOverride() *ocrtypes.ConfigOverride

func (*ConfigOverriderImpl) Start added in v0.10.14

func (c *ConfigOverriderImpl) Start() error

type ContractFlags added in v0.10.14

type ContractFlags struct {
	flags_wrapper.FlagsInterface
}

ContractFlags wraps the a contract

func NewFlags added in v0.10.14

func NewFlags(addrHex string, ethClient evmclient.Client) (*ContractFlags, error)

NewFlags constructs a new Flags from a flags contract address

func (*ContractFlags) Contract added in v0.10.14

Contract returns the flags contract

func (*ContractFlags) ContractExists added in v0.10.14

func (f *ContractFlags) ContractExists() bool

ContractExists returns whether a flag contract exists

func (*ContractFlags) IsLowered added in v0.10.14

func (f *ContractFlags) IsLowered(contractAddr common.Address) (bool, error)

IsLowered determines whether the flag is lowered for a given contract. If a contract does not exist, it is considered to be lowered

type Delegate added in v0.9.10

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

func NewDelegate added in v0.9.10

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,
) *Delegate

func (Delegate) AfterJobCreated added in v0.10.11

func (Delegate) AfterJobCreated(spec job.Job)

func (Delegate) BeforeJobDeleted added in v0.10.11

func (Delegate) BeforeJobDeleted(spec job.Job)

func (Delegate) JobType added in v0.9.10

func (d Delegate) JobType() job.Type

func (Delegate) ServicesForSpec added in v0.9.10

func (d Delegate) ServicesForSpec(jb job.Job) (services []job.Service, err error)

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

Configs complies with ContractConfigSubscription interface

type OCRContractTracker added in v0.10.3

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 added in v0.10.3

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,
	headBroadcaster httypes.HeadBroadcaster,
) (o *OCRContractTracker)

NewOCRContractTracker makes a new OCRContractTracker

func (*OCRContractTracker) Close added in v0.10.3

func (t *OCRContractTracker) Close() error

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

func (*OCRContractTracker) ConfigFromLogs added in v0.10.3

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 added in v0.10.3

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

HandleLog complies with LogListener interface It is not thread safe

func (*OCRContractTracker) JobID added in v0.10.3

func (t *OCRContractTracker) JobID() int32

JobID complies with LogListener interface

func (*OCRContractTracker) LatestBlockHeight added in v0.10.3

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

LatestBlockHeight queries the eth node for the most recent header

func (*OCRContractTracker) LatestConfigDetails added in v0.10.3

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

LatestConfigDetails queries the eth node

func (*OCRContractTracker) LatestRoundRequested added in v0.10.3

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 added in v0.10.9

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

OnNewLongestChain conformed to HeadTrackable and updates latestBlockHeight

func (*OCRContractTracker) Start added in v0.10.3

func (t *OCRContractTracker) Start() error

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

func (*OCRContractTracker) SubscribeToNewConfigs added in v0.10.3

SubscribeToNewConfigs returns the tracker aliased as a ContractConfigSubscription

type OCRContractTrackerDB added in v0.10.3

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

type OCRContractTransmitter added in v0.9.6

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

func NewOCRContractTransmitter added in v0.9.6

func NewOCRContractTransmitter(
	address gethCommon.Address,
	contractCaller *offchainaggregator.OffchainAggregatorCaller,
	contractABI abi.ABI,
	transmitter ocrcommon.Transmitter,
	logBroadcaster log.Broadcaster,
	tracker *OCRContractTracker,
	chainID *big.Int,
) *OCRContractTransmitter

func (*OCRContractTransmitter) ChainID added in v0.10.8

func (oc *OCRContractTransmitter) ChainID() *big.Int

func (*OCRContractTransmitter) FromAddress added in v0.9.6

func (oc *OCRContractTransmitter) FromAddress() gethCommon.Address

func (*OCRContractTransmitter) LatestRoundRequested added in v0.10.3

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 added in v0.9.6

func (oc *OCRContractTransmitter) LatestTransmissionDetails(ctx context.Context) (configDigest ocrtypes.ConfigDigest, epoch uint32, round uint8, latestAnswer ocrtypes.Observation, latestTimestamp time.Time, err error)

func (*OCRContractTransmitter) Transmit added in v0.9.6

func (oc *OCRContractTransmitter) Transmit(ctx context.Context, report []byte, rs, ss [][32]byte, vs [32]byte) error

type ValidationConfig added in v0.10.11

type ValidationConfig interface {
	ChainType() chains.ChainType
	Dev() bool
	OCRBlockchainTimeout() time.Duration
	OCRContractConfirmations() uint16
	OCRContractPollInterval() time.Duration
	OCRContractSubscribeInterval() time.Duration
	OCRContractTransmitterTransmitTimeout() time.Duration
	OCRDatabaseTimeout() time.Duration
	OCRKeyBundleID() (string, error)
	OCRObservationGracePeriod() time.Duration
	OCRObservationTimeout() time.Duration
	OCRTransmitterAddress() (ethkey.EIP55Address, error)
	P2PPeerID() p2pkey.PeerID
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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