companion for 14754: cli: move no-beefy flag to sc-cli (#7600)

* cli: move no-beefy flag to substrate sc-cli config

* bump substrate ref

---------

Signed-off-by: Adrian Catangiu <adrian@parity.io>
This commit is contained in:
Adrian Catangiu
2023-08-11 18:30:58 +03:00
committed by GitHub
parent 693a29da1a
commit 26adab4f7c
7 changed files with 195 additions and 202 deletions
+184 -184
View File
File diff suppressed because it is too large Load Diff
-5
View File
@@ -99,11 +99,6 @@ pub struct RunCmd {
#[arg(long = "grandpa-pause", num_args = 2)] #[arg(long = "grandpa-pause", num_args = 2)]
pub grandpa_pause: Vec<u32>, pub grandpa_pause: Vec<u32>,
/// 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. /// Add the destination address to the jaeger agent.
/// ///
/// Must be valid socket address, of format `IP:Port` /// Must be valid socket address, of format `IP:Port`
+5 -6
View File
@@ -235,15 +235,11 @@ fn run_node_inner<F>(
where where
F: FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration), F: FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration),
{ {
let runner = cli let mut runner = cli
.create_runner_with_logger_hook::<sc_cli::RunCmd, F>(&cli.run.base, logger_hook) .create_runner_with_logger_hook::<sc_cli::RunCmd, F>(&cli.run.base, logger_hook)
.map_err(Error::from)?; .map_err(Error::from)?;
let chain_spec = &runner.config().chain_spec; 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()) &&
!cli.run.no_beefy;
set_default_ss58_version(chain_spec); set_default_ss58_version(chain_spec);
let grandpa_pause = if cli.run.grandpa_pause.is_empty() { let grandpa_pause = if cli.run.grandpa_pause.is_empty() {
@@ -259,6 +255,10 @@ where
info!(" KUSAMA FOUNDATION "); info!(" KUSAMA FOUNDATION ");
info!("----------------------------"); info!("----------------------------");
} }
// BEEFY allowed only on test networks.
if !(chain_spec.is_rococo() || chain_spec.is_wococo() || chain_spec.is_versi()) {
runner.config_mut().disable_beefy = true;
}
let jaeger_agent = if let Some(ref jaeger_agent) = cli.run.jaeger_agent { let jaeger_agent = if let Some(ref jaeger_agent) = cli.run.jaeger_agent {
Some( Some(
@@ -289,7 +289,6 @@ where
service::NewFullParams { service::NewFullParams {
is_collator: service::IsCollator::No, is_collator: service::IsCollator::No,
grandpa_pause, grandpa_pause,
enable_beefy,
jaeger_agent, jaeger_agent,
telemetry_worker_handle: None, telemetry_worker_handle: None,
node_version, node_version,
+1 -2
View File
@@ -629,7 +629,6 @@ where
pub struct NewFullParams<OverseerGenerator: OverseerGen> { pub struct NewFullParams<OverseerGenerator: OverseerGen> {
pub is_collator: IsCollator, pub is_collator: IsCollator,
pub grandpa_pause: Option<(u32, u32)>, pub grandpa_pause: Option<(u32, u32)>,
pub enable_beefy: bool,
pub jaeger_agent: Option<std::net::SocketAddr>, pub jaeger_agent: Option<std::net::SocketAddr>,
pub telemetry_worker_handle: Option<TelemetryWorkerHandle>, pub telemetry_worker_handle: Option<TelemetryWorkerHandle>,
/// The version of the node. TESTING ONLY: `None` can be passed to skip the node/worker version /// The version of the node. TESTING ONLY: `None` can be passed to skip the node/worker version
@@ -711,7 +710,6 @@ pub fn new_full<OverseerGenerator: OverseerGen>(
NewFullParams { NewFullParams {
is_collator, is_collator,
grandpa_pause, grandpa_pause,
enable_beefy,
jaeger_agent, jaeger_agent,
telemetry_worker_handle, telemetry_worker_handle,
node_version, node_version,
@@ -746,6 +744,7 @@ pub fn new_full<OverseerGenerator: OverseerGen>(
Some(backoff) Some(backoff)
}; };
let enable_beefy = !config.disable_beefy;
// If not on a known test network, warn the user that BEEFY is still experimental. // If not on a known test network, warn the user that BEEFY is still experimental.
if enable_beefy && if enable_beefy &&
!config.chain_spec.is_rococo() && !config.chain_spec.is_rococo() &&
+1 -1
View File
@@ -81,7 +81,6 @@ pub fn new_full(
polkadot_service::NewFullParams { polkadot_service::NewFullParams {
is_collator, is_collator,
grandpa_pause: None, grandpa_pause: None,
enable_beefy: true,
jaeger_agent: None, jaeger_agent: None,
telemetry_worker_handle: None, telemetry_worker_handle: None,
node_version: None, node_version: None,
@@ -188,6 +187,7 @@ pub fn node_config(
offchain_worker: Default::default(), offchain_worker: Default::default(),
force_authoring: false, force_authoring: false,
disable_grandpa: false, disable_grandpa: false,
disable_beefy: false,
dev_key_seed: Some(key_seed), dev_key_seed: Some(key_seed),
tracing_targets: None, tracing_targets: None,
tracing_receiver: Default::default(), tracing_receiver: Default::default(),
@@ -53,15 +53,15 @@ fn main() -> Result<()> {
) )
})?; })?;
runner.run_node_until_exit(|config| async move { runner.run_node_until_exit(|mut config| async move {
let collator = Collator::new(); let collator = Collator::new();
config.disable_beefy = true;
let full_node = polkadot_service::build_full( let full_node = polkadot_service::build_full(
config, config,
polkadot_service::NewFullParams { polkadot_service::NewFullParams {
is_collator: polkadot_service::IsCollator::Yes(collator.collator_key()), is_collator: polkadot_service::IsCollator::Yes(collator.collator_key()),
grandpa_pause: None, grandpa_pause: None,
enable_beefy: false,
jaeger_agent: None, jaeger_agent: None,
telemetry_worker_handle: None, telemetry_worker_handle: None,
@@ -53,15 +53,15 @@ fn main() -> Result<()> {
) )
})?; })?;
runner.run_node_until_exit(|config| async move { runner.run_node_until_exit(|mut config| async move {
let collator = Collator::new(cli.run.pov_size, cli.run.pvf_complexity); let collator = Collator::new(cli.run.pov_size, cli.run.pvf_complexity);
config.disable_beefy = true;
let full_node = polkadot_service::build_full( let full_node = polkadot_service::build_full(
config, config,
polkadot_service::NewFullParams { polkadot_service::NewFullParams {
is_collator: polkadot_service::IsCollator::Yes(collator.collator_key()), is_collator: polkadot_service::IsCollator::Yes(collator.collator_key()),
grandpa_pause: None, grandpa_pause: None,
enable_beefy: false,
jaeger_agent: None, jaeger_agent: None,
telemetry_worker_handle: None, telemetry_worker_handle: None,