From 75bb4288ffe85f896c165a3c7a4b6309624234f4 Mon Sep 17 00:00:00 2001 From: Eitan Seri- Levi Date: Tue, 3 Feb 2026 21:19:58 -0800 Subject: [PATCH] Resolve some TODOs --- beacon_node/beacon_chain/src/beacon_block.rs | 35 +++++++------------ .../validator_services/src/block_service.rs | 5 +++ 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/beacon_node/beacon_chain/src/beacon_block.rs b/beacon_node/beacon_chain/src/beacon_block.rs index 3b69318427..98233cdf08 100644 --- a/beacon_node/beacon_chain/src/beacon_block.rs +++ b/beacon_node/beacon_chain/src/beacon_block.rs @@ -196,14 +196,12 @@ impl BeaconChain { }); } - // TODO(gloas) - // let slot_timer = metrics::start_timer(&metrics::BLOCK_PRODUCTION_SLOT_PROCESS_TIMES); + let slot_timer = metrics::start_timer(&metrics::BLOCK_PRODUCTION_SLOT_PROCESS_TIMES); // Ensure the state has performed a complete transition into the required slot. complete_state_advance(&mut state, state_root_opt, produce_at_slot, &self.spec)?; - // TODO(gloas) - // drop(slot_timer); + drop(slot_timer); state.build_committee_cache(RelativeEpoch::Current, &self.spec)?; state.apply_pending_mutations()?; @@ -238,9 +236,8 @@ impl BeaconChain { // are included in the operation pool. { let _guard = debug_span!("import_naive_aggregation_pool").entered(); - // TODO(gloas) - // let _unagg_import_timer = - // metrics::start_timer(&metrics::BLOCK_PRODUCTION_UNAGGREGATED_TIMES); + let _unagg_import_timer = + metrics::start_timer(&metrics::BLOCK_PRODUCTION_UNAGGREGATED_TIMES); for attestation in self.naive_aggregation_pool.read().iter() { let import = |attestation: &Attestation| { let attesting_indices = @@ -260,9 +257,8 @@ impl BeaconChain { let mut attestations = { let _guard = debug_span!("pack_attestations").entered(); - // TODO(gloas) - // let _attestation_packing_timer = - // metrics::start_timer(&metrics::BLOCK_PRODUCTION_ATTESTATION_TIMES); + let _attestation_packing_timer = + metrics::start_timer(&metrics::BLOCK_PRODUCTION_ATTESTATION_TIMES); // Epoch cache and total balance cache are required for op pool packing. state.build_total_active_balance_cache(&self.spec)?; @@ -528,19 +524,16 @@ impl BeaconChain { Signature::empty(), ); - // TODO(gloas) ensure block size is measured from the signed block let block_size = signed_beacon_block.ssz_bytes_len(); debug!(%block_size, "Produced block on state"); - // TODO(gloas) - // metrics::observe(&metrics::BLOCK_SIZE, block_size as f64); + metrics::observe(&metrics::BLOCK_SIZE, block_size as f64); if block_size > self.config.max_network_size { return Err(BlockProductionError::BlockTooLarge(block_size)); } - // TODO(gloas) - // let process_timer = metrics::start_timer(&metrics::BLOCK_PRODUCTION_PROCESS_TIMES); + let process_timer = metrics::start_timer(&metrics::BLOCK_PRODUCTION_PROCESS_TIMES); let signature_strategy = match verification { ProduceBlockVerification::VerifyRandao => BlockSignatureStrategy::VerifyRandao, ProduceBlockVerification::NoVerification => BlockSignatureStrategy::NoVerification, @@ -562,16 +555,13 @@ impl BeaconChain { &mut ctxt, &self.spec, )?; - // TODO(gloas) - // drop(process_timer); + drop(process_timer); - // TODO(gloas) - //let state_root_timer = metrics::start_timer(&metrics::BLOCK_PRODUCTION_STATE_ROOT_TIMES); + let state_root_timer = metrics::start_timer(&metrics::BLOCK_PRODUCTION_STATE_ROOT_TIMES); let state_root = state.update_tree_hash_cache()?; - // TODO(gloas) - // drop(state_root_timer); + drop(state_root_timer); let (mut block, _) = signed_beacon_block.deconstruct(); *block.state_root_mut() = state_root; @@ -603,8 +593,7 @@ impl BeaconChain { ); } - // TODO(gloas) - // metrics::inc_counter(&metrics::BLOCK_PRODUCTION_SUCCESSES); + metrics::inc_counter(&metrics::BLOCK_PRODUCTION_SUCCESSES); trace!( parent = ?block.parent_root(), diff --git a/validator_client/validator_services/src/block_service.rs b/validator_client/validator_services/src/block_service.rs index 1f1ccdb320..2e20ec736e 100644 --- a/validator_client/validator_services/src/block_service.rs +++ b/validator_client/validator_services/src/block_service.rs @@ -631,6 +631,11 @@ impl BlockService { /// Fetch, sign, and publish the execution payload envelope for Gloas. /// This should be called after the block has been published. + /// + /// TODO(gloas): For multi-BN setups, we need to track which beacon node produced the block + /// and fetch/publish the envelope from that same node. The envelope is cached per-BN, + /// so fetching from a different BN than the one that built the block will fail. + /// See: https://github.com/sigp/lighthouse/pull/8313 #[instrument(skip_all, fields(%slot, ?validator_pubkey))] async fn fetch_sign_and_publish_payload_envelope( &self,