generateattestations

package
v0.0.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2026 License: GPL-3.0 Imports: 20 Imported by: 0

README

generate_attestations Task

Description

The generate_attestations task is designed to generate valid attestations for a specified range of validator keys and submit them to the network. This task fetches attester duties for the configured validators, retrieves attestation data from the beacon node, signs the attestations with the validator private keys, and submits them via the beacon API.

The task supports advanced configuration options for testing various attestation scenarios, including attesting for previous epochs, using delayed head blocks, and randomizing late head offsets per attestation.

Configuration Parameters

  • mnemonic:
    A mnemonic phrase used for generating the validators' private keys. The keys are derived using the standard BIP39/BIP44 path (m/12381/3600/{index}/0/0).

  • startIndex:
    The starting index within the mnemonic from which to begin generating validator keys. This sets the initial point for key derivation.

  • indexCount:
    The number of validator keys to generate from the mnemonic, determining how many validators will be used for attestation generation.

  • limitTotal:
    The total limit on the number of attestations that the task will generate. The task will stop after reaching this limit.

  • limitEpochs:
    The total number of epochs to generate attestations for. The task will stop after processing this many epochs.

  • clientPattern:
    A regex pattern for selecting specific client endpoints for fetching attestation data and submitting attestations. If left empty, any available endpoint will be used.

  • excludeClientPattern:
    A regex pattern to exclude certain client endpoints from being used. This parameter adds a layer of control by allowing the exclusion of specific clients.

Advanced Settings

  • lastEpochAttestations:
    When set to true, the task will generate attestations for the previous epoch's duties instead of the current epoch. This is useful for testing late attestation scenarios. Attestations are sent one slot at a time (each wallclock slot sends attestations for the corresponding slot in the previous epoch).

  • sendAllLastEpoch:
    When set to true, instead of sending attestations slot-by-slot, all attestations for the previous epoch are sent at once at each epoch boundary. This is useful for bulk testing of late attestations. Requires lastEpochAttestations to be implicitly treated as true.

  • lateHead:
    Offsets the beacon block root in the attestation by the specified number of blocks. For example, setting lateHead: 5 will use the block root from 5 blocks before the current head. This simulates validators with a delayed view of the chain. Positive values go back (older blocks), negative values go forward.

  • randomLateHead:
    Specifies a range for randomizing the late head offset per attestation in "min:max" or "min-max" format. For example, randomLateHead: "1-5" will apply a random late head offset between 1 and 5 blocks (inclusive). By default, each attestation gets its own random offset. Use lateHeadClusterSize to group attestations with the same offset.

  • lateHeadClusterSize:
    Controls how many attestations share the same random late head offset. Default is 1 (each attestation gets its own random offset). Setting this to a higher value groups attestations together with the same late head value. For example, lateHeadClusterSize: 10 means every 10 attestations will share the same random offset.

Defaults

Default settings for the generate_attestations task:

- name: generate_attestations
  config:
    mnemonic: ""
    startIndex: 0
    indexCount: 0
    limitTotal: 0
    limitEpochs: 0
    clientPattern: ""
    excludeClientPattern: ""
    lastEpochAttestations: false
    sendAllLastEpoch: false
    lateHead: 0
    randomLateHead: ""
    lateHeadClusterSize: 1

Example Usage

Basic usage to generate attestations for 100 validators over 5 epochs:

- name: generate_attestations
  config:
    mnemonic: "your mnemonic phrase here"
    startIndex: 0
    indexCount: 100
    limitEpochs: 5

Advanced usage with late head for testing delayed attestations:

- name: generate_attestations
  config:
    mnemonic: "your mnemonic phrase here"
    startIndex: 0
    indexCount: 50
    limitTotal: 1000
    clientPattern: "lighthouse.*"
    lastEpochAttestations: true
    lateHead: 3

Bulk send all previous epoch attestations at once with random late head:

- name: generate_attestations
  config:
    mnemonic: "your mnemonic phrase here"
    startIndex: 0
    indexCount: 100
    limitEpochs: 3
    sendAllLastEpoch: true
    randomLateHead: "1:10"

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TaskName       = "generate_attestations"
	TaskDescriptor = &types.TaskDescriptor{
		Name:        TaskName,
		Description: "Generates valid attestations and sends them to the network",
		Config:      DefaultConfig(),
		NewTask:     NewTask,
	}
)

Functions

func NewTask

func NewTask(ctx *types.TaskContext, options *types.TaskOptions) (types.Task, error)

Types

type Config

type Config struct {
	// Key configuration
	Mnemonic   string `yaml:"mnemonic" json:"mnemonic"`
	StartIndex int    `yaml:"startIndex" json:"startIndex"`
	IndexCount int    `yaml:"indexCount" json:"indexCount"`

	// Limit configuration
	LimitTotal  int `yaml:"limitTotal" json:"limitTotal"`
	LimitEpochs int `yaml:"limitEpochs" json:"limitEpochs"`

	// Client selection
	ClientPattern        string `yaml:"clientPattern" json:"clientPattern"`
	ExcludeClientPattern string `yaml:"excludeClientPattern" json:"excludeClientPattern"`

	// Advanced settings
	LastEpochAttestations bool   `yaml:"lastEpochAttestations" json:"lastEpochAttestations"`
	SendAllLastEpoch      bool   `yaml:"sendAllLastEpoch" json:"sendAllLastEpoch"`
	LateHead              int    `yaml:"lateHead" json:"lateHead"`
	RandomLateHead        string `yaml:"randomLateHead" json:"randomLateHead"`
	LateHeadClusterSize   int    `yaml:"lateHeadClusterSize" json:"lateHeadClusterSize"`
}

func DefaultConfig

func DefaultConfig() Config

func (*Config) ParseRandomLateHead

func (c *Config) ParseRandomLateHead() (minVal, maxVal int, enabled bool, err error)

ParseRandomLateHead parses the RandomLateHead string in "min:max" or "min-max" format. Returns minVal, maxVal values and whether random late head is enabled.

func (*Config) Validate

func (c *Config) Validate() error

type Task

type Task struct {
	// contains filtered or unexported fields
}

func (*Task) Config

func (t *Task) Config() interface{}

func (*Task) Execute

func (t *Task) Execute(ctx context.Context) error

func (*Task) LoadConfig

func (t *Task) LoadConfig() error

func (*Task) Timeout

func (t *Task) Timeout() time.Duration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL