checkconsensusidentity

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: 15 Imported by: 0

README

check_consensus_identity Task

This task checks consensus client node identity information by querying the /eth/v1/node/identity API endpoint. It can verify various aspects of the node identity including CGC (Custody Group Count) extracted from ENR (Ethereum Node Record).

Task Behavior

  • The task polls clients at regular intervals to check their identity information.
  • By default, the task returns immediately when the identity criteria are met.
  • Use continueOnPass: true to keep monitoring even after success.

Configuration

Required Parameters
  • clientPattern (string): Pattern to match client names (e.g., "lodestar-*", "*" for all)
Optional Parameters
  • pollInterval (duration): Interval between checks (default: 10s)
  • minClientCount (int): Minimum number of clients that must pass checks (default: 1)
  • maxFailCount (int): Maximum number of clients that can fail (-1 for no limit, default: -1)
  • failOnCheckMiss (bool): Whether to fail the task when checks don't pass (default: false)
  • continueOnPass (bool): Keep monitoring even after success (default: false)
CGC (Custody Group Count) Checks
  • expectCgc (int): Expect exact CGC value
  • minCgc (int): Minimum CGC value required
  • maxCgc (int): Maximum CGC value allowed
ENR Checks
  • expectEnrField (map[string]interface{}): Expected ENR field values
PeerID Checks
  • expectPeerIdPattern (string): Regex pattern that PeerID must match
P2P Address Checks
  • expectP2pAddressCount (int): Expected number of P2P addresses
  • expectP2pAddressMatch (string): Regex pattern that at least one P2P address must match
Metadata Checks
  • expectSeqNumber (uint64): Expected sequence number
  • minSeqNumber (uint64): Minimum sequence number required

Outputs

The task exports the following data via ctx.Outputs:

  • matchingClients: Array of clients that passed all checks
  • failedClients: Array of clients that failed checks
  • totalCount: Total number of clients checked
  • matchingCount: Number of clients that passed checks
  • failedCount: Number of clients that failed checks

Each client result includes:

  • clientName: Name of the consensus client
  • peerId: Peer ID from node identity
  • enr: ENR string
  • p2pAddresses: Array of P2P addresses
  • discoveryAddresses: Array of discovery addresses
  • seqNumber: Metadata sequence number
  • attnets: Attestation subnets
  • syncnets: Sync subnets
  • cgc: Extracted Custody Group Count
  • enrFields: Parsed ENR fields
  • checksPassed: Whether all configured checks passed
  • failureReasons: Array of reasons why checks failed (if any)

Example Configurations

Basic Identity Check
- name: check_node_identity
  task: check_consensus_identity
  config:
    clientPattern: "lodestar-*"
    minClientCount: 1
CGC Validation
- name: validate_cgc
  task: check_consensus_identity
  config:
    clientPattern: "*"
    expectCgc: 8
    failOnCheckMiss: true
Continuous Monitoring
- name: monitor_identity
  task: check_consensus_identity
  config:
    clientPattern: "*"
    minCgc: 4
    continueOnPass: true
    timeout: 30m
Comprehensive Identity Check
- name: full_identity_check
  task: check_consensus_identity
  config:
    clientPattern: "prysm-*"
    minCgc: 4
    maxCgc: 16
    expectP2pAddressCount: 2
    expectPeerIdPattern: "^16Uiu2HA.*"
    minSeqNumber: 1
    pollInterval: 30s
    failOnCheckMiss: true

Use Cases

  1. PeerDAS Validation: Verify nodes have correct custody assignments
  2. Network Health: Check node identity consistency across clients
  3. Configuration Validation: Ensure nodes are properly configured for specific network requirements
  4. Testing: Validate node behavior changes after deposits or configuration updates
  5. Monitoring: Track node identity changes over time

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TaskName       = "check_consensus_identity"
	TaskDescriptor = &types.TaskDescriptor{
		Name:        TaskName,
		Description: "Checks consensus client node identity information including CGC extraction from ENR.",
		Category:    "consensus",
		Config:      DefaultConfig(),
		Outputs: []types.TaskOutputDefinition{
			{
				Name:        "matchingClients",
				Type:        "array",
				Description: "List of clients that passed identity checks.",
			},
			{
				Name:        "failedClients",
				Type:        "array",
				Description: "List of clients that failed identity checks.",
			},
			{
				Name:        "totalCount",
				Type:        "int",
				Description: "Total number of clients checked.",
			},
			{
				Name:        "matchingCount",
				Type:        "int",
				Description: "Number of clients that passed checks.",
			},
			{
				Name:        "failedCount",
				Type:        "int",
				Description: "Number of clients that failed checks.",
			},
		},
		NewTask: NewTask,
	}
)

Functions

func NewTask

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

Types

type Config

type Config struct {
	ClientPattern   string          `` /* 133-byte string literal not displayed */
	PollInterval    helper.Duration `yaml:"pollInterval" json:"pollInterval" desc:"Interval between identity check polls (e.g., '10s', '1m')."`
	MinClientCount  int             `yaml:"minClientCount" json:"minClientCount" desc:"Minimum number of clients required to pass the check."`
	MaxFailCount    int             `yaml:"maxFailCount" json:"maxFailCount" desc:"Maximum number of clients allowed to fail the check (-1 for unlimited)."`
	FailOnCheckMiss bool            `yaml:"failOnCheckMiss" json:"failOnCheckMiss" desc:"If true, fail the task when identity check condition is not met."`

	// CGC (Custody Group Count) checks
	ExpectCGC *uint64 `yaml:"expectCgc" json:"expectCgc" desc:"Expected custody group count (CGC) value."`
	MinCGC    *uint64 `yaml:"minCgc" json:"minCgc" desc:"Minimum custody group count required."`
	MaxCGC    *uint64 `yaml:"maxCgc" json:"maxCgc" desc:"Maximum custody group count allowed."`

	// ENR checks
	ExpectENRField map[string]interface{} `yaml:"expectEnrField" json:"expectEnrField" desc:"Map of ENR field names to expected values."`

	// PeerID checks
	ExpectPeerIDPattern string `yaml:"expectPeerIdPattern" json:"expectPeerIdPattern" desc:"Regex pattern that peer ID must match."`

	// P2P address checks
	ExpectP2PAddressCount *int   `yaml:"expectP2pAddressCount" json:"expectP2pAddressCount" desc:"Expected number of P2P addresses."`
	ExpectP2PAddressMatch string `yaml:"expectP2pAddressMatch" json:"expectP2pAddressMatch" desc:"Regex pattern that P2P addresses must match."`

	// Metadata checks
	ExpectSeqNumber *uint64 `yaml:"expectSeqNumber" json:"expectSeqNumber" desc:"Expected metadata sequence number."`
	MinSeqNumber    *uint64 `yaml:"minSeqNumber" json:"minSeqNumber" desc:"Minimum metadata sequence number required."`
	ContinueOnPass  bool    `` /* 137-byte string literal not displayed */
}

func DefaultConfig

func DefaultConfig() Config

func (*Config) Validate

func (c *Config) Validate() error

type IdentityCheckResult

type IdentityCheckResult struct {
	ClientName         string                 `json:"clientName"`
	PeerID             string                 `json:"peerId"`
	ENR                string                 `json:"enr"`
	P2PAddresses       []string               `json:"p2pAddresses"`
	DiscoveryAddresses []string               `json:"discoveryAddresses"`
	SeqNumber          uint64                 `json:"seqNumber"`
	Attnets            string                 `json:"attnets"`
	Syncnets           string                 `json:"syncnets"`
	CGC                uint64                 `json:"cgc"`
	ENRFields          map[string]interface{} `json:"enrFields"`
	ChecksPassed       bool                   `json:"checksPassed"`
	FailureReasons     []string               `json:"failureReasons"`
}

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