From 5c236b9bcc42e4bc268b1f9f239fdbe0169f5742 Mon Sep 17 00:00:00 2001 From: acatangiu Date: Thu, 25 May 2023 15:18:14 +0300 Subject: [PATCH 1/2] cli: enable BEEFY by default on test networks We consider BEEFY mature enough to run by default on all nodes for test networks (Rococo/Wococo/Versi). Right now, most nodes are not running it since it's opt-in using --beefy flag. Remove --beefy flag from CLI and have BEEFY client started (or not) based on network id. Signed-off-by: acatangiu --- cli/src/cli.rs | 4 ---- cli/src/command.rs | 10 +++------- node/service/src/lib.rs | 12 ++++-------- zombienet_tests/functional/0003-beefy-and-mmr.toml | 4 ++-- 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/cli/src/cli.rs b/cli/src/cli.rs index b775bb6b77ad..50061e7fe8c4 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -114,10 +114,6 @@ pub struct RunCmd { #[arg(long = "grandpa-pause", num_args = 2)] pub grandpa_pause: Vec, - /// Enable the BEEFY gadget (only on Rococo or Wococo for now). - #[arg(long)] - pub beefy: bool, - /// Add the destination address to the jaeger agent. /// /// Must be valid socket address, of format `IP:Port` diff --git a/cli/src/command.rs b/cli/src/command.rs index 802ba93941c3..15fef13757e9 100644 --- a/cli/src/command.rs +++ b/cli/src/command.rs @@ -298,12 +298,8 @@ where .map_err(Error::from)?; let chain_spec = &runner.config().chain_spec; - // Disallow BEEFY on production networks. - if cli.run.beefy && - (chain_spec.is_polkadot() || chain_spec.is_kusama() || chain_spec.is_westend()) - { - return Err(Error::Other("BEEFY disallowed on production networks".to_string())) - } + // By default, enable BEEFY on test networks. + let enable_beefy = chain_spec.is_rococo() || chain_spec.is_wococo() || chain_spec.is_versi(); set_default_ss58_version(chain_spec); @@ -346,7 +342,7 @@ where config, service::IsCollator::No, grandpa_pause, - cli.run.beefy, + enable_beefy, jaeger_agent, None, false, diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 800a8af9e2a0..e55f2456160b 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -1158,15 +1158,11 @@ where let gadget = beefy::start_beefy_gadget::<_, _, _, _, _, _, _>(beefy_params); - // Wococo's purpose is to be a testbed for BEEFY, so if it fails we'll + // BEEFY currently only runs on testnets, if it fails we'll // bring the node down with it to make sure it is noticed. - if chain_spec.is_wococo() { - task_manager - .spawn_essential_handle() - .spawn_blocking("beefy-gadget", None, gadget); - } else { - task_manager.spawn_handle().spawn_blocking("beefy-gadget", None, gadget); - } + task_manager + .spawn_essential_handle() + .spawn_blocking("beefy-gadget", None, gadget); if is_offchain_indexing_enabled { task_manager.spawn_handle().spawn_blocking( diff --git a/zombienet_tests/functional/0003-beefy-and-mmr.toml b/zombienet_tests/functional/0003-beefy-and-mmr.toml index bea5ac1ba64f..a8d97bc30f85 100644 --- a/zombienet_tests/functional/0003-beefy-and-mmr.toml +++ b/zombienet_tests/functional/0003-beefy-and-mmr.toml @@ -9,8 +9,8 @@ command = "polkadot" [[relaychain.node_groups]] name = "validator" count = 3 -args = ["--log=beefy=debug", "--beefy", "--enable-offchain-indexing=true"] +args = ["--log=beefy=debug", "--enable-offchain-indexing=true"] [[relaychain.nodes]] name = "validator-unstable" -args = ["--log=beefy=debug", "--beefy", "--enable-offchain-indexing=true"] +args = ["--log=beefy=debug", "--enable-offchain-indexing=true"] From 67219892a3297397977eba0fed76b54d0cd17100 Mon Sep 17 00:00:00 2001 From: acatangiu Date: Thu, 25 May 2023 18:31:26 +0300 Subject: [PATCH 2/2] switch to --no-beefy flag --- cli/src/cli.rs | 5 +++++ cli/src/command.rs | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cli/src/cli.rs b/cli/src/cli.rs index 50061e7fe8c4..69c54b428a92 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -114,6 +114,11 @@ pub struct RunCmd { #[arg(long = "grandpa-pause", num_args = 2)] pub grandpa_pause: Vec, + /// Disable the BEEFY gadget + /// (currently enabled by default on Rococo, Wococo and Versi). + #[arg(long)] + pub no_beefy: bool, + /// Add the destination address to the jaeger agent. /// /// Must be valid socket address, of format `IP:Port` diff --git a/cli/src/command.rs b/cli/src/command.rs index 15fef13757e9..da225df37f6d 100644 --- a/cli/src/command.rs +++ b/cli/src/command.rs @@ -299,7 +299,8 @@ where let chain_spec = &runner.config().chain_spec; // By default, enable BEEFY on test networks. - let enable_beefy = chain_spec.is_rococo() || chain_spec.is_wococo() || chain_spec.is_versi(); + let enable_beefy = (chain_spec.is_rococo() || chain_spec.is_wococo() || chain_spec.is_versi()) && + !cli.run.no_beefy; set_default_ss58_version(chain_spec);