chainlink icon indicating copy to clipboard operation
chainlink copied to clipboard

Set log buffer limits via the log provider config

Open ferglor opened this issue 1 year ago • 2 comments

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}

ferglor avatar Feb 23 '24 01:02 ferglor

I see that you haven't updated any CHANGELOG files. Would it make sense to do so?

github-actions[bot] avatar Feb 23 '24 01:02 github-actions[bot]