mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 12:47:05 +00:00
Merge branch 'unstable' of https://github.com/sigp/lighthouse into gloas-parent-envelope-unknown-lookup
This commit is contained in:
@@ -756,6 +756,7 @@ where
|
||||
block_delay: Duration,
|
||||
state: &BeaconState<E>,
|
||||
payload_verification_status: PayloadVerificationStatus,
|
||||
canonical_head_proposer_index: u64,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<(), Error<T::Error>> {
|
||||
let _timer = metrics::start_timer(&metrics::FORK_CHOICE_ON_BLOCK_TIMES);
|
||||
@@ -820,16 +821,18 @@ where
|
||||
|
||||
let attestation_threshold = spec.get_attestation_due::<E>(block.slot());
|
||||
|
||||
// Add proposer score boost if the block is timely.
|
||||
// TODO(gloas): the spec's `update_proposer_boost_root` additionally checks that
|
||||
// `block.proposer_index == get_beacon_proposer_index(head_state)` — i.e. that
|
||||
// the block's proposer matches the expected proposer on the canonical chain.
|
||||
// This requires calling `get_head` and advancing the head state to the current
|
||||
// slot, which is expensive. Implement once we have a cached proposer index.
|
||||
// Add proposer score boost if the block is the first timely block for this slot and its
|
||||
// proposer matches the expected proposer on the canonical chain (per spec
|
||||
// `update_proposer_boost_root`, introduced in v1.7.0-alpha.5).
|
||||
let is_before_attesting_interval = block_delay < attestation_threshold;
|
||||
|
||||
let is_first_block = self.fc_store.proposer_boost_root().is_zero();
|
||||
if current_slot == block.slot() && is_before_attesting_interval && is_first_block {
|
||||
let is_canonical_proposer = block.proposer_index() == canonical_head_proposer_index;
|
||||
if current_slot == block.slot()
|
||||
&& is_before_attesting_interval
|
||||
&& is_first_block
|
||||
&& is_canonical_proposer
|
||||
{
|
||||
self.fc_store.set_proposer_boost_root(block_root);
|
||||
}
|
||||
|
||||
|
||||
@@ -316,6 +316,7 @@ impl ForkChoiceTest {
|
||||
Duration::from_secs(0),
|
||||
&state,
|
||||
PayloadVerificationStatus::Verified,
|
||||
block.message().proposer_index(),
|
||||
&self.harness.chain.spec,
|
||||
)
|
||||
.unwrap();
|
||||
@@ -359,6 +360,7 @@ impl ForkChoiceTest {
|
||||
Duration::from_secs(0),
|
||||
&state,
|
||||
PayloadVerificationStatus::Verified,
|
||||
block.message().proposer_index(),
|
||||
&self.harness.chain.spec,
|
||||
)
|
||||
.expect_err("on_block did not return an error");
|
||||
|
||||
Reference in New Issue
Block a user