| 390 | } |
| 391 | |
| 392 | fn create_node_config( |
| 393 | chain_spec: Arc<BaseChainSpec>, |
| 394 | data_path: &std::path::Path, |
| 395 | jwt_path: &std::path::Path, |
| 396 | config: &InProcessBuilderConfig, |
| 397 | ) -> Result<NodeConfig<BaseChainSpec>> { |
| 398 | let mut rpc = |
| 399 | if config.http_port.is_some() || config.ws_port.is_some() || config.auth_port.is_some() { |
| 400 | RpcServerArgs::default().with_http().with_ws() |
| 401 | } else { |
| 402 | RpcServerArgs::default().with_unused_ports().with_http().with_ws() |
| 403 | }; |
| 404 | |
| 405 | rpc.http_addr = Ipv4Addr::LOCALHOST.into(); |
| 406 | rpc.ws_addr = Ipv4Addr::LOCALHOST.into(); |
| 407 | rpc.auth_jwtsecret = Some(jwt_path.to_path_buf()); |
| 408 | // Match docker-compose `--rpc.eth-proof-window=1209600` (reth default is 0). |
| 409 | rpc.rpc_eth_proof_window = 1_209_600; |
| 410 | |
| 411 | if let Some(port) = config.http_port { |
| 412 | rpc.http_port = port; |
| 413 | } |
| 414 | if let Some(port) = config.ws_port { |
| 415 | rpc.ws_port = port; |
| 416 | } |
| 417 | if let Some(port) = config.auth_port { |
| 418 | rpc.auth_port = port; |
| 419 | } |
| 420 | |
| 421 | rpc.http_api = Some( |
| 422 | "admin,eth,web3,net,rpc,debug,txpool,miner" |
| 423 | .parse() |
| 424 | .wrap_err("Failed to parse HTTP API modules")?, |
| 425 | ); |
| 426 | rpc.ws_api = Some( |
| 427 | "admin,eth,web3,net,rpc,debug,txpool,miner" |
| 428 | .parse() |
| 429 | .wrap_err("Failed to parse WS API modules")?, |
| 430 | ); |
| 431 | |
| 432 | let mut network = if config.p2p_port.is_some() { |
| 433 | NetworkArgs::default() |
| 434 | } else { |
| 435 | NetworkArgs::default().with_unused_ports() |
| 436 | }; |
| 437 | network.p2p_secret_key_hex = Some(BUILDER.private_key); |
| 438 | network.discovery.disable_discovery = true; |
| 439 | if let Some(port) = config.p2p_port { |
| 440 | network.port = port; |
| 441 | } |
| 442 | |
| 443 | let datadir = DatadirArgs { |
| 444 | datadir: MaybePlatformPath::<DataDirPath>::from(data_path.to_path_buf()), |
| 445 | static_files_path: None, |
| 446 | rocksdb_path: None, |
| 447 | pprof_dumps_path: None, |
| 448 | }; |
| 449 | |