mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
Unimplement TreeHash for BeaconState (#6083)
* Unimplement `TreeHash` for `BeaconState`
This commit is contained in:
@@ -17,7 +17,6 @@ use state_processing::{
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use tree_hash::TreeHash;
|
||||
use types::{
|
||||
Address, Epoch, EthSpec, ExecPayload, ExecutionBlockHash, ForkName, MainnetEthSpec,
|
||||
MinimalEthSpec, ProposerPreparationData, Slot,
|
||||
@@ -515,16 +514,17 @@ pub async fn proposer_boost_re_org_test(
|
||||
}
|
||||
|
||||
harness.advance_slot();
|
||||
let (block_a_root, block_a, state_a) = harness
|
||||
let (block_a_root, block_a, mut state_a) = harness
|
||||
.add_block_at_slot(slot_a, harness.get_current_state())
|
||||
.await
|
||||
.unwrap();
|
||||
let state_a_root = state_a.canonical_root().unwrap();
|
||||
|
||||
// Attest to block A during slot A.
|
||||
let (block_a_parent_votes, _) = harness.make_attestations_with_limit(
|
||||
&all_validators,
|
||||
&state_a,
|
||||
state_a.canonical_root(),
|
||||
state_a_root,
|
||||
block_a_root,
|
||||
slot_a,
|
||||
num_parent_votes,
|
||||
@@ -538,7 +538,7 @@ pub async fn proposer_boost_re_org_test(
|
||||
let (block_a_empty_votes, block_a_attesters) = harness.make_attestations_with_limit(
|
||||
&all_validators,
|
||||
&state_a,
|
||||
state_a.canonical_root(),
|
||||
state_a_root,
|
||||
block_a_root,
|
||||
slot_b,
|
||||
num_empty_votes,
|
||||
@@ -553,6 +553,7 @@ pub async fn proposer_boost_re_org_test(
|
||||
|
||||
// Produce block B and process it halfway through the slot.
|
||||
let (block_b, mut state_b) = harness.make_block(state_a.clone(), slot_b).await;
|
||||
let state_b_root = state_b.canonical_root().unwrap();
|
||||
let block_b_root = block_b.0.canonical_root();
|
||||
|
||||
let obs_time = slot_clock.start_of(slot_b).unwrap() + slot_clock.slot_duration() / 2;
|
||||
@@ -570,7 +571,7 @@ pub async fn proposer_boost_re_org_test(
|
||||
let (block_b_head_votes, _) = harness.make_attestations_with_limit(
|
||||
&remaining_attesters,
|
||||
&state_b,
|
||||
state_b.canonical_root(),
|
||||
state_b_root,
|
||||
block_b_root.into(),
|
||||
slot_b,
|
||||
num_head_votes,
|
||||
@@ -774,32 +775,34 @@ pub async fn fork_choice_before_proposal() {
|
||||
let slot_d = slot_a + 3;
|
||||
|
||||
let state_a = harness.get_current_state();
|
||||
let (block_b, state_b) = harness.make_block(state_a.clone(), slot_b).await;
|
||||
let (block_b, mut state_b) = harness.make_block(state_a.clone(), slot_b).await;
|
||||
let block_root_b = harness
|
||||
.process_block(slot_b, block_b.0.canonical_root(), block_b)
|
||||
.await
|
||||
.unwrap();
|
||||
let state_root_b = state_b.canonical_root().unwrap();
|
||||
|
||||
// Create attestations to B but keep them in reserve until after C has been processed.
|
||||
let attestations_b = harness.make_attestations(
|
||||
&all_validators,
|
||||
&state_b,
|
||||
state_b.tree_hash_root(),
|
||||
state_root_b,
|
||||
block_root_b,
|
||||
slot_b,
|
||||
);
|
||||
|
||||
let (block_c, state_c) = harness.make_block(state_a, slot_c).await;
|
||||
let (block_c, mut state_c) = harness.make_block(state_a, slot_c).await;
|
||||
let block_root_c = harness
|
||||
.process_block(slot_c, block_c.0.canonical_root(), block_c.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
let state_root_c = state_c.canonical_root().unwrap();
|
||||
|
||||
// Create attestations to C from a small number of validators and process them immediately.
|
||||
let attestations_c = harness.make_attestations(
|
||||
&all_validators[..validator_count / 2],
|
||||
&state_c,
|
||||
state_c.tree_hash_root(),
|
||||
state_root_c,
|
||||
block_root_c,
|
||||
slot_c,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user