mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-10 01:26:44 +00:00
Call core proto-array in compliance check
This commit is contained in:
@@ -730,7 +730,7 @@ impl ProtoArray {
|
||||
/// Returns `true` if the proposer boost should be kept. Returns `false` if the
|
||||
/// boost should be subtracted (invalidated) because the parent is weak and there
|
||||
/// are no equivocating blocks at the parent's slot.
|
||||
pub(crate) fn should_apply_proposer_boost<E: EthSpec>(
|
||||
fn should_apply_proposer_boost<E: EthSpec>(
|
||||
&self,
|
||||
proposer_boost_root: Hash256,
|
||||
justified_balances: &JustifiedBalances,
|
||||
@@ -1129,7 +1129,7 @@ impl ProtoArray {
|
||||
///
|
||||
/// Returns the set of node indices on viable branches — those with at least
|
||||
/// one leaf descendant with correct justified/finalized checkpoints.
|
||||
pub(crate) fn get_filtered_block_tree<E: EthSpec>(
|
||||
fn get_filtered_block_tree<E: EthSpec>(
|
||||
&self,
|
||||
start_index: usize,
|
||||
current_slot: Slot,
|
||||
@@ -1303,7 +1303,7 @@ impl ProtoArray {
|
||||
/// This is similar to `find_head_walk`, except it walks every viable branch instead of taking
|
||||
/// the maximum child at each step.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) fn filtered_block_tree_leaves_and_weights<E: EthSpec>(
|
||||
pub fn filtered_block_tree_leaves_and_weights<E: EthSpec>(
|
||||
&self,
|
||||
justified_root: &Hash256,
|
||||
current_slot: Slot,
|
||||
|
||||
@@ -1119,33 +1119,6 @@ impl ProtoArrayForkChoice {
|
||||
.map(|node| node.weight())
|
||||
}
|
||||
|
||||
/// Returns the leaves of the filtered block tree (rooted at `justified_root`) along with
|
||||
/// their weights — i.e. roots that are viable for head and have no descendant that is also
|
||||
/// viable for head. Mirrors the spec's `viable_for_head_roots_and_weights` check.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn filtered_block_tree_leaves_and_weights<E: EthSpec>(
|
||||
&self,
|
||||
justified_root: &Hash256,
|
||||
current_slot: Slot,
|
||||
justified_checkpoint: Checkpoint,
|
||||
finalized_checkpoint: Checkpoint,
|
||||
proposer_boost_root: Hash256,
|
||||
justified_balances: &JustifiedBalances,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<Vec<(Hash256, PayloadStatus, u64)>, String> {
|
||||
self.proto_array
|
||||
.filtered_block_tree_leaves_and_weights::<E>(
|
||||
justified_root,
|
||||
current_slot,
|
||||
justified_checkpoint,
|
||||
finalized_checkpoint,
|
||||
proposer_boost_root,
|
||||
justified_balances,
|
||||
spec,
|
||||
)
|
||||
.map_err(|e| format!("filtered_block_tree_leaves_and_weights failed: {e:?}"))
|
||||
}
|
||||
|
||||
/// Returns the payload status of the head node based on accumulated weights and tiebreaker.
|
||||
///
|
||||
/// See `ProtoArray` documentation.
|
||||
|
||||
@@ -1412,6 +1412,7 @@ impl<E: EthSpec> Tester<E> {
|
||||
let justified_balances = fork_choice.fc_store().justified_balances().clone();
|
||||
let actual = fork_choice
|
||||
.proto_array()
|
||||
.core_proto_array()
|
||||
.filtered_block_tree_leaves_and_weights::<E>(
|
||||
&justified.root,
|
||||
current_slot,
|
||||
@@ -1423,7 +1424,7 @@ impl<E: EthSpec> Tester<E> {
|
||||
)
|
||||
.map_err(|e| {
|
||||
Error::InternalError(format!(
|
||||
"filtered_block_tree_leaves_and_weights failed: {e}"
|
||||
"filtered_block_tree_leaves_and_weights failed: {e:?}"
|
||||
))
|
||||
})?;
|
||||
drop(fork_choice);
|
||||
|
||||
Reference in New Issue
Block a user