Repository navigation
feat(validator): --network, to hold every beacon node to a named network - #902
Open
MegaRedHand wants to merge 5 commits into
Open
MegaRedHand wants to merge 5 commits into
MegaRedHand wants to merge 5 commits into
Conversation
Brings in #868, #872, #880, #884, #885 and #886, among others. Each side added a flag next to --beacon-nodes, a ValidatorConfig field and a row in the README and docs/cli.md flag tables. --network and main's --broadcast both stay, --network first, and the --beacon-nodes rows take main's text, which describes #885's ranking. The config is built before run (#872), so network joins main's broadcast and event_stream fields there.
…agreeing nodes Review round 1 on #902: - With --network, the reference was the first node on the network whatever schedule it served, so with one node stale on a rescheduled fork listed ahead of an upgraded one, the client followed the stale schedule and later dropped the node that agreed with the network. The first node on the network that also serves the network's schedule is now the reference, and the first on the network when none does. - The help text and the flag row said startup fails when every node that answered is off the network. It fails once every configured node has answered and none is on it, and waits while one has not answered. - The schedule warning told the operator to upgrade the beacon nodes or this client. For a directory the stale side can be its config.yaml, so the warning now names --network's config (this binary's for a built-in network, the directory's config.yaml otherwise), and the help text agrees with it. - The help text and docs/cli.md say a directory is resolved whole, as for beacon: its genesis.ssz decoded and its bootnodes file read. - Tests: the reference preference, a network directory resolving to its genesis and config, and a directory without CONFIG_NAME named by the flag's value. network::dir's complete_dir fixture is now reachable from the crate's other tests.
… schedule says Review round 2 on #902 found round 1's tie-break wrong in the other half of the case it was for. When the validator binary is the stale side (a fork postponed from X to Y, the binary still at X), preferring the node that matches --network's schedule made the stale node the reference: the client followed X, the upgraded node was dropped at X, and the schedule warning stayed quiet since the followed schedule equalled the network's. That is the outage the PR's design rules out by only ever comparing against the network's config. The reference is the first node on the network again, as without --network. The test now pins that a later node matching the network's schedule does not take its place, and the docs and help text say why: the network's config may be the stale side, and the once-an-epoch warning names the difference in either case.
MegaRedHand
added a commit
that referenced
this pull request
Nov 27, 2026
…ork (#902) The validator client had no network config of its own: it ran on whatever chain the first beacon node to answer was on, created its slashing protection record on that chain, and followed an outdated fork schedule without a word when every node served one. ethlambda validator now takes an optional --network (mainnet, sepolia, hoodi, plataberget, or a directory of published network files), resolved by the same network module ethlambda beacon uses. With no flag nothing changes. The network holds the chain's identity: a node whose preset, genesis time, genesis validators root, slot duration or genesis fork version differs from it is never the reference and is skipped like any incompatible node, and startup fails once every configured node has answered and none is on the network (it waits while one has not answered). The fork schedule only warns, once an epoch, naming both values, since either side can be the stale one: the beacon nodes, or --network's config (this binary's for a built-in network, the directory's config.yaml otherwise). The named network is only compared against; the client still runs on the reference node's config, and list order still picks the reference among the nodes on the network. Applied as the PR's own diff against its merge base with main (4989419), since its branch carries main merges, on top of #899. Resolved against #871, #873, #874 and #877: ValidatorConfig and its construction keep #874's distributed and #877's shut_down_when_slashed next to this PR's network, with --broadcast where nightly has it; the imports keep #871's GraffitiFile, and drop DEFAULT_GAS_LIMIT as #873 did; chain_check::run takes #873's settings and this PR's network, and each round hands over the gas limit schedule before the schedule warning.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🗒️ Description / Motivation
The validator client has no network config of its own. It runs on whatever chain the first beacon node to answer is on, and checks the other nodes against that one. That leaves two gaps:
genesis_validators_rootonce it exists, but it is created on whatever chain the first answering node reports.Lighthouse, Lodestar and Prysm let the validator client name its network; Teku defaults to
auto(take it from the node), and Nimbus has no flag. This adds an optional--network, in the style of Teku's named mode and Lighthouse's check: it holds the identity of the chain to the named network, and only warns about the fork schedule.No open PR adds this. The closest is #873 (GAS_LIMIT_SCHEDULE), which touches
chain_check.rs, the spec parsing andlib.rs; it is a likely merge conflict, not something to build on. This PR keeps its edits to those files additive.What Changed
ethlambda validator --network <name|dir>ethlambda beacon --networktakes:mainnet,sepolia,hoodi,plataberget, or a directory of published network files. It is resolved by the samenetworkmodule (NetworkSpec::parse+NetworkSource::resolve), so the client and the node read a network's config the same way.validator::run. Resolving selects the network's preset, which is fine forrequire_unread_preset(): that only fails when a read froze a preset before any select.What the network is compared on (
chain_check)PRESET_BASE,genesis_time,genesis_validators_root, slot duration,GENESIS_FORK_VERSIONfirst_identity_difference)schedule_differences,warn_if_schedule_differs)first_identity_differenceis the prefixfirst_chain_differencealready checked, pulled out into its own function;first_chain_differencecalls it, so node-vs-node checking is unchanged.GLOAS_FORK_EPOCH (beacon nodes unscheduled, network config 143616)), and says one side is out of date without guessing which.SharedConfigor the schedule merge; the client still runs on the reference node's config.Startup (
FallbackBeaconNode::establish_on)establishnow delegates to a newestablish_on(network, with_reference), so the existing call sites are untouched. With a network:with_referencenever adopts its chain or its preset.node 0: not on sepolia: genesis_time (ours 1655733600, theirs 1742213400)). Otherwise it keeps waiting for a node on the network, as it waits today.After startup nothing changes: every node compatible with the reference has the network's identity.
Docs
docs/cli.md(flag row and the chain-check section), README flag table,CLAUDE.md's validator paragraph, and the doc comments onadopt_preset, thechain_checkmodule,establish_onandvalidator.rs's module doc.Correctness / Behavior Guarantees
establish(f)isestablish_on(None, f), and withNoneeveryOkanswer can be the reference, as before. The only user-visible differences are the wording of the "waiting for a node" log line and anetworkfield on the startup log line.NetworkSource::resolveunchanged, so it decodes the directory'sgenesis.sszand runscheck_constants. A directory whose constants this binary refuses as a beacon node is refused here too, even though a validator client does not use those constants.ethlambda voluntary-exittakes no--network.Tests Added / Run
Added (not run locally; CI runs them):
chain_check:the_identity_leaves_the_forks_out,a_schedule_differs_from_the_network_by_epoch_or_scheduled_version,an_unscheduled_forks_version_is_no_schedule_difference.chain_check, through the fallback with mock nodes:a_node_off_the_named_network_is_never_the_reference(also checkswith_referencesees only the network's chain and the off-network node gets no duty call),without_a_named_network_the_first_answer_is_the_reference,the_named_networks_schedule_does_not_pick_the_reference,every_node_off_the_named_network_fails_at_once(under a 1 s timeout, shorter than a startup retry),startup_waits_for_a_node_on_the_named_network.bin/ethlambda/src/validator.rs:the_network_is_optional,a_built_in_network_resolves_to_its_genesis_and_config(Hoodi),a_network_directory_resolves_to_its_genesis_and_config,a_network_directory_without_a_config_name_is_named_by_its_path,an_unknown_network_name_is_refused_at_startup.Run:
make fmt make lint # clippy --all-targets, so the new tests compileEnd to end, the
release-fastbinary against a local server replaying the/eth/v1/beacon/genesisand/eth/v1/config/specanswers recorded from our Hoodi and Sepolia beacon nodes (no validators loaded):--network hoodinetwork="hoodi"--network sepolianode 0: not on sepolia: genesis_time (ours 1655733600, theirs 1742213400)--network sepolianetwork="any, taken from the beacon nodes"GLOAS_FORK_EPOCH: 143616--network hoodi(run before #901 merged, when this branch's Hoodi config had Gloas unscheduled)differences=GLOAS_FORK_EPOCH (beacon nodes 143616, network config unscheduled)So a real node's spec and the built-in configs agree on every identity field (
PRESET_BASE,SLOT_DURATION_MS,GENESIS_FORK_VERSION, genesis).Related Issues / PRs
chain_check.rs,fallback.rsorlib.rs.✅ Verification Checklist
make fmtmake lint(clippy with-D warnings)make test: left to CI