Skip to content

Commit 89fd980

Browse files
authored
cli: disallow BEEFY and warp sync together (#7661)
Signed-off-by: Adrian Catangiu <[email protected]>
1 parent a5f421e commit 89fd980

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

polkadot/cli/src/command.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use crate::cli::{Cli, Subcommand, NODE_VERSION};
1818
use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE};
1919
use futures::future::TryFutureExt;
20-
use log::info;
20+
use log::{info, warn};
2121
use sc_cli::SubstrateCli;
2222
use service::{
2323
self,
@@ -240,8 +240,24 @@ where
240240
.map_err(Error::from)?;
241241
let chain_spec = &runner.config().chain_spec;
242242

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

246262
set_default_ss58_version(chain_spec);
247263

0 commit comments

Comments
 (0)