mercury

package
v2.4.0-beta0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: MIT Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Mercury server error codes
	DuplicateReport = 2
)

Variables

View Source
var FeedScopedConfigSet common.Hash

FeedScopedConfigSet ConfigSet with FeedID for use with mercury (and multi-config DON)

View Source
var PayloadTypes = getPayloadTypes()

Functions

func FilterName

func FilterName(addr common.Address, feedID common.Hash) string

func NewDataSource

func NewDataSource(pr pipeline.Runner, jb job.Job, spec pipeline.Spec, lggr logger.Logger, rr chan pipeline.Run, enhancedTelemChan chan ocrcommon.EnhancedTelemetryMercuryData, chainHeadTracker ChainHeadTracker, fetcher Fetcher, initialBlockNumber *int64) *datasource

func NewTransmitter

func NewTransmitter(lggr logger.Logger, cfgTracker ConfigTracker, rpcClient wsrpc.Client, fromAccount ed25519.PublicKey, feedID [32]byte, db *sqlx.DB, cfg pg.QConfig) *mercuryTransmitter

Types

type ChainHeadTracker added in v2.2.0

type ChainHeadTracker interface {
	Client() evmclient.Client
	HeadTracker() httypes.HeadTracker
}

type ConfigPoller

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

ConfigPoller defines the Mercury Config Poller

func NewConfigPoller

func NewConfigPoller(lggr logger.Logger, destChainPoller logpoller.LogPoller, addr common.Address, feedId common.Hash, eventBroadcaster pg.EventBroadcaster) (*ConfigPoller, error)

NewConfigPoller creates a new Mercury ConfigPoller

func (*ConfigPoller) Close added in v2.3.0

func (cp *ConfigPoller) Close() error

Close the subscription to Postgres' notify events.

func (*ConfigPoller) LatestBlockHeight

func (cp *ConfigPoller) LatestBlockHeight(ctx context.Context) (blockHeight uint64, err error)

LatestBlockHeight returns the latest block height from the logs

func (*ConfigPoller) LatestConfig

func (cp *ConfigPoller) LatestConfig(ctx context.Context, changedInBlock uint64) (ocrtypes.ContractConfig, error)

LatestConfig returns the latest config from the logs on a certain block

func (*ConfigPoller) LatestConfigDetails

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

LatestConfigDetails returns the latest config details from the logs

func (*ConfigPoller) Notify

func (cp *ConfigPoller) Notify() <-chan struct{}

Notify abstracts the logpoller.LogPoller Notify() implementation

func (*ConfigPoller) Replay

func (cp *ConfigPoller) Replay(ctx context.Context, fromBlock int64) error

Replay abstracts the logpoller.LogPoller Replay() implementation

func (*ConfigPoller) Start added in v2.3.0

func (cp *ConfigPoller) Start()

Start the subscription to Postgres' notify events.

type ConfigTracker

type ConfigTracker interface {
	LatestConfigDetails(ctx context.Context) (changedInBlock uint64, configDigest ocrtypes.ConfigDigest, err error)
}

type Fetcher added in v2.3.0

type Fetcher interface {
	// FetchInitialMaxFinalizedBlockNumber should fetch the initial max
	// finalized block number from the mercury server.
	FetchInitialMaxFinalizedBlockNumber(context.Context) (*int64, error)
}

type FullConfigFromLog

type FullConfigFromLog struct {
	ocrtypes.ContractConfig
	// contains filtered or unexported fields
}

FullConfigFromLog defines the contract config with the feedID

type ORM added in v2.4.0

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

func NewORM added in v2.4.0

func NewORM(db *sqlx.DB, lggr logger.Logger, cfg pg.QConfig) *ORM

func (*ORM) DeleteTransmitRequests added in v2.4.0

func (o *ORM) DeleteTransmitRequests(reqs []*pb.TransmitRequest, qopts ...pg.QOpt) error

DeleteTransmitRequest deletes the given transmit requests if they exist.

func (*ORM) GetTransmitRequests added in v2.4.0

func (o *ORM) GetTransmitRequests(qopts ...pg.QOpt) ([]*Transmission, error)

GetTransmitRequests returns all transmit requests in chronologically descending order.

func (*ORM) InsertTransmitRequest added in v2.4.0

func (o *ORM) InsertTransmitRequest(req *pb.TransmitRequest, reportCtx ocrtypes.ReportContext, qopts ...pg.QOpt) error

InsertTransmitRequest inserts one transmit request if the payload does not exist already.

func (*ORM) PruneTransmitRequests added in v2.4.0

func (o *ORM) PruneTransmitRequests(maxSize int, qopts ...pg.QOpt) error

PruneTransmitRequests keeps at most maxSize rows in the table, deleting the oldest transactions.

type OffchainConfigDigester

type OffchainConfigDigester struct {
	FeedID          [32]byte
	ChainID         *big.Int
	ContractAddress common.Address
}

func NewOffchainConfigDigester

func NewOffchainConfigDigester(feedID [32]byte, chainID *big.Int, contractAddress common.Address) OffchainConfigDigester

func (OffchainConfigDigester) ConfigDigest

func (OffchainConfigDigester) ConfigDigestPrefix

func (d OffchainConfigDigester) ConfigDigestPrefix() (types.ConfigDigestPrefix, error)

type PersistenceManager added in v2.4.0

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

func NewPersistenceManager added in v2.4.0

func NewPersistenceManager(lggr logger.Logger, orm *ORM) *PersistenceManager

func (*PersistenceManager) AsyncDelete added in v2.4.0

func (pm *PersistenceManager) AsyncDelete(req *pb.TransmitRequest)

func (*PersistenceManager) Close added in v2.4.0

func (pm *PersistenceManager) Close() error

func (*PersistenceManager) Delete added in v2.4.0

func (pm *PersistenceManager) Delete(ctx context.Context, req *pb.TransmitRequest) error

func (*PersistenceManager) Insert added in v2.4.0

func (*PersistenceManager) Load added in v2.4.0

func (pm *PersistenceManager) Load(ctx context.Context) ([]*Transmission, error)

func (*PersistenceManager) Start added in v2.4.0

func (pm *PersistenceManager) Start(ctx context.Context) error

type Runner added in v2.3.0

type Runner interface {
	ExecuteRun(ctx context.Context, spec pipeline.Spec, vars pipeline.Vars, l logger.Logger) (run pipeline.Run, trrs pipeline.TaskRunResults, err error)
}

type Transmission added in v2.2.0

type Transmission struct {
	Req       *pb.TransmitRequest    // the payload to transmit
	ReportCtx ocrtypes.ReportContext // contains priority information (latest epoch/round wins)
	// contains filtered or unexported fields
}

type TransmitQueue added in v2.2.0

type TransmitQueue struct {
	utils.StartStopOnce
	// contains filtered or unexported fields
}

TransmitQueue is the high-level package that everything outside of this file should be using It stores pending transmissions, yielding the latest (highest priority) first to the caller

func NewTransmitQueue added in v2.2.0

func NewTransmitQueue(lggr logger.Logger, feedID string, maxlen int, transmissions []*Transmission, asyncDeleter asyncDeleter) *TransmitQueue

maxlen controls how many items will be stored in the queue 0 means unlimited - be careful, this can cause memory leaks

func (*TransmitQueue) BlockingPop added in v2.2.0

func (tq *TransmitQueue) BlockingPop() (t *Transmission)

BlockingPop will block until at least one item is in the heap, and then return it If the queue is closed, it will immediately return nil

func (*TransmitQueue) Close added in v2.2.0

func (tq *TransmitQueue) Close() error

func (*TransmitQueue) HealthReport added in v2.2.0

func (tq *TransmitQueue) HealthReport() map[string]error

func (*TransmitQueue) IsEmpty added in v2.2.0

func (tq *TransmitQueue) IsEmpty() bool

func (*TransmitQueue) Name added in v2.2.0

func (tq *TransmitQueue) Name() string

func (*TransmitQueue) Push added in v2.2.0

func (tq *TransmitQueue) Push(req *pb.TransmitRequest, reportCtx ocrtypes.ReportContext) (ok bool)

func (*TransmitQueue) Ready added in v2.2.0

func (tq *TransmitQueue) Ready() error

func (*TransmitQueue) Start added in v2.2.0

func (tq *TransmitQueue) Start(context.Context) error

type Transmitter

type Transmitter interface {
	relaymercury.Transmitter
	services.ServiceCtx
}

Directories

Path Synopsis
pb

Jump to

Keyboard shortcuts

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