Repository navigation
Description
Problem
ethlambda beacon does not implement fulu validator custody. It custodies and advertises whatever --custody-group-count says (default CUSTODY_REQUIREMENT = 4), regardless of how many validators are attached to it.
Fulu validator.md ("Validator custody") says a node with validators attached custodies get_validators_custody_requirement(state, validator_indices) groups. That is the attached validators' total effective balance divided by BALANCE_PER_ADDITIONAL_CUSTODY_GROUP (32 ETH), with a floor of VALIDATOR_CUSTODY_REQUIREMENT (8) and a cap of NUMBER_OF_CUSTODY_GROUPS (128). A node with 4096 ETH or more attached must therefore be a supernode.
Observed in a kurtosis test enclave: with 128 validators attached, ethlambda logged custody_group_count=4, while Lighthouse in the same network reported 128. A network laid out on the assumption that every validating node stores at least 8 groups is short on column custody wherever ethlambda runs the validators.
What the code does today (at 0ea6e21)
validator_custody_requirementandbalance_per_additional_custody_groupare parsed intoConfigand then dropped.first_config_differencedestructures both as_, and nothing else reads them.
ethlambda/bin/ethlambda/src/main.rs
Lines 1884 to 1890 in 0ea6e21
// PeerDAS custody: describes what this node samples/custodies, an // operator/wire choice, not a state-transition rule. balance_per_additional_custody_group: _, custody_requirement: _, number_of_custody_groups: _, samples_per_slot: _, validator_custody_requirement: _, - The custody set is computed once at startup, in
wire_params, from the CLI value, and kept for the life of the process.
ethlambda/bin/ethlambda/src/beacon.rs
Lines 211 to 220 in 0ea6e21
let sampling = ethlambda_state_transition::beacon::das::sampling_size(custody_group_count); let custody_columns = ethlambda_state_transition::beacon::das::custody_columns(node_id, sampling) .expect("the sampling size is within NUMBER_OF_CUSTODY_GROUPS"); info!( custody_group_count, sampling, columns = ?custody_columns, "Custodying data columns" ); - The node does not record which validators are attached.
beacon_committee_subscriptionsparsesvalidator_indexbut never reads it, andprepare_beacon_proposerkeeps the indices only as keys of the fee-recipient map.
ethlambda/crates/net/rpc/src/beacon/validator.rs
Lines 285 to 299 in 0ea6e21
/// One entry of `beacon_committee_subscriptions`. Parsed so a malformed body /// is refused, though `validator_index` is never read. #[derive(Debug, Deserialize)] struct CommitteeSubscription { #[allow(dead_code)] #[serde(with = "ethlambda_types::beacon::serde_helpers::quoted_or_bare")] validator_index: ValidatorIndex, #[serde(with = "ethlambda_types::beacon::serde_helpers::quoted_or_bare")] committee_index: CommitteeIndex, #[serde(with = "ethlambda_types::beacon::serde_helpers::quoted_or_bare")] committees_at_slot: u64, #[serde(with = "ethlambda_types::beacon::serde_helpers::quoted_or_bare")] slot: Slot, is_aggregator: bool, }
ethlambda/crates/net/rpc/src/beacon/validator.rs
Lines 348 to 358 in 0ea6e21
/// `POST /eth/v1/validator/prepare_beacon_proposer`: record where each /// validator's block rewards should be paid. async fn post_prepare_beacon_proposer( Extension(fee_recipients): Extension<FeeRecipients>, Json(preparations): Json<Vec<ProposerPreparation>>, ) -> Response { let mut map = fee_recipients.lock().expect("fee recipient lock poisoned"); for preparation in preparations { map.insert(preparation.validator_index, preparation.fee_recipient); } axum::http::StatusCode::OK.into_response() - MetaData v3 always answers
custody_group_count = CUSTODY_REQUIREMENT, even when--custody-group-countis set higher. The ENR'scgcdoes carry the flag's value, so the two disagree on any node started with a non-default count.
ethlambda/crates/net/p2p/src/beacon/handler.rs
Lines 124 to 148 in 0ea6e21
/// `custody_group_count` is `CUSTODY_REQUIREMENT`, the floor a peer may demand, /// not this node's actual custody: `sampling_size` raises what it stores and /// serves (`BeaconWire::custody_columns`) to cover at least `SAMPLES_PER_SLOT` /// groups, so `cgc` can only understate this node's real coverage, never /// overstate it. pub fn build_metadata(wire: &BeaconWire, protocol: &str) -> Option<BeaconMetaData> { let seq_number = wire.metadata_seq_number; let attnets = attnets(wire); let syncnets = syncnets(wire); match protocol { protocols::METADATA_V1 => Some(BeaconMetaData::V1(MetaDataV1 { seq_number, attnets, })), protocols::METADATA_V2 => Some(BeaconMetaData::V2(MetaDataV2 { seq_number, attnets, syncnets, })), protocols::METADATA_V3 => Some(BeaconMetaData::V3(MetaDataV3 { seq_number, attnets, syncnets, custody_group_count: constants::CUSTODY_REQUIREMENT, })), GET /eth/v1/node/identityreportsseq_number,attnetsandsyncnetsundermetadata, but notcustody_group_count.AdvertisedMetaDatahas no field for it.
ethlambda/crates/net/rpc/src/beacon/node.rs
Lines 117 to 130 in 0ea6e21
let identity = identity.unwrap_or_default(); let metadata = match identity.metadata { Some(metadata) => { let metadata = metadata.get(); serde_json::json!({ "seq_number": metadata.seq_number.to_string(), "attnets": format!("0x{}", hex::encode(&metadata.attnets)), "syncnets": format!("0x{}", hex::encode(&metadata.syncnets)), }) } None => serde_json::json!({ "seq_number": "0", "attnets": "0x0000000000000000", "syncnets": "0x00",
What the spec asks for (fulu validator.md)
- Advertise the higher count in MetaData
custody_group_countand in the ENR'scgc. - Adjust it dynamically, without operator input, as the attached validators' effective balances change.
- On an increase, advertise the new count immediately. Backfill MAY follow.
earliest_available_slotin Status v2 should reflect what the node can actually serve, and may move lower as backfill progresses. - On a decrease, keep custodying and advertising the previous (highest) count, and persist it across restarts.
Rough scope
- Track attached validator indices from validator client calls (
beacon_committee_subscriptions,prepare_beacon_proposer), with an expiry so that a detached validator client stops counting. - Once per epoch, compute
get_validators_custody_requirementand take the larger of the flag, that requirement, and the persisted highest count. Store the highest count in the data directory. - Make the custody set changeable at runtime. Today it is fixed in
BeaconWireand in the chain actor at spawn, and these paths read it: data-column subnet subscriptions, the availability check, req/resp serving, and the engine's custody columns. - When the count changes, bump the MetaData
seq_numberand the ENR. The ENR has the same known gap as the fork digest: ethrex'sDiscoveryServercannot replace the record it serves at runtime, socgcwould stay at its startup value until a restart. - Make MetaData v3 report the real count, and add
custody_group_countto/eth/v1/node/identity. - After an increase, keep
earliest_available_slothonest until backfill completes.
Steps 5 and 1 are small and independent, so they could land first.
Activity