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

@@ -35,7 +35,6 @@ use store::{
};
use tempfile::{tempdir, TempDir};
use tokio::time::sleep;
use tree_hash::TreeHash;
use types::test_utils::{SeedableRng, XorShiftRng};
use types::*;
@@ -199,8 +198,8 @@ async fn heal_freezer_block_roots_with_skip_slots() {
);
let harness = get_harness(store.clone(), LOW_VALIDATOR_COUNT);
let current_state = harness.get_current_state();
let state_root = harness.get_current_state().tree_hash_root();
let mut current_state = harness.get_current_state();
let state_root = current_state.canonical_root().unwrap();
let all_validators = &harness.get_all_validators();
harness
.add_attested_blocks_at_slots(
@@ -611,12 +610,13 @@ async fn epoch_boundary_state_attestation_processing() {
.get_blinded_block(&block_root)
.unwrap()
.expect("block exists");
let epoch_boundary_state = store
let mut epoch_boundary_state = store
.load_epoch_boundary_state(&block.state_root())
.expect("no error")
.expect("epoch boundary state exists");
let ebs_state_root = epoch_boundary_state.canonical_root().unwrap();
let ebs_of_ebs = store
.load_epoch_boundary_state(&epoch_boundary_state.canonical_root())
.load_epoch_boundary_state(&ebs_state_root)
.expect("no error")
.expect("ebs of ebs exists");
assert_eq!(epoch_boundary_state, ebs_of_ebs);
@@ -2604,9 +2604,9 @@ async fn weak_subjectivity_sync_test(slots: Vec<Slot>, checkpoint_slot: Slot) {
.unwrap()
.map(Result::unwrap)
{
let state = store.get_state(&state_root, Some(slot)).unwrap().unwrap();
let mut state = store.get_state(&state_root, Some(slot)).unwrap().unwrap();
assert_eq!(state.slot(), slot);
assert_eq!(state.canonical_root(), state_root);
assert_eq!(state.canonical_root().unwrap(), state_root);
}
// Anchor slot is still set to the slot of the checkpoint block.