Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
cli: disallow BEEFY and warp sync together
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Catangiu <[email protected]>
  • Loading branch information
acatangiu committed Aug 24, 2023
1 parent 7f0eb5f commit 65ae271
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use crate::cli::{Cli, Subcommand, NODE_VERSION};
use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE};
use futures::future::TryFutureExt;
use log::info;
use log::{info, warn};
use sc_cli::SubstrateCli;
use service::{
self,
Expand Down Expand Up @@ -240,8 +240,24 @@ where
.map_err(Error::from)?;
let chain_spec = &runner.config().chain_spec;

// By default, enable BEEFY on all networks except Polkadot (for now).
let enable_beefy = !chain_spec.is_polkadot() && !cli.run.no_beefy;
// By default, enable BEEFY on all networks except Polkadot (for now), unless
// explicitly disabled through CLI.
let mut enable_beefy = !chain_spec.is_polkadot() && !cli.run.no_beefy;
// BEEFY doesn't (yet) support warp sync:
// Until we implement https://github.com/paritytech/substrate/issues/14756
// - disallow warp sync for validators,
// - disable BEEFY when warp sync for non-validators.
if enable_beefy && runner.config().network.sync_mode.is_warp() {
if runner.config().role.is_authority() {
return Err(Error::Other(
"Warp sync not supported for validator nodes running BEEFY.".into(),
))
} else {
// disable BEEFY for non-validator nodes that are warp syncing
warn!("🥩 BEEFY not supported when warp syncing. Disabling BEEFY.");
enable_beefy = false;
}
}

set_default_ss58_version(chain_spec);

Expand Down

0 comments on commit 65ae271

Please sign in to comment.