mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-18 05:18:30 +00:00
Gloas fork choice redux (#9025)
Co-Authored-By: hopinheimer <knmanas6@gmail.com> Co-Authored-By: Michael Sproul <michael@sigmaprime.io> Co-Authored-By: hopinheimer <48147533+hopinheimer@users.noreply.github.com> Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com> Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com> Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com> Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com> Co-Authored-By: Daniel Knopik <107140945+dknopik@users.noreply.github.com>
This commit is contained in:
@@ -1350,7 +1350,7 @@ async fn recover_from_invalid_head_by_importing_blocks() {
|
||||
"the fork block should become the head"
|
||||
);
|
||||
|
||||
let manual_get_head = rig
|
||||
let (manual_get_head, _) = rig
|
||||
.harness
|
||||
.chain
|
||||
.canonical_head
|
||||
@@ -1428,7 +1428,7 @@ async fn weights_after_resetting_optimistic_status() {
|
||||
.fork_choice_read_lock()
|
||||
.proto_array()
|
||||
.iter_nodes(&head.head_block_root())
|
||||
.map(|node| (node.root, node.weight))
|
||||
.map(|node| (node.root(), node.weight()))
|
||||
.collect::<HashMap<_, _>>();
|
||||
|
||||
rig.invalidate_manually(roots[1]).await;
|
||||
@@ -1438,7 +1438,7 @@ async fn weights_after_resetting_optimistic_status() {
|
||||
.canonical_head
|
||||
.fork_choice_write_lock()
|
||||
.proto_array_mut()
|
||||
.set_all_blocks_to_optimistic::<E>(&rig.harness.chain.spec)
|
||||
.set_all_blocks_to_optimistic::<E>()
|
||||
.unwrap();
|
||||
|
||||
let new_weights = rig
|
||||
@@ -1448,7 +1448,7 @@ async fn weights_after_resetting_optimistic_status() {
|
||||
.fork_choice_read_lock()
|
||||
.proto_array()
|
||||
.iter_nodes(&head.head_block_root())
|
||||
.map(|node| (node.root, node.weight))
|
||||
.map(|node| (node.root(), node.weight()))
|
||||
.collect::<HashMap<_, _>>();
|
||||
|
||||
assert_eq!(original_weights, new_weights);
|
||||
|
||||
@@ -3995,7 +3995,7 @@ async fn schema_downgrade_to_min_version(store_config: StoreConfig, archive: boo
|
||||
)
|
||||
.await;
|
||||
|
||||
let min_version = CURRENT_SCHEMA_VERSION;
|
||||
let min_version = SchemaVersion(28);
|
||||
|
||||
// Save the slot clock so that the new harness doesn't revert in time.
|
||||
let slot_clock = harness.chain.slot_clock.clone();
|
||||
@@ -5426,10 +5426,12 @@ fn assert_chains_pretty_much_the_same<T: BeaconChainTypes>(a: &BeaconChain<T>, b
|
||||
.fork_choice_write_lock()
|
||||
.get_head(slot, &spec)
|
||||
.unwrap()
|
||||
.0
|
||||
== b.canonical_head
|
||||
.fork_choice_write_lock()
|
||||
.get_head(slot, &spec)
|
||||
.unwrap(),
|
||||
.unwrap()
|
||||
.0,
|
||||
"fork_choice heads should be equal"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -590,7 +590,10 @@ async fn unaggregated_attestations_added_to_fork_choice_some_none() {
|
||||
|
||||
if slot <= num_blocks_produced && slot != 0 {
|
||||
assert_eq!(
|
||||
latest_message.unwrap().1,
|
||||
latest_message
|
||||
.expect("latest message should be present")
|
||||
.slot
|
||||
.epoch(MinimalEthSpec::slots_per_epoch()),
|
||||
slot.epoch(MinimalEthSpec::slots_per_epoch()),
|
||||
"Latest message epoch for {} should be equal to epoch {}.",
|
||||
validator,
|
||||
@@ -700,10 +703,12 @@ async fn unaggregated_attestations_added_to_fork_choice_all_updated() {
|
||||
let validator_slots: Vec<(&usize, Slot)> = validators.iter().zip(slots).collect();
|
||||
|
||||
for (validator, slot) in validator_slots {
|
||||
let latest_message = fork_choice.latest_message(*validator);
|
||||
let latest_message = fork_choice
|
||||
.latest_message(*validator)
|
||||
.expect("latest message should be present");
|
||||
|
||||
assert_eq!(
|
||||
latest_message.unwrap().1,
|
||||
latest_message.slot.epoch(MinimalEthSpec::slots_per_epoch()),
|
||||
slot.epoch(MinimalEthSpec::slots_per_epoch()),
|
||||
"Latest message slot should be equal to attester duty."
|
||||
);
|
||||
@@ -714,8 +719,7 @@ async fn unaggregated_attestations_added_to_fork_choice_all_updated() {
|
||||
.expect("Should get block root at slot");
|
||||
|
||||
assert_eq!(
|
||||
latest_message.unwrap().0,
|
||||
*block_root,
|
||||
latest_message.root, *block_root,
|
||||
"Latest message block root should be equal to block at slot."
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user