diff --git a/pkg/coordinator/tasks/generate_exits/README.md b/pkg/coordinator/tasks/generate_exits/README.md index 2bbcd33..d3d5078 100644 --- a/pkg/coordinator/tasks/generate_exits/README.md +++ b/pkg/coordinator/tasks/generate_exits/README.md @@ -20,6 +20,9 @@ The `generate_exits` task is designed to create and send voluntary exit transact - **`indexCount`**:\ The number of validator keys to generate from the mnemonic, determining how many unique exit transactions will be created. +- **`exitEpoch`**:\ + The exit epoch number set within the exit message. (defaults to head epoch) + - **`clientPattern`**:\ A regex pattern for selecting specific client endpoints for sending the exit transactions. If left empty, any available endpoint will be used. @@ -39,6 +42,7 @@ Default settings for the `generate_exits` task: mnemonic: "" startIndex: 0 indexCount: 0 + exitEpoch: -1 clientPattern: "" excludeClientPattern: "" ``` diff --git a/pkg/coordinator/tasks/generate_exits/config.go b/pkg/coordinator/tasks/generate_exits/config.go index e86bec9..53ca741 100644 --- a/pkg/coordinator/tasks/generate_exits/config.go +++ b/pkg/coordinator/tasks/generate_exits/config.go @@ -10,6 +10,7 @@ type Config struct { Mnemonic string `yaml:"mnemonic" json:"mnemonic"` StartIndex int `yaml:"startIndex" json:"startIndex"` IndexCount int `yaml:"indexCount" json:"indexCount"` + ExitEpoch int64 `yaml:"exitEpoch" json:"exitEpoch"` ClientPattern string `yaml:"clientPattern" json:"clientPattern"` ExcludeClientPattern string `yaml:"excludeClientPattern" json:"excludeClientPattern"` } diff --git a/pkg/coordinator/tasks/generate_exits/task.go b/pkg/coordinator/tasks/generate_exits/task.go index ebf81f3..6b5ec0c 100644 --- a/pkg/coordinator/tasks/generate_exits/task.go +++ b/pkg/coordinator/tasks/generate_exits/task.go @@ -228,14 +228,18 @@ func (t *Task) generateVoluntaryExit(ctx context.Context, accountIdx uint64, for } // build voluntary exit message - currentSlot, _ := client.GetLastHead() specs := clientPool.GetConsensusPool().GetBlockCache().GetSpecs() - currentEpoch := phase0.Epoch(currentSlot / phase0.Slot(specs.SlotsPerEpoch)) operation := &phase0.VoluntaryExit{ - Epoch: currentEpoch, ValidatorIndex: validator.Index, } + if t.config.ExitEpoch >= 0 { + operation.Epoch = phase0.Epoch(t.config.ExitEpoch) + } else { + currentSlot, _ := client.GetLastHead() + operation.Epoch = phase0.Epoch(currentSlot / phase0.Slot(specs.SlotsPerEpoch)) + } + root, err := operation.HashTreeRoot() if err != nil { return fmt.Errorf("failed to generate root for exit operation: %w", err)