pluginconfig

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 14 Imported by: 4

Documentation

Index

Constants

View Source
const MaxPluginConfigSize = 8 * 1024 * 1024 // 8 MiB

MaxPluginConfigSize is a sanity limit on the size of the JSON-encoded plugin config. It is generous enough to hold inline ChannelDefinitions for very large DONs, while preventing unbounded allocations from a malformed or hostile config blob.

View Source
const MaxProtocolInstances = 2

MaxProtocolInstances is the number of protocol instances one LLO job may run: one production instance, plus one staging instance during a blue/green handover. It bounds PluginVersions.

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration added in v1.1.2

type Duration time.Duration

Duration is a time.Duration that decodes from a duration string in both TOML and JSON, so the v31 knobs read as "2s" in a job spec.

func (Duration) Duration added in v1.1.2

func (d Duration) Duration() time.Duration

func (Duration) MarshalJSON added in v1.1.2

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

func (Duration) MarshalText added in v1.1.2

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

func (Duration) String added in v1.1.2

func (d Duration) String() string

func (*Duration) UnmarshalJSON added in v1.1.2

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

UnmarshalJSON accepts a duration string ("2s") or a plain number of nanoseconds, matching time.Duration's own JSON encoding.

func (*Duration) UnmarshalText added in v1.1.2

func (d *Duration) UnmarshalText(text []byte) error

type PluginConfig

type PluginConfig struct {
	ChannelDefinitionsContractAddress   common.Address `json:"channelDefinitionsContractAddress" toml:"channelDefinitionsContractAddress"`
	ChannelDefinitionsContractFromBlock int64          `json:"channelDefinitionsContractFromBlock" toml:"channelDefinitionsContractFromBlock"`

	// NOTE: ChannelDefinitions is an override.
	// If ChannelDefinitions is specified, values for
	// ChannelDefinitionsContractAddress and
	// ChannelDefinitionsContractFromBlock will be ignored
	ChannelDefinitions string `json:"channelDefinitions" toml:"channelDefinitions"`

	// BenchmarkMode is a flag to enable benchmarking mode. In this mode, the
	// transmitter will not transmit anything at all and instead emit
	// logs/metrics.
	BenchmarkMode bool `json:"benchmarkMode" toml:"benchmarkMode"`

	// KeyBundleIDs maps supported keys to their respective bundle IDs
	// Key must match llo's ReportFormat
	KeyBundleIDs map[string]string `json:"keyBundleIDs" toml:"keyBundleIDs"`

	DonID uint32 `json:"donID" toml:"donID"`

	// Mercury servers
	Servers map[string]hex.PlainHexBytes `json:"servers" toml:"servers"`

	Transmitters []TransmitterConfig `json:"transmitters" toml:"transmitters"`

	// PluginVersion selects the LLO plugin the job runs on:
	//   "" or "v30" => llo/v30, on libocr OCR3.0
	//   "v31"       => llo/dev/v31, on libocr OCR3.1
	// NOTE: this names the plugin package, not the LLO offchain ProtocolVersion
	// (0/1/2) carried in the offchain config, nor the ocr2 job spec's own
	// OCRVersion.
	//
	// It applies to every protocol instance in the job. To run the instances on
	// different plugins, which is what a v30 -> v31 blue/green handover needs,
	// use PluginVersions instead.
	PluginVersion PluginVersion `json:"pluginVersion" toml:"pluginVersion"`

	// PluginVersions selects the plugin per protocol instance, positionally
	// aligned with the job's contract config trackers (index 0 is "Blue", index
	// 1 is "Green"). Entries take the same values as PluginVersion.
	//
	// This exists for the blue/green handover between the v30 and v31 plugins,
	// where the two instances of one job deliberately run different versions:
	//
	//	"pluginVersions": ["v30", "v31"]
	//
	// When empty, every instance falls back to the scalar PluginVersion, so job
	// specs predating this field are unaffected. When non-empty it takes
	// precedence, and its length must match the number of trackers: that check
	// belongs to the consumer, which is the only side that knows how many there
	// are. Validate here only bounds the length and checks each entry.
	PluginVersions []PluginVersion `json:"pluginVersions" toml:"pluginVersions"`

	// V31 carries the v31 plugin knobs. Only read when the job runs any v31
	// instance.
	V31 V31Config `json:"v31" toml:"v31"`
}

func (PluginConfig) AnyV31 added in v1.1.2

func (p PluginConfig) AnyV31() bool

AnyV31 reports whether any protocol instance runs on v31.

This is the predicate for building the OCR3.1-only dependencies (the 3.1 network endpoint factory, the key-value database factory): during a handover only one of the two instances is v31, but the dependencies are per job.

func (PluginConfig) GetServers

func (p PluginConfig) GetServers() (servers []mercuryconfig.Server)

func (PluginConfig) IsV31 added in v1.1.2

func (p PluginConfig) IsV31() bool

IsV31 reports whether the job should run on the v31 (libocr OCR3.1) plugin.

NOTE: this reads the scalar PluginVersion only, so it is wrong for a job with a mixed PluginVersions list. Prefer IsV31Instance for selecting a plugin and AnyV31 for deciding whether to build the OCR3.1-only dependencies. It is kept for consumers that have not moved to the per-instance accessors yet.

func (PluginConfig) IsV31Instance added in v1.1.2

func (p PluginConfig) IsV31Instance(i int) bool

IsV31Instance reports whether protocol instance i runs on the v31 (libocr OCR3.1) plugin.

func (PluginConfig) PluginVersionForInstance added in v1.1.2

func (p PluginConfig) PluginVersionForInstance(i int) PluginVersion

PluginVersionForInstance returns the plugin version for protocol instance i, normalized so that the empty value is reported as PluginVersionV30.

It falls back to the scalar PluginVersion when PluginVersions is empty or does not reach index i. A short list is not an error here: Validate bounds its length, and matching it against the actual tracker count is the consumer's job.

func (*PluginConfig) Unmarshal

func (p *PluginConfig) Unmarshal(data []byte) error

func (PluginConfig) Validate

func (p PluginConfig) Validate() (merr error)

type PluginVersion added in v1.1.2

type PluginVersion string

PluginVersion names an LLO plugin package. The empty value means PluginVersionV30, so that a job spec predating the field keeps working.

const (
	PluginVersionV30 PluginVersion = "v30"
	PluginVersionV31 PluginVersion = "v31"
)

type TransmitterConfig

type TransmitterConfig struct {
	Type TransmitterType `json:"type" toml:"type"`
	// each sub-transmitter can have its own specific configuration
	Opts json.RawMessage `json:"opts" toml:"opts"`
}

type TransmitterType

type TransmitterType int
const (
	TransmitterTypeCRE TransmitterType = iota
)

func (TransmitterType) String

func (t TransmitterType) String() string

func (*TransmitterType) UnmarshalText

func (t *TransmitterType) UnmarshalText(text []byte) error

type V31Config added in v1.1.2

type V31Config struct {
	// VerboseLogging enables additional, potentially expensive logging.
	VerboseLogging bool `json:"verboseLogging" toml:"verboseLogging"`

	// BlobLifetimeRounds bounds how long peers can still fetch a broadcast
	// blob, and so for how many rounds a snapshot can be offered. It does not
	// bound staleness, the state transition does.
	BlobLifetimeRounds uint64 `json:"blobLifetimeRounds" toml:"blobLifetimeRounds"`

	// MaxDurationBlobObservation is the blob pump's per-cycle observation
	// budget.
	MaxDurationBlobObservation Duration `json:"maxDurationBlobObservation" toml:"maxDurationBlobObservation"`

	// BlobInFlightWaitFactor divides MaxDurationObservation into how long Take
	// waits for a cycle already in flight to park, so a larger factor waits
	// less.
	BlobInFlightWaitFactor uint64 `json:"blobInFlightWaitFactor" toml:"blobInFlightWaitFactor"`

	// Plugin telemetry. Each is decided here for v31, independently of
	// the node CaptureEATelemetry parameter, which keeps driving data source telemetry.
	//
	// CaptureOutcomeTelemetry emits one outcome per StateTransition.
	CaptureOutcomeTelemetry bool `json:"captureOutcomeTelemetry" toml:"captureOutcomeTelemetry"`
	// CaptureReportTelemetry emits one telemetry per report.
	CaptureReportTelemetry bool `json:"captureReportTelemetry" toml:"captureReportTelemetry"`
	// CaptureAttributedObservationTelemetry emits the decoded oracle observations that made into
	// the state transition.
	CaptureAttributedObservationTelemetry bool `json:"captureAttributedObservationTelemetry" toml:"captureAttributedObservationTelemetry"`
	// CaptureStagingTelemetry makes a staging instance emit the plugin telemetry
	// enabled above. Off, only a production instance emits it.
	CaptureStagingTelemetry bool `json:"captureStagingTelemetry" toml:"captureStagingTelemetry"`
}

V31Config carries the v31 plugin knobs. Every field is optional: left at zero the plugin applies its own default. Only meaningful when PluginVersion is "v31".

func (V31Config) IsZero added in v1.1.2

func (o V31Config) IsZero() bool

IsZero reports whether no knob is set, so the caller can tell an absent block from one that configures defaults.

func (V31Config) Validate added in v1.1.2

func (o V31Config) Validate() (merr error)

Jump to

Keyboard shortcuts

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