vrfcommon

package
v2.7.1-beta0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ReasonMailboxSize describes when a VRF request is dropped due to the log mailbox being
	// over capacity.
	ReasonMailboxSize dropReason = "mailbox_size"

	// ReasonAge describes when a VRF request is dropped due to its age.
	ReasonAge dropReason = "age"
)

Variables

View Source
var (
	MetricQueueSize = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "vrf_request_queue_size",
		Help: "The number of VRF requests currently in the in-memory queue.",
	}, []string{"job_name", "external_job_id", "vrf_version"})

	MetricProcessedReqs = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "vrf_processed_request_count",
		Help: "The number of VRF requests processed.",
	}, []string{"job_name", "external_job_id", "vrf_version"})

	MetricDroppedRequests = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "vrf_dropped_request_count",
		Help: "The number of VRF requests dropped due to reasons such as expiry or mailbox size.",
	}, []string{"job_name", "external_job_id", "vrf_version", "drop_reason"})

	MetricDupeRequests = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "vrf_duplicate_requests",
		Help: "The number of times the VRF listener receives duplicate requests, which could indicate a reorg.",
	}, []string{"job_name", "external_job_id", "vrf_version"})

	MetricTimeBetweenSims = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name: "vrf_request_time_between_sims",
		Help: "How long a VRF request sits in the in-memory queue in between simulation attempts.",
		Buckets: []float64{
			float64(time.Second),
			float64(30 * time.Second),
			float64(time.Minute),
			float64(2 * time.Minute),
			float64(5 * time.Minute),
		},
	}, []string{"job_name", "external_job_id", "vrf_version"})

	MetricTimeUntilInitialSim = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name: "vrf_request_time_until_initial_sim",
		Help: "How long a VRF request sits in the in-memory queue until it gets simulated for the first time.",
		Buckets: []float64{
			float64(time.Second),
			float64(30 * time.Second),
			float64(time.Minute),
			float64(2 * time.Minute),
			float64(5 * time.Minute),
		},
	}, []string{"job_name", "external_job_id", "vrf_version"})
)
View Source
var (
	ErrKeyNotSet = errors.New("key not set")
)

Functions

func IncDroppedReqs

func IncDroppedReqs(jobName string, extJobID uuid.UUID, vrfVersion Version, reason dropReason)

func IncDupeReqs

func IncDupeReqs(jobName string, extJobID uuid.UUID, vrfVersion Version)

func IncProcessedReqs

func IncProcessedReqs(jobName string, extJobID uuid.UUID, vrfVersion Version)

func UpdateQueueSize

func UpdateQueueSize(jobName string, extJobID uuid.UUID, vrfVersion Version, size int)

func ValidatedVRFSpec

func ValidatedVRFSpec(tomlString string) (job.Job, error)

Types

type Config

type Config interface {
	FinalityDepth() uint32
	MinIncomingConfirmations() uint32
}

type FeeConfig

type FeeConfig interface {
	LimitDefault() uint32
	LimitJobType() config.LimitJobType
	PriceMaxKey(addr common.Address) *assets.Wei
}

type GethKeyStore

type GethKeyStore interface {
	GetRoundRobinAddress(chainID *big.Int, addresses ...common.Address) (common.Address, error)
}

type LogDeduper

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

LogDeduper prevents duplicate logs from being reprocessed.

func NewLogDeduper

func NewLogDeduper(lookback int) *LogDeduper

func (*LogDeduper) Clear

func (l *LogDeduper) Clear()

Clear clears the log deduper's internal cache.

func (*LogDeduper) Prune

func (l *LogDeduper) Prune(logBlock uint64)

func (*LogDeduper) ShouldDeliver

func (l *LogDeduper) ShouldDeliver(log types.Log) bool

type Version

type Version string

version describes a VRF version.

const (
	V1     Version = "V1"
	V2     Version = "V2"
	V2Plus Version = "V2Plus"
)

Jump to

Keyboard shortcuts

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