checkconsensusidentity

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 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).

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)
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
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
Using Outputs in Subsequent Tasks
- name: check_identity
  task: check_consensus_identity
  config:
    clientPattern: "*"
    expectCgc: 8

- name: verify_results
  task: run_shell
  config:
    command: |
      echo "Found ${check_identity.matchingCount} matching clients"
      echo "Total CGC sum: $(echo '${check_identity.matchingClients}' | jq '[.[] | .cgc] | add')"

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.",
		Config:      DefaultConfig(),
		NewTask:     NewTask,
	}
)

Functions

func NewTask

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

Types

type Config

type Config struct {
	ClientPattern   string          `yaml:"clientPattern" json:"clientPattern"`
	PollInterval    helper.Duration `yaml:"pollInterval" json:"pollInterval"`
	MinClientCount  int             `yaml:"minClientCount" json:"minClientCount"`
	MaxFailCount    int             `yaml:"maxFailCount" json:"maxFailCount"`
	FailOnCheckMiss bool            `yaml:"failOnCheckMiss" json:"failOnCheckMiss"`

	// CGC (Custody Group Count) checks
	ExpectCGC *uint64 `yaml:"expectCgc" json:"expectCgc"`
	MinCGC    *uint64 `yaml:"minCgc" json:"minCgc"`
	MaxCGC    *uint64 `yaml:"maxCgc" json:"maxCgc"`

	// ENR checks
	ExpectENRField map[string]interface{} `yaml:"expectEnrField" json:"expectEnrField"`

	// PeerID checks
	ExpectPeerIDPattern string `yaml:"expectPeerIdPattern" json:"expectPeerIdPattern"`

	// P2P address checks
	ExpectP2PAddressCount *int   `yaml:"expectP2pAddressCount" json:"expectP2pAddressCount"`
	ExpectP2PAddressMatch string `yaml:"expectP2pAddressMatch" json:"expectP2pAddressMatch"`

	// Metadata checks
	ExpectSeqNumber *uint64 `yaml:"expectSeqNumber" json:"expectSeqNumber"`
	MinSeqNumber    *uint64 `yaml:"minSeqNumber" json:"minSeqNumber"`
}

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