evaluators

package
v7.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: GPL-3.0 Imports: 53 Imported by: 0

Documentation

Overview

Package evaluators defines functions which can peer into end to end tests to determine if a chain is running as required.

Index

Constants

This section is empty.

Variables

View Source
var ActivatesDepositedValidators = e2etypes.Evaluator{
	Name: "processes_deposit_validators_epoch_%d",
	Policy: func(e primitives.Epoch) bool {

		if e2etypes.GenesisFork() >= version.Electra {
			return false
		}
		return policies.BetweenEpochs(depositActivationStartEpoch, depositEndEpoch)(e)
	},
	Evaluation: activatesDepositedValidators,
}

ActivatesDepositedValidators ensures the expected amount of validator deposits are activated into the state. Note: This evaluator only works for pre-Electra genesis since Electra uses EIP-6110 deposit requests.

View Source
var AllNodesHaveSameHead = e2etypes.Evaluator{
	Name:       "all_nodes_have_same_head_%d",
	Policy:     policies.AllEpochs,
	Evaluation: allNodesHaveSameHead,
}

AllNodesHaveSameHead ensures all nodes have the same head epoch. Checks finality and justification as well. Not checking head block root as it may change irregularly for the validator connected nodes.

View Source
var AltairForkTransition = e2etypes.Evaluator{
	Name: "altair_fork_transition_%d",
	Policy: func(e primitives.Epoch) bool {

		if e2etypes.GenesisFork() >= version.Altair {
			return false
		}
		altair := policies.OnEpoch(params.BeaconConfig().AltairForkEpoch)
		return altair(e)
	},
	Evaluation: altairForkOccurs,
}

AltairForkTransition ensures that the Altair hard fork has occurred successfully.

View Source
var BellatrixForkTransition = e2etypes.Evaluator{
	Name: "bellatrix_fork_transition_%d",
	Policy: func(e primitives.Epoch) bool {

		if e2etypes.GenesisFork() >= version.Bellatrix {
			return false
		}
		fEpoch := params.BeaconConfig().BellatrixForkEpoch
		return policies.OnEpoch(fEpoch)(e)
	},
	Evaluation: bellatrixForkOccurs,
}

BellatrixForkTransition ensures that the Bellatrix hard fork has occurred successfully.

View Source
var BlobLimitsRespected = e2etypes.Evaluator{
	Name: "blob_limits_respected_epoch_%d",
	Policy: func(currentEpoch primitives.Epoch) bool {

		return policies.OnwardsNthEpoch(params.BeaconConfig().FuluForkEpoch)(currentEpoch)
	},
	Evaluation: blobLimitsRespected,
}

BlobLimitsRespected verifies that the BPO (Blob Parameter Optimization) limits are correctly enforced after Fulu fork, checking that: 1. Blocks don't exceed MaxBlobsPerBlock for their respective epoch 2. We're utilizing the increased capacity (at least 50% utilization) 3. When BPO activates (limit increases), blocks actually use the new higher limit

View Source
var BlobsIncludedInBlocks = e2etypes.Evaluator{
	Name: "blobs_included_in_blocks_epoch_%d",
	Policy: func(currentEpoch primitives.Epoch) bool {

		return policies.OnwardsNthEpoch(params.BeaconConfig().DenebForkEpoch)(currentEpoch)
	},
	Evaluation: blobsIncludedInBlocks,
}

BlobsIncludedInBlocks verifies that blocks contain blobs and that the blob count does not exceed the maximum allowed for the epoch (respecting BPO schedule).

View Source
var BuilderIsActive = e2etypes.Evaluator{
	Name: "builder_is_active_at_epoch_%d",
	Policy: func(e primitives.Epoch) bool {
		fEpoch := params.BeaconConfig().BellatrixForkEpoch
		return policies.OnwardsNthEpoch(fEpoch)(e)
	},
	Evaluation: builderActive,
}

BuilderIsActive checks that the builder is indeed producing the respective payloads

View Source
var CapellaForkTransition = e2etypes.Evaluator{
	Name: "capella_fork_transition_%d",
	Policy: func(e primitives.Epoch) bool {

		if e2etypes.GenesisFork() >= version.Capella {
			return false
		}
		fEpoch := params.BeaconConfig().CapellaForkEpoch
		return policies.OnEpoch(fEpoch)(e)
	},
	Evaluation: capellaForkOccurs,
}

CapellaForkTransition ensures that the Capella hard fork has occurred successfully.

View Source
var ColdStateCheckpoint = e2etypes.Evaluator{
	Name: "cold_state_assignments_from_epoch_%d",
	Policy: func(currentEpoch primitives.Epoch) bool {
		return currentEpoch == epochToCheck
	},
	Evaluation: checkColdStateCheckpoint,
}

ColdStateCheckpoint checks data from the database using cold state storage.

View Source
var DenebForkTransition = e2etypes.Evaluator{
	Name: "deneb_fork_transition_%d",
	Policy: func(e primitives.Epoch) bool {

		if e2etypes.GenesisFork() >= version.Deneb {
			return false
		}
		fEpoch := params.BeaconConfig().DenebForkEpoch
		return policies.OnEpoch(fEpoch)(e)
	},
	Evaluation: denebForkOccurs,
}

DenebForkTransition ensures that the Deneb hard fork has occurred successfully

View Source
var DepositedValidatorsAreActive = e2etypes.Evaluator{
	Name: "deposited_validators_are_active_epoch_%d",
	Policy: func(e primitives.Epoch) bool {

		if e2etypes.GenesisFork() >= version.Electra {
			return false
		}
		return policies.AfterNthEpoch(depositEndEpoch)(e)
	},
	Evaluation: depositedValidatorsAreActive,
}

DepositedValidatorsAreActive ensures the expected amount of validators are active after their deposits are processed. Note: This evaluator only works for pre-Electra genesis since Electra uses EIP-6110 deposit requests.

View Source
var ElectraForkTransition = e2etypes.Evaluator{
	Name: "electra_fork_transition_%d",
	Policy: func(e primitives.Epoch) bool {

		if e2etypes.GenesisFork() >= version.Electra {
			return false
		}
		fEpoch := params.BeaconConfig().ElectraForkEpoch
		return policies.OnEpoch(fEpoch)(e)
	},
	Evaluation: electraForkOccurs,
}

ElectraForkTransition ensures that the electra hard fork has occurred successfully

View Source
var FeeRecipientIsPresent = types.Evaluator{
	Name: "fee_recipient_is_present_%d",
	Policy: func(e primitives.Epoch) bool {
		fEpoch := params.BeaconConfig().BellatrixForkEpoch
		return policies.AfterNthEpoch(fEpoch)(e)
	},
	Evaluation: feeRecipientIsPresent,
}
View Source
var FinalizationOccurs = func(epoch primitives.Epoch) types.Evaluator {
	return types.Evaluator{
		Name:       "finalizes_at_epoch_%d",
		Policy:     policies.AfterNthEpoch(epoch),
		Evaluation: finalizationOccurs,
	}
}

FinalizationOccurs is an evaluator to make sure finalization is performing as it should. Requires to be run after at least 4 epochs have passed.

View Source
var FinishedSyncing = e2etypes.Evaluator{
	Name:       "finished_syncing_%d",
	Policy:     policies.AllEpochs,
	Evaluation: finishedSyncing,
}

FinishedSyncing returns whether the beacon node with the given rpc port has finished syncing.

View Source
var FuluForkTransition = e2etypes.Evaluator{
	Name: "fulu_fork_transition_%d",
	Policy: func(e primitives.Epoch) bool {

		if e2etypes.GenesisFork() >= version.Fulu {
			return false
		}
		fEpoch := params.BeaconConfig().FuluForkEpoch
		return policies.OnEpoch(fEpoch)(e)
	},
	Evaluation: fuluForkOccurs,
}

FuluForkTransition ensures that the fulu hard fork has occurred successfully

View Source
var HealthzCheck = e2etypes.Evaluator{
	Name:       "healthz_check_epoch_%d",
	Policy:     policies.AfterNthEpoch(0),
	Evaluation: healthzCheck,
}

HealthzCheck pings healthz and errors if it doesn't have the expected OK status.

View Source
var InjectDoubleBlockOnEpoch = func(n primitives.Epoch) e2eTypes.Evaluator {
	return e2eTypes.Evaluator{
		Name:       "inject_double_block_%d",
		Policy:     policies.OnEpoch(n),
		Evaluation: proposeDoubleBlock,
	}
}

InjectDoubleBlockOnEpoch proposes a double block to the beacon node for the slasher to detect.

View Source
var InjectDoubleVoteOnEpoch = func(n primitives.Epoch) e2eTypes.Evaluator {
	return e2eTypes.Evaluator{
		Name:       "inject_double_vote_%d",
		Policy:     policies.OnEpoch(n),
		Evaluation: insertDoubleAttestationIntoPool,
	}
}

InjectDoubleVoteOnEpoch broadcasts a double vote into the beacon node pool for the slasher to detect.

View Source
var MetricsCheck = types.Evaluator{
	Name:       "metrics_check_epoch_%d",
	Policy:     policies.AfterNthEpoch(0),
	Evaluation: metricsTest,
}

MetricsCheck performs a check on metrics to make sure caches are functioning, and overall health is good. Not checking the first epoch so the sample size isn't too small.

View Source
var OptimisticSyncEnabled = types.Evaluator{
	Name:       "optimistic_sync_at_epoch_%d",
	Policy:     policies.AllEpochs,
	Evaluation: optimisticSyncEnabled,
}

OptimisticSyncEnabled checks that the node is in an optimistic state.

View Source
var PeersCheck = types.Evaluator{
	Name:       "peers_check_epoch_%d",
	Policy:     policies.AfterNthEpoch(0),
	Evaluation: peersTest,
}

PeersCheck performs a check on peer data to ensure that any connected peers are not publishing invalid data.

View Source
var PeersConnect = e2etypes.Evaluator{
	Name:       "peers_connect_epoch_%d",
	Policy:     policies.OnEpoch(0),
	Evaluation: peersConnect,
}

PeersConnect checks all beacon nodes and returns whether they are connected to each other as peers.

View Source
var ProcessesDepositsInBlocks = e2etypes.Evaluator{
	Name: "processes_deposits_in_blocks_epoch_%d",
	Policy: func(e primitives.Epoch) bool {

		if e2etypes.GenesisFork() >= version.Electra {
			return false
		}
		return policies.OnEpoch(depositsInBlockStart)(e)
	},
	Evaluation: processesDepositsInBlocks,
}

ProcessesDepositsInBlocks ensures the expected amount of deposits are accepted into blocks. Note: This evaluator only works for pre-Electra genesis since Electra uses EIP-6110 deposit requests.

View Source
var ProposeVoluntaryExit = ProposeVoluntaryExitAtEpoch(defaultExitSubmissionEpoch)

ProposeVoluntaryExit sends a voluntary exit from randomly selected validator in the genesis set. Uses the default exit submission epoch (7).

View Source
var ProposeVoluntaryExitAtEpoch = func(epoch primitives.Epoch) e2etypes.Evaluator {
	return e2etypes.Evaluator{
		Name:       "propose_voluntary_exit_epoch_%d",
		Policy:     policies.OnEpoch(epoch),
		Evaluation: proposeVoluntaryExit,
	}
}

ProposeVoluntaryExitAtEpoch sends a voluntary exit at the specified epoch.

View Source
var SlashedValidatorsLoseBalanceAfterEpoch = func(n primitives.Epoch) e2eTypes.Evaluator {
	return e2eTypes.Evaluator{
		Name:       "slashed_validators_lose_balance_epoch_%d",
		Policy:     policies.AfterNthEpoch(n),
		Evaluation: validatorsLoseBalance,
	}
}

SlashedValidatorsLoseBalanceAfterEpoch checks if the validators slashed lose the right balance.

View Source
var SubmitWithdrawal = SubmitWithdrawalAtEpoch(defaultExitSubmissionEpoch + 1)

SubmitWithdrawal sends a withdrawal from a previously exited validator. Uses default timing based on exit submission epoch.

View Source
var SubmitWithdrawalAtEpoch = func(epoch primitives.Epoch) e2etypes.Evaluator {
	return e2etypes.Evaluator{
		Name: "submit_withdrawal_epoch_%d",
		Policy: func(currentEpoch primitives.Epoch) bool {
			fEpoch := params.BeaconConfig().CapellaForkEpoch

			if e2etypes.GenesisFork() >= version.Deneb {
				return policies.OnEpoch(epoch)(currentEpoch)
			}
			return policies.BetweenEpochs(fEpoch-2, fEpoch+1)(currentEpoch)
		},
		Evaluation: submitWithdrawal,
	}
}

SubmitWithdrawalAtEpoch sends a withdrawal at the specified epoch. For pre-Deneb genesis, it runs around the Capella fork epoch instead.

View Source
var ValidatorSyncParticipation = types.Evaluator{
	Name: "validator_sync_participation_%d",
	Policy: func(e primitives.Epoch) bool {
		fEpoch := params.BeaconConfig().AltairForkEpoch
		return policies.OnwardsNthEpoch(fEpoch)(e)
	},
	Evaluation: validatorsSyncParticipation,
}

ValidatorSyncParticipation ensures the expected amount of sync committee participants are active.

View Source
var ValidatorsAreActive = types.Evaluator{
	Name:       "validators_active_epoch_%d",
	Policy:     policies.AllEpochs,
	Evaluation: validatorsAreActive,
}

ValidatorsAreActive ensures the expected amount of validators are active.

View Source
var ValidatorsHaveExited = ValidatorsHaveExitedAtEpoch(defaultExitSubmissionEpoch + 1)

ValidatorsHaveExited checks the beacon state for the exited validator and ensures its marked as exited. Uses the default exit submission epoch + 1 (epoch 8).

View Source
var ValidatorsHaveExitedAtEpoch = func(epoch primitives.Epoch) e2etypes.Evaluator {
	return e2etypes.Evaluator{
		Name:       "voluntary_has_exited_%d",
		Policy:     policies.OnEpoch(epoch),
		Evaluation: validatorsHaveExited,
	}
}

ValidatorsHaveExitedAtEpoch checks validators have exited at the specified epoch.

View Source
var ValidatorsHaveWithdrawn = ValidatorsHaveWithdrawnAfterExitAtEpoch(defaultExitSubmissionEpoch)

ValidatorsHaveWithdrawn checks the beacon state for the withdrawn validator and ensures it has been withdrawn. Uses default timing based on exit submission epoch.

View Source
var ValidatorsHaveWithdrawnAfterExitAtEpoch = func(exitSubmitEpoch primitives.Epoch) e2etypes.Evaluator {
	return e2etypes.Evaluator{
		Name: "validator_has_withdrawn_%d",
		Policy: func(currentEpoch primitives.Epoch) bool {

			if params.BeaconConfig().ConfigName != params.EndToEndName {
				return false
			}

			fEpoch := params.BeaconConfig().CapellaForkEpoch
			// If Capella is disabled (starting at Deneb+), run after withdrawal submission
			var validWithdrawnEpoch primitives.Epoch
			if e2etypes.GenesisFork() >= version.Deneb {

				exitEpoch := exitSubmitEpoch + 1 + primitives.Epoch(params.BeaconConfig().MaxSeedLookahead)
				withdrawableEpoch := exitEpoch + primitives.Epoch(params.BeaconConfig().MinValidatorWithdrawabilityDelay)
				validWithdrawnEpoch = withdrawableEpoch + 1
			} else {

				validWithdrawnEpoch = fEpoch + 2
			}

			requiredPolicy := policies.OnEpoch(validWithdrawnEpoch)
			return requiredPolicy(currentEpoch)
		},
		Evaluation: validatorsAreWithdrawn,
	}
}

ValidatorsHaveWithdrawnAfterExitAtEpoch checks validators have withdrawn after exiting at the specified epoch. For pre-Deneb genesis, it runs at CapellaForkEpoch + 1 instead.

View Source
var ValidatorsParticipatingAtEpoch = func(epoch primitives.Epoch) types.Evaluator {
	return types.Evaluator{
		Name:       "validators_participating_epoch_%d",
		Policy:     policies.AfterNthEpoch(epoch),
		Evaluation: validatorsParticipating,
	}
}

ValidatorsParticipatingAtEpoch ensures the expected amount of validators are participating.

View Source
var ValidatorsSlashedAfterEpoch = func(n primitives.Epoch) e2eTypes.Evaluator {
	return e2eTypes.Evaluator{
		Name:       "validators_slashed_epoch_%d",
		Policy:     policies.AfterNthEpoch(n),
		Evaluation: validatorsSlashed,
	}
}

ValidatorsSlashedAfterEpoch ensures the expected amount of validators are slashed.

View Source
var ValidatorsVoteWithTheMajority = e2etypes.Evaluator{
	Name:       "validators_vote_with_the_majority_%d",
	Policy:     policies.AfterNthEpoch(0),
	Evaluation: validatorsVoteWithTheMajority,
}

ValidatorsVoteWithTheMajority verifies whether validator vote for eth1data using the majority algorithm.

View Source
var VerifyBlockGraffiti = e2etypes.Evaluator{
	Name:       "verify_graffiti_in_blocks_epoch_%d",
	Policy:     policies.AfterNthEpoch(0),
	Evaluation: verifyGraffitiInBlocks,
}

VerifyBlockGraffiti ensures the block graffiti is one of the random list.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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