common

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LifeCycleStageStaging    llotypes.LifeCycleStage = "staging"
	LifeCycleStageProduction llotypes.LifeCycleStage = "production"
	LifeCycleStageRetired    llotypes.LifeCycleStage = "retired"
)

Protocol instances start in either the staging or production stage. They may later be retired and "hand over" their work to another protocol instance that will move from the staging to the production stage.

These lifecycle constants and the retirement handover types are shared across all LLO plugin versions.

View Source
const (
	// MaxReportCount is the maximum number of reports (and therefore channels)
	// supported. CAREFUL! If we ever accidentally exceed this e.g. through too
	// many channels/streams, the protocol will halt.
	// https://smartcontract-it.atlassian.net/browse/MERC-6468
	MaxReportCount = ocr3types.MaxMaxReportCount

	// Maximum amount of channels that can be removed per round (if more than
	// this need to be removed, they will be removed in batches until
	// everything is up-to-date)
	MaxObservationRemoveChannelIDsLength = 5
	// Maximum amount of channels that can be added/updated per round (if more
	// than this need to be added, they will be added in batches until
	// everything is up-to-date)
	MaxObservationUpdateChannelDefinitionsLength = 5
	// Maximum number of streams that can be observed per round
	MaxObservationStreamValuesLength = 10_000
	// Maximum allowed number of streams per channel
	MaxStreamsPerChannel = 10_000
	// MaxOutcomeChannelDefinitionsLength is the maximum number of channels that
	// can be supported
	MaxOutcomeChannelDefinitionsLength = MaxReportCount
)

Additional limits so we can more effectively bound the size of observations NOTE: These are hardcoded because these exact values are relied upon as a property of coming to consensus, it's too dangerous to make these configurable on a per-node basis. It may be possible to add them to the OffchainConfig if they need to be changed dynamically and in a backwards-compatible way.

These LLO-protocol limits are shared across all plugin versions.

View Source
const (
	// DefaultMaxReportRange is the default maximum range of the report if unset in the opts.
	DefaultMaxReportRange = Duration(5 * time.Minute)
)

Variables

View Source
var (
	LLOStreamValue_Type_name = map[int32]string{
		0: "Decimal",
		1: "Quote",
		2: "TimestampedStreamValue",
	}
	LLOStreamValue_Type_value = map[string]int32{
		"Decimal":                0,
		"Quote":                  1,
		"TimestampedStreamValue": 2,
	}
)

Enum value maps for LLOStreamValue_Type.

View Source
var (
	ErrNilStreamValue = errors.New("nil stream value")
)
View Source
var File_llo_offchain_config_proto protoreflect.FileDescriptor
View Source
var File_llo_plugin_telemetry_proto protoreflect.FileDescriptor
View Source
var File_plugin_codecs_proto protoreflect.FileDescriptor

Functions

func Abs

func Abs(x any) (decimal.Decimal, error)

Abs returns the absolute value of x

func Add

func Add(x, y any) (decimal.Decimal, error)

Add returns the sum of x and y

func Avg

func Avg(x ...any) (decimal.Decimal, error)

Avg returns the average of x elements

func Ceil

func Ceil(x any) (decimal.Decimal, error)

Ceil returns the ceiling of x

func ConvertTimestamp

func ConvertTimestamp(timestampNanos uint64, resolution TimeResolution) uint64

ConvertTimestamp converts a nanosecond timestamp to a specified resolution.

func Decode

func Decode(value StreamValue, data []byte) error

func Div

func Div(x, y any) (decimal.Decimal, error)

Div returns the quotient of x and y

func DropInvalidHistoryBackfillChannels

func DropInvalidHistoryBackfillChannels(lggr logger.Logger, defs llotypes.ChannelDefinitions, nowNanos uint64) llotypes.ChannelDefinitions

DropInvalidHistoryBackfillChannels returns a copy of defs without history_backfill channels that fail validation. The input defs map is not modified. nowNanos should be wall-clock nanoseconds; use 0 to skip the future-timestamp check.

func Equal

func Equal(x, y any) (bool, error)

Equal returns true if x and y are equal

func Floor

func Floor(x any) (decimal.Decimal, error)

Floor returns the floor of x

func GetOpts

func GetOpts[T any](c *OptsCache, channelID llotypes.ChannelID) (T, error)

GetOpts returns decoded channel opts of type T for the given channel. On the first call for a given (channelID, T) after Set, the raw bytes are decoded via json.Unmarshal and the result is cached. Subsequent calls return the cached value directly.

Returns an error if the channel is not in the cache or decoding fails. The caller must pass a valid opts cache.

func GreaterThan

func GreaterThan(x, y any) (bool, error)

GreaterThan returns true if x is greater than y

func GreaterThanOrEqual

func GreaterThanOrEqual(x, y any) (bool, error)

GreaterThanOrEqual returns true if x is greater than or equal to y

func IsNegative

func IsNegative(x any) (bool, error)

IsNegative returns true if x is negative

func IsPositive

func IsPositive(x any) (bool, error)

IsPositive returns true if x is positive

func IsZero

func IsZero(x any) (bool, error)

IsZero returns true if x is zero

func LessThan

func LessThan(x, y any) (bool, error)

LessThan returns true if x is less than y

func LessThanOrEqual

func LessThanOrEqual(x, y any) (bool, error)

LessThanOrEqual returns true if x is less than or equal to y

func Ln

func Ln(x any) (decimal.Decimal, error)

Ln returns the natural logarithm of x.

func Log

func Log(x, y any) (decimal.Decimal, error)

Log returns the logarithms of y with base x. This is equivalent to log_x(y).

We use this formula:

             ln(y)
log_x(y)  =  ----
             ln(x)

func Max

func Max(x ...any) (decimal.Decimal, error)

Max returns the maximum of x elements

func Min

func Min(x ...any) (decimal.Decimal, error)

Min returns the minimum of x elements

func Mul

func Mul(x, y any) (decimal.Decimal, error)

Mul returns the product of x and y

func NewEnv

func NewEnv(observationTimestampNanoseconds uint64) environment

NewEnv returns a new environment with the default functions

func ObservationTimestampKeyToNanoseconds

func ObservationTimestampKeyToNanoseconds(rawKey uint64, res TimeResolution) uint64

ObservationTimestampKeyToNanoseconds converts a raw observation timestamp key from opts to nanoseconds.

func ParseDuration

func ParseDuration(x string) (time.Duration, error)

ParseDuration parses a duration string into a time.ParseDuration

func Pow

func Pow(x, y any) (decimal.Decimal, error)

Pow returns x, raised to the power of y

func ProcessCalculatedStreams

func ProcessCalculatedStreams(lggr logger.Logger, channelDefinitions llotypes.ChannelDefinitions, streamAggregates StreamAggregates, observationTimestampNanoseconds uint64, optsCache *OptsCache)

ProcessCalculatedStreams evaluates expressions for each channel of the EVMABIEncodeUnpackedExpr format, appending the calculated streams to their channel definitions and writing the evaluated values into streamAggregates. It is version-agnostic: both the v30 and v31 plugins call it with their own outcome/precursor fields.

func ProcessCalculatedStreamsDryRun

func ProcessCalculatedStreamsDryRun(expression string) error

ProcessCalculatedStreamsDryRun processes the calculated streams for the given expression against synthetic inputs and returns an error if it cannot be evaluated. Useful for validating expressions.

func ReportTimestampResolutionNanos

func ReportTimestampResolutionNanos(target llotypes.ChannelDefinition) (uint64, error)

ReportTimestampResolutionNanos returns one tick of the target channel's observation timestamp resolution in nanoseconds.

func Round

func Round(x any, precision int) (decimal.Decimal, error)

Round returns the rounded value of x to the given precision

func ScaleSeconds

func ScaleSeconds(seconds uint32, resolution TimeResolution) uint64

ScaleSeconds converts a duration in seconds to a target resolution.

func Sqrt

func Sqrt(x any) (decimal.Decimal, error)

Sqrt returns the square root of x. Returns error for negative values.

func Sub

func Sub(x, y any) (decimal.Decimal, error)

Sub returns the difference of x and y

func SubtractChannelDefinitions

func SubtractChannelDefinitions(minuend llotypes.ChannelDefinitions, subtrahend llotypes.ChannelDefinitions, limit int) llotypes.ChannelDefinitions

func Truncate

func Truncate(x any, precision int) (decimal.Decimal, error)

Truncate truncates off digits from the number, without rounding.

func ValidateHistoryBackfillAgainstDefinitions

func ValidateHistoryBackfillAgainstDefinitions(cd llotypes.ChannelDefinition, defs llotypes.ChannelDefinitions, nowNanos uint64) error

ValidateHistoryBackfillAgainstDefinitions checks a single history_backfill definition against the full map. If nowNanos > 0, observation timestamps (converted to nanoseconds) must be < nowNanos.

func VerifyChannelDefinitions

func VerifyChannelDefinitions(codecs map[llotypes.ReportFormat]ReportCodec, channelDefs llotypes.ChannelDefinitions) (merr error)

Types

type AggregatorFunc

type AggregatorFunc func(values []StreamValue, f int) (StreamValue, error)

func GetAggregatorFunc

func GetAggregatorFunc(a llotypes.Aggregator) AggregatorFunc

type ChannelDefinitionWithID

type ChannelDefinitionWithID struct {
	llotypes.ChannelDefinition
	ChannelID llotypes.ChannelID
}

type ChannelHash

type ChannelHash [32]byte

type Decimal

type Decimal decimal.Decimal

func ToDecimal

func ToDecimal(d decimal.Decimal) *Decimal

func (*Decimal) Decimal

func (v *Decimal) Decimal() decimal.Decimal

func (*Decimal) MarshalBinary

func (v *Decimal) MarshalBinary() ([]byte, error)

func (*Decimal) MarshalText

func (v *Decimal) MarshalText() ([]byte, error)

func (*Decimal) String

func (v *Decimal) String() string

func (*Decimal) Type

func (v *Decimal) Type() LLOStreamValue_Type

func (*Decimal) UnmarshalBinary

func (v *Decimal) UnmarshalBinary(data []byte) error

func (*Decimal) UnmarshalText

func (v *Decimal) UnmarshalText(data []byte) error

type Duration

type Duration time.Duration

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (Duration) String

func (d Duration) String() string

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type EVMOnchainConfigCodec

type EVMOnchainConfigCodec struct{}

EVMOnchainConfigCodec provides a llo-specific implementation of OnchainConfigCodec.

An encoded onchain config is expected to be in the format <version><predecessorConfigDigest> where version is a uint8 and min and max are in the format returned by EncodeValueInt192.

func (EVMOnchainConfigCodec) Decode

func (EVMOnchainConfigCodec) Encode

type HistoryBackfillOpts

type HistoryBackfillOpts struct {
	TargetChannelID llotypes.ChannelID `json:"targetChannelId"`
	// Observations maps raw timestamp keys (in the target channel's time resolution)
	// to stream ID -> serialized stream value string.
	Observations map[uint64]map[llotypes.StreamID]string `json:"-"`
}

HistoryBackfillOpts is the canonical JSON shape for history_backfill channel opts (after any DON-specific flattening into ChannelDefinition.Opts).

func ParseHistoryBackfillOpts

func ParseHistoryBackfillOpts(raw llotypes.ChannelOpts) (HistoryBackfillOpts, error)

ParseHistoryBackfillOpts decodes opts bytes into HistoryBackfillOpts.

func (*HistoryBackfillOpts) UnmarshalJSON

func (o *HistoryBackfillOpts) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes observations with string keys into uint64 maps.

type JSONReportCodec

type JSONReportCodec struct{}

func (JSONReportCodec) Decode

func (cdc JSONReportCodec) Decode(b []byte) (r Report, err error)

func (JSONReportCodec) Encode

func (JSONReportCodec) Pack

func (cdc JSONReportCodec) Pack(digest types.ConfigDigest, seqNr uint64, report ocr2types.Report, sigs []types.AttributedOnchainSignature) ([]byte, error)

func (JSONReportCodec) Unpack

func (cdc JSONReportCodec) Unpack(b []byte) (digest types.ConfigDigest, seqNr uint64, report ocr2types.Report, sigs []types.AttributedOnchainSignature, err error)

func (JSONReportCodec) UnpackDecode

func (cdc JSONReportCodec) UnpackDecode(b []byte) (digest types.ConfigDigest, seqNr uint64, report Report, sigs []types.AttributedOnchainSignature, err error)

func (JSONReportCodec) Verify

type LLOAggregatorStreamValue

type LLOAggregatorStreamValue struct {
	AggregatorValues map[uint32]*LLOStreamValue `` /* 184-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*LLOAggregatorStreamValue) Descriptor deprecated

func (*LLOAggregatorStreamValue) Descriptor() ([]byte, []int)

Deprecated: Use LLOAggregatorStreamValue.ProtoReflect.Descriptor instead.

func (*LLOAggregatorStreamValue) GetAggregatorValues

func (x *LLOAggregatorStreamValue) GetAggregatorValues() map[uint32]*LLOStreamValue

func (*LLOAggregatorStreamValue) ProtoMessage

func (*LLOAggregatorStreamValue) ProtoMessage()

func (*LLOAggregatorStreamValue) ProtoReflect

func (x *LLOAggregatorStreamValue) ProtoReflect() protoreflect.Message

func (*LLOAggregatorStreamValue) Reset

func (x *LLOAggregatorStreamValue) Reset()

func (*LLOAggregatorStreamValue) String

func (x *LLOAggregatorStreamValue) String() string

type LLOChannelDefinitionProto

type LLOChannelDefinitionProto struct {
	ReportFormat           uint32                 `protobuf:"varint,1,opt,name=reportFormat,proto3" json:"reportFormat,omitempty"`
	Streams                []*LLOStreamDefinition `protobuf:"bytes,2,rep,name=streams,proto3" json:"streams,omitempty"`
	Opts                   []byte                 `protobuf:"bytes,3,opt,name=opts,proto3" json:"opts,omitempty"`
	Tombstone              bool                   `protobuf:"varint,4,opt,name=tombstone,proto3" json:"tombstone,omitempty"`
	Source                 uint32                 `protobuf:"varint,5,opt,name=source,proto3" json:"source,omitempty"`
	DisableNilStreamValues bool                   `protobuf:"varint,6,opt,name=disableNilStreamValues,proto3" json:"disableNilStreamValues,omitempty"`
	// contains filtered or unexported fields
}

func (*LLOChannelDefinitionProto) Descriptor deprecated

func (*LLOChannelDefinitionProto) Descriptor() ([]byte, []int)

Deprecated: Use LLOChannelDefinitionProto.ProtoReflect.Descriptor instead.

func (*LLOChannelDefinitionProto) GetDisableNilStreamValues

func (x *LLOChannelDefinitionProto) GetDisableNilStreamValues() bool

func (*LLOChannelDefinitionProto) GetOpts

func (x *LLOChannelDefinitionProto) GetOpts() []byte

func (*LLOChannelDefinitionProto) GetReportFormat

func (x *LLOChannelDefinitionProto) GetReportFormat() uint32

func (*LLOChannelDefinitionProto) GetSource

func (x *LLOChannelDefinitionProto) GetSource() uint32

func (*LLOChannelDefinitionProto) GetStreams

func (*LLOChannelDefinitionProto) GetTombstone

func (x *LLOChannelDefinitionProto) GetTombstone() bool

func (*LLOChannelDefinitionProto) ProtoMessage

func (*LLOChannelDefinitionProto) ProtoMessage()

func (*LLOChannelDefinitionProto) ProtoReflect

func (*LLOChannelDefinitionProto) Reset

func (x *LLOChannelDefinitionProto) Reset()

func (*LLOChannelDefinitionProto) String

func (x *LLOChannelDefinitionProto) String() string

type LLOChannelIDAndDefinitionProto

type LLOChannelIDAndDefinitionProto struct {
	ChannelID         uint32                     `protobuf:"varint,1,opt,name=channelID,proto3" json:"channelID,omitempty"`
	ChannelDefinition *LLOChannelDefinitionProto `protobuf:"bytes,2,opt,name=channelDefinition,proto3" json:"channelDefinition,omitempty"`
	// contains filtered or unexported fields
}

func (*LLOChannelIDAndDefinitionProto) Descriptor deprecated

func (*LLOChannelIDAndDefinitionProto) Descriptor() ([]byte, []int)

Deprecated: Use LLOChannelIDAndDefinitionProto.ProtoReflect.Descriptor instead.

func (*LLOChannelIDAndDefinitionProto) GetChannelDefinition

func (x *LLOChannelIDAndDefinitionProto) GetChannelDefinition() *LLOChannelDefinitionProto

func (*LLOChannelIDAndDefinitionProto) GetChannelID

func (x *LLOChannelIDAndDefinitionProto) GetChannelID() uint32

func (*LLOChannelIDAndDefinitionProto) ProtoMessage

func (*LLOChannelIDAndDefinitionProto) ProtoMessage()

func (*LLOChannelIDAndDefinitionProto) ProtoReflect

func (*LLOChannelIDAndDefinitionProto) Reset

func (x *LLOChannelIDAndDefinitionProto) Reset()

func (*LLOChannelIDAndDefinitionProto) String

type LLOChannelIDAndValidAfterNanosecondsProto

type LLOChannelIDAndValidAfterNanosecondsProto struct {
	ChannelID             uint32 `protobuf:"varint,1,opt,name=channelID,proto3" json:"channelID,omitempty"`
	ValidAfterNanoseconds uint64 `protobuf:"varint,2,opt,name=validAfterNanoseconds,proto3" json:"validAfterNanoseconds,omitempty"`
	// contains filtered or unexported fields
}

func (*LLOChannelIDAndValidAfterNanosecondsProto) Descriptor deprecated

func (*LLOChannelIDAndValidAfterNanosecondsProto) Descriptor() ([]byte, []int)

Deprecated: Use LLOChannelIDAndValidAfterNanosecondsProto.ProtoReflect.Descriptor instead.

func (*LLOChannelIDAndValidAfterNanosecondsProto) GetChannelID

func (*LLOChannelIDAndValidAfterNanosecondsProto) GetValidAfterNanoseconds

func (x *LLOChannelIDAndValidAfterNanosecondsProto) GetValidAfterNanoseconds() uint64

func (*LLOChannelIDAndValidAfterNanosecondsProto) ProtoMessage

func (*LLOChannelIDAndValidAfterNanosecondsProto) ProtoReflect

func (*LLOChannelIDAndValidAfterNanosecondsProto) Reset

func (*LLOChannelIDAndValidAfterNanosecondsProto) String

type LLOChannelIDAndValidAfterSecondsProto

type LLOChannelIDAndValidAfterSecondsProto struct {
	ChannelID         uint32 `protobuf:"varint,1,opt,name=channelID,proto3" json:"channelID,omitempty"`
	ValidAfterSeconds uint32 `protobuf:"varint,2,opt,name=validAfterSeconds,proto3" json:"validAfterSeconds,omitempty"`
	// contains filtered or unexported fields
}

func (*LLOChannelIDAndValidAfterSecondsProto) Descriptor deprecated

func (*LLOChannelIDAndValidAfterSecondsProto) Descriptor() ([]byte, []int)

Deprecated: Use LLOChannelIDAndValidAfterSecondsProto.ProtoReflect.Descriptor instead.

func (*LLOChannelIDAndValidAfterSecondsProto) GetChannelID

func (*LLOChannelIDAndValidAfterSecondsProto) GetValidAfterSeconds

func (x *LLOChannelIDAndValidAfterSecondsProto) GetValidAfterSeconds() uint32

func (*LLOChannelIDAndValidAfterSecondsProto) ProtoMessage

func (*LLOChannelIDAndValidAfterSecondsProto) ProtoMessage()

func (*LLOChannelIDAndValidAfterSecondsProto) ProtoReflect

func (*LLOChannelIDAndValidAfterSecondsProto) Reset

func (*LLOChannelIDAndValidAfterSecondsProto) String

type LLOObservationProto

type LLOObservationProto struct {
	AttestedPredecessorRetirement []byte `protobuf:"bytes,1,opt,name=attestedPredecessorRetirement,proto3" json:"attestedPredecessorRetirement,omitempty"`
	ShouldRetire                  bool   `protobuf:"varint,2,opt,name=shouldRetire,proto3" json:"shouldRetire,omitempty"`
	// TODO: unixTimestampNanosecondsLegacy can be removed after this version
	// is rolled out everywhere
	UnixTimestampNanosecondsLegacy int64    `protobuf:"varint,3,opt,name=unixTimestampNanosecondsLegacy,proto3" json:"unixTimestampNanosecondsLegacy,omitempty"`
	UnixTimestampNanoseconds       uint64   `protobuf:"varint,7,opt,name=unixTimestampNanoseconds,proto3" json:"unixTimestampNanoseconds,omitempty"`
	RemoveChannelIDs               []uint32 `protobuf:"varint,4,rep,packed,name=removeChannelIDs,proto3" json:"removeChannelIDs,omitempty"`
	// Maps are safe to use here because Observation serialization does not
	// need to be deterministic. Non-deterministic map serialization is
	// marginally more efficient than converting to tuples and guarantees
	// uniqueness.
	UpdateChannelDefinitions map[uint32]*LLOChannelDefinitionProto `` /* 176-byte string literal not displayed */
	StreamValues             map[uint32]*LLOStreamValue            `` /* 152-byte string literal not displayed */
	// contains filtered or unexported fields
}

Observation CAN be changed as long as it doesn't break decode for legacy versions.

i.e. adding new fields is ok

func (*LLOObservationProto) Descriptor deprecated

func (*LLOObservationProto) Descriptor() ([]byte, []int)

Deprecated: Use LLOObservationProto.ProtoReflect.Descriptor instead.

func (*LLOObservationProto) GetAttestedPredecessorRetirement

func (x *LLOObservationProto) GetAttestedPredecessorRetirement() []byte

func (*LLOObservationProto) GetRemoveChannelIDs

func (x *LLOObservationProto) GetRemoveChannelIDs() []uint32

func (*LLOObservationProto) GetShouldRetire

func (x *LLOObservationProto) GetShouldRetire() bool

func (*LLOObservationProto) GetStreamValues

func (x *LLOObservationProto) GetStreamValues() map[uint32]*LLOStreamValue

func (*LLOObservationProto) GetUnixTimestampNanoseconds

func (x *LLOObservationProto) GetUnixTimestampNanoseconds() uint64

func (*LLOObservationProto) GetUnixTimestampNanosecondsLegacy

func (x *LLOObservationProto) GetUnixTimestampNanosecondsLegacy() int64

func (*LLOObservationProto) GetUpdateChannelDefinitions

func (x *LLOObservationProto) GetUpdateChannelDefinitions() map[uint32]*LLOChannelDefinitionProto

func (*LLOObservationProto) ProtoMessage

func (*LLOObservationProto) ProtoMessage()

func (*LLOObservationProto) ProtoReflect

func (x *LLOObservationProto) ProtoReflect() protoreflect.Message

func (*LLOObservationProto) Reset

func (x *LLOObservationProto) Reset()

func (*LLOObservationProto) String

func (x *LLOObservationProto) String() string

type LLOOffchainConfigProto

type LLOOffchainConfigProto struct {
	ProtocolVersion                     uint32 `protobuf:"varint,1,opt,name=protocolVersion,proto3" json:"protocolVersion,omitempty"`
	DefaultMinReportIntervalNanoseconds uint64 `protobuf:"varint,2,opt,name=defaultMinReportIntervalNanoseconds,proto3" json:"defaultMinReportIntervalNanoseconds,omitempty"`
	EnableObservationCompression        bool   `protobuf:"varint,3,opt,name=enableObservationCompression,proto3" json:"enableObservationCompression,omitempty"`
	// contains filtered or unexported fields
}

func (*LLOOffchainConfigProto) Descriptor deprecated

func (*LLOOffchainConfigProto) Descriptor() ([]byte, []int)

Deprecated: Use LLOOffchainConfigProto.ProtoReflect.Descriptor instead.

func (*LLOOffchainConfigProto) GetDefaultMinReportIntervalNanoseconds

func (x *LLOOffchainConfigProto) GetDefaultMinReportIntervalNanoseconds() uint64

func (*LLOOffchainConfigProto) GetEnableObservationCompression

func (x *LLOOffchainConfigProto) GetEnableObservationCompression() bool

func (*LLOOffchainConfigProto) GetProtocolVersion

func (x *LLOOffchainConfigProto) GetProtocolVersion() uint32

func (*LLOOffchainConfigProto) ProtoMessage

func (*LLOOffchainConfigProto) ProtoMessage()

func (*LLOOffchainConfigProto) ProtoReflect

func (x *LLOOffchainConfigProto) ProtoReflect() protoreflect.Message

func (*LLOOffchainConfigProto) Reset

func (x *LLOOffchainConfigProto) Reset()

func (*LLOOffchainConfigProto) String

func (x *LLOOffchainConfigProto) String() string

type LLOOutcomeProtoV0

type LLOOutcomeProtoV0 struct {
	LifeCycleStage                  string                                   `protobuf:"bytes,1,opt,name=lifeCycleStage,proto3" json:"lifeCycleStage,omitempty"`
	ObservationTimestampNanoseconds int64                                    `protobuf:"varint,2,opt,name=observationTimestampNanoseconds,proto3" json:"observationTimestampNanoseconds,omitempty"`
	ChannelDefinitions              []*LLOChannelIDAndDefinitionProto        `protobuf:"bytes,3,rep,name=channelDefinitions,proto3" json:"channelDefinitions,omitempty"`
	ValidAfterSeconds               []*LLOChannelIDAndValidAfterSecondsProto `protobuf:"bytes,4,rep,name=validAfterSeconds,proto3" json:"validAfterSeconds,omitempty"`
	StreamAggregates                []*LLOStreamAggregate                    `protobuf:"bytes,5,rep,name=streamAggregates,proto3" json:"streamAggregates,omitempty"`
	// contains filtered or unexported fields
}

NOTE: Outcome must serialize deterministically, hence use of repeated tuple instead of maps

func (*LLOOutcomeProtoV0) Descriptor deprecated

func (*LLOOutcomeProtoV0) Descriptor() ([]byte, []int)

Deprecated: Use LLOOutcomeProtoV0.ProtoReflect.Descriptor instead.

func (*LLOOutcomeProtoV0) GetChannelDefinitions

func (x *LLOOutcomeProtoV0) GetChannelDefinitions() []*LLOChannelIDAndDefinitionProto

func (*LLOOutcomeProtoV0) GetLifeCycleStage

func (x *LLOOutcomeProtoV0) GetLifeCycleStage() string

func (*LLOOutcomeProtoV0) GetObservationTimestampNanoseconds

func (x *LLOOutcomeProtoV0) GetObservationTimestampNanoseconds() int64

func (*LLOOutcomeProtoV0) GetStreamAggregates

func (x *LLOOutcomeProtoV0) GetStreamAggregates() []*LLOStreamAggregate

func (*LLOOutcomeProtoV0) GetValidAfterSeconds

func (x *LLOOutcomeProtoV0) GetValidAfterSeconds() []*LLOChannelIDAndValidAfterSecondsProto

func (*LLOOutcomeProtoV0) ProtoMessage

func (*LLOOutcomeProtoV0) ProtoMessage()

func (*LLOOutcomeProtoV0) ProtoReflect

func (x *LLOOutcomeProtoV0) ProtoReflect() protoreflect.Message

func (*LLOOutcomeProtoV0) Reset

func (x *LLOOutcomeProtoV0) Reset()

func (*LLOOutcomeProtoV0) String

func (x *LLOOutcomeProtoV0) String() string

type LLOOutcomeProtoV1

type LLOOutcomeProtoV1 struct {
	LifeCycleStage                  string                                       `protobuf:"bytes,1,opt,name=lifeCycleStage,proto3" json:"lifeCycleStage,omitempty"`
	ObservationTimestampNanoseconds uint64                                       `protobuf:"varint,2,opt,name=observationTimestampNanoseconds,proto3" json:"observationTimestampNanoseconds,omitempty"`
	ChannelDefinitions              []*LLOChannelIDAndDefinitionProto            `protobuf:"bytes,3,rep,name=channelDefinitions,proto3" json:"channelDefinitions,omitempty"`
	ValidAfterNanoseconds           []*LLOChannelIDAndValidAfterNanosecondsProto `protobuf:"bytes,4,rep,name=validAfterNanoseconds,proto3" json:"validAfterNanoseconds,omitempty"`
	StreamAggregates                []*LLOStreamAggregate                        `protobuf:"bytes,5,rep,name=streamAggregates,proto3" json:"streamAggregates,omitempty"`
	// contains filtered or unexported fields
}

NOTE: Outcome must serialize deterministically, hence use of repeated tuple instead of maps

func (*LLOOutcomeProtoV1) Descriptor deprecated

func (*LLOOutcomeProtoV1) Descriptor() ([]byte, []int)

Deprecated: Use LLOOutcomeProtoV1.ProtoReflect.Descriptor instead.

func (*LLOOutcomeProtoV1) GetChannelDefinitions

func (x *LLOOutcomeProtoV1) GetChannelDefinitions() []*LLOChannelIDAndDefinitionProto

func (*LLOOutcomeProtoV1) GetLifeCycleStage

func (x *LLOOutcomeProtoV1) GetLifeCycleStage() string

func (*LLOOutcomeProtoV1) GetObservationTimestampNanoseconds

func (x *LLOOutcomeProtoV1) GetObservationTimestampNanoseconds() uint64

func (*LLOOutcomeProtoV1) GetStreamAggregates

func (x *LLOOutcomeProtoV1) GetStreamAggregates() []*LLOStreamAggregate

func (*LLOOutcomeProtoV1) GetValidAfterNanoseconds

func (x *LLOOutcomeProtoV1) GetValidAfterNanoseconds() []*LLOChannelIDAndValidAfterNanosecondsProto

func (*LLOOutcomeProtoV1) ProtoMessage

func (*LLOOutcomeProtoV1) ProtoMessage()

func (*LLOOutcomeProtoV1) ProtoReflect

func (x *LLOOutcomeProtoV1) ProtoReflect() protoreflect.Message

func (*LLOOutcomeProtoV1) Reset

func (x *LLOOutcomeProtoV1) Reset()

func (*LLOOutcomeProtoV1) String

func (x *LLOOutcomeProtoV1) String() string

type LLOOutcomeTelemetry

type LLOOutcomeTelemetry struct {
	LifeCycleStage                  string `protobuf:"bytes,1,opt,name=life_cycle_stage,json=lifeCycleStage,proto3" json:"life_cycle_stage,omitempty"`
	ObservationTimestampNanoseconds uint64 `` /* 157-byte string literal not displayed */
	// channel id => channel definition
	ChannelDefinitions map[uint32]*LLOChannelDefinitionProto `` /* 190-byte string literal not displayed */
	// channel id => valid after nanoseconds
	ValidAfterNanoseconds map[uint32]uint64 `` /* 202-byte string literal not displayed */
	// stream id => aggregator => value
	StreamAggregates map[uint32]*LLOAggregatorStreamValue `` /* 184-byte string literal not displayed */
	SeqNr            uint64                               `protobuf:"varint,9,opt,name=seq_nr,json=seqNr,proto3" json:"seq_nr,omitempty"`
	ConfigDigest     []byte                               `protobuf:"bytes,10,opt,name=config_digest,json=configDigest,proto3" json:"config_digest,omitempty"`
	DonId            uint32                               `protobuf:"varint,11,opt,name=don_id,json=donId,proto3" json:"don_id,omitempty"`
	// contains filtered or unexported fields
}

LLOOutcomeTelemetry sent on every call to Outcome (once per round)

func (*LLOOutcomeTelemetry) Descriptor deprecated

func (*LLOOutcomeTelemetry) Descriptor() ([]byte, []int)

Deprecated: Use LLOOutcomeTelemetry.ProtoReflect.Descriptor instead.

func (*LLOOutcomeTelemetry) GetChannelDefinitions

func (x *LLOOutcomeTelemetry) GetChannelDefinitions() map[uint32]*LLOChannelDefinitionProto

func (*LLOOutcomeTelemetry) GetConfigDigest

func (x *LLOOutcomeTelemetry) GetConfigDigest() []byte

func (*LLOOutcomeTelemetry) GetDonId

func (x *LLOOutcomeTelemetry) GetDonId() uint32

func (*LLOOutcomeTelemetry) GetLifeCycleStage

func (x *LLOOutcomeTelemetry) GetLifeCycleStage() string

func (*LLOOutcomeTelemetry) GetObservationTimestampNanoseconds

func (x *LLOOutcomeTelemetry) GetObservationTimestampNanoseconds() uint64

func (*LLOOutcomeTelemetry) GetSeqNr

func (x *LLOOutcomeTelemetry) GetSeqNr() uint64

func (*LLOOutcomeTelemetry) GetStreamAggregates

func (x *LLOOutcomeTelemetry) GetStreamAggregates() map[uint32]*LLOAggregatorStreamValue

func (*LLOOutcomeTelemetry) GetValidAfterNanoseconds

func (x *LLOOutcomeTelemetry) GetValidAfterNanoseconds() map[uint32]uint64

func (*LLOOutcomeTelemetry) ProtoMessage

func (*LLOOutcomeTelemetry) ProtoMessage()

func (*LLOOutcomeTelemetry) ProtoReflect

func (x *LLOOutcomeTelemetry) ProtoReflect() protoreflect.Message

func (*LLOOutcomeTelemetry) Reset

func (x *LLOOutcomeTelemetry) Reset()

func (*LLOOutcomeTelemetry) String

func (x *LLOOutcomeTelemetry) String() string

type LLOReportTelemetry

type LLOReportTelemetry struct {
	ChannelId                       uint32                 `protobuf:"varint,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"`
	ValidAfterNanoseconds           uint64                 `` /* 127-byte string literal not displayed */
	ObservationTimestampNanoseconds uint64                 `` /* 157-byte string literal not displayed */
	ReportFormat                    uint32                 `protobuf:"varint,4,opt,name=report_format,json=reportFormat,proto3" json:"report_format,omitempty"`
	Specimen                        bool                   `protobuf:"varint,5,opt,name=specimen,proto3" json:"specimen,omitempty"`
	StreamDefinitions               []*LLOStreamDefinition `protobuf:"bytes,6,rep,name=stream_definitions,json=streamDefinitions,proto3" json:"stream_definitions,omitempty"`
	StreamValues                    []*LLOStreamValue      `protobuf:"bytes,7,rep,name=stream_values,json=streamValues,proto3" json:"stream_values,omitempty"`
	ChannelOpts                     []byte                 `protobuf:"bytes,8,opt,name=channel_opts,json=channelOpts,proto3" json:"channel_opts,omitempty"`
	SeqNr                           uint64                 `protobuf:"varint,9,opt,name=seq_nr,json=seqNr,proto3" json:"seq_nr,omitempty"`
	ConfigDigest                    []byte                 `protobuf:"bytes,10,opt,name=config_digest,json=configDigest,proto3" json:"config_digest,omitempty"`
	DonId                           uint32                 `protobuf:"varint,11,opt,name=don_id,json=donId,proto3" json:"don_id,omitempty"`
	// contains filtered or unexported fields
}

LLOReportTelemetry sent for each report on every call to Reports

func (*LLOReportTelemetry) Descriptor deprecated

func (*LLOReportTelemetry) Descriptor() ([]byte, []int)

Deprecated: Use LLOReportTelemetry.ProtoReflect.Descriptor instead.

func (*LLOReportTelemetry) GetChannelId

func (x *LLOReportTelemetry) GetChannelId() uint32

func (*LLOReportTelemetry) GetChannelOpts

func (x *LLOReportTelemetry) GetChannelOpts() []byte

func (*LLOReportTelemetry) GetConfigDigest

func (x *LLOReportTelemetry) GetConfigDigest() []byte

func (*LLOReportTelemetry) GetDonId

func (x *LLOReportTelemetry) GetDonId() uint32

func (*LLOReportTelemetry) GetObservationTimestampNanoseconds

func (x *LLOReportTelemetry) GetObservationTimestampNanoseconds() uint64

func (*LLOReportTelemetry) GetReportFormat

func (x *LLOReportTelemetry) GetReportFormat() uint32

func (*LLOReportTelemetry) GetSeqNr

func (x *LLOReportTelemetry) GetSeqNr() uint64

func (*LLOReportTelemetry) GetSpecimen

func (x *LLOReportTelemetry) GetSpecimen() bool

func (*LLOReportTelemetry) GetStreamDefinitions

func (x *LLOReportTelemetry) GetStreamDefinitions() []*LLOStreamDefinition

func (*LLOReportTelemetry) GetStreamValues

func (x *LLOReportTelemetry) GetStreamValues() []*LLOStreamValue

func (*LLOReportTelemetry) GetValidAfterNanoseconds

func (x *LLOReportTelemetry) GetValidAfterNanoseconds() uint64

func (*LLOReportTelemetry) ProtoMessage

func (*LLOReportTelemetry) ProtoMessage()

func (*LLOReportTelemetry) ProtoReflect

func (x *LLOReportTelemetry) ProtoReflect() protoreflect.Message

func (*LLOReportTelemetry) Reset

func (x *LLOReportTelemetry) Reset()

func (*LLOReportTelemetry) String

func (x *LLOReportTelemetry) String() string

type LLOStreamAggregate

type LLOStreamAggregate struct {
	StreamID    uint32          `protobuf:"varint,1,opt,name=streamID,proto3" json:"streamID,omitempty"`
	StreamValue *LLOStreamValue `protobuf:"bytes,2,opt,name=streamValue,proto3" json:"streamValue,omitempty"`
	Aggregator  uint32          `protobuf:"varint,3,opt,name=aggregator,proto3" json:"aggregator,omitempty"`
	// contains filtered or unexported fields
}

func (*LLOStreamAggregate) Descriptor deprecated

func (*LLOStreamAggregate) Descriptor() ([]byte, []int)

Deprecated: Use LLOStreamAggregate.ProtoReflect.Descriptor instead.

func (*LLOStreamAggregate) GetAggregator

func (x *LLOStreamAggregate) GetAggregator() uint32

func (*LLOStreamAggregate) GetStreamID

func (x *LLOStreamAggregate) GetStreamID() uint32

func (*LLOStreamAggregate) GetStreamValue

func (x *LLOStreamAggregate) GetStreamValue() *LLOStreamValue

func (*LLOStreamAggregate) ProtoMessage

func (*LLOStreamAggregate) ProtoMessage()

func (*LLOStreamAggregate) ProtoReflect

func (x *LLOStreamAggregate) ProtoReflect() protoreflect.Message

func (*LLOStreamAggregate) Reset

func (x *LLOStreamAggregate) Reset()

func (*LLOStreamAggregate) String

func (x *LLOStreamAggregate) String() string

type LLOStreamDefinition

type LLOStreamDefinition struct {
	StreamID   uint32 `protobuf:"varint,1,opt,name=streamID,proto3" json:"streamID,omitempty"`
	Aggregator uint32 `protobuf:"varint,2,opt,name=aggregator,proto3" json:"aggregator,omitempty"`
	// contains filtered or unexported fields
}

func (*LLOStreamDefinition) Descriptor deprecated

func (*LLOStreamDefinition) Descriptor() ([]byte, []int)

Deprecated: Use LLOStreamDefinition.ProtoReflect.Descriptor instead.

func (*LLOStreamDefinition) GetAggregator

func (x *LLOStreamDefinition) GetAggregator() uint32

func (*LLOStreamDefinition) GetStreamID

func (x *LLOStreamDefinition) GetStreamID() uint32

func (*LLOStreamDefinition) ProtoMessage

func (*LLOStreamDefinition) ProtoMessage()

func (*LLOStreamDefinition) ProtoReflect

func (x *LLOStreamDefinition) ProtoReflect() protoreflect.Message

func (*LLOStreamDefinition) Reset

func (x *LLOStreamDefinition) Reset()

func (*LLOStreamDefinition) String

func (x *LLOStreamDefinition) String() string

type LLOStreamObservationProto

type LLOStreamObservationProto struct {
	Valid bool   `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"`
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*LLOStreamObservationProto) Descriptor deprecated

func (*LLOStreamObservationProto) Descriptor() ([]byte, []int)

Deprecated: Use LLOStreamObservationProto.ProtoReflect.Descriptor instead.

func (*LLOStreamObservationProto) GetValid

func (x *LLOStreamObservationProto) GetValid() bool

func (*LLOStreamObservationProto) GetValue

func (x *LLOStreamObservationProto) GetValue() []byte

func (*LLOStreamObservationProto) ProtoMessage

func (*LLOStreamObservationProto) ProtoMessage()

func (*LLOStreamObservationProto) ProtoReflect

func (*LLOStreamObservationProto) Reset

func (x *LLOStreamObservationProto) Reset()

func (*LLOStreamObservationProto) String

func (x *LLOStreamObservationProto) String() string

type LLOStreamValue

type LLOStreamValue struct {
	Type  LLOStreamValue_Type `protobuf:"varint,1,opt,name=type,proto3,enum=v1.LLOStreamValue_Type" json:"type,omitempty"`
	Value []byte              `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*LLOStreamValue) Descriptor deprecated

func (*LLOStreamValue) Descriptor() ([]byte, []int)

Deprecated: Use LLOStreamValue.ProtoReflect.Descriptor instead.

func (*LLOStreamValue) GetType

func (x *LLOStreamValue) GetType() LLOStreamValue_Type

func (*LLOStreamValue) GetValue

func (x *LLOStreamValue) GetValue() []byte

func (*LLOStreamValue) ProtoMessage

func (*LLOStreamValue) ProtoMessage()

func (*LLOStreamValue) ProtoReflect

func (x *LLOStreamValue) ProtoReflect() protoreflect.Message

func (*LLOStreamValue) Reset

func (x *LLOStreamValue) Reset()

func (*LLOStreamValue) String

func (x *LLOStreamValue) String() string

type LLOStreamValueQuote

type LLOStreamValueQuote struct {
	Bid       []byte `protobuf:"bytes,1,opt,name=bid,proto3" json:"bid,omitempty"`
	Benchmark []byte `protobuf:"bytes,2,opt,name=benchmark,proto3" json:"benchmark,omitempty"`
	Ask       []byte `protobuf:"bytes,3,opt,name=ask,proto3" json:"ask,omitempty"`
	// contains filtered or unexported fields
}

func (*LLOStreamValueQuote) Descriptor deprecated

func (*LLOStreamValueQuote) Descriptor() ([]byte, []int)

Deprecated: Use LLOStreamValueQuote.ProtoReflect.Descriptor instead.

func (*LLOStreamValueQuote) GetAsk

func (x *LLOStreamValueQuote) GetAsk() []byte

func (*LLOStreamValueQuote) GetBenchmark

func (x *LLOStreamValueQuote) GetBenchmark() []byte

func (*LLOStreamValueQuote) GetBid

func (x *LLOStreamValueQuote) GetBid() []byte

func (*LLOStreamValueQuote) ProtoMessage

func (*LLOStreamValueQuote) ProtoMessage()

func (*LLOStreamValueQuote) ProtoReflect

func (x *LLOStreamValueQuote) ProtoReflect() protoreflect.Message

func (*LLOStreamValueQuote) Reset

func (x *LLOStreamValueQuote) Reset()

func (*LLOStreamValueQuote) String

func (x *LLOStreamValueQuote) String() string

type LLOStreamValue_Type

type LLOStreamValue_Type int32
const (
	LLOStreamValue_Decimal                LLOStreamValue_Type = 0
	LLOStreamValue_Quote                  LLOStreamValue_Type = 1
	LLOStreamValue_TimestampedStreamValue LLOStreamValue_Type = 2
)

func (LLOStreamValue_Type) Descriptor

func (LLOStreamValue_Type) Enum

func (LLOStreamValue_Type) EnumDescriptor deprecated

func (LLOStreamValue_Type) EnumDescriptor() ([]byte, []int)

Deprecated: Use LLOStreamValue_Type.Descriptor instead.

func (LLOStreamValue_Type) Number

func (LLOStreamValue_Type) String

func (x LLOStreamValue_Type) String() string

func (LLOStreamValue_Type) Type

type LLOTimestampedStreamValue

type LLOTimestampedStreamValue struct {
	ObservedAtNanoseconds uint64          `protobuf:"varint,1,opt,name=observedAtNanoseconds,proto3" json:"observedAtNanoseconds,omitempty"`
	StreamValue           *LLOStreamValue `protobuf:"bytes,2,opt,name=streamValue,proto3" json:"streamValue,omitempty"`
	// contains filtered or unexported fields
}

func (*LLOTimestampedStreamValue) Descriptor deprecated

func (*LLOTimestampedStreamValue) Descriptor() ([]byte, []int)

Deprecated: Use LLOTimestampedStreamValue.ProtoReflect.Descriptor instead.

func (*LLOTimestampedStreamValue) GetObservedAtNanoseconds

func (x *LLOTimestampedStreamValue) GetObservedAtNanoseconds() uint64

func (*LLOTimestampedStreamValue) GetStreamValue

func (x *LLOTimestampedStreamValue) GetStreamValue() *LLOStreamValue

func (*LLOTimestampedStreamValue) ProtoMessage

func (*LLOTimestampedStreamValue) ProtoMessage()

func (*LLOTimestampedStreamValue) ProtoReflect

func (*LLOTimestampedStreamValue) Reset

func (x *LLOTimestampedStreamValue) Reset()

func (*LLOTimestampedStreamValue) String

func (x *LLOTimestampedStreamValue) String() string

type OffchainConfig

type OffchainConfig struct {
	ProtocolVersion uint32
	// DefaultMinReportIntervalNanoseconds is the default minimum report interval in nanoseconds.
	// It must be set to 0 for protocol version 0.
	// It must be set to 1 or greater for protocol version 1+.
	//
	// NOTE: This merely controls the _minimum_ interval between reports. It
	// does not guarantee a maximum interval. If you want reports to be
	// produced quickly, you are still limited by OCR3's DeltaRound and
	// DeltaGrace params, as well as networking latency.
	DefaultMinReportIntervalNanoseconds uint64
	// EnableObservationCompression enables observation compression.
	EnableObservationCompression bool
}

func DecodeOffchainConfig

func DecodeOffchainConfig(b []byte) (o OffchainConfig, err error)

func (OffchainConfig) Encode

func (c OffchainConfig) Encode() ([]byte, error)

func (OffchainConfig) Validate

func (c OffchainConfig) Validate() error

type OnchainConfig

type OnchainConfig struct {
	Version                 uint8
	PredecessorConfigDigest *types.ConfigDigest
}

type OnchainConfigCodec

type OnchainConfigCodec interface {
	Decode(b []byte) (OnchainConfig, error)
	Encode(OnchainConfig) ([]byte, error)
}

type OptsCache

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

OptsCache caches decoded channel definition options keyed by (ChannelID, target type). Raw opts bytes are stored via Set during channel definition changes in Outcome(). Decoded values are produced lazily on the first GetOpts call for a given (channelID, type) and reused until the channel is updated or removed.

func NewOptsCache

func NewOptsCache() *OptsCache

func (*OptsCache) Len

func (c *OptsCache) Len() int

Len returns the number of channels in the cache.

func (*OptsCache) Remove

func (c *OptsCache) Remove(channelID llotypes.ChannelID)

Remove removes all raw and decoded data for a channel.

func (*OptsCache) ResetTo

func (c *OptsCache) ResetTo(channelDefinitions llotypes.ChannelDefinitions)

ResetTo resets the cache to the given channel definitions.

func (*OptsCache) Set

func (c *OptsCache) Set(channelID llotypes.ChannelID, raw llotypes.ChannelOpts)

Set stores the raw opts for a channel and invalidates any previously decoded values for that channel. It is a no-op when the raw bytes are identical to what is already stored.

type PredecessorRetirementReportCache

type PredecessorRetirementReportCache interface {
	// AttestedRetirementReport returns the attested retirement report for the
	// given config digest from the local cache.
	//
	// This should return nil and not error in the case of a missing attested
	// retirement report.
	AttestedRetirementReport(predecessorConfigDigest ocr2types.ConfigDigest) ([]byte, error)
	// CheckAttestedRetirementReport verifies that an attested retirement
	// report, which may have come from another node, is valid (signed) with
	// signers corresponding to the given config digest
	CheckAttestedRetirementReport(predecessorConfigDigest ocr2types.ConfigDigest, attestedRetirementReport []byte) (RetirementReport, error)
}

The predecessor protocol instance stores its attested retirement report in this cache (locally, offchain), so it can be fetched by the successor protocol instance.

PredecessorRetirementReportCache is populated by the old protocol instance writing to it and the new protocol instance reading from it.

The sketch envisions it being implemented as a single object that is shared between different protocol instances.

type Quote

type Quote struct {
	Bid       decimal.Decimal
	Benchmark decimal.Decimal
	Ask       decimal.Decimal
}

func (*Quote) IsValid

func (v *Quote) IsValid() bool

func (*Quote) MarshalBinary

func (v *Quote) MarshalBinary() (b []byte, err error)

func (*Quote) MarshalText

func (v *Quote) MarshalText() ([]byte, error)

func (*Quote) Type

func (v *Quote) Type() LLOStreamValue_Type

func (*Quote) UnmarshalBinary

func (v *Quote) UnmarshalBinary(data []byte) error

func (*Quote) UnmarshalText

func (v *Quote) UnmarshalText(data []byte) error

type Report

type Report struct {
	ConfigDigest types.ConfigDigest
	// OCR sequence number of this report
	SeqNr uint64
	// Channel that is being reported on
	ChannelID llotypes.ChannelID
	// Report is only valid at t > ValidAfterNanoseconds
	// ValidAfterNanoseconds < ObservationTimestampNanoseconds always, by enforcement
	// in IsReportable
	ValidAfterNanoseconds uint64
	// ObservationTimestampNanoseconds is the median of all observation timestamps
	// (note that this timestamp is taken immediately before we initiate any
	// observations)
	ObservationTimestampNanoseconds uint64
	// Values for every stream in the channel
	Values []StreamValue
	// The contract onchain will only validate non-specimen reports. A staging
	// protocol instance will generate specimen reports so we can validate it
	// works properly without any risk of misreports landing on chain.
	Specimen bool
}

type ReportCodec

type ReportCodec interface {
	// Encode may be lossy, so no Decode function is expected
	// Encode should handle nil stream aggregate values without panicking (it
	// may return error instead).
	// Codecs may use GetOpts(optsCache, report.ChannelID) to get cached parsed opts.
	Encode(Report, llotypes.ChannelDefinition, *OptsCache) ([]byte, error)
	// Verify may optionally verify a channel definition to ensure it is valid
	// for the given report codec. If a codec does not wish to implement
	// validation it may simply return nil here. If any definition fails
	// validation, the entire channel definitions file will be rejected.
	// This can be useful to ensure that e.g. options aren't changed
	// accidentally to something that would later break a report on encoding.
	Verify(llotypes.ChannelDefinition) error
}

type ReportCodecHistoryBackfill

type ReportCodecHistoryBackfill struct{}

ReportCodecHistoryBackfill validates channel definitions; encoding is delegated to the target channel codec.

func (ReportCodecHistoryBackfill) Encode

func (ReportCodecHistoryBackfill) Verify

type RetirementReport

type RetirementReport struct {
	// Retirement reports are not guaranteed to be compatible across different
	// protocol versions
	ProtocolVersion uint32
	// Carries validity time stamps between protocol instances to ensure there
	// are no gaps
	ValidAfterNanoseconds map[llotypes.ChannelID]uint64
}

type RetirementReportCodec

type RetirementReportCodec interface {
	Encode(RetirementReport) ([]byte, error)
	Decode([]byte) (RetirementReport, error)
}

type StandardRetirementReportCodec

type StandardRetirementReportCodec struct{}

func (StandardRetirementReportCodec) Decode

func (StandardRetirementReportCodec) Encode

type StreamAggregates

type StreamAggregates map[llotypes.StreamID]map[llotypes.Aggregator]StreamValue

type StreamValue

type StreamValue interface {
	// Binary marshaler/unmarshaler used for protobufs
	// Unmarshal should NOT panic on nil receiver, but instead return ErrNilStreamValue
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
	// TextMarshaler needed for JSON serialization and logging
	// Unmarshal should NOT panic on nil receiver, but instead return ErrNilStreamValue
	encoding.TextMarshaler
	encoding.TextUnmarshaler
	// Type is needed for proto serialization so we know how to unserialize it
	Type() LLOStreamValue_Type
}

func BuildBackfillStreamValues

func BuildBackfillStreamValues(target llotypes.ChannelDefinition, row map[llotypes.StreamID]string) ([]StreamValue, error)

BuildBackfillStreamValues builds stream values for a backfill timestamp row in target stream order.

func MedianAggregator

func MedianAggregator(values []StreamValue, f int) (StreamValue, error)

func ModeAggregator

func ModeAggregator(values []StreamValue, f int) (StreamValue, error)

ModeAggregator works on arbitrary StreamValue types It picks the most common value There must be at least f+1 observations in agreement in order to produce a value nil observations are ignored

func QuoteAggregator

func QuoteAggregator(values []StreamValue, f int) (StreamValue, error)

func StreamValueFromBackfillString

func StreamValueFromBackfillString(agg llotypes.Aggregator, s string) (StreamValue, error)

StreamValueFromBackfillString parses a backfill observation string for the given aggregator.

func UnmarshalProtoStreamValue

func UnmarshalProtoStreamValue(enc *LLOStreamValue) (sv StreamValue, err error)

func UnmarshalTypedTextStreamValue

func UnmarshalTypedTextStreamValue(enc *TypedTextStreamValue) (StreamValue, error)

type StreamValues

type StreamValues map[llotypes.StreamID]StreamValue

Values for a set of streams, e.g. "eth-usd", "link-usd", "eur-chf" etc StreamIDs are uint32

type TimeResolution

type TimeResolution uint8

TimeResolution represents the resolution for timestamp conversion

const (
	ResolutionSeconds TimeResolution = iota
	ResolutionMilliseconds
	ResolutionMicroseconds
	ResolutionNanoseconds
)

func TargetChannelTimeResolution

func TargetChannelTimeResolution(target llotypes.ChannelDefinition) (TimeResolution, error)

func (TimeResolution) MarshalJSON

func (tp TimeResolution) MarshalJSON() ([]byte, error)

func (*TimeResolution) UnmarshalJSON

func (tp *TimeResolution) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals TimeResolution from JSON - used to unmarshal from the Opts structs.

type TimestampedStreamValue

type TimestampedStreamValue struct {
	ObservedAtNanoseconds uint64      `json:"observedAtNanoseconds"`
	StreamValue           StreamValue `json:"streamValue"`
}

TimestampedStreamValue is a StreamValue with an associated timestamp

func (*TimestampedStreamValue) MarshalBinary

func (v *TimestampedStreamValue) MarshalBinary() ([]byte, error)

func (*TimestampedStreamValue) MarshalText

func (v *TimestampedStreamValue) MarshalText() ([]byte, error)

func (*TimestampedStreamValue) Type

func (*TimestampedStreamValue) UnmarshalBinary

func (v *TimestampedStreamValue) UnmarshalBinary(data []byte) error

func (*TimestampedStreamValue) UnmarshalText

func (v *TimestampedStreamValue) UnmarshalText(data []byte) error

type Transmitter

type Transmitter interface {
	// NOTE: Mercury doesn't actually transmit on-chain, so there is no
	// "contract" involved with the transmitter.
	// - Transmit should be implemented and send to Mercury server
	// - FromAccount() should return CSA public key
	ocr3types.ContractTransmitter[llotypes.ReportInfo]
}

type TypedTextStreamValue

type TypedTextStreamValue struct {
	Type                  LLOStreamValue_Type `json:"t"`
	SerializedStreamValue string              `json:"v"`
}

func NewTypedTextStreamValue

func NewTypedTextStreamValue(sv StreamValue) (TypedTextStreamValue, error)

Jump to

Keyboard shortcuts

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