()
| 13 | |
| 14 | #[tokio::main] |
| 15 | async fn main() -> Result<()> { |
| 16 | tracing_subscriber::fmt::init(); |
| 17 | |
| 18 | let matches = Command::new("Execute Blocks") |
| 19 | .version("1.0") |
| 20 | .about("Executes historical blocks through op-reth engine API") |
| 21 | .arg( |
| 22 | Arg::new("block-dir") |
| 23 | .long("block-dir") |
| 24 | .value_name("PATH") |
| 25 | .help("Directory containing block files") |
| 26 | .required(true), |
| 27 | ) |
| 28 | .arg( |
| 29 | Arg::new("genesis-hash") |
| 30 | .long("genesis-hash") |
| 31 | .value_name("HASH") |
| 32 | .help("Genesis block hash") |
| 33 | .default_value(GENESIS_HASH), |
| 34 | ) |
| 35 | .arg( |
| 36 | Arg::new("engine-ipc-path") |
| 37 | .long("engine-ipc-path") |
| 38 | .value_name("PATH") |
| 39 | .help("Engine API IPC socket path") |
| 40 | .required(true), |
| 41 | ) |
| 42 | .arg( |
| 43 | Arg::new("start-block") |
| 44 | .long("start-block") |
| 45 | .value_name("COUNT") |
| 46 | .help("Block number of the first block") |
| 47 | .default_value("0"), |
| 48 | ) |
| 49 | .arg( |
| 50 | Arg::new("num-blocks") |
| 51 | .long("num-blocks") |
| 52 | .value_name("COUNT") |
| 53 | .help("Number of blocks to process") |
| 54 | .default_value("1000"), |
| 55 | ) |
| 56 | .get_matches(); |
| 57 | |
| 58 | let block_dir = PathBuf::from(matches.get_one::<String>("block-dir").unwrap()); |
| 59 | let genesis_hash_str = matches.get_one::<String>("genesis-hash").unwrap(); |
| 60 | let engine_ipc_path = matches |
| 61 | .get_one::<String>("engine-ipc-path") |
| 62 | .unwrap() |
| 63 | .to_string(); |
| 64 | let start_block: u64 = matches.get_one::<String>("start-block").unwrap().parse()?; |
| 65 | let num_blocks: u64 = matches.get_one::<String>("num-blocks").unwrap().parse()?; |
| 66 | |
| 67 | #[allow(unused)] |
| 68 | #[cfg(feature = "bench")] |
| 69 | let mut client = EthereumHistoricalEngineClient::new(engine_ipc_path, block_dir).await; |
| 70 | |
| 71 | // Load and commit blocks to Reth |
| 72 | let genesis_hash: [u8; 32] = from_hex_formatted(genesis_hash_str) |
nothing calls this directly
no test coverage detected