Skip to content

Commit

Permalink
aider: Added ChunkSize to BeaconValidatorsDeriverConfig and updat…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
samcm committed Jun 11, 2024
1 parent c79d03d commit 5711930
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/cannon/deriver/beacon/eth/v1/beacon_validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const (
)

type BeaconValidatorsDeriverConfig struct {
Enabled bool `yaml:"enabled" default:"true"`
Enabled bool `yaml:"enabled" default:"true"`
ChunkSize int `yaml:"chunkSize" default:"100"`
}

type BeaconValidatorsDeriver struct {
Expand Down Expand Up @@ -240,8 +241,8 @@ func (b *BeaconValidatorsDeriver) processEpoch(ctx context.Context, epoch phase0

validatorsMap := validatorsResponse.Data

// Chunk the validators per 1000
chunkSize := 1000
// Chunk the validators per the configured chunk size
chunkSize := b.cfg.ChunkSize

var validatorChunks [][]*apiv1.Validator

Expand Down

0 comments on commit 5711930

Please sign in to comment.