diff --git a/beacon_node/src/cli.rs b/beacon_node/src/cli.rs index e6f1673964..712f0eae75 100644 --- a/beacon_node/src/cli.rs +++ b/beacon_node/src/cli.rs @@ -45,6 +45,12 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> { --subscribe-all-subnets to ensure all attestations are received for import.") .takes_value(false), ) + .arg( + Arg::with_name("disable-packet-filter") + .long("disable-packet-filter") + .help("Disables the discovery packet filter. Useful for testing in smaller networks") + .takes_value(false), + ) .arg( Arg::with_name("zero-ports") .long("zero-ports") diff --git a/beacon_node/src/config.rs b/beacon_node/src/config.rs index 40b9ced584..628ecf3168 100644 --- a/beacon_node/src/config.rs +++ b/beacon_node/src/config.rs @@ -612,6 +612,11 @@ pub fn set_network_config( config.discv5_config.enr_update = false; } + if cli_args.is_present("disable-packet-filter") { + warn!(log, "Discv5 packet filter is disabled"); + config.discv5_config.enable_packet_filter = false; + } + if cli_args.is_present("disable-discovery") { config.disable_discovery = true; warn!(log, "Discovery is disabled. New peers will not be found"); diff --git a/boot_node/src/cli.rs b/boot_node/src/cli.rs index c82a452b0b..9a37320028 100644 --- a/boot_node/src/cli.rs +++ b/boot_node/src/cli.rs @@ -60,6 +60,11 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> { .help("Discovery can automatically update the node's local ENR with an external IP address and port as seen by other peers on the network. \ This enables this feature.") ) + .arg( + Arg::with_name("disable-packet-filter") + .long("disable-packet-filter") + .help("Disables discv5 packet filter. Useful for testing in smaller networks") + ) .arg( Arg::with_name("network-dir") .value_name("NETWORK_DIR") diff --git a/boot_node/src/config.rs b/boot_node/src/config.rs index 00a1ab5604..0d5aab1abc 100644 --- a/boot_node/src/config.rs +++ b/boot_node/src/config.rs @@ -19,6 +19,7 @@ pub struct BootNodeConfig { pub local_enr: Enr, pub local_key: CombinedKey, pub auto_update: bool, + pub disable_packet_filter: bool, phantom: PhantomData, } @@ -69,6 +70,7 @@ impl TryFrom<&ArgMatches<'_>> for BootNodeConfig { } let auto_update = matches.is_present("enable-enr_auto_update"); + let disable_packet_filter = matches.is_present("disable-packet-filter"); // the address to listen on let listen_socket = @@ -128,6 +130,7 @@ impl TryFrom<&ArgMatches<'_>> for BootNodeConfig { local_enr, local_key, auto_update, + disable_packet_filter, phantom: PhantomData, }) } diff --git a/boot_node/src/server.rs b/boot_node/src/server.rs index 3cdd8789a3..fc1de95f44 100644 --- a/boot_node/src/server.rs +++ b/boot_node/src/server.rs @@ -32,7 +32,9 @@ pub async fn run(config: BootNodeConfig, log: slog::Logger) { let discv5_config = { let mut builder = Discv5ConfigBuilder::new(); - builder.enable_packet_filter(); + if !config.disable_packet_filter { + builder.enable_packet_filter(); + } if !config.auto_update { builder.disable_enr_update(); } diff --git a/scripts/local_testnet/beacon_node.sh b/scripts/local_testnet/beacon_node.sh index 5c286e3197..6b66bec050 100755 --- a/scripts/local_testnet/beacon_node.sh +++ b/scripts/local_testnet/beacon_node.sh @@ -21,4 +21,5 @@ exec lighthouse \ --enr-tcp-port $2 \ --port $2 \ --http-port $3 \ + --disable-packet-filter \ --target-peers $((NODE_COUNT - 1)) diff --git a/scripts/local_testnet/bootnode.sh b/scripts/local_testnet/bootnode.sh index 9558a487bc..bef207a694 100755 --- a/scripts/local_testnet/bootnode.sh +++ b/scripts/local_testnet/bootnode.sh @@ -30,4 +30,5 @@ exec lighthouse boot_node \ --testnet-dir $TESTNET_DIR \ --port $BOOTNODE_PORT \ --listen-address 127.0.0.1 \ + --disable-packet-filter \ --network-dir $DATADIR/bootnode \