feat: Pseudo peer and staged sync

For simplicity, we use with_pow() + pseudo peer that connects to reth itself, so that it can support 1. StateFetcher via NetworkState 2. Block announcement (which requires with_pow()).

For block announcement, another way was using ImportService like before, or calling engine_api. But for simplicitiy, for now we just publish from pseudo peer like pre-PoS, hence with_pow().
This commit is contained in:
sprites0
2025-06-27 19:38:53 +00:00
parent 2c6e989ad0
commit ba8dfc4d96
18 changed files with 2112 additions and 130 deletions

View File

@ -12,6 +12,7 @@ use crate::{
},
storage::HlStorage,
},
pseudo_peer::BlockSourceConfig,
};
use consensus::HlConsensusBuilder;
use engine::HlPayloadServiceBuilder;
@ -49,12 +50,15 @@ pub type HlNodeAddOns<N> =
pub struct HlNode {
engine_handle_rx:
Arc<Mutex<Option<oneshot::Receiver<BeaconConsensusEngineHandle<HlPayloadTypes>>>>>,
block_source_config: BlockSourceConfig,
}
impl HlNode {
pub fn new() -> (Self, oneshot::Sender<BeaconConsensusEngineHandle<HlPayloadTypes>>) {
pub fn new(
block_source_config: BlockSourceConfig,
) -> (Self, oneshot::Sender<BeaconConsensusEngineHandle<HlPayloadTypes>>) {
let (tx, rx) = oneshot::channel();
(Self { engine_handle_rx: Arc::new(Mutex::new(Some(rx))) }, tx)
(Self { engine_handle_rx: Arc::new(Mutex::new(Some(rx))), block_source_config }, tx)
}
}
@ -79,7 +83,10 @@ impl HlNode {
.pool(HlPoolBuilder)
.executor(HlExecutorBuilder::default())
.payload(HlPayloadServiceBuilder::default())
.network(HlNetworkBuilder { engine_handle_rx: self.engine_handle_rx.clone() })
.network(HlNetworkBuilder {
engine_handle_rx: self.engine_handle_rx.clone(),
block_source_config: self.block_source_config.clone(),
})
.consensus(HlConsensusBuilder::default())
}
}