mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-05 13:54:36 +00:00
Fix execution payload request block prod code path
This commit is contained in:
@@ -341,8 +341,13 @@ pub struct GetPayloadResponse<E: EthSpec> {
|
||||
pub blobs_bundle: BlobsBundle<E>,
|
||||
#[superstruct(only(Deneb, Electra, Fulu, Gloas), partial_getter(copy))]
|
||||
pub should_override_builder: bool,
|
||||
#[superstruct(only(Electra, Fulu, Gloas))]
|
||||
pub requests: ExecutionRequests<E>,
|
||||
#[superstruct(
|
||||
only(Electra, Fulu),
|
||||
partial_getter(rename = "execution_requests_electra")
|
||||
)]
|
||||
pub requests: types::ExecutionRequestsElectra<E>,
|
||||
#[superstruct(only(Gloas), partial_getter(rename = "execution_requests_gloas"))]
|
||||
pub requests: types::ExecutionRequestsGloas<E>,
|
||||
}
|
||||
|
||||
impl<E: EthSpec> GetPayloadResponse<E> {
|
||||
@@ -407,19 +412,19 @@ impl<E: EthSpec> From<GetPayloadResponse<E>>
|
||||
ExecutionPayload::Electra(inner.execution_payload),
|
||||
inner.block_value,
|
||||
Some(inner.blobs_bundle),
|
||||
Some(inner.requests),
|
||||
Some(ExecutionRequests::Electra(inner.requests)),
|
||||
),
|
||||
GetPayloadResponse::Fulu(inner) => (
|
||||
ExecutionPayload::Fulu(inner.execution_payload),
|
||||
inner.block_value,
|
||||
Some(inner.blobs_bundle),
|
||||
Some(inner.requests),
|
||||
Some(ExecutionRequests::Electra(inner.requests)),
|
||||
),
|
||||
GetPayloadResponse::Gloas(inner) => (
|
||||
ExecutionPayload::Gloas(inner.execution_payload),
|
||||
inner.block_value,
|
||||
Some(inner.blobs_bundle),
|
||||
Some(inner.requests),
|
||||
Some(ExecutionRequests::Gloas(inner.requests)),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,6 +474,7 @@ pub enum RequestsError {
|
||||
InvalidOrdering,
|
||||
InvalidPrefix(u8),
|
||||
DecodeError(String),
|
||||
VariantMismatch,
|
||||
}
|
||||
|
||||
/// Format of `ExecutionRequests` received over the engine api.
|
||||
@@ -606,6 +607,28 @@ impl<E: EthSpec> TryFrom<JsonExecutionRequests> for ExecutionRequests<E> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> TryFrom<JsonExecutionRequests> for ExecutionRequestsElectra<E> {
|
||||
type Error = RequestsError;
|
||||
|
||||
fn try_from(value: JsonExecutionRequests) -> Result<Self, Self::Error> {
|
||||
match ExecutionRequests::<E>::try_from(value)? {
|
||||
ExecutionRequests::Electra(requests) => Ok(requests),
|
||||
ExecutionRequests::Gloas(_) => Err(RequestsError::VariantMismatch),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> TryFrom<JsonExecutionRequests> for ExecutionRequestsGloas<E> {
|
||||
type Error = RequestsError;
|
||||
|
||||
fn try_from(value: JsonExecutionRequests) -> Result<Self, Self::Error> {
|
||||
match ExecutionRequests::<E>::try_from(value)? {
|
||||
ExecutionRequests::Gloas(requests) => Ok(requests),
|
||||
ExecutionRequests::Electra(_) => Err(RequestsError::VariantMismatch),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[superstruct(
|
||||
variants(Bellatrix, Capella, Deneb, Electra, Fulu, Gloas),
|
||||
variant_attributes(
|
||||
|
||||
@@ -43,7 +43,6 @@ use tokio::{
|
||||
use tokio_stream::wrappers::WatchStream;
|
||||
use tracing::{Instrument, debug, debug_span, error, info, instrument, warn};
|
||||
use tree_hash::TreeHash;
|
||||
use types::ExecutionPayloadGloas;
|
||||
use types::builder::BuilderBid;
|
||||
use types::execution::BlockProductionVersion;
|
||||
use types::kzg_ext::KzgCommitments;
|
||||
@@ -56,6 +55,7 @@ use types::{
|
||||
ExecutionPayloadCapella, ExecutionPayloadElectra, ExecutionPayloadFulu, FullPayload,
|
||||
ProposerPreparationData, Slot,
|
||||
};
|
||||
use types::{ExecutionPayloadGloas, ExecutionRequestsGloas};
|
||||
|
||||
mod block_hash;
|
||||
mod engine_api;
|
||||
@@ -206,7 +206,7 @@ pub struct BlockProposalContentsGloas<E: EthSpec> {
|
||||
pub payload_value: Uint256,
|
||||
pub blob_kzg_commitments: KzgCommitments<E>,
|
||||
pub blobs_and_proofs: (BlobsList<E>, KzgProofs<E>),
|
||||
pub execution_requests: ExecutionRequests<E>,
|
||||
pub execution_requests: ExecutionRequestsGloas<E>,
|
||||
pub should_override_builder: bool,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user