checkconsensusattestationstats

package
v0.1.1 Latest Latest
Warning

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

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

README

check_consensus_attestation_stats Task

Description

The check_consensus_attestation_stats task is designed to monitor attestation voting statistics on the consensus chain, ensuring that voting patterns align with specified criteria.

Task Behavior
  • The task monitors attestation statistics over a specified number of epochs.
  • By default, the task returns immediately when the attestation criteria are met.
  • Use continueOnPass: true to keep monitoring even after success.

Configuration Parameters

  • minTargetPercent:
    The minimum percentage of correct target votes per checked epoch required for the task to succeed. The range is 0-100%. Default: 0.

  • maxTargetPercent:
    The maximum allowable percentage of correct target votes per checked epoch for the task to succeed. The range is 0-100%. Default: 100.

  • minHeadPercent:
    The minimum percentage of correct head votes per checked epoch needed for the task to succeed. The range is 0-100%. Default: 0.

  • maxHeadPercent:
    The maximum allowable percentage of correct head votes per checked epoch for the task to succeed. The range is 0-100%. Default: 100.

  • minTotalPercent:
    The minimum overall voting participation per checked epoch in percent needed for the task to succeed. The range is 0-100%. Default: 0.

  • maxTotalPercent:
    The maximum allowable overall voting participation per checked epoch for the task to succeed. The range is 0-100%. Default: 100.

  • failOnCheckMiss:
    Determines whether the task should stop with a failure result if a checked epoch does not meet the specified voting ranges. If false, the task continues checking subsequent epochs until it succeeds or times out. Default: false.

  • minCheckedEpochs:
    The minimum number of consecutive epochs that must pass the check for the task to succeed. Default: 1.

  • continueOnPass:
    If set to true, the task continues monitoring attestation statistics even after the criteria are met. This is useful for long-running monitoring scenarios. If false (default), the task exits immediately on success.

Defaults

These are the default settings for the check_consensus_attestation_stats task:

- name: check_consensus_attestation_stats
  config:
    minTargetPercent: 0
    maxTargetPercent: 100
    minHeadPercent: 0
    maxHeadPercent: 100
    minTotalPercent: 0
    maxTotalPercent: 100
    failOnCheckMiss: false
    minCheckedEpochs: 1
    continueOnPass: false

Outputs

This task does not produce any outputs.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TaskName       = "check_consensus_attestation_stats"
	TaskDescriptor = &types.TaskDescriptor{
		Name:        TaskName,
		Description: "Check attestation stats for consensus chain.",
		Category:    "consensus",
		Config:      DefaultConfig(),
		Outputs: []types.TaskOutputDefinition{
			{
				Name:        "lastCheckedEpoch",
				Type:        "uint64",
				Description: "The last epoch that was checked for attestation stats.",
			},
			{
				Name:        "validatorCount",
				Type:        "uint64",
				Description: "Number of active validators in the epoch.",
			},
			{
				Name:        "validatorBalance",
				Type:        "uint64",
				Description: "Total effective balance of active validators.",
			},
			{
				Name:        "targetVotes",
				Type:        "uint64",
				Description: "Number of correct target votes.",
			},
			{
				Name:        "targetVotesPercent",
				Type:        "float64",
				Description: "Percentage of correct target votes.",
			},
			{
				Name:        "headVotes",
				Type:        "uint64",
				Description: "Number of correct head votes.",
			},
			{
				Name:        "headVotesPercent",
				Type:        "float64",
				Description: "Percentage of correct head votes.",
			},
			{
				Name:        "totalVotes",
				Type:        "uint64",
				Description: "Total number of attestation votes.",
			},
			{
				Name:        "totalVotesPercent",
				Type:        "float64",
				Description: "Percentage of total attestation participation.",
			},
		},
		NewTask: NewTask,
	}
)

Functions

func NewTask

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

Types

type Config

type Config struct {
	MinTargetPercent uint64 `yaml:"minTargetPercent" json:"minTargetPercent" desc:"Minimum percentage of correct target votes required."`
	MaxTargetPercent uint64 `yaml:"maxTargetPercent" json:"maxTargetPercent" desc:"Maximum percentage of correct target votes allowed."`
	MinHeadPercent   uint64 `yaml:"minHeadPercent" json:"minHeadPercent" desc:"Minimum percentage of correct head votes required."`
	MaxHeadPercent   uint64 `yaml:"maxHeadPercent" json:"maxHeadPercent" desc:"Maximum percentage of correct head votes allowed."`
	MinTotalPercent  uint64 `yaml:"minTotalPercent" json:"minTotalPercent" desc:"Minimum total attestation participation percentage required."`
	MaxTotalPercent  uint64 `yaml:"maxTotalPercent" json:"maxTotalPercent" desc:"Maximum total attestation participation percentage allowed."`
	FailOnCheckMiss  bool   `yaml:"failOnCheckMiss" json:"failOnCheckMiss" desc:"If true, fail the task when attestation stats condition is not met."`
	MinCheckedEpochs uint64 `yaml:"minCheckedEpochs" json:"minCheckedEpochs" desc:"Minimum number of epochs to check before evaluating conditions."`
	ContinueOnPass   bool   `` /* 137-byte string literal not displayed */
}

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