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

@ -1,8 +1,8 @@
use clap::{Args, Parser};
use clap::Parser;
use reth::builder::NodeHandle;
use reth_hl::{
chainspec::parser::HlChainSpecParser,
node::{cli::Cli, storage::tables::Tables, HlNode},
node::{cli::{Cli, HlNodeArgs}, storage::tables::Tables, HlNode},
};
// We use jemalloc for performance reasons
@ -10,11 +10,6 @@ use reth_hl::{
#[global_allocator]
static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
/// No Additional arguments
#[derive(Debug, Clone, Copy, Default, Args)]
#[non_exhaustive]
struct NoArgs;
fn main() -> eyre::Result<()> {
reth_cli_util::sigsegv_handler::install();
@ -23,9 +18,9 @@ fn main() -> eyre::Result<()> {
std::env::set_var("RUST_BACKTRACE", "1");
}
Cli::<HlChainSpecParser, NoArgs>::parse().run(|builder, _| async move {
Cli::<HlChainSpecParser, HlNodeArgs>::parse().run(|builder, ext| async move {
builder.builder.database.create_tables_for::<Tables>()?;
let (node, engine_handle_tx) = HlNode::new();
let (node, engine_handle_tx) = HlNode::new(ext.block_source_args.parse().await?);
let NodeHandle { node, node_exit_future: exit_future } =
builder.node(node).launch().await?;