mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-20 22:38:34 +00:00
Merge branch 'gloas-walk-always' into epbs-devnet-1
This commit is contained in:
@@ -1705,7 +1705,7 @@ impl<T: BeaconChainTypes> ExecutionPendingBlock<T> {
|
||||
indexed_payload_attestation,
|
||||
AttestationFromBlock::True,
|
||||
&ptc.0,
|
||||
) && !matches!(e, ForkChoiceError::InvalidAttestation(_))
|
||||
) && !matches!(e, ForkChoiceError::InvalidPayloadAttestation(_))
|
||||
{
|
||||
return Err(BlockError::BeaconChainError(Box::new(e.into())));
|
||||
}
|
||||
|
||||
@@ -168,6 +168,16 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
.map_err(BeaconChainError::TokioJoin)?
|
||||
.ok_or(BeaconChainError::RuntimeShutdown)??;
|
||||
|
||||
// TODO(gloas): optimistic sync is not supported for Gloas, maybe we could re-add it
|
||||
if payload_verification_outcome
|
||||
.payload_verification_status
|
||||
.is_optimistic()
|
||||
{
|
||||
return Err(EnvelopeError::OptimisticSyncNotSupported {
|
||||
block_root: import_data.block_root,
|
||||
});
|
||||
}
|
||||
|
||||
Ok(ExecutedEnvelope::new(
|
||||
signed_envelope,
|
||||
import_data,
|
||||
@@ -244,9 +254,10 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
// avoiding taking other locks whilst holding this lock.
|
||||
let mut fork_choice = parking_lot::RwLockUpgradableReadGuard::upgrade(fork_choice_reader);
|
||||
|
||||
// Update the node's payload_status from PENDING to FULL in fork choice.
|
||||
// Update the block's payload to received in fork choice, which creates the `Full` virtual
|
||||
// node which can be eligible for head.
|
||||
fork_choice
|
||||
.on_execution_payload(block_root)
|
||||
.on_valid_payload_envelope_received(block_root)
|
||||
.map_err(|e| EnvelopeError::InternalError(format!("{e:?}")))?;
|
||||
|
||||
// TODO(gloas) emit SSE event if the payload became the new head payload
|
||||
|
||||
@@ -198,6 +198,8 @@ pub enum EnvelopeError {
|
||||
payload_slot: Slot,
|
||||
latest_finalized_slot: Slot,
|
||||
},
|
||||
/// Optimistic sync is not supported for Gloas payload envelopes.
|
||||
OptimisticSyncNotSupported { block_root: Hash256 },
|
||||
/// Some Beacon Chain Error
|
||||
BeaconChainError(Arc<BeaconChainError>),
|
||||
/// Some Beacon State error
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
use crate::beacon_chain::{BeaconChainTypes, FORK_CHOICE_DB_KEY};
|
||||
use crate::persisted_fork_choice::{PersistedForkChoiceV28, PersistedForkChoiceV29};
|
||||
use std::collections::HashMap;
|
||||
use store::hot_cold_store::HotColdDB;
|
||||
use store::{DBColumn, Error as StoreError, KeyValueStore, KeyValueStoreOp};
|
||||
use tracing::warn;
|
||||
use types::EthSpec;
|
||||
|
||||
/// Upgrade from schema v28 to v29.
|
||||
@@ -49,8 +51,49 @@ pub fn upgrade_to_v29<T: BeaconChainTypes>(
|
||||
}
|
||||
}
|
||||
|
||||
// Convert to v29 and encode.
|
||||
let persisted_v29 = PersistedForkChoiceV29::from(persisted_v28);
|
||||
// Read the previous proposer boost before converting to V29 (V29 no longer stores it).
|
||||
let previous_proposer_boost = persisted_v28
|
||||
.fork_choice_v28
|
||||
.proto_array_v28
|
||||
.previous_proposer_boost;
|
||||
|
||||
// Convert to v29.
|
||||
let mut persisted_v29 = PersistedForkChoiceV29::from(persisted_v28);
|
||||
|
||||
// Subtract the proposer boost from the boosted node and all its ancestors.
|
||||
//
|
||||
// In the V28 schema, `apply_score_changes` baked the proposer boost directly into node
|
||||
// weights and back-propagated it up the parent chain. In V29, the boost is computed
|
||||
// on-the-fly during the virtual tree walk. If we don't subtract the baked-in boost here,
|
||||
// it will be double-counted after the upgrade.
|
||||
if !previous_proposer_boost.root.is_zero() && previous_proposer_boost.score > 0 {
|
||||
let score = previous_proposer_boost.score;
|
||||
let indices: HashMap<_, _> = persisted_v29
|
||||
.fork_choice
|
||||
.proto_array
|
||||
.indices
|
||||
.iter()
|
||||
.cloned()
|
||||
.collect();
|
||||
|
||||
if let Some(node_index) = indices.get(&previous_proposer_boost.root).copied() {
|
||||
let nodes = &mut persisted_v29.fork_choice.proto_array.nodes;
|
||||
let mut current = Some(node_index);
|
||||
while let Some(idx) = current {
|
||||
if let Some(node) = nodes.get_mut(idx) {
|
||||
*node.weight_mut() = node.weight().saturating_sub(score);
|
||||
current = node.parent();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
warn!(
|
||||
root = ?previous_proposer_boost.root,
|
||||
"Proposer boost node missing from fork choice"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(vec![
|
||||
persisted_v29.as_kv_store_op(FORK_CHOICE_DB_KEY, db.get_config())?,
|
||||
|
||||
@@ -1438,7 +1438,7 @@ async fn weights_after_resetting_optimistic_status() {
|
||||
.canonical_head
|
||||
.fork_choice_write_lock()
|
||||
.proto_array_mut()
|
||||
.set_all_blocks_to_optimistic::<E>(&rig.harness.chain.spec)
|
||||
.set_all_blocks_to_optimistic::<E>()
|
||||
.unwrap();
|
||||
|
||||
let new_weights = rig
|
||||
|
||||
Reference in New Issue
Block a user