mercury

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 38 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 BuildSamplePayload

func BuildSamplePayload(report []byte, reportCtx ocrtypes.ReportContext, sigs []ocrtypes.AttributedOnchainSignature) []byte

func FeedIDFromReport

func FeedIDFromReport(report ocrtypes.Report) (feedID utils.FeedID, err error)

func FilterName

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

func MustHexToConfigDigest

func MustHexToConfigDigest(s string) (cd ocrtypes.ConfigDigest)

func NewTransmitter

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

Types

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) (*ConfigPoller, error)

NewConfigPoller creates a new Mercury ConfigPoller

func (*ConfigPoller) Close

func (cp *ConfigPoller) Close() error

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{}

func (*ConfigPoller) Replay

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

Replay abstracts the logpoller.LogPoller Replay() implementation

func (*ConfigPoller) Start

func (cp *ConfigPoller) Start()

type ConfigTracker

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

type FullConfigFromLog

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

FullConfigFromLog defines the contract config with the feedID

type ORM

type ORM interface {
	InsertTransmitRequest(req *pb.TransmitRequest, jobID int32, reportCtx ocrtypes.ReportContext, qopts ...pg.QOpt) error
	DeleteTransmitRequests(reqs []*pb.TransmitRequest, qopts ...pg.QOpt) error
	GetTransmitRequests(jobID int32, qopts ...pg.QOpt) ([]*Transmission, error)
	PruneTransmitRequests(jobID int32, maxSize int, qopts ...pg.QOpt) error
	LatestReport(ctx context.Context, feedID [32]byte, qopts ...pg.QOpt) (report []byte, err error)
}

func NewORM

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

type OffchainConfigDigester

type OffchainConfigDigester struct {
	FeedID          utils.FeedID
	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() (ocrtypes.ConfigDigestPrefix, error)

type PersistenceManager

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

func NewPersistenceManager

func NewPersistenceManager(lggr logger.Logger, orm ORM, jobID int32, maxTransmitQueueSize int, flushDeletesFrequency, pruneFrequency time.Duration) *PersistenceManager

func (*PersistenceManager) AsyncDelete

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

func (*PersistenceManager) Close

func (pm *PersistenceManager) Close() error

func (*PersistenceManager) Delete

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

func (*PersistenceManager) Insert

func (*PersistenceManager) Load

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

func (*PersistenceManager) Start

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

type Transmission

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

type TransmitQueue

type TransmitQueue struct {
	services.StateMachine
	// 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

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

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

func (tq *TransmitQueue) Close() error

func (*TransmitQueue) HealthReport

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

func (*TransmitQueue) IsEmpty

func (tq *TransmitQueue) IsEmpty() bool

func (*TransmitQueue) Name

func (tq *TransmitQueue) Name() string

func (*TransmitQueue) Push

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

func (*TransmitQueue) Ready

func (tq *TransmitQueue) Ready() error

func (*TransmitQueue) Start

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

type Transmitter

type Transmitter interface {
	mercury.Transmitter
	services.Service
}

type TransmitterReportDecoder

type TransmitterReportDecoder interface {
	BenchmarkPriceFromReport(report ocrtypes.Report) (*big.Int, error)
}

Directories

Path Synopsis
v1
v2
v3
pb

Jump to

Keyboard shortcuts

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