From 43a1114337bef9f301ce5e8aa30c3fbf0d84fd08 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Wed, 8 Oct 2025 11:10:46 +0200 Subject: [PATCH] custom rpc port --- crates/ml-test-runner/src/main.rs | 6 ++++++ crates/node/src/node_implementations/geth.rs | 4 ++-- crates/node/src/node_implementations/substrate.rs | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/crates/ml-test-runner/src/main.rs b/crates/ml-test-runner/src/main.rs index b356580..525c7d3 100644 --- a/crates/ml-test-runner/src/main.rs +++ b/crates/ml-test-runner/src/main.rs @@ -58,6 +58,10 @@ struct MlTestRunnerArgs { default_value = "0x5fb92d6e98884f76de468fa3f6278f8807c48bebc13595d45af5bdc4da702133" )] private_key: String, + + /// RPC port to connect to when using existing node + #[arg(long = "rpc-port", default_value = "8545")] + rpc_port: u16, } fn main() -> anyhow::Result<()> { @@ -315,6 +319,7 @@ async fn execute_test_file( PlatformIdentifier::GethEvmSolc | PlatformIdentifier::LighthouseGethEvmSolc => Box::new( revive_dt_node::node_implementations::geth::GethNode::new_existing( &args.private_key, + args.rpc_port, ) .await?, ), @@ -326,6 +331,7 @@ async fn execute_test_file( | PlatformIdentifier::ZombienetRevmSolc => Box::new( revive_dt_node::node_implementations::substrate::SubstrateNode::new_existing( &args.private_key, + args.rpc_port, ) .await?, ), diff --git a/crates/node/src/node_implementations/geth.rs b/crates/node/src/node_implementations/geth.rs index 31ff200..bc9ac8f 100644 --- a/crates/node/src/node_implementations/geth.rs +++ b/crates/node/src/node_implementations/geth.rs @@ -130,7 +130,7 @@ impl GethNode { } } - pub async fn new_existing(private_key: &str) -> anyhow::Result { + pub async fn new_existing(private_key: &str, rpc_port: u16) -> anyhow::Result { use alloy::{primitives::FixedBytes, signers::local::PrivateKeySigner}; let key_str = private_key.trim().strip_prefix("0x").unwrap_or(private_key.trim()); @@ -154,7 +154,7 @@ impl GethNode { let wallet = Arc::new(EthereumWallet::new(signer)); let node = Self { - connection_string: "http://localhost:8545".to_string(), + connection_string: format!("http://localhost:{}", rpc_port), base_directory: PathBuf::new(), data_directory: PathBuf::new(), logs_directory: PathBuf::new(), diff --git a/crates/node/src/node_implementations/substrate.rs b/crates/node/src/node_implementations/substrate.rs index ee7a5d8..7c7dde6 100644 --- a/crates/node/src/node_implementations/substrate.rs +++ b/crates/node/src/node_implementations/substrate.rs @@ -132,7 +132,7 @@ impl SubstrateNode { } } - pub async fn new_existing(private_key: &str) -> anyhow::Result { + pub async fn new_existing(private_key: &str, rpc_port: u16) -> anyhow::Result { use alloy::{primitives::FixedBytes, signers::local::PrivateKeySigner}; let key_str = private_key.trim().strip_prefix("0x").unwrap_or(private_key.trim()); @@ -159,7 +159,7 @@ impl SubstrateNode { node_binary: PathBuf::new(), eth_proxy_binary: PathBuf::new(), export_chainspec_command: String::new(), - rpc_url: "http://localhost:8545".to_string(), + rpc_url: format!("http://localhost:{}", rpc_port), base_directory: PathBuf::new(), logs_directory: PathBuf::new(), substrate_process: None,