Documentation
¶
Index ¶
- Constants
- type AutomationProvider
- type BoundContract
- type ChainReader
- type ChainService
- type ChainStatus
- type Codec
- type ConfigProvider
- type ContractTypeProvider
- type Decoder
- type Encoder
- type ErrorLog
- type Event
- type EventFilter
- type FunctionsEvents
- type FunctionsProvider
- type InternalError
- type InvalidArgumentError
- type Keystore
- type MedianProvider
- type MercuryProvider
- type MonitoringEndpointGenerator
- type NodeStatus
- type NotFoundError
- type OCR2PluginType
- type Options
- type OracleRequest
- type OracleResponse
- type PipelineRunnerService
- type Plugin
- type PluginArgs
- type PluginMedian
- type PluginProvider
- type RelayArgs
- type Relayerdeprecated
- type RemoteCodec
- type ReportingPluginClient
- type ReportingPluginFactory
- type ReportingPluginServer
- type ReportingPluginServiceConfig
- type Servicedeprecated
- type TaskResult
- type TaskResults
- type TaskValue
- type TelemetryClient
- type TelemetryClientEndpoint
- type TelemetryService
- type TypeProvider
- type UnimplementedError
- type Vars
Constants ¶
const ( ErrInvalidType = InvalidArgumentError("invalid type") ErrInvalidConfig = InvalidArgumentError("invalid configuration") ErrChainReaderConfigMissing = UnimplementedError("ChainReader entry missing from RelayConfig") ErrInternal = InternalError("internal error") ErrNotFound = NotFoundError("not found") )
Errors exposed to product plugins
const ( ErrFieldNotFound = InvalidArgumentError("field not found") ErrInvalidEncoding = InvalidArgumentError("invalid encoding") ErrSliceWrongLen = InvalidArgumentError("slice is wrong length") ErrNotASlice = InvalidArgumentError("element is not a slice") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutomationProvider ¶
type AutomationProvider interface {
PluginProvider
Registry() automation.Registry
Encoder() automation.Encoder
TransmitEventProvider() automation.EventProvider
BlockSubscriber() automation.BlockSubscriber
PayloadBuilder() automation.PayloadBuilder
UpkeepStateStore() automation.UpkeepStateStore
LogEventProvider() automation.LogEventProvider
LogRecoverer() automation.LogRecoverer
UpkeepProvider() automation.ConditionalUpkeepProvider
}
AutomationProvider provides components needed for the automation OCR2 plugin.
type BoundContract ¶
type ChainReader ¶
type ChainReader interface {
// GetLatestValue gets the latest value....
// The params argument can be any object which maps a set of generic parameters into chain specific parameters defined in RelayConfig.
// It must encode as an object via [json.Marshal] and [github.com/fxamacker/cbor/v2.Marshal].
// Typically, would be either a struct with field names mapping to arguments, or anonymous map such as `map[string]any{"baz": 42, "test": true}}`
//
// returnVal must [json.Unmarshal] and and [github.com/fxamacker/cbor/v2.Marshal] as an object.
//
// Example use:
// type ProductParams struct {
// ID int `json:"id"`
// }
// type ProductReturn struct {
// Foo string `json:"foo"`
// Bar *big.Int `json:"bar"`
// }
// func do(ctx context.Context, cr ChainReader) (resp ProductReturn, err error) {
// err = cr.GetLatestValue(ctx, "FooContract", "GetProduct", ProductParams{ID:1}, &resp)
// return
// }
//
// Note that implementations should ignore extra fields in params that are not expected in the call to allow easier
// use across chains and contract versions.
// Similarly, when using a struct for returnVal, fields in the return value that are not on-chain will not be set.
GetLatestValue(ctx context.Context, contractName string, method string, params, returnVal any) error
// Bind will override current bindings for the same contract, if one has been set and will return an error if the
// contract is not known by the ChainReader, or if the address is invalid
Bind(ctx context.Context, bindings []BoundContract) error
}
type ChainService ¶
type ChainService interface {
Service
GetChainStatus(ctx context.Context) (ChainStatus, error)
ListNodeStatuses(ctx context.Context, pageSize int32, pageToken string) (stats []NodeStatus, nextPageToken string, total int, err error)
Transact(ctx context.Context, from, to string, amount *big.Int, balanceCheck bool) error
}
ChainService is a sub-interface of [loop.Relayer] that encapsulates the explicit interactions with a chain
type ChainStatus ¶
type ConfigProvider ¶
type ConfigProvider interface {
Service
OffchainConfigDigester() ocrtypes.OffchainConfigDigester
ContractConfigTracker() ocrtypes.ContractConfigTracker
}
The bootstrap jobs only watch config.
type ContractTypeProvider ¶
type Decoder ¶
type Decoder interface {
Decode(ctx context.Context, raw []byte, into any, itemType string) error
// GetMaxDecodingSize returns the max size in bytes if n elements are supplied for all top level dynamically sized elements.
// If no elements are dynamically sized, the returned value will be the same for all n.
// If there are multiple levels of dynamically sized elements, or itemType cannot be found,
// ErrInvalidType will be returned.
GetMaxDecodingSize(ctx context.Context, n int, itemType string) (int, error)
}
type Encoder ¶
type Encoder interface {
Encode(ctx context.Context, item any, itemType string) ([]byte, error)
// GetMaxEncodingSize returns the max size in bytes if n elements are supplied for all top level dynamically sized elements.
// If no elements are dynamically sized, the returned value will be the same for all n.
// If there are multiple levels of dynamically sized elements, or itemType cannot be found,
// ErrInvalidType will be returned.
GetMaxEncodingSize(ctx context.Context, n int, itemType string) (int, error)
}
type EventFilter ¶
type EventFilter struct {
AddressList []string // contract address
KeysList [][]string // 2D list of indexed search keys, outer dim = AND, inner dim = OR. Params[0] is the name of the event (or "event type"), rest are any narrowing parameters that may help further specify the event
Retention time.Duration
}
type FunctionsEvents ¶
type FunctionsEvents interface {
Service
LatestEvents() ([]OracleRequest, []OracleResponse, error)
}
An on-chain event source, which understands router proxy contracts.
type FunctionsProvider ¶
type FunctionsProvider interface {
PluginProvider
FunctionsEvents() FunctionsEvents
}
type InternalError ¶
type InternalError string
func (InternalError) Error ¶
func (e InternalError) Error() string
func (InternalError) GRPCStatus ¶
func (e InternalError) GRPCStatus() *status.Status
func (InternalError) Is ¶
func (e InternalError) Is(target error) bool
type InvalidArgumentError ¶
type InvalidArgumentError string
func (InvalidArgumentError) Error ¶
func (e InvalidArgumentError) Error() string
func (InvalidArgumentError) GRPCStatus ¶
func (e InvalidArgumentError) GRPCStatus() *status.Status
func (InvalidArgumentError) Is ¶
func (e InvalidArgumentError) Is(target error) bool
type MedianProvider ¶
type MedianProvider interface {
PluginProvider
ReportCodec() median.ReportCodec
MedianContract() median.MedianContract
OnchainConfigCodec() median.OnchainConfigCodec
}
MedianProvider provides all components needed for a median OCR2 plugin.
type MercuryProvider ¶
type MercuryProvider interface {
PluginProvider
ReportCodecV1() v1.ReportCodec
ReportCodecV2() v2.ReportCodec
ReportCodecV3() v3.ReportCodec
OnchainConfigCodec() mercury.OnchainConfigCodec
MercuryServerFetcher() mercury.ServerFetcher
MercuryChainReader() mercury.ChainReader
}
MercuryProvider provides components needed for a mercury OCR2 plugin. Mercury requires config tracking but does not transmit on-chain.
type MonitoringEndpointGenerator ¶
type MonitoringEndpointGenerator interface {
GenMonitoringEndpoint(network, chainID, contractID, telemetryType string) commontypes.MonitoringEndpoint
}
type NodeStatus ¶
type NotFoundError ¶
type NotFoundError string
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
func (NotFoundError) GRPCStatus ¶
func (e NotFoundError) GRPCStatus() *status.Status
func (NotFoundError) Is ¶
func (e NotFoundError) Is(target error) bool
type OCR2PluginType ¶
type OCR2PluginType string
OCR2PluginType defines supported OCR2 plugin types.
const ( Median OCR2PluginType = "median" DKG OCR2PluginType = "dkg" OCR2VRF OCR2PluginType = "ocr2vrf" // TODO: sc-55296 to rename ocr2keeper to ocr2automation in code OCR2Keeper OCR2PluginType = "ocr2automation" Functions OCR2PluginType = "functions" Mercury OCR2PluginType = "mercury" GenericPlugin OCR2PluginType = "plugin" CCIPCommit OCR2PluginType = "ccip-commit" CCIPExecution OCR2PluginType = "ccip-execution" )
type OracleRequest ¶
type OracleRequest struct {
RequestID [32]byte
RequestingContract ocrtypes.Account
RequestInitiator ocrtypes.Account
//nolint:revive
SubscriptionId uint64
SubscriptionOwner ocrtypes.Account
Data []byte
DataVersion uint16
Flags [32]byte
CallbackGasLimit uint64
TxHash []byte
CoordinatorContract ocrtypes.Account
OnchainMetadata []byte
}
type OracleResponse ¶
type OracleResponse struct {
RequestID [32]byte
}
type PipelineRunnerService ¶
type Plugin ¶
type Plugin = PluginProvider
Plugin is an alias for PluginProvider, for compatibility. Deprecated
type PluginArgs ¶
PluginArgs are the args required to create any OCR2 plugin components. It's possible that the plugin config might actually be different per relay type, so we pass the config directly through.
type PluginMedian ¶
type PluginMedian interface {
// NewMedianFactory returns a new ReportingPluginFactory. If provider implements GRPCClientConn, it can be forwarded efficiently via proxy.
NewMedianFactory(ctx context.Context, provider MedianProvider, dataSource, juelsPerFeeCoin median.DataSource, errorLog ErrorLog) (ReportingPluginFactory, error)
}
type PluginProvider ¶
type PluginProvider interface {
ConfigProvider
ContractTransmitter() ocrtypes.ContractTransmitter
ChainReader() ChainReader
Codec() Codec
}
PluginProvider provides common components for any OCR2 plugin. It watches config and is able to transmit.
type RemoteCodec ¶
type RemoteCodec interface {
Codec
TypeProvider
}
type ReportingPluginClient ¶
type ReportingPluginClient interface {
NewReportingPluginFactory(ctx context.Context, config ReportingPluginServiceConfig, grpcProvider grpc.ClientConnInterface, pipelineRunner PipelineRunnerService, telemetry TelemetryService, errorLog ErrorLog) (ReportingPluginFactory, error)
}
ReportingPluginClient is the client interface to a plugin running as a generic job (job type = GenericPlugin) inside the core node.
type ReportingPluginFactory ¶
type ReportingPluginFactory interface {
Service
libocr.ReportingPluginFactory
}
type ReportingPluginServer ¶
type ReportingPluginServer[T PluginProvider] interface { NewReportingPluginFactory(ctx context.Context, config ReportingPluginServiceConfig, provider T, pipelineRunner PipelineRunnerService, telemetry TelemetryClient, errorLog ErrorLog) (ReportingPluginFactory, error) }
ReportingPluginServer is the server interface to a plugin running as a generic job (job type = GenericPlugin) inside the core node, with the passthrough provider connection converted to the provider expected by the plugin.
type TaskResults ¶
type TaskResults []TaskResult
func (TaskResults) FinalResults ¶
func (tr TaskResults) FinalResults() []TaskValue
type TelemetryClient ¶
type TelemetryClient interface {
TelemetryService
NewEndpoint(ctx context.Context, nework string, chainID string, contractID string, telemetryType string) (TelemetryClientEndpoint, error)
}
type TelemetryClientEndpoint ¶
type TelemetryService ¶
type TypeProvider ¶
type UnimplementedError ¶
type UnimplementedError string
func (UnimplementedError) Error ¶
func (e UnimplementedError) Error() string
func (UnimplementedError) GRPCStatus ¶
func (e UnimplementedError) GRPCStatus() *status.Status
func (UnimplementedError) Is ¶
func (e UnimplementedError) Is(target error) bool