mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-30 03:14:25 +00:00
Enable late re-org and re-org interactive tests (#9405)
https://github.com/sigp/lighthouse/issues/8959 WIP still working on adding more re-org tests and refactoring existing. Co-Authored-By: hopinheimer <knmanas6@gmail.com> Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
@@ -174,6 +174,10 @@ pub struct ProtoNode {
|
||||
}
|
||||
|
||||
impl ProtoNode {
|
||||
pub fn is_gloas(&self) -> bool {
|
||||
self.as_v29().is_ok()
|
||||
}
|
||||
|
||||
/// Generic version of spec's `parent_payload_status` that works for pre-Gloas nodes by
|
||||
/// considering their parents Empty.
|
||||
pub fn get_parent_payload_status(&self) -> PayloadStatus {
|
||||
|
||||
@@ -723,15 +723,14 @@ impl ProtoArrayForkChoice {
|
||||
.into());
|
||||
}
|
||||
|
||||
// Spec: `is_parent_strong`. Use payload-aware weight matching the
|
||||
// payload path the head node is on from its parent.
|
||||
let parent_payload_status = info.head_node.get_parent_payload_status();
|
||||
let parent_weight = info.parent_node.attestation_score(parent_payload_status);
|
||||
// Spec: `is_parent_strong`. Use `PayloadStatus::Pending` to avoid weight split
|
||||
// between payload statuses. https://github.com/ethereum/consensus-specs/issues/5305
|
||||
let parent_pending_weight = info.parent_node.attestation_score(PayloadStatus::Pending);
|
||||
let re_org_parent_weight_threshold = info.re_org_parent_weight_threshold;
|
||||
let parent_strong = parent_weight > re_org_parent_weight_threshold;
|
||||
let parent_strong = parent_pending_weight > re_org_parent_weight_threshold;
|
||||
if !parent_strong {
|
||||
return Err(DoNotReOrg::ParentNotStrong {
|
||||
parent_weight,
|
||||
parent_weight: parent_pending_weight,
|
||||
re_org_parent_weight_threshold,
|
||||
}
|
||||
.into());
|
||||
|
||||
Reference in New Issue
Block a user