|
17 | 17 | use crate::cli::{Cli, Subcommand, NODE_VERSION}; |
18 | 18 | use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE}; |
19 | 19 | use futures::future::TryFutureExt; |
20 | | -use log::info; |
| 20 | +use log::{info, warn}; |
21 | 21 | use sc_cli::SubstrateCli; |
22 | 22 | use service::{ |
23 | 23 | self, |
@@ -240,8 +240,24 @@ where |
240 | 240 | .map_err(Error::from)?; |
241 | 241 | let chain_spec = &runner.config().chain_spec; |
242 | 242 |
|
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 | + } |
245 | 261 |
|
246 | 262 | set_default_ss58_version(chain_spec); |
247 | 263 |
|
|
0 commit comments