chainlink
chainlink copied to clipboard
Set log buffer limits via the log provider config
https://smartcontract-it.atlassian.net/browse/AUTO-9023
In this PR, we're implementing the new SetConfig
function on the LogEventProvider
type. When called, the passed config struct is read, and the values are passed into the SetLimits
function on the logEventBuffer
type. The log buffer performs checks to ensure that if zero values are passed, we fall back to the default values for each config value.
Related PRs
- chainlink-automation: https://github.com/smartcontractkit/chainlink-automation/pull/314
- chainlink-common: https://github.com/smartcontractkit/chainlink-common/pull/367
Testing
The following tests were conducted through integration tests developed by @anirudhwarrier 🎉 🙏 🙌 ; the code samples are excerpts from a go codebase tasked with calling SetConfig on a deployed registry running against the code in this PR. The log samples are from grafana.
SetConfig with non-zero values in LogProviderConfig
LogProviderConfig: ocr2keepers30config.LogProviderConfig{
NumOfLogUpkeeps: 10,
FastExecLogsHigh: 5,
},
When SetConfig in the provider is called with non-zero values:
{"level":"info","ts":"2024-02-23T12:46:24.169Z","logger":"EVM.80001.Relayer.AutomationProvider.0fef745e-5507-4346-81da-2e742ad6af19.OCR2KeeperRelayer.KeepersRegistry.LogEventProvider","caller":"logprovider/provider.go:121","msg":"SetConfig called","version":"2.9.0@2023dfd","numOfLogUpkeeps":10,"fastExecLogsHigh":5}
SetLimits in the log buffer uses the off chain config values:
{"level":"info","ts":"2024-02-23T12:46:24.169Z","logger":"EVM.80001.Relayer.AutomationProvider.0fef745e-5507-4346-81da-2e742ad6af19.OCR2KeeperRelayer.KeepersRegistry.LogEventBuffer","caller":"logprovider/buffer.go:182","msg":"SetLimits called","version":"2.9.0@2023dfd","numOfLogUpkeeps":10,"fastExecLogsHigh":5}
SetConfig with missing LogProviderConfig
json.Marshal(ocr2keepers30config.OffchainConfig{
TargetProbability: a.PluginConfig.TargetProbability,
TargetInRounds: a.PluginConfig.TargetInRounds,
PerformLockoutWindow: a.PluginConfig.PerformLockoutWindow,
GasLimitPerReport: a.PluginConfig.GasLimitPerReport,
GasOverheadPerUpkeep: a.PluginConfig.GasOverheadPerUpkeep,
MinConfirmations: a.PluginConfig.MinConfirmations,
MaxUpkeepBatchSize: a.PluginConfig.MaxUpkeepBatchSize,
//LogProviderConfig: a.PluginConfig.LogProviderConfig,
})
When SetConfig in the provider is called with zero values:
{"level":"info","ts":"2024-02-23T12:54:13.637Z","logger":"EVM.80001.Relayer.AutomationProvider.f7e3a0f8-005f-4de9-97ac-6ae477e52d65.OCR2KeeperRelayer.KeepersRegistry.LogEventProvider","caller":"logprovider/provider.go:121","msg":"SetConfig called","version":"2.9.0@2023dfd","numOfLogUpkeeps":0,"fastExecLogsHigh":0}
SetLimits in the log buffer uses the default values:
{"level":"info","ts":"2024-02-23T12:54:13.637Z","logger":"EVM.80001.Relayer.AutomationProvider.f7e3a0f8-005f-4de9-97ac-6ae477e52d65.OCR2KeeperRelayer.KeepersRegistry.LogEventBuffer","caller":"logprovider/buffer.go:182","msg":"SetLimits called","version":"2.9.0@2023dfd","numOfLogUpkeeps":50,"fastExecLogsHigh":32}
I see that you haven't updated any CHANGELOG files. Would it make sense to do so?
Quality Gate passed
Issues
2 New issues
0 Fixed issues
0 Accepted issues
Measures
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code