mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-26 17:23:41 +00:00
implement scoring mechanisms and plumbing
This commit is contained in:
@@ -1441,7 +1441,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
.proto_array()
|
||||
.heads_descended_from_finalization::<T::EthSpec>(fork_choice.finalized_checkpoint())
|
||||
.iter()
|
||||
.map(|node| (node.root, node.slot))
|
||||
.map(|node| (node.root(), node.slot()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
@@ -4776,7 +4776,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
|
||||
// The slot of our potential re-org block is always 1 greater than the head block because we
|
||||
// only attempt single-slot re-orgs.
|
||||
let head_slot = info.head_node.slot;
|
||||
let head_slot = info.head_node.slot();
|
||||
let re_org_block_slot = head_slot + 1;
|
||||
let fork_choice_slot = info.current_slot;
|
||||
|
||||
@@ -4811,9 +4811,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
.fork_name_at_slot::<T::EthSpec>(re_org_block_slot)
|
||||
.fulu_enabled()
|
||||
{
|
||||
info.head_node.current_epoch_shuffling_id
|
||||
info.head_node.current_epoch_shuffling_id()
|
||||
} else {
|
||||
info.head_node.next_epoch_shuffling_id
|
||||
info.head_node.next_epoch_shuffling_id()
|
||||
}
|
||||
.shuffling_decision_block;
|
||||
let proposer_index = self
|
||||
@@ -4844,8 +4844,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
// and the actual weight of the parent against the parent re-org threshold.
|
||||
let (head_weak, parent_strong) = if fork_choice_slot == re_org_block_slot {
|
||||
(
|
||||
info.head_node.weight < info.re_org_head_weight_threshold,
|
||||
info.parent_node.weight > info.re_org_parent_weight_threshold,
|
||||
info.head_node.weight() < info.re_org_head_weight_threshold,
|
||||
info.parent_node.weight() > info.re_org_parent_weight_threshold,
|
||||
)
|
||||
} else {
|
||||
(true, true)
|
||||
@@ -4853,7 +4853,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
if !head_weak {
|
||||
return Err(Box::new(
|
||||
DoNotReOrg::HeadNotWeak {
|
||||
head_weight: info.head_node.weight,
|
||||
head_weight: info.head_node.weight(),
|
||||
re_org_head_weight_threshold: info.re_org_head_weight_threshold,
|
||||
}
|
||||
.into(),
|
||||
@@ -4862,7 +4862,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
if !parent_strong {
|
||||
return Err(Box::new(
|
||||
DoNotReOrg::ParentNotStrong {
|
||||
parent_weight: info.parent_node.weight,
|
||||
parent_weight: info.parent_node.weight(),
|
||||
re_org_parent_weight_threshold: info.re_org_parent_weight_threshold,
|
||||
}
|
||||
.into(),
|
||||
@@ -4880,9 +4880,13 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
return Err(Box::new(DoNotReOrg::HeadNotLate.into()));
|
||||
}
|
||||
|
||||
let parent_head_hash = info.parent_node.execution_status.block_hash();
|
||||
let parent_head_hash = info
|
||||
.parent_node
|
||||
.execution_status()
|
||||
.ok()
|
||||
.and_then(|execution_status| execution_status.block_hash());
|
||||
let forkchoice_update_params = ForkchoiceUpdateParameters {
|
||||
head_root: info.parent_node.root,
|
||||
head_root: info.parent_node.root(),
|
||||
head_hash: parent_head_hash,
|
||||
justified_hash: canonical_forkchoice_params.justified_hash,
|
||||
finalized_hash: canonical_forkchoice_params.finalized_hash,
|
||||
@@ -4890,7 +4894,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
|
||||
debug!(
|
||||
canonical_head = ?head_block_root,
|
||||
?info.parent_node.root,
|
||||
parent_root = ?info.parent_node.root(),
|
||||
slot = %fork_choice_slot,
|
||||
"Fork choice update overridden"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user