diff --git a/eth2/proto_array_fork_choice/src/lib.rs b/eth2/proto_array_fork_choice/src/lib.rs index 8787efb94d..a21c73154a 100644 --- a/eth2/proto_array_fork_choice/src/lib.rs +++ b/eth2/proto_array_fork_choice/src/lib.rs @@ -103,7 +103,6 @@ impl ProtoArrayForkChoice { ) -> Result { let mut proto_array = ProtoArray { prune_threshold: DEFAULT_PRUNE_THRESHOLD, - ffg_update_required: false, justified_epoch, finalized_epoch, nodes: Vec::with_capacity(1), diff --git a/eth2/proto_array_fork_choice/src/proto_array.rs b/eth2/proto_array_fork_choice/src/proto_array.rs index ead4a8f649..8659a790f1 100644 --- a/eth2/proto_array_fork_choice/src/proto_array.rs +++ b/eth2/proto_array_fork_choice/src/proto_array.rs @@ -22,9 +22,6 @@ pub struct ProtoArray { /// Do not attempt to prune the tree unless it has at least this many nodes. Small prunes /// simply waste time. pub prune_threshold: usize, - /// Set to true when the Casper FFG justified/finalized epochs should be checked to ensure the - /// tree is filtered as per eth2 specs. - pub ffg_update_required: bool, pub justified_epoch: Epoch, pub finalized_epoch: Epoch, pub nodes: Vec, @@ -59,13 +56,7 @@ impl ProtoArray { }); } - // The `self.ffg_update_required` flag indicates if it is necessary to check the - // finalized/justified epoch of all nodes against the epochs in `self`. - // - // This behaviour is equivalent to the `filter_block_tree` function in the spec. - self.ffg_update_required = - justified_epoch != self.justified_epoch || finalized_epoch != self.finalized_epoch; - if self.ffg_update_required { + if justified_epoch != self.justified_epoch || finalized_epoch != self.finalized_epoch { self.justified_epoch = justified_epoch; self.finalized_epoch = finalized_epoch; } @@ -124,8 +115,6 @@ impl ProtoArray { } } - self.ffg_update_required = false; - Ok(()) } @@ -235,7 +224,6 @@ impl ProtoArray { }); } else if finalized_epoch != self.finalized_epoch { self.finalized_epoch = finalized_epoch; - self.ffg_update_required = true; } let finalized_index = *self diff --git a/eth2/proto_array_fork_choice/src/ssz_container.rs b/eth2/proto_array_fork_choice/src/ssz_container.rs index 1e2fcb92d7..802b9285f5 100644 --- a/eth2/proto_array_fork_choice/src/ssz_container.rs +++ b/eth2/proto_array_fork_choice/src/ssz_container.rs @@ -13,6 +13,8 @@ pub struct SszContainer { votes: Vec, balances: Vec, prune_threshold: usize, + // TODO: this field is no longer required, I'm just leaving it here for the time being so we + // don't need to resync nodes. ffg_update_required: bool, justified_epoch: Epoch, finalized_epoch: Epoch, @@ -28,7 +30,7 @@ impl From<&ProtoArrayForkChoice> for SszContainer { votes: from.votes.read().0.clone(), balances: from.balances.read().clone(), prune_threshold: proto_array.prune_threshold, - ffg_update_required: proto_array.ffg_update_required, + ffg_update_required: false, justified_epoch: proto_array.justified_epoch, finalized_epoch: proto_array.finalized_epoch, nodes: proto_array.nodes.clone(), @@ -41,7 +43,6 @@ impl From for ProtoArrayForkChoice { fn from(from: SszContainer) -> Self { let proto_array = ProtoArray { prune_threshold: from.prune_threshold, - ffg_update_required: from.ffg_update_required, justified_epoch: from.justified_epoch, finalized_epoch: from.finalized_epoch, nodes: from.nodes,