mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-29 20:27:14 +00:00
Merge branch 'unstable' into eip4844
This commit is contained in:
@@ -201,6 +201,9 @@ pub enum ProduceBlockVerification {
|
||||
pub struct PrePayloadAttributes {
|
||||
pub proposer_index: u64,
|
||||
pub prev_randao: Hash256,
|
||||
/// The parent block number is not part of the payload attributes sent to the EL, but *is*
|
||||
/// sent to builders via SSE.
|
||||
pub parent_block_number: u64,
|
||||
}
|
||||
|
||||
/// Define whether a forkchoiceUpdate needs to be checked for an override (`Yes`) or has already
|
||||
@@ -3975,16 +3978,21 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
proposer as u64
|
||||
};
|
||||
|
||||
// Get the `prev_randao` value.
|
||||
let prev_randao = if proposer_head == parent_block_root {
|
||||
cached_head.parent_random()
|
||||
// Get the `prev_randao` and parent block number.
|
||||
let head_block_number = cached_head.head_block_number()?;
|
||||
let (prev_randao, parent_block_number) = if proposer_head == parent_block_root {
|
||||
(
|
||||
cached_head.parent_random()?,
|
||||
head_block_number.saturating_sub(1),
|
||||
)
|
||||
} else {
|
||||
cached_head.head_random()
|
||||
}?;
|
||||
(cached_head.head_random()?, head_block_number)
|
||||
};
|
||||
|
||||
Ok(Some(PrePayloadAttributes {
|
||||
proposer_index,
|
||||
prev_randao,
|
||||
parent_block_number,
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -5059,6 +5067,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
proposal_slot: prepare_slot,
|
||||
proposer_index: proposer,
|
||||
parent_block_root: head_root,
|
||||
parent_block_number: pre_payload_attributes.parent_block_number,
|
||||
parent_block_hash: forkchoice_update_params.head_hash.unwrap_or_default(),
|
||||
payload_attributes: payload_attributes.into(),
|
||||
},
|
||||
|
||||
@@ -167,6 +167,17 @@ impl<E: EthSpec> CachedHead<E> {
|
||||
.map(|payload| payload.prev_randao())
|
||||
}
|
||||
|
||||
/// Returns the execution block number of the block at the head of the chain.
|
||||
///
|
||||
/// Returns an error if the chain is prior to Bellatrix.
|
||||
pub fn head_block_number(&self) -> Result<u64, BeaconStateError> {
|
||||
self.snapshot
|
||||
.beacon_block
|
||||
.message()
|
||||
.execution_payload()
|
||||
.map(|payload| payload.block_number())
|
||||
}
|
||||
|
||||
/// Returns the active validator count for the current epoch of the head state.
|
||||
///
|
||||
/// Should only return `None` if the caches have not been built on the head state (this should
|
||||
|
||||
@@ -65,43 +65,43 @@ impl<T: EthSpec> ServerSentEventHandler<T> {
|
||||
EventKind::Attestation(_) => self
|
||||
.attestation_tx
|
||||
.send(kind)
|
||||
.map(|count| log_count(count, "attestation")),
|
||||
.map(|count| log_count("attestation", count)),
|
||||
EventKind::Block(_) => self
|
||||
.block_tx
|
||||
.send(kind)
|
||||
.map(|count| log_count(count, "block")),
|
||||
.map(|count| log_count("block", count)),
|
||||
EventKind::FinalizedCheckpoint(_) => self
|
||||
.finalized_tx
|
||||
.send(kind)
|
||||
.map(|count| log_count(count, "finalized checkpoint")),
|
||||
.map(|count| log_count("finalized checkpoint", count)),
|
||||
EventKind::Head(_) => self
|
||||
.head_tx
|
||||
.send(kind)
|
||||
.map(|count| log_count(count, "head")),
|
||||
.map(|count| log_count("head", count)),
|
||||
EventKind::VoluntaryExit(_) => self
|
||||
.exit_tx
|
||||
.send(kind)
|
||||
.map(|count| log_count(count, "exit")),
|
||||
.map(|count| log_count("exit", count)),
|
||||
EventKind::ChainReorg(_) => self
|
||||
.chain_reorg_tx
|
||||
.send(kind)
|
||||
.map(|count| log_count(count, "chain reorg")),
|
||||
.map(|count| log_count("chain reorg", count)),
|
||||
EventKind::ContributionAndProof(_) => self
|
||||
.contribution_tx
|
||||
.send(kind)
|
||||
.map(|count| log_count(count, "contribution and proof")),
|
||||
.map(|count| log_count("contribution and proof", count)),
|
||||
EventKind::PayloadAttributes(_) => self
|
||||
.payload_attributes_tx
|
||||
.send(kind)
|
||||
.map(|count| log_count(count, "payload attributes")),
|
||||
.map(|count| log_count("payload attributes", count)),
|
||||
EventKind::LateHead(_) => self
|
||||
.late_head
|
||||
.send(kind)
|
||||
.map(|count| log_count(count, "late head")),
|
||||
.map(|count| log_count("late head", count)),
|
||||
EventKind::BlockReward(_) => self
|
||||
.block_reward_tx
|
||||
.send(kind)
|
||||
.map(|count| log_count(count, "block reward")),
|
||||
.map(|count| log_count("block reward", count)),
|
||||
};
|
||||
if let Err(SendError(event)) = result {
|
||||
trace!(self.log, "No receivers registered to listen for event"; "event" => ?event);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#![recursion_limit = "128"] // For lazy-static
|
||||
pub mod attestation_rewards;
|
||||
pub mod attestation_verification;
|
||||
mod attester_cache;
|
||||
|
||||
@@ -468,7 +468,7 @@ where
|
||||
builder_threshold: Option<u128>,
|
||||
) -> Self {
|
||||
// Get a random unused port
|
||||
let port = unused_port::unused_tcp_port().unwrap();
|
||||
let port = unused_port::unused_tcp4_port().unwrap();
|
||||
let builder_url = SensitiveUrl::parse(format!("http://127.0.0.1:{port}").as_str()).unwrap();
|
||||
|
||||
let spec = self.spec.clone().expect("cannot build without spec");
|
||||
|
||||
Reference in New Issue
Block a user