move execution pending envelolpe logic to its own file

This commit is contained in:
Eitan Seri- Levi
2026-02-24 12:08:07 -08:00
parent 30241f54c4
commit 2093dc1f39
3 changed files with 146 additions and 134 deletions

View File

@@ -39,31 +39,16 @@ use types::{
};
use crate::{
BeaconChain, BeaconChainError, BeaconChainTypes, BeaconStore, BlockError,
ExecutionPayloadError, NotifyExecutionLayer, PayloadVerificationOutcome,
block_verification::PayloadVerificationHandle, canonical_head::CanonicalHead,
payload_envelope_verification::gossip_verified_envelope::GossipVerifiedEnvelope,
BeaconChainError, BeaconChainTypes, BeaconStore, BlockError, ExecutionPayloadError,
PayloadVerificationOutcome, canonical_head::CanonicalHead,
};
pub mod execution_pending_envelope;
pub mod gossip_verified_envelope;
pub mod import;
mod payload_notifier;
pub trait IntoExecutionPendingEnvelope<T: BeaconChainTypes>: Sized {
fn into_execution_pending_envelope(
self,
chain: &Arc<BeaconChain<T>>,
notify_execution_layer: NotifyExecutionLayer,
) -> Result<ExecutionPendingEnvelope<T::EthSpec>, EnvelopeError>;
fn envelope(&self) -> &Arc<SignedExecutionPayloadEnvelope<T::EthSpec>>;
}
pub struct ExecutionPendingEnvelope<E: EthSpec> {
pub signed_envelope: MaybeAvailableEnvelope<E>,
pub import_data: EnvelopeImportData<E>,
pub payload_verification_handle: PayloadVerificationHandle,
}
pub use execution_pending_envelope::{ExecutionPendingEnvelope, IntoExecutionPendingEnvelope};
#[derive(PartialEq)]
pub struct EnvelopeImportData<E: EthSpec> {
@@ -348,20 +333,3 @@ pub(crate) fn load_snapshot<T: BeaconChainTypes>(
load_snapshot_from_state_root::<T>(beacon_block_root, proto_beacon_block.state_root, store)
}
impl<T: BeaconChainTypes> IntoExecutionPendingEnvelope<T>
for Arc<SignedExecutionPayloadEnvelope<T::EthSpec>>
{
fn into_execution_pending_envelope(
self,
chain: &Arc<BeaconChain<T>>,
notify_execution_layer: NotifyExecutionLayer,
) -> Result<ExecutionPendingEnvelope<T::EthSpec>, EnvelopeError> {
GossipVerifiedEnvelope::new(self, &chain.gossip_verification_context())?
.into_execution_pending_envelope(chain, notify_execution_layer)
}
fn envelope(&self) -> &Arc<SignedExecutionPayloadEnvelope<T::EthSpec>> {
self
}
}