Serve rpc by range and by root:

This commit is contained in:
Eitan Seri- Levi
2026-02-24 00:55:29 -08:00
parent dcc43e3d20
commit ffc2b97699
19 changed files with 1140 additions and 8 deletions

View File

@@ -30,6 +30,7 @@ use crate::early_attester_cache::EarlyAttesterCache;
use crate::errors::{BeaconChainError as Error, BlockProductionError};
use crate::events::ServerSentEventHandler;
use crate::execution_payload::{NotifyExecutionLayer, PreparePayloadHandle, get_execution_payload};
use crate::execution_payload_envelope_streamer::PayloadEnvelopeStreamer;
use crate::fetch_blobs::EngineGetBlobsOutput;
use crate::fork_choice_signal::{ForkChoiceSignalRx, ForkChoiceSignalTx};
use crate::graffiti_calculator::{GraffitiCalculator, GraffitiSettings};
@@ -1125,6 +1126,58 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
.map_or_else(|| self.get_blobs(block_root), Ok)
}
/// Returns the execution payload envelopes at the given roots, if any.
///
/// Will also check any associated caches. The expected use for this function is *only* for returning blocks requested
/// from P2P peers.
///
/// ## Errors
///
/// May return a database error.
#[allow(clippy::type_complexity)]
pub fn get_payload_envelopes_checking_caches(
self: &Arc<Self>,
block_roots: Vec<Hash256>,
) -> Result<
impl Stream<
Item = (
Hash256,
Arc<Result<Option<Arc<SignedExecutionPayloadEnvelope<T::EthSpec>>>, Error>>,
),
>,
Error,
> {
Ok(PayloadEnvelopeStreamer::<T>::new(
self.execution_layer.clone(),
self.store.clone(),
self.task_executor.clone(),
CheckCaches::Yes,
)?
.launch_stream(block_roots))
}
#[allow(clippy::type_complexity)]
pub fn get_payload_envelopes(
self: &Arc<Self>,
block_roots: Vec<Hash256>,
) -> Result<
impl Stream<
Item = (
Hash256,
Arc<Result<Option<Arc<SignedExecutionPayloadEnvelope<T::EthSpec>>>, Error>>,
),
>,
Error,
> {
Ok(PayloadEnvelopeStreamer::<T>::new(
self.execution_layer.clone(),
self.store.clone(),
self.task_executor.clone(),
CheckCaches::No,
)?
.launch_stream(block_roots))
}
pub fn get_data_columns_checking_all_caches(
&self,
block_root: Hash256,