Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a SetConfig function to the LogEventProvider interface #367

Merged
merged 2 commits into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/types/automation/interfaces.go
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty unusual within our existing model. Is the point to be able to mutate the configuration along the way?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmank88 Sorry, only seeing this now! So, we need a way to update the config of the LogEventProvider, based on the config stored in the on-chain automation registry. Within libocr, we have code that listens for changes to the config on the registry, and when a change is detected, a new instance of the automation plugin is started with that new config.

Now, we want to be able to set configuration for the LogEventProvider on the registry, and have a way to pass that config change from the registry, into the LogEventProvider. To achieve this, we're utilising the existing libocr/automation functionality that listens for/propagates config changes, and we're setting the config on the LogEventProvider from within the automation plugin.

To facilitiate this, we're adding a SetConfig function to the LogEventProvider interface in common, which the automation plugin can call, and pass the config into using the LogEventProviderConfig. So the flow will be:

setConfig -> registry -> libocr -> chainlink-automation -> LogEventProvider.SetConfig(LogEventProviderConfig{})

Does that make sense?

Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,17 @@ type Encoder interface {

type LogEventProvider interface {
GetLatestPayloads(context.Context) ([]UpkeepPayload, error)
SetConfig(LogEventProviderConfig)
Start(context.Context) error
Close() error
}

type LogEventProviderConfig struct {
NumLogUpkeeps uint32
FastExecLogsHigh uint32
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing FastExecLogsLow

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see this PR is merged but we might need changes based on comments on https://github.com/smartcontractkit/chainlink-automation/pull/314/files

FastExecLogsLow uint32
}

type RecoverableProvider interface {
GetRecoveryProposals(context.Context) ([]UpkeepPayload, error)
}
Expand Down
Loading