mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 18:32:42 +00:00
Refactored Execution Layer & Fixed Some Tests
This commit is contained in:
@@ -59,7 +59,7 @@ use crate::{metrics, BeaconChainError};
|
||||
use eth2::types::{EventKind, SseBlock, SyncDuty};
|
||||
use execution_layer::{
|
||||
BlockProposalContents, BuilderParams, ChainHealth, ExecutionLayer, FailedCondition,
|
||||
PayloadAttributes, PayloadAttributesV1, PayloadAttributesV2, PayloadStatus,
|
||||
PayloadAttributes, PayloadStatus,
|
||||
};
|
||||
pub use fork_choice::CountUnrealized;
|
||||
use fork_choice::{
|
||||
@@ -4179,21 +4179,20 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
.map(|withdrawals_opt| withdrawals_opt.map(|w| w.into()))
|
||||
.map_err(Error::PrepareProposerFailed)?;
|
||||
|
||||
let payload_attributes = PayloadAttributes::V2(PayloadAttributesV2 {
|
||||
timestamp: self
|
||||
.slot_clock
|
||||
let payload_attributes = PayloadAttributes::new(
|
||||
self.slot_clock
|
||||
.start_of(prepare_slot)
|
||||
.ok_or(Error::InvalidSlot(prepare_slot))?
|
||||
.as_secs(),
|
||||
prev_randao: head_random,
|
||||
suggested_fee_recipient: execution_layer
|
||||
head_random,
|
||||
execution_layer
|
||||
.get_suggested_fee_recipient(proposer as u64)
|
||||
.await,
|
||||
#[cfg(feature = "withdrawals")]
|
||||
withdrawals,
|
||||
#[cfg(not(feature = "withdrawals"))]
|
||||
withdrawals: None,
|
||||
});
|
||||
None,
|
||||
);
|
||||
|
||||
debug!(
|
||||
self.log,
|
||||
|
||||
@@ -12,7 +12,7 @@ use crate::{
|
||||
BeaconChain, BeaconChainError, BeaconChainTypes, BlockError, BlockProductionError,
|
||||
ExecutionPayloadError,
|
||||
};
|
||||
use execution_layer::{BlockProposalContents, BuilderParams, PayloadStatus};
|
||||
use execution_layer::{BlockProposalContents, BuilderParams, PayloadAttributes, PayloadStatus};
|
||||
use fork_choice::{InvalidationOperation, PayloadVerificationStatus};
|
||||
use proto_array::{Block as ProtoBlock, ExecutionStatus};
|
||||
use slog::debug;
|
||||
@@ -483,20 +483,29 @@ where
|
||||
.await
|
||||
.map_err(BlockProductionError::BeaconChain)?;
|
||||
|
||||
let suggested_fee_recipient = execution_layer
|
||||
.get_suggested_fee_recipient(proposer_index)
|
||||
.await;
|
||||
let payload_attributes = PayloadAttributes::new(
|
||||
timestamp,
|
||||
random,
|
||||
suggested_fee_recipient,
|
||||
#[cfg(feature = "withdrawals")]
|
||||
withdrawals,
|
||||
#[cfg(not(feature = "withdrawals"))]
|
||||
None,
|
||||
);
|
||||
|
||||
// Note: the suggested_fee_recipient is stored in the `execution_layer`, it will add this parameter.
|
||||
//
|
||||
// This future is not executed here, it's up to the caller to await it.
|
||||
let block_contents = execution_layer
|
||||
.get_payload::<Payload>(
|
||||
parent_hash,
|
||||
timestamp,
|
||||
random,
|
||||
proposer_index,
|
||||
&payload_attributes,
|
||||
forkchoice_update_params,
|
||||
builder_params,
|
||||
fork,
|
||||
#[cfg(feature = "withdrawals")]
|
||||
withdrawals,
|
||||
&chain.spec,
|
||||
)
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user