Skip to main content

build_engine_orchestrator

Function build_engine_orchestrator 

Source
pub fn build_engine_orchestrator<N, Client, S, V, C>(
    engine_kind: EngineApiKind,
    consensus: Arc<dyn FullConsensus<N::Primitives>>,
    client: Client,
    incoming_requests: S,
    pipeline: Pipeline<N>,
    pipeline_task_spawner: Runtime,
    provider: ProviderFactory<N>,
    blockchain_db: BlockchainProvider<N>,
    pruner: PrunerWithFactory<ProviderFactory<N>>,
    payload_builder: PayloadBuilderHandle<N::Payload>,
    payload_validator: V,
    tree_config: TreeConfig,
    sync_metrics_tx: MetricEventsSender,
    evm_config: C,
    changeset_cache: ChangesetCache,
    runtime: Runtime,
) -> ChainOrchestrator<EngineHandler<EngineApiRequestHandler<EngineApiRequest<N::Payload, N::Primitives>, N::Primitives>, S, BasicBlockDownloader<Client, <N::Primitives as NodePrimitives>::Block>>, PipelineSync<N>>
where N: ProviderNodeTypes, Client: BlockClient<Block = <N::Primitives as NodePrimitives>::Block> + 'static, S: Stream<Item = BeaconEngineMessage<N::Payload>> + Send + Sync + Unpin + 'static, V: EngineValidator<N::Payload> + WaitForCaches, C: ConfigureEvm<Primitives = N::Primitives> + 'static,
Expand description

Builds the engine ChainOrchestrator that drives the chain forward.

This spawns and wires together the following components:

  • BasicBlockDownloader — downloads blocks on demand from the network during live sync.
  • PersistenceHandle — spawns the persistence service on a background thread for writing blocks and performing pruning outside the critical consensus path.
  • EngineApiTreeHandler — spawns the tree handler that processes engine API requests (newPayload, forkchoiceUpdated) and maintains the in-memory chain state.
  • EngineApiRequestHandler + EngineHandler — glue that routes incoming CL messages to the tree handler and manages download requests.
  • PipelineSync — wraps the staged sync Pipeline for backfill sync when the node needs to catch up over large block ranges.

The returned orchestrator implements [Stream] and yields ChainEvents.