Unimplement TreeHash for BeaconState (#6083)

* Unimplement `TreeHash` for `BeaconState`
This commit is contained in:
Michael Sproul
2024-07-12 23:06:08 +10:00
committed by GitHub
parent 0c0b56d9e8
commit 2f0af2be89
16 changed files with 117 additions and 70 deletions

View File

@@ -93,7 +93,6 @@ use std::io::Write;
use std::sync::Arc;
use store::{Error as DBError, HotStateSummary, KeyValueStore, StoreOp};
use task_executor::JoinHandle;
use tree_hash::TreeHash;
use types::{
BeaconBlockRef, BeaconState, BeaconStateError, ChainSpec, Epoch, EthSpec, ExecutionBlockHash,
Hash256, InconsistentFork, PublicKey, PublicKeyBytes, RelativeEpoch, SignedBeaconBlock,
@@ -2107,7 +2106,14 @@ pub fn verify_header_signature<T: BeaconChainTypes, Err: BlockBlobError>(
fn write_state<E: EthSpec>(prefix: &str, state: &BeaconState<E>, log: &Logger) {
if WRITE_BLOCK_PROCESSING_SSZ {
let root = state.tree_hash_root();
let mut state = state.clone();
let Ok(root) = state.canonical_root() else {
error!(
log,
"Unable to hash state for writing";
);
return;
};
let filename = format!("{}_slot_{}_root_{}.ssz", prefix, state.slot(), root);
let mut path = std::env::temp_dir().join("lighthouse");
let _ = fs::create_dir_all(path.clone());