Resolve some TODOs

This commit is contained in:
Eitan Seri- Levi
2026-02-03 21:19:58 -08:00
parent 96d02ad93d
commit 75bb4288ff
2 changed files with 17 additions and 23 deletions

View File

@@ -196,14 +196,12 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
});
}
// 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<T: BeaconChainTypes> BeaconChain<T> {
// 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<T::EthSpec>| {
let attesting_indices =
@@ -260,9 +257,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
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<T: BeaconChainTypes> BeaconChain<T> {
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<T: BeaconChainTypes> BeaconChain<T> {
&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<T: BeaconChainTypes> BeaconChain<T> {
);
}
// TODO(gloas)
// metrics::inc_counter(&metrics::BLOCK_PRODUCTION_SUCCESSES);
metrics::inc_counter(&metrics::BLOCK_PRODUCTION_SUCCESSES);
trace!(
parent = ?block.parent_root(),

View File

@@ -631,6 +631,11 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> BlockService<S, T> {
/// 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,