-
Notifications
You must be signed in to change notification settings - Fork 16
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
Feat(cannon): Validators chunk size #330
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…nfigurable with a default of 100. # Aider chat conversation: USER: Make the chunk size in the cannon beacon valdiators deriver configurable. Default to 100. ASSISTANT: To make the chunk size in the cannon beacon validators deriver configurable with a default value of 100, we will likely need to edit the following files: 1. `pkg/cannon/deriver/config.go` - To add the new configuration option. 2. `pkg/cannon/deriver/validators.go` (or similar file where the chunk size is used) - To use the new configuration option. Please add these files to the chat so I can provide the necessary *SEARCH/REPLACE* blocks. USER: I added these files to the chat: pkg/cannon/deriver/config.go. If you need to propose edits to other existing files not already added to the chat, you *MUST* tell the me their full path names and ask me to *add the files to the chat*. End your reply and wait for my approval. You can keep asking if you then decide you need to edit more files. ASSISTANT: To make the chunk size in the cannon beacon validators deriver configurable with a default value of 100, we need to: 1. Add a new field to the `Config` struct in `pkg/cannon/deriver/config.go`. 2. Ensure that this new configuration option is used in the appropriate place in the code. Let's start by adding the new configuration option to `pkg/cannon/deriver/config.go`. pkg/cannon/deriver/config.go ```go <<<<<<< SEARCH BeaconValidatorsConfig v1.BeaconValidatorsDeriverConfig `yaml:"beaconValidators"` ======= BeaconValidatorsConfig v1.BeaconValidatorsDeriverConfig `yaml:"beaconValidators"` ChunkSize int `yaml:"chunkSize" default:"100"` >>>>>>> REPLACE ``` Next, we need to ensure that this new configuration option is used in the appropriate place in the code. Please add the file where the chunk size is used, likely something like `pkg/cannon/deriver/validators.go`, to the chat.
# Aider chat conversation: USER: move the chunk size tot he BeaconValidatorsConfig struct ASSISTANT: To move the `ChunkSize` field to the `BeaconValidatorsConfig` struct, we need to: 1. Remove the `ChunkSize` field from the `Config` struct in `pkg/cannon/deriver/config.go`. 2. Add the `ChunkSize` field to the `BeaconValidatorsConfig` struct in the appropriate file. Let's start with the changes to `pkg/cannon/deriver/config.go`. pkg/cannon/deriver/config.go ```go <<<<<<< SEARCH BeaconValidatorsConfig v1.BeaconValidatorsDeriverConfig `yaml:"beaconValidators"` ChunkSize int `yaml:"chunkSize" default:"100"` ======= BeaconValidatorsConfig v1.BeaconValidatorsDeriverConfig `yaml:"beaconValidators"` >>>>>>> REPLACE ``` Next, we need to add the `ChunkSize` field to the `BeaconValidatorsConfig` struct. Please add the file where the `BeaconValidatorsDeriverConfig` struct is defined, likely something like `pkg/cannon/deriver/beacon/eth/v1/config.go`, to the chat.
…ed its usage. # Aider chat conversation: USER: Make the beacon validators deriver respect the new config value. ASSISTANT: To make the beacon validators deriver respect the new `ChunkSize` config value, we need to: 1. Ensure the `ChunkSize` field is added to the `BeaconValidatorsDeriverConfig` struct. 2. Update the code that uses the chunk size to reference this new config value. Let's start by adding the `ChunkSize` field to the `BeaconValidatorsDeriverConfig` struct. Please add the file where the `BeaconValidatorsDeriverConfig` struct is defined, likely something like `pkg/cannon/deriver/beacon/eth/v1/config.go`, to the chat. USER: I added these files to the chat: /Users/samcm/go/src/github.com/ethpandaops/xatu/pkg/cannon/deriver/beacon/eth/v1/beacon_validators.go. If you need to propose edits to other existing files not already added to the chat, you *MUST* tell the me their full path names and ask me to *add the files to the chat*. End your reply and wait for my approval. You can keep asking if you then decide you need to edit more files. ASSISTANT: To make the beacon validators deriver respect the new `ChunkSize` config value, we need to: 1. Add the `ChunkSize` field to the `BeaconValidatorsDeriverConfig` struct in `pkg/cannon/deriver/beacon/eth/v1/beacon_validators.go`. 2. Update the code that uses the chunk size to reference this new config value. Here are the necessary *SEARCH/REPLACE* blocks: pkg/cannon/deriver/beacon/eth/v1/beacon_validators.go ```go <<<<<<< SEARCH Enabled bool `yaml:"enabled" default:"true"` ======= Enabled bool `yaml:"enabled" default:"true"` ChunkSize int `yaml:"chunkSize" default:"100"` >>>>>>> REPLACE ``` pkg/cannon/deriver/beacon/eth/v1/beacon_validators.go ```go <<<<<<< SEARCH // Chunk the validators per 1000 chunkSize := 1000 ======= // Chunk the validators per the configured chunk size chunkSize := b.cfg.ChunkSize >>>>>>> REPLACE ``` This will ensure that the chunk size is configurable and defaults to 100 as specified in the configuration.
# Aider chat conversation: USER: Add logs to the startup of the deriver ASSISTANT: To add logs to the startup of the deriver, we will add logging statements in the `Start` method of the `BeaconValidatorsDeriver` struct in `pkg/cannon/deriver/beacon/eth/v1/beacon_validators.go`. Here is the *SEARCH/REPLACE* block: pkg/cannon/deriver/beacon/eth/v1/beacon_validators.go ```go <<<<<<< SEARCH if !b.cfg.Enabled { b.log.Info("Validator states deriver disabled") return nil } b.log.Info("Validator states deriver enabled") ======= b.log.WithFields(logrus.Fields{ "chunk_size": b.cfg.ChunkSize, "enabled": b.cfg.Enabled, }).Info("Starting BeaconValidatorsDeriver") if !b.cfg.Enabled { b.log.Info("Validator states deriver disabled") return nil } b.log.Info("Validator states deriver enabled") >>>>>>> REPLACE ``` This will add a log statement at the start of the `Start` method, logging the chunk size and whether the deriver is enabled.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.