mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-01 05:37:05 +00:00
heze boilerplate
This commit is contained in:
@@ -44,6 +44,7 @@ use tokio_stream::wrappers::WatchStream;
|
||||
use tracing::{Instrument, debug, debug_span, error, info, instrument, warn};
|
||||
use tree_hash::TreeHash;
|
||||
use types::ExecutionPayloadGloas;
|
||||
use types::ExecutionPayloadHeze;
|
||||
use types::builder::BuilderBid;
|
||||
use types::execution::BlockProductionVersion;
|
||||
use types::kzg_ext::KzgCommitments;
|
||||
@@ -219,6 +220,26 @@ impl<E: EthSpec> From<GetPayloadResponseGloas<E>> for BlockProposalContentsGloas
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BlockProposalContentsHeze<E: EthSpec> {
|
||||
pub payload: ExecutionPayloadHeze<E>,
|
||||
pub payload_value: Uint256,
|
||||
pub blob_kzg_commitments: KzgCommitments<E>,
|
||||
pub blobs_and_proofs: (BlobsList<E>, KzgProofs<E>),
|
||||
pub execution_requests: ExecutionRequests<E>,
|
||||
}
|
||||
|
||||
impl<E: EthSpec> From<GetPayloadResponseHeze<E>> for BlockProposalContentsHeze<E> {
|
||||
fn from(response: GetPayloadResponseHeze<E>) -> Self {
|
||||
Self {
|
||||
payload: response.execution_payload,
|
||||
payload_value: response.block_value,
|
||||
blob_kzg_commitments: response.blobs_bundle.commitments,
|
||||
blobs_and_proofs: (response.blobs_bundle.blobs, response.blobs_bundle.proofs),
|
||||
execution_requests: response.requests,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub enum BlockProposalContents<E: EthSpec, Payload: AbstractExecPayload<E>> {
|
||||
Payload {
|
||||
payload: Payload,
|
||||
@@ -930,6 +951,44 @@ impl<E: EthSpec> ExecutionLayer<E> {
|
||||
Ok(payload_response.into())
|
||||
}
|
||||
|
||||
/// Maps to the `engine_getPayload` JSON-RPC call for post-Heze payload construction.
|
||||
///
|
||||
/// However, it will attempt to call `self.prepare_payload` if it cannot find an existing
|
||||
/// payload id for the given parameters.
|
||||
///
|
||||
/// ## Fallback Behavior
|
||||
///
|
||||
/// The result will be returned from the first node that returns successfully. No more nodes
|
||||
/// will be contacted.
|
||||
#[instrument(level = "debug", skip_all)]
|
||||
pub async fn get_payload_heze(
|
||||
&self,
|
||||
payload_parameters: PayloadParameters<'_>,
|
||||
) -> Result<BlockProposalContentsHeze<E>, Error> {
|
||||
let payload_response_type = self.get_full_payload_caching(payload_parameters).await?;
|
||||
let GetPayloadResponseType::Full(payload_response) = payload_response_type else {
|
||||
return Err(Error::Unexpected(
|
||||
"get_payload_heze should never return a blinded payload".to_owned(),
|
||||
));
|
||||
};
|
||||
let GetPayloadResponse::Heze(payload_response) = payload_response else {
|
||||
return Err(Error::Unexpected(
|
||||
"get_payload_heze should always return a heze `GetPayloadResponse` variant"
|
||||
.to_owned(),
|
||||
));
|
||||
};
|
||||
metrics::inc_counter_vec(
|
||||
&metrics::EXECUTION_LAYER_GET_PAYLOAD_OUTCOME,
|
||||
&[metrics::SUCCESS],
|
||||
);
|
||||
metrics::inc_counter_vec(
|
||||
&metrics::EXECUTION_LAYER_GET_PAYLOAD_SOURCE,
|
||||
&[metrics::LOCAL],
|
||||
);
|
||||
|
||||
Ok(payload_response.into())
|
||||
}
|
||||
|
||||
/// Maps to the `engine_getPayload` JSON-RPC call.
|
||||
///
|
||||
/// However, it will attempt to call `self.prepare_payload` if it cannot find an existing
|
||||
@@ -1690,6 +1749,9 @@ impl<E: EthSpec> ExecutionLayer<E> {
|
||||
ForkName::Gloas => {
|
||||
return Err(Error::InvalidForkForPayload);
|
||||
}
|
||||
ForkName::Heze => {
|
||||
return Err(Error::InvalidForkForPayload);
|
||||
}
|
||||
};
|
||||
return Ok(Some(payload));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user