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

Set log buffer limits via the log provider config #12152

Merged
merged 1 commit into from
Apr 1, 2024
Merged

Conversation

ferglor
Copy link
Collaborator

@ferglor ferglor commented Feb 23, 2024

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 SetConfig 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

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{
	BlockRate:  10,
	LogLimit: 20,
},

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","blockRate":10,"logLimit":20}

SetConfig 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":"SetConfig called","version":"2.9.0@2023dfd","blockRate":10,"logLimit":20}

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","blockRate":0,"logLimit":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":"SetConfig called","version":"2.9.0@2023dfd","blockRate":1,"logLimit":2}

Copy link
Contributor

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

@ferglor ferglor changed the base branch from develop to fix/migration-pg14-dep February 23, 2024 12:29
@ferglor ferglor marked this pull request as ready for review February 23, 2024 14:16
@ferglor ferglor requested review from a team February 23, 2024 14:16
@ferglor ferglor requested review from a team as code owners February 23, 2024 19:32
@ferglor ferglor changed the base branch from fix/migration-pg14-dep to develop February 26, 2024 14:06
amirylm
amirylm previously approved these changes Apr 1, 2024
Store default block rates and log limits on the log buffer

Revert buffer changes, calculate default values in the provider and pass to the buffer for now

go mod tidy

Move the default block rate and log limits into their own functions

Update tests

Update tests

Update tests

Keep buffer unchanged, update tests

Update tests

Bump automation

Bump automation

Keep buffer.go as-is for now

Update constructor

Update changeset

Bump automation and common
@ferglor ferglor added this pull request to the merge queue Apr 1, 2024
Merged via the queue into develop with commit a6a2acf Apr 1, 2024
102 checks passed
@ferglor ferglor deleted the feature/AUTO-9023 branch April 1, 2024 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants