Merge branch 'unstable' into eip4844

This commit is contained in:
Diva M
2023-03-10 11:19:56 -05:00
29 changed files with 1012 additions and 148 deletions

View File

@@ -5,6 +5,7 @@ use crate::http::{
ENGINE_GET_PAYLOAD_V3, ENGINE_NEW_PAYLOAD_V1, ENGINE_NEW_PAYLOAD_V2, ENGINE_NEW_PAYLOAD_V3,
};
use crate::BlobTxConversionError;
use eth2::types::{SsePayloadAttributes, SsePayloadAttributesV1, SsePayloadAttributesV2};
pub use ethers_core::types::Transaction;
use ethers_core::utils::rlp::{self, Decodable, Rlp};
use http::deposit_methods::RpcError;
@@ -312,6 +313,33 @@ impl PayloadAttributes {
}
}
impl From<PayloadAttributes> for SsePayloadAttributes {
fn from(pa: PayloadAttributes) -> Self {
match pa {
PayloadAttributes::V1(PayloadAttributesV1 {
timestamp,
prev_randao,
suggested_fee_recipient,
}) => Self::V1(SsePayloadAttributesV1 {
timestamp,
prev_randao,
suggested_fee_recipient,
}),
PayloadAttributes::V2(PayloadAttributesV2 {
timestamp,
prev_randao,
suggested_fee_recipient,
withdrawals,
}) => Self::V2(SsePayloadAttributesV2 {
timestamp,
prev_randao,
suggested_fee_recipient,
withdrawals,
}),
}
}
}
#[derive(Clone, Debug, PartialEq)]
pub struct ForkchoiceUpdatedResponse {
pub payload_status: PayloadStatusV1,

View File

@@ -268,6 +268,7 @@ struct Inner<E: EthSpec> {
payload_cache: PayloadCache<E>,
builder_profit_threshold: Uint256,
log: Logger,
always_prefer_builder_payload: bool,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
@@ -290,6 +291,7 @@ pub struct Config {
/// The minimum value of an external payload for it to be considered in a proposal.
pub builder_profit_threshold: u128,
pub execution_timeout_multiplier: Option<u32>,
pub always_prefer_builder_payload: bool,
}
/// Provides access to one execution engine and provides a neat interface for consumption by the
@@ -312,6 +314,7 @@ impl<T: EthSpec> ExecutionLayer<T> {
default_datadir,
builder_profit_threshold,
execution_timeout_multiplier,
always_prefer_builder_payload,
} = config;
if urls.len() > 1 {
@@ -384,6 +387,7 @@ impl<T: EthSpec> ExecutionLayer<T> {
payload_cache: PayloadCache::default(),
builder_profit_threshold: Uint256::from(builder_profit_threshold),
log,
always_prefer_builder_payload,
};
Ok(Self {
@@ -845,7 +849,9 @@ impl<T: EthSpec> ExecutionLayer<T> {
let relay_value = relay.data.message.value;
let local_value = *local.block_value();
if local_value >= relay_value {
if !self.inner.always_prefer_builder_payload
&& local_value >= relay_value
{
info!(
self.log(),
"Local block is more profitable than relay block";