Documentation ¶
Index ¶
- Constants
- Variables
- func NewEvmRegistryPackerV2_1(abi abi.ABI, utilsAbi abi.ABI) *evmRegistryPackerV2_1
- func TransmitEventProviderFilterName(addr common.Address) string
- func UpkeepFilterName(addr common.Address) string
- func UpkeepTriggerID(id *big.Int, trigger []byte) (string, error)
- type AdminOffchainConfig
- type BlockKey
- type BlockKeyHelper
- type BlockSubscriber
- type EVMAutomationEncoder21
- type EVMAutomationResultExtension21
- type EVMAutomationUpkeepResult21
- type EvmRegistry
- func (r *EvmRegistry) CheckUpkeeps(ctx context.Context, keys ...ocr2keepers.UpkeepPayload) ([]ocr2keepers.CheckResult, error)
- func (r *EvmRegistry) Close() error
- func (r *EvmRegistry) GetActiveUpkeepIDs(ctx context.Context) ([]ocr2keepers.UpkeepIdentifier, error)
- func (r *EvmRegistry) GetActiveUpkeepIDsByType(ctx context.Context, triggers ...uint8) ([]ocr2keepers.UpkeepIdentifier, error)
- func (r *EvmRegistry) HealthReport() map[string]error
- func (r *EvmRegistry) LogEventProvider() logprovider.LogEventProvider
- func (r *EvmRegistry) Name() string
- func (r *EvmRegistry) Ready() error
- func (r *EvmRegistry) Start(ctx context.Context) error
- type FeedLookup
- type HttpClient
- type LatestBlockGetter
- type MercuryBytes
- type MercuryConfig
- type MercuryResponse
- type MercuryVersion
- type Registry
- type TransmitEventProvider
- func (c *TransmitEventProvider) Close() error
- func (c *TransmitEventProvider) Events(ctx context.Context) ([]ocr2keepers.TransmitEvent, error)
- func (c *TransmitEventProvider) HealthReport() map[string]error
- func (c *TransmitEventProvider) Name() string
- func (c *TransmitEventProvider) Ready() error
- func (c *TransmitEventProvider) Start(ctx context.Context) error
- type UpkeepInfo
- type UpkeepKeyHelper
- type UpkeepState
- type UpkeepStateReader
- type UpkeepStateStore
- type UpkeepStateUpdater
Constants ¶
const ( UPKEEP_FAILURE_REASON_NONE = iota UPKEEP_FAILURE_REASON_UPKEEP_CANCELLED UPKEEP_FAILURE_REASON_UPKEEP_PAUSED UPKEEP_FAILURE_REASON_TARGET_CHECK_REVERTED UPKEEP_FAILURE_REASON_UPKEEP_NOT_NEEDED UPKEEP_FAILURE_REASON_PERFORM_DATA_EXCEEDS_LIMIT UPKEEP_FAILURE_REASON_INSUFFICIENT_BALANCE UPKEEP_FAILURE_REASON_MERCURY_CALLBACK_REVERTED UPKEEP_FAILURE_REASON_REVERT_DATA_EXCEEDS_LIMIT UPKEEP_FAILURE_REASON_REGISTRY_PAUSED // Start of offchain failure types. All onchain failure reasons from // contract should be put above UPKEEP_FAILURE_REASON_MERCURY_ACCESS_NOT_ALLOWED )
enum UpkeepFailureReason is defined by https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/dev/automation/2_1/interfaces/AutomationRegistryInterface2_1.sol#L97 make sure failure reasons are in sync between contract and offchain enum
const ( // PollLogInterval is the interval to query log poller PollLogInterval = time.Second // CleanUpInterval is the interval for cleaning up block maps CleanUpInterval = 15 * time.Minute // ChannelSize represents the channel size for head broadcaster ChannelSize = 20 )
const ( BlockNumber = "blockNumber" // valid for v0.2 FeedId = "feedId" // valid for v0.3 FeedIdHex = "feedIdHex" // valid for v0.2 MercuryPathV2 = "/client?" MercuryPathV3 = "/v1/reports?" MercuryBatchPathV3 = "/v1/reports/bulk?" RetryDelay = 500 * time.Millisecond Timestamp = "timestamp" // valid for v0.3 TotalAttempt = 3 UserId = "userId" MercuryV02 = MercuryVersion("v0.2") MercuryV03 = MercuryVersion("v0.3") )
const ( // DefaultAllowListExpiration decides how long an upkeep's allow list info will be valid for. DefaultAllowListExpiration = 20 * time.Minute // CleanupInterval decides when the expired items in cache will be deleted. CleanupInterval = 25 * time.Minute )
const BlockKeySeparator = "|"
Variables ¶
var ( ErrLogReadFailure = fmt.Errorf("failure reading logs") ErrHeadNotAvailable = fmt.Errorf("head not available") ErrRegistryCallFailure = fmt.Errorf("registry chain call failure") ErrBlockKeyNotParsable = fmt.Errorf("block identifier not parsable") ErrUpkeepKeyNotParsable = fmt.Errorf("upkeep key not parsable") ErrInitializationFailure = fmt.Errorf("failed to initialize registry") ErrContextCancelled = fmt.Errorf("context was cancelled") ErrABINotParsable = fmt.Errorf("error parsing abi") ActiveUpkeepIDBatchSize int64 = 1000 FetchUpkeepConfigBatchSize = 10 )
var (
ErrEmptyResults = fmt.Errorf("empty results; cannot encode")
)
Functions ¶
func TransmitEventProviderFilterName ¶ added in v2.4.0
func UpkeepFilterName ¶
Types ¶
type AdminOffchainConfig ¶
type AdminOffchainConfig struct {
MercuryEnabled bool `json:"mercuryEnabled"`
}
AdminOffchainConfig represents the administrative offchain config for each upkeep. It can be set by s_upkeepManager role on the registry. Upkeeps allowed to use Mercury server will have this set to true.
type BlockKeyHelper ¶
func (BlockKeyHelper[T]) MakeBlockKey ¶
func (kh BlockKeyHelper[T]) MakeBlockKey(b T) ocr2keepers.BlockKey
type BlockSubscriber ¶ added in v2.4.0
type BlockSubscriber struct {
// contains filtered or unexported fields
}
func NewBlockSubscriber ¶ added in v2.4.0
func NewBlockSubscriber(hb httypes.HeadBroadcaster, lp logpoller.LogPoller, blockHistorySize int64, lggr logger.Logger) *BlockSubscriber
func (*BlockSubscriber) Close ¶ added in v2.4.0
func (hw *BlockSubscriber) Close() error
func (*BlockSubscriber) Start ¶ added in v2.4.0
func (hw *BlockSubscriber) Start(_ context.Context) error
func (*BlockSubscriber) Subscribe ¶ added in v2.4.0
func (hw *BlockSubscriber) Subscribe() (int, chan ocr2keepers.BlockHistory, error)
func (*BlockSubscriber) Unsubscribe ¶ added in v2.4.0
func (hw *BlockSubscriber) Unsubscribe(subId int) error
type EVMAutomationEncoder21 ¶
type EVMAutomationEncoder21 struct { encoding.BasicEncoder // contains filtered or unexported fields }
func (EVMAutomationEncoder21) Encode ¶ added in v2.4.0
func (enc EVMAutomationEncoder21) Encode(results ...ocr2keepers.CheckResult) ([]byte, error)
func (EVMAutomationEncoder21) Extract ¶ added in v2.4.0
func (enc EVMAutomationEncoder21) Extract(raw []byte) ([]ocr2keepers.ReportedUpkeep, error)
Extract the plugin will call this function to accept/transmit reports
type EVMAutomationResultExtension21 ¶ added in v2.4.0
type EVMAutomationUpkeepResult21 ¶
type EVMAutomationUpkeepResult21 struct { // Block is the block number used to build an UpkeepKey for this result Block uint32 // ID is the unique identifier for the upkeep ID *big.Int Eligible bool FailureReason uint8 GasUsed *big.Int PerformData []byte FastGasWei *big.Int LinkNative *big.Int // CheckBlockNumber is the block number that the contract indicates the // upkeep was checked on CheckBlockNumber uint32 CheckBlockHash [32]byte ExecuteGas uint32 Retryable bool }
type EvmRegistry ¶
type EvmRegistry struct {
// contains filtered or unexported fields
}
func NewEVMRegistryService ¶
func NewEVMRegistryService(addr common.Address, client evm.Chain, mc *models.MercuryCredentials, lggr logger.Logger) (*EvmRegistry, error)
func (*EvmRegistry) CheckUpkeeps ¶ added in v2.4.0
func (r *EvmRegistry) CheckUpkeeps(ctx context.Context, keys ...ocr2keepers.UpkeepPayload) ([]ocr2keepers.CheckResult, error)
func (*EvmRegistry) Close ¶
func (r *EvmRegistry) Close() error
func (*EvmRegistry) GetActiveUpkeepIDs ¶
func (r *EvmRegistry) GetActiveUpkeepIDs(ctx context.Context) ([]ocr2keepers.UpkeepIdentifier, error)
GetActiveUpkeepIDs uses the latest head and map of all active upkeeps to build a slice of upkeep keys.
func (*EvmRegistry) GetActiveUpkeepIDsByType ¶
func (r *EvmRegistry) GetActiveUpkeepIDsByType(ctx context.Context, triggers ...uint8) ([]ocr2keepers.UpkeepIdentifier, error)
GetActiveUpkeepIDsByType returns all active upkeeps of the given trigger types.
func (*EvmRegistry) HealthReport ¶
func (r *EvmRegistry) HealthReport() map[string]error
func (*EvmRegistry) LogEventProvider ¶ added in v2.4.0
func (r *EvmRegistry) LogEventProvider() logprovider.LogEventProvider
func (*EvmRegistry) Name ¶
func (r *EvmRegistry) Name() string
func (*EvmRegistry) Ready ¶
func (r *EvmRegistry) Ready() error
type FeedLookup ¶
type FeedLookup struct {
// contains filtered or unexported fields
}
type LatestBlockGetter ¶
type LatestBlockGetter interface {
LatestBlock() int64
}
type MercuryConfig ¶
type MercuryConfig struct {
// contains filtered or unexported fields
}
type MercuryResponse ¶
type MercuryResponse struct {
ChainlinkBlob string `json:"chainlinkBlob"`
}
MercuryResponse is used in both single feed endpoint and bulk endpoint because bulk endpoint will return ONE chainlinkBlob which contains multiple reports instead of multiple blobs.
type MercuryVersion ¶
type MercuryVersion string
type Registry ¶
type Registry interface { GetUpkeep(opts *bind.CallOpts, id *big.Int) (UpkeepInfo, error) GetState(opts *bind.CallOpts) (iregistry21.GetState, error) GetActiveUpkeepIDs(opts *bind.CallOpts, startIndex *big.Int, maxCount *big.Int) ([]*big.Int, error) GetAdminPrivilegeConfig(opts *bind.CallOpts, admin common.Address) ([]byte, error) GetUpkeepTriggerConfig(opts *bind.CallOpts, upkeepId *big.Int) ([]byte, error) CheckCallback(opts *bind.TransactOpts, id *big.Int, values [][]byte, extraData []byte) (*coreTypes.Transaction, error) ParseLog(log coreTypes.Log) (generated.AbigenLog, error) }
type TransmitEventProvider ¶ added in v2.4.0
type TransmitEventProvider struct {
// contains filtered or unexported fields
}
func NewTransmitEventProvider ¶ added in v2.4.0
func (*TransmitEventProvider) Close ¶ added in v2.4.0
func (c *TransmitEventProvider) Close() error
func (*TransmitEventProvider) Events ¶ added in v2.4.0
func (c *TransmitEventProvider) Events(ctx context.Context) ([]ocr2keepers.TransmitEvent, error)
func (*TransmitEventProvider) HealthReport ¶ added in v2.4.0
func (c *TransmitEventProvider) HealthReport() map[string]error
func (*TransmitEventProvider) Name ¶ added in v2.4.0
func (c *TransmitEventProvider) Name() string
func (*TransmitEventProvider) Ready ¶ added in v2.4.0
func (c *TransmitEventProvider) Ready() error
type UpkeepInfo ¶
type UpkeepInfo = iregistry21.KeeperRegistryBase21UpkeepInfo
type UpkeepKeyHelper ¶
func (UpkeepKeyHelper[T]) MakeUpkeepKey ¶
func (kh UpkeepKeyHelper[T]) MakeUpkeepKey(b T, id *big.Int) ocr2keepers.UpkeepKey
type UpkeepState ¶ added in v2.4.0
type UpkeepState uint8
TODO: use the same type defined in keeper plugin after a new release is cut
const ( Performed UpkeepState = iota Eligible )
type UpkeepStateReader ¶ added in v2.4.0
type UpkeepStateReader interface { // SelectByUpkeepIDsAndBlockRange retrieves upkeep states for provided upkeep ids and block range, the result is currently not in particular order SelectByUpkeepIDsAndBlockRange(upkeepIds []*big.Int, start, end int64) ([]*ocr2keepers.UpkeepPayload, []*UpkeepState, error) }
type UpkeepStateStore ¶ added in v2.4.0
type UpkeepStateStore struct {
// contains filtered or unexported fields
}
func NewUpkeepStateStore ¶ added in v2.4.0
func NewUpkeepStateStore(lggr logger.Logger) *UpkeepStateStore
NewUpkeepStateStore creates a new state store. This is an initial version of this store. More improvements to come: TODO: AUTO-4027
func (*UpkeepStateStore) SelectByUpkeepIDsAndBlockRange ¶ added in v2.4.0
func (u *UpkeepStateStore) SelectByUpkeepIDsAndBlockRange(upkeepIds []*big.Int, start, end int64) ([]*ocr2keepers.UpkeepPayload, []*UpkeepState, error)
func (*UpkeepStateStore) SetUpkeepState ¶ added in v2.4.0
func (u *UpkeepStateStore) SetUpkeepState(pl ocr2keepers.UpkeepPayload, us UpkeepState) error
type UpkeepStateUpdater ¶ added in v2.4.0
type UpkeepStateUpdater interface {
SetUpkeepState(ocr2keepers.UpkeepPayload, UpkeepState) error
}