offchainreporting

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2020 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 added in v0.9.3

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

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

func RegisterJobType added in v0.9.3

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

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

func NewKeyStore added in v0.9.3

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

func (KeyStore) ArchiveEncryptedOCRKeyBundle added in v0.9.3

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

ArchiveEncryptedOCRKeyBundle deletes the provided encrypted OCR key bundle

func (KeyStore) ArchiveEncryptedP2PKey added in v0.9.3

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

func (KeyStore) CreateEncryptedOCRKeyBundle added in v0.9.3

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

CreateEncryptedOCRKeyBundle creates an encrypted OCR private key record

func (KeyStore) DecryptedOCRKey added in v0.9.3

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

func (KeyStore) DecryptedP2PKey added in v0.9.3

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

func (KeyStore) DeleteEncryptedOCRKeyBundle added in v0.9.3

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

DeleteEncryptedOCRKeyBundle deletes the provided encrypted OCR key bundle

func (KeyStore) DeleteEncryptedP2PKey added in v0.9.3

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

func (KeyStore) FindEncryptedOCRKeyBundleByID added in v0.9.3

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

FindEncryptedOCRKeyBundleByID finds an EncryptedKeyBundle bundle by its ID

func (KeyStore) FindEncryptedOCRKeyBundles added in v0.9.3

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

FindEncryptedOCRKeyBundles finds all the encrypted OCR key records

func (KeyStore) FindEncryptedP2PKeyByID added in v0.9.3

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

func (KeyStore) FindEncryptedP2PKeys added in v0.9.3

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

func (KeyStore) GenerateEncryptedOCRKeyBundle added in v0.9.3

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

func (KeyStore) GenerateEncryptedP2PKey added in v0.9.3

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

func (*KeyStore) Unlock added in v0.9.3

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

func (KeyStore) UpsertEncryptedP2PKey added in v0.9.3

func (ks KeyStore) UpsertEncryptedP2PKey(k *p2pkey.EncryptedP2PKey) 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 added in v0.9.3

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

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

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

func NewOCRContractConfigTracker added in v0.9.6

func NewOCRContractConfigTracker(
	address gethCommon.Address,
	contractFilterer *offchainaggregator.OffchainAggregatorFilterer,
	contractCaller *offchainaggregator.OffchainAggregatorCaller,
	ethClient eth.Client,
	logBroadcaster eth.LogBroadcaster,
	jobID int32,
	logger logger.Logger,
) (o *OCRContractConfigTracker, err error)

func (*OCRContractConfigTracker) ConfigFromLogs added in v0.9.6

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

func (*OCRContractConfigTracker) LatestBlockHeight added in v0.9.6

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

func (*OCRContractConfigTracker) LatestConfigDetails added in v0.9.6

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

func (*OCRContractConfigTracker) SubscribeToNewConfigs added in v0.9.6

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 Transmitter,
) *OCRContractTransmitter

func (*OCRContractTransmitter) FromAddress added in v0.9.6

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

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

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

func (spec OracleSpec) JobID() int32

func (OracleSpec) JobType added in v0.9.3

func (spec OracleSpec) JobType() job.Type

func (OracleSpec) TaskDAG added in v0.9.3

func (spec OracleSpec) TaskDAG() pipeline.TaskDAG

type P2PPeer added in v0.9.6

type P2PPeer struct {
	ID        string
	Addr      string
	JobID     int32
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (P2PPeer) TableName added in v0.9.6

func (P2PPeer) TableName() string

type Pstorewrapper added in v0.9.6

type Pstorewrapper struct {
	utils.StartStopOnce
	Peerstore p2ppeerstore.Peerstore
	// contains filtered or unexported fields
}

func NewPeerstoreWrapper added in v0.9.6

func NewPeerstoreWrapper(db *gorm.DB, writeInterval time.Duration, jobID int32) (*Pstorewrapper, error)

NewPeerstoreWrapper creates a new database-backed peerstore wrapper scoped to the given jobID Multiple peerstore wrappers should not be instantiated with the same jobID

func (*Pstorewrapper) Close added in v0.9.6

func (p *Pstorewrapper) Close() error

func (*Pstorewrapper) Start added in v0.9.6

func (p *Pstorewrapper) Start() error

func (*Pstorewrapper) WriteToDB added in v0.9.6

func (p *Pstorewrapper) WriteToDB() error

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