Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree states optimization using EpochCache #4429

Merged
merged 12 commits into from
Jun 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Initialize EpochCache in transition_blocks if `exclude_cache_buil…
…ds` is enabled
jimmygchen committed Jun 23, 2023

Verified

This commit was signed with the committer’s verified signature.
djhi Gildas Garcia
commit 0db4a4773869a9113fb2c66aa7b379f863315b20
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 {