mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 09:16:00 +00:00
Resolve some TODOs
This commit is contained in:
@@ -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.
|
// 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)?;
|
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.build_committee_cache(RelativeEpoch::Current, &self.spec)?;
|
||||||
state.apply_pending_mutations()?;
|
state.apply_pending_mutations()?;
|
||||||
@@ -238,9 +236,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
// are included in the operation pool.
|
// are included in the operation pool.
|
||||||
{
|
{
|
||||||
let _guard = debug_span!("import_naive_aggregation_pool").entered();
|
let _guard = debug_span!("import_naive_aggregation_pool").entered();
|
||||||
// TODO(gloas)
|
let _unagg_import_timer =
|
||||||
// let _unagg_import_timer =
|
metrics::start_timer(&metrics::BLOCK_PRODUCTION_UNAGGREGATED_TIMES);
|
||||||
// metrics::start_timer(&metrics::BLOCK_PRODUCTION_UNAGGREGATED_TIMES);
|
|
||||||
for attestation in self.naive_aggregation_pool.read().iter() {
|
for attestation in self.naive_aggregation_pool.read().iter() {
|
||||||
let import = |attestation: &Attestation<T::EthSpec>| {
|
let import = |attestation: &Attestation<T::EthSpec>| {
|
||||||
let attesting_indices =
|
let attesting_indices =
|
||||||
@@ -260,9 +257,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
|
|
||||||
let mut attestations = {
|
let mut attestations = {
|
||||||
let _guard = debug_span!("pack_attestations").entered();
|
let _guard = debug_span!("pack_attestations").entered();
|
||||||
// TODO(gloas)
|
let _attestation_packing_timer =
|
||||||
// let _attestation_packing_timer =
|
metrics::start_timer(&metrics::BLOCK_PRODUCTION_ATTESTATION_TIMES);
|
||||||
// metrics::start_timer(&metrics::BLOCK_PRODUCTION_ATTESTATION_TIMES);
|
|
||||||
|
|
||||||
// Epoch cache and total balance cache are required for op pool packing.
|
// Epoch cache and total balance cache are required for op pool packing.
|
||||||
state.build_total_active_balance_cache(&self.spec)?;
|
state.build_total_active_balance_cache(&self.spec)?;
|
||||||
@@ -528,19 +524,16 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
Signature::empty(),
|
Signature::empty(),
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO(gloas) ensure block size is measured from the signed block
|
|
||||||
let block_size = signed_beacon_block.ssz_bytes_len();
|
let block_size = signed_beacon_block.ssz_bytes_len();
|
||||||
debug!(%block_size, "Produced block on state");
|
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 {
|
if block_size > self.config.max_network_size {
|
||||||
return Err(BlockProductionError::BlockTooLarge(block_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 {
|
let signature_strategy = match verification {
|
||||||
ProduceBlockVerification::VerifyRandao => BlockSignatureStrategy::VerifyRandao,
|
ProduceBlockVerification::VerifyRandao => BlockSignatureStrategy::VerifyRandao,
|
||||||
ProduceBlockVerification::NoVerification => BlockSignatureStrategy::NoVerification,
|
ProduceBlockVerification::NoVerification => BlockSignatureStrategy::NoVerification,
|
||||||
@@ -562,16 +555,13 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
&mut ctxt,
|
&mut ctxt,
|
||||||
&self.spec,
|
&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()?;
|
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();
|
let (mut block, _) = signed_beacon_block.deconstruct();
|
||||||
*block.state_root_mut() = state_root;
|
*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!(
|
trace!(
|
||||||
parent = ?block.parent_root(),
|
parent = ?block.parent_root(),
|
||||||
|
|||||||
@@ -631,6 +631,11 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> BlockService<S, T> {
|
|||||||
|
|
||||||
/// Fetch, sign, and publish the execution payload envelope for Gloas.
|
/// Fetch, sign, and publish the execution payload envelope for Gloas.
|
||||||
/// This should be called after the block has been published.
|
/// 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))]
|
#[instrument(skip_all, fields(%slot, ?validator_pubkey))]
|
||||||
async fn fetch_sign_and_publish_payload_envelope(
|
async fn fetch_sign_and_publish_payload_envelope(
|
||||||
&self,
|
&self,
|
||||||
|
|||||||
Reference in New Issue
Block a user