Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialize EpochCache in transition_blocks if `exclude_cache_buil…
Browse files Browse the repository at this point in the history
…ds` is enabled
jimmygchen committed Jun 23, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 77d0f44 commit 0db4a47
Showing 3 changed files with 10 additions and 8 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -16,11 +16,6 @@ An open-source Ethereum consensus client, written in Rust and maintained by Sigm

![Banner](https://i.postimg.cc/hjdTGKPd/photo-2020-10-23-09-52-16.jpg)

| | `unstable` | `tree-states-fast`|
| ----------- | ----------- | ------ |
| Process Block | | 9 - 10 ms |
| Post-block tree hash | | ~5ms |

## Overview

Lighthouse is:
1 change: 0 additions & 1 deletion consensus/types/src/epoch_cache.rs
Original file line number Diff line number Diff line change
@@ -58,7 +58,6 @@ impl EpochCache {
}
}

// TODO: check at start of block processing
pub fn check_validity<E: EthSpec>(
&self,
current_epoch: Epoch,
12 changes: 10 additions & 2 deletions lcli/src/transition_blocks.rs
Original file line number Diff line number Diff line change
@@ -72,6 +72,7 @@ use eth2::{
BeaconNodeHttpClient, SensitiveUrl, Timeouts,
};
use ssz::Encode;
use state_processing::epoch_cache::initialize_epoch_cache_if_required;
use state_processing::{
block_signature_verifier::BlockSignatureVerifier, per_block_processing, per_slot_processing,
BlockSignatureStrategy, ConsensusContext, StateProcessingStrategy, VerifyBlockRoot,
@@ -351,9 +352,16 @@ fn do_transition<T: EthSpec>(
let mut ctxt = if let Some(ctxt) = saved_ctxt {
ctxt.clone()
} else {
ConsensusContext::new(pre_state.slot())
let ctxt = ConsensusContext::new(pre_state.slot())
.set_current_block_root(block_root)
.set_proposer_index(block.message().proposer_index())
.set_proposer_index(block.message().proposer_index());

if config.exclude_cache_builds {
let epoch = pre_state.current_epoch();
initialize_epoch_cache_if_required(&mut pre_state, epoch, spec)
.map_err(|e| format!("{e:?}"))?;
}
ctxt
};

if !config.no_signature_verification {

0 comments on commit 0db4a47

Please sign in to comment.