mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: update el requests for devnet 4 (#11865)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -4,6 +4,7 @@ use crate::{
|
||||
engine::message::OnForkChoiceUpdated, BeaconConsensusEngineEvent, BeaconEngineMessage,
|
||||
BeaconForkChoiceUpdateError, BeaconOnNewPayloadError,
|
||||
};
|
||||
use alloy_primitives::Bytes;
|
||||
use alloy_rpc_types_engine::{
|
||||
CancunPayloadFields, ExecutionPayload, ForkchoiceState, ForkchoiceUpdated, PayloadStatus,
|
||||
};
|
||||
@ -47,9 +48,17 @@ where
|
||||
&self,
|
||||
payload: ExecutionPayload,
|
||||
cancun_fields: Option<CancunPayloadFields>,
|
||||
execution_requests: Option<Vec<Bytes>>,
|
||||
) -> Result<PayloadStatus, BeaconOnNewPayloadError> {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
let _ = self.to_engine.send(BeaconEngineMessage::NewPayload { payload, cancun_fields, tx });
|
||||
// HACK(onbjerg): We should have a pectra payload fields struct, this is just a temporary
|
||||
// workaround.
|
||||
let _ = self.to_engine.send(BeaconEngineMessage::NewPayload {
|
||||
payload,
|
||||
cancun_fields,
|
||||
execution_requests,
|
||||
tx,
|
||||
});
|
||||
rx.await.map_err(|_| BeaconOnNewPayloadError::EngineUnavailable)?
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
use crate::engine::{error::BeaconOnNewPayloadError, forkchoice::ForkchoiceStatus};
|
||||
use alloy_primitives::Bytes;
|
||||
use alloy_rpc_types_engine::{
|
||||
CancunPayloadFields, ExecutionPayload, ForkChoiceUpdateResult, ForkchoiceState,
|
||||
ForkchoiceUpdateError, ForkchoiceUpdated, PayloadId, PayloadStatus, PayloadStatusEnum,
|
||||
@ -146,6 +147,10 @@ pub enum BeaconEngineMessage<Engine: EngineTypes> {
|
||||
payload: ExecutionPayload,
|
||||
/// The cancun-related newPayload fields, if any.
|
||||
cancun_fields: Option<CancunPayloadFields>,
|
||||
// HACK(onbjerg): We should have a pectra payload fields struct, this is just a temporary
|
||||
// workaround.
|
||||
/// The pectra EIP-7685 execution requests.
|
||||
execution_requests: Option<Vec<Bytes>>,
|
||||
/// The sender for returning payload status result.
|
||||
tx: oneshot::Sender<Result<PayloadStatus, BeaconOnNewPayloadError>>,
|
||||
},
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use alloy_primitives::{BlockNumber, B256};
|
||||
use alloy_primitives::{BlockNumber, Bytes, B256};
|
||||
use alloy_rpc_types_engine::{
|
||||
CancunPayloadFields, ExecutionPayload, ForkchoiceState, PayloadStatus, PayloadStatusEnum,
|
||||
PayloadValidationError,
|
||||
@ -1085,6 +1085,9 @@ where
|
||||
&mut self,
|
||||
payload: ExecutionPayload,
|
||||
cancun_fields: Option<CancunPayloadFields>,
|
||||
// HACK(onbjerg): We should have a pectra payload fields struct, this is just a temporary
|
||||
// workaround.
|
||||
execution_requests: Option<Vec<Bytes>>,
|
||||
) -> Result<Either<PayloadStatus, SealedBlock>, BeaconOnNewPayloadError> {
|
||||
self.metrics.new_payload_messages.increment(1);
|
||||
|
||||
@ -1114,10 +1117,11 @@ where
|
||||
//
|
||||
// This validation **MUST** be instantly run in all cases even during active sync process.
|
||||
let parent_hash = payload.parent_hash();
|
||||
let block = match self
|
||||
.payload_validator
|
||||
.ensure_well_formed_payload(payload, cancun_fields.into())
|
||||
{
|
||||
let block = match self.payload_validator.ensure_well_formed_payload(
|
||||
payload,
|
||||
cancun_fields.into(),
|
||||
execution_requests,
|
||||
) {
|
||||
Ok(block) => block,
|
||||
Err(error) => {
|
||||
error!(target: "consensus::engine", %error, "Invalid payload");
|
||||
@ -1862,8 +1866,13 @@ where
|
||||
BeaconEngineMessage::ForkchoiceUpdated { state, payload_attrs, tx } => {
|
||||
this.on_forkchoice_updated(state, payload_attrs, tx);
|
||||
}
|
||||
BeaconEngineMessage::NewPayload { payload, cancun_fields, tx } => {
|
||||
match this.on_new_payload(payload, cancun_fields) {
|
||||
BeaconEngineMessage::NewPayload {
|
||||
payload,
|
||||
cancun_fields,
|
||||
execution_requests,
|
||||
tx,
|
||||
} => {
|
||||
match this.on_new_payload(payload, cancun_fields, execution_requests) {
|
||||
Ok(Either::Right(block)) => {
|
||||
this.set_blockchain_tree_action(
|
||||
BlockchainTreeAction::InsertNewPayload { block, tx },
|
||||
|
||||
@ -70,7 +70,7 @@ impl<DB> TestEnv<DB> {
|
||||
payload: T,
|
||||
cancun_fields: Option<CancunPayloadFields>,
|
||||
) -> Result<PayloadStatus, BeaconOnNewPayloadError> {
|
||||
self.engine_handle.new_payload(payload.into(), cancun_fields).await
|
||||
self.engine_handle.new_payload(payload.into(), cancun_fields, None).await
|
||||
}
|
||||
|
||||
/// Sends the `ExecutionPayload` message to the consensus engine and retries if the engine
|
||||
|
||||
Reference in New Issue
Block a user