generateslashings

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: GPL-3.0 Imports: 19 Imported by: 0

README

generate_slashings Task

Description

The generate_slashings task is designed to create slashing operations for artificially constructed slashable conditions, and send these operations to the network.
It's important to note that while the slashing operations are sent to the network, the fake attestations or proposals that justify these slashings are never actually broadcasted. This task is vital for testing the network's response to validator misconduct without affecting the actual network operations.

Configuration Parameters

  • slashingType:
    Determines the type of slashing to be simulated. Options are attester for attestations-related slashing and proposer for proposal-related slashing.
    This setting decides the kind of validator misbehavior being simulated.

  • limitPerSlot:
    The maximum number of slashing operations to generate per slot.

  • limitTotal:
    The total limit on the number of slashing operations to be generated by this task.

  • mnemonic:
    A mnemonic phrase for generating the keys of validators involved in the simulated slashing.

  • startIndex:
    The index from which to start generating validator keys within the mnemonic sequence.

  • indexCount:
    The number of validator keys to generate from the mnemonic, indicating how many distinct slashing operations will be created.

    • clientPattern:
      A regex pattern for selecting specific client endpoints to send the slashing operations. If not specified, the task will use any available endpoint.
  • excludeClientPattern:
    A regex pattern to exclude certain clients from being used for slashing operations. This feature provides an additional layer of control by allowing the exclusion of specific clients, which can be useful for testing under various network conditions.

  • awaitInclusion:
    If set to true, the task waits for all submitted slashing proofs to be included in beacon blocks before completing. The task monitors new blocks and checks for both attester and proposer slashings matching the submitted validator indices.

Outputs

  • slashedValidators:
    Array of validator indices that were submitted for slashing.

  • includedSlashings:
    Number of slashings confirmed on-chain (only populated when awaitInclusion is enabled).

Defaults

Default settings for the generate_slashings task:

- name: generate_slashings
  config:
    slashingType: attester
    limitPerSlot: 0
    limitTotal: 0
    mnemonic: ""
    startIndex: 0
    indexCount: 0
    clientPattern: ""
    excludeClientPattern: ""
    awaitInclusion: false

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TaskName       = "generate_slashings"
	TaskDescriptor = &types.TaskDescriptor{
		Name:        TaskName,
		Description: "Generates slashable attestations / proposals and sends them to the network",
		Category:    "validator",
		Config:      DefaultConfig(),
		Outputs: []types.TaskOutputDefinition{
			{
				Name:        "slashedValidators",
				Type:        "array",
				Description: "Array of validator indices that were submitted for slashing.",
			},
			{
				Name:        "includedSlashings",
				Type:        "number",
				Description: "Number of slashings included on-chain (when awaitInclusion is enabled).",
			},
		},
		NewTask: NewTask,
	}
)

Functions

func NewTask

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

Types

type Config

type Config struct {
	SlashingType         string `yaml:"slashingType" json:"slashingType" desc:"Type of slashing to generate: 'attester' or 'proposer'."`
	LimitPerSlot         int    `yaml:"limitPerSlot" json:"limitPerSlot" require:"A.1" desc:"Maximum number of slashing operations to generate per slot."`
	LimitTotal           int    `yaml:"limitTotal" json:"limitTotal" require:"A.2" desc:"Total limit on the number of slashing operations to generate."`
	Mnemonic             string `yaml:"mnemonic" json:"mnemonic" require:"B" desc:"Mnemonic phrase used to generate validator keys."`
	StartIndex           int    `yaml:"startIndex" json:"startIndex" desc:"Index within the mnemonic from which to start generating validator keys."`
	IndexCount           int    `yaml:"indexCount" json:"indexCount" require:"A.3" desc:"Number of validator keys to generate from the mnemonic."`
	ClientPattern        string `yaml:"clientPattern" json:"clientPattern" desc:"Regex pattern to select specific client endpoints for submitting operations."`
	ExcludeClientPattern string `yaml:"excludeClientPattern" json:"excludeClientPattern" desc:"Regex pattern to exclude certain client endpoints."`
	AwaitInclusion       bool   `yaml:"awaitInclusion" json:"awaitInclusion" desc:"Wait for slashings to be included in beacon blocks before completing."`
}

func DefaultConfig

func DefaultConfig() Config

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