diff --git a/ethportal-peertest/README.md b/ethportal-peertest/README.md index 38085c386..1c26f35d3 100644 --- a/ethportal-peertest/README.md +++ b/ethportal-peertest/README.md @@ -8,6 +8,13 @@ cd ethportal-peertest RUST_LOG=debug cargo run -p ethportal-peertest -- --target-node enr:-IS4QBDHCSMoYoC5UziAwKSyTmMPrhMaEpaE52L8DDAkipqvZQe9fgLy2wVuuEJwO9l1KsYrRoFGCsNjylbd0CDNw60BgmlkgnY0gmlwhMCoXUSJc2VjcDI1NmsxoQJPAZUFErHK1DZYRTLjk3SCNgye9sS-MxoQI-gLiUdwc4N1ZHCCIyk ``` +If you are running it on a local network you will likely want to manually give it a port +to use and advertise: + +```sh +RUST_LOG=debug cargo run -p ethportal-peertest -- --external-address 127.0.0.1:4568 --listen-port 4568 --target-node $ENR +``` + ## Transport selection Running the test harness will by default test all jsonrpc endpoints over IPC to the target node. To make sure these pass, please make sure that the target node is running with `--web3-transport ipc`. To test jsonrpc over http, use the `--target-transport http` cli argument for the harness, and make sure the target node is running with `--web3-transport http`. Ideally, both transport methods are tested before PRs. diff --git a/ethportal-peertest/src/cli.rs b/ethportal-peertest/src/cli.rs index 2bb875819..241a280b1 100644 --- a/ethportal-peertest/src/cli.rs +++ b/ethportal-peertest/src/cli.rs @@ -1,5 +1,6 @@ use std::env; use std::ffi::OsString; +use std::net::SocketAddr; use structopt::StructOpt; use trin_core::cli::DEFAULT_WEB3_HTTP_PORT as DEFAULT_TARGET_HTTP_PORT; use trin_core::cli::DEFAULT_WEB3_IPC_PATH as DEFAULT_TARGET_IPC_PATH; @@ -57,6 +58,12 @@ pub struct PeertestConfig { help = "HTTP port of target node under test" )] pub target_http_port: String, + + #[structopt( + long = "external-address", + help = "(Only use this if you are behind a NAT) This is the address which will be advertised to peers (in an ENR). Changing it does not change which port or address trin binds to." + )] + pub external_addr: Option, } impl PeertestConfig { diff --git a/ethportal-peertest/src/main.rs b/ethportal-peertest/src/main.rs index dfa61edb0..0e0826fa8 100644 --- a/ethportal-peertest/src/main.rs +++ b/ethportal-peertest/src/main.rs @@ -26,6 +26,7 @@ async fn main() -> Result<(), Box> { tokio::spawn(async move { let peertest_config = PeertestConfig::default(); let portal_config = PortalnetConfig { + external_addr: peertest_config.external_addr, listen_port: peertest_config.listen_port, ..Default::default() };