offchainreporting

package
v0.0.0-...-e348512 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const JobType job.Type = "offchainreporting"
View Source
const OCRContractConfigSubscriptionHandleLogTimeout = 5 * time.Second

Variables

View Source
var (
	OCRContractConfigSet = getConfigSetHash()
)

Functions

func NewDB

func NewDB(sqldb *sql.DB, oracleSpecID int32) ocrtypes.Database

NewDB returns a new DB scoped to this oracleSpecID

func NewJobSpawnerDelegate

func NewJobSpawnerDelegate(
	db *gorm.DB,
	jobORM job.ORM,
	config *orm.Config,
	keyStore *KeyStore,
	pipelineRunner pipeline.Runner,
	ethClient eth.Client,
	logBroadcaster eth.LogBroadcaster,
) *jobSpawnerDelegate

func NewLogger

func NewLogger(internal *logger.Logger, trace bool, saveError func(string)) ocrtypes.Logger

func NewPeerstore

func NewPeerstore(ctx context.Context, db *sql.DB) (p2ppeerstore.Peerstore, error)

NewPeerstore creates a new database-backed peerstore NOTE: You can get sql.DB from store with store.DB.DB()

func RegisterJobType

func RegisterJobType(
	db *gorm.DB,
	jobORM job.ORM,
	config *orm.Config,
	keyStore *KeyStore,
	jobSpawner job.Spawner,
	pipelineRunner pipeline.Runner,
	ethClient eth.Client,
	logBroadcaster eth.LogBroadcaster,
)

Types

type KeyStore

type KeyStore struct {
	*gorm.DB
	// contains filtered or unexported fields
}

func NewKeyStore

func NewKeyStore(db *gorm.DB, scryptParams utils.ScryptParams) *KeyStore

func (KeyStore) ArchiveEncryptedOCRKeyBundle

func (ks KeyStore) ArchiveEncryptedOCRKeyBundle(key *ocrkey.EncryptedKeyBundle) error

ArchiveEncryptedOCRKeyBundle deletes the provided encrypted OCR key bundle

func (KeyStore) ArchiveEncryptedP2PKey

func (ks KeyStore) ArchiveEncryptedP2PKey(key *p2pkey.EncryptedP2PKey) error

func (KeyStore) CreateEncryptedOCRKeyBundle

func (ks KeyStore) CreateEncryptedOCRKeyBundle(encryptedKey *ocrkey.EncryptedKeyBundle) error

CreateEncryptedOCRKeyBundle creates an encrypted OCR private key record

func (KeyStore) DecryptedOCRKey

func (ks KeyStore) DecryptedOCRKey(hash models.Sha256Hash) (ocrkey.KeyBundle, bool)

func (KeyStore) DecryptedP2PKey

func (ks KeyStore) DecryptedP2PKey(peerID peer.ID) (p2pkey.Key, bool)

func (KeyStore) DeleteEncryptedOCRKeyBundle

func (ks KeyStore) DeleteEncryptedOCRKeyBundle(key *ocrkey.EncryptedKeyBundle) error

DeleteEncryptedOCRKeyBundle deletes the provided encrypted OCR key bundle

func (KeyStore) DeleteEncryptedP2PKey

func (ks KeyStore) DeleteEncryptedP2PKey(key *p2pkey.EncryptedP2PKey) error

func (KeyStore) FindEncryptedOCRKeyBundleByID

func (ks KeyStore) FindEncryptedOCRKeyBundleByID(id models.Sha256Hash) (ocrkey.EncryptedKeyBundle, error)

FindEncryptedOCRKeyBundleByID finds an EncryptedKeyBundle bundle by its ID

func (KeyStore) FindEncryptedOCRKeyBundles

func (ks KeyStore) FindEncryptedOCRKeyBundles() (keys []ocrkey.EncryptedKeyBundle, err error)

FindEncryptedOCRKeyBundles finds all the encrypted OCR key records

func (KeyStore) FindEncryptedP2PKeyByID

func (ks KeyStore) FindEncryptedP2PKeyByID(id int32) (*p2pkey.EncryptedP2PKey, error)

func (KeyStore) FindEncryptedP2PKeys

func (ks KeyStore) FindEncryptedP2PKeys() (keys []p2pkey.EncryptedP2PKey, err error)

func (KeyStore) GenerateEncryptedOCRKeyBundle

func (ks KeyStore) GenerateEncryptedOCRKeyBundle() (ocrkey.KeyBundle, ocrkey.EncryptedKeyBundle, error)

func (KeyStore) GenerateEncryptedP2PKey

func (ks KeyStore) GenerateEncryptedP2PKey() (p2pkey.Key, p2pkey.EncryptedP2PKey, error)

func (*KeyStore) Unlock

func (ks *KeyStore) Unlock(password string) error

func (KeyStore) UpsertEncryptedP2PKey

func (ks KeyStore) UpsertEncryptedP2PKey(k *p2pkey.EncryptedP2PKey) error

type OCRContract

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

func NewOCRContract

func NewOCRContract(address gethCommon.Address, ethClient eth.Client, logBroadcaster eth.LogBroadcaster, jobID int32, transmitter Transmitter, logger logger.Logger) (o *OCRContract, err error)

func (*OCRContract) ConfigFromLogs

func (oc *OCRContract) ConfigFromLogs(ctx context.Context, changedInBlock uint64) (c ocrtypes.ContractConfig, err error)

func (*OCRContract) FromAddress

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

func (*OCRContract) LatestBlockHeight

func (oc *OCRContract) LatestBlockHeight(ctx context.Context) (blockheight uint64, err error)

func (*OCRContract) LatestConfigDetails

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

func (*OCRContract) LatestTransmissionDetails

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

func (*OCRContract) SubscribeToNewConfigs

func (oc *OCRContract) SubscribeToNewConfigs(context.Context) (ocrtypes.ContractConfigSubscription, error)

func (*OCRContract) Transmit

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

type OCRContractConfigSubscription

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

func (*OCRContractConfigSubscription) Close

func (sub *OCRContractConfigSubscription) Close()

Close complies with ContractConfigSubscription interface

func (*OCRContractConfigSubscription) Configs

Configs complies with ContractConfigSubscription interface

func (*OCRContractConfigSubscription) HandleLog

func (sub *OCRContractConfigSubscription) HandleLog(lb eth.LogBroadcast, err error)

HandleLog complies with LogListener interface

func (*OCRContractConfigSubscription) IsV2Job

func (sub *OCRContractConfigSubscription) IsV2Job() bool

IsV2Job complies with LogListener interface

func (*OCRContractConfigSubscription) JobID

func (sub *OCRContractConfigSubscription) JobID() *models.ID

JobID complies with LogListener interface

func (*OCRContractConfigSubscription) JobIDV2

func (sub *OCRContractConfigSubscription) JobIDV2() int32

JobIDV2 complies with LogListener interface

func (*OCRContractConfigSubscription) OnConnect

func (sub *OCRContractConfigSubscription) OnConnect()

OnConnect complies with LogListener interface

func (*OCRContractConfigSubscription) OnDisconnect

func (sub *OCRContractConfigSubscription) OnDisconnect()

OnDisconnect complies with LogListener interface

type OracleSpec

type OracleSpec struct {
	Type          string `toml:"type"`
	SchemaVersion uint32 `toml:"schemaVersion"`

	models.OffchainReportingOracleSpec

	// The `Pipeline` field is only used during unmarshaling.  A pipeline.TaskDAG
	// is a type that implements gonum.org/v1/gonum/graph#Graph, which means that
	// you can dot.Unmarshal(...) raw DOT source directly into it, and it will
	// be a fully-instantiated DAG containing information about all of the nodes
	// and edges described by the DOT.  Our pipeline.TaskDAG type has a method
	// called `.TasksInDependencyOrder()` which converts this node/edge data
	// structure into task specs which can then be saved to the database.
	Pipeline pipeline.TaskDAG `toml:"observationSource"`
	// contains filtered or unexported fields
}

OracleSpec is a wrapper for `models.OffchainReportingOracleSpec`, the DB representation of the OCR job spec. It fulfills the job.Spec interface and has facilities for unmarshaling the pipeline DAG from the job spec text.

func (OracleSpec) JobID

func (spec OracleSpec) JobID() int32

func (OracleSpec) JobType

func (spec OracleSpec) JobType() job.Type

func (OracleSpec) TaskDAG

func (spec OracleSpec) TaskDAG() pipeline.TaskDAG

type Transmitter

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

func NewTransmitter

func NewTransmitter(sqldb *sql.DB, fromAddress gethCommon.Address, gasLimit uint64) Transmitter

NewTransmitter creates a new eth transmitter

Jump to

Keyboard shortcuts

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