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

Commit

Permalink
sc-cli: add no-beefy flag to cli config (#14754)
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Catangiu <adrian@parity.io>
  • Loading branch information
acatangiu committed Aug 11, 2023
1 parent aedfdc9 commit 2060c36
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions bin/node/cli/benches/block_production.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase {
offchain_worker: OffchainWorkerConfig { enabled: true, indexing_enabled: false },
force_authoring: false,
disable_grandpa: false,
disable_beefy: false,
dev_key_seed: Some(Sr25519Keyring::Alice.to_seed()),
tracing_targets: None,
tracing_receiver: Default::default(),
Expand Down
1 change: 1 addition & 0 deletions bin/node/cli/benches/transaction_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase {
offchain_worker: OffchainWorkerConfig { enabled: true, indexing_enabled: false },
force_authoring: false,
disable_grandpa: false,
disable_beefy: false,
dev_key_seed: Some(Sr25519Keyring::Alice.to_seed()),
tracing_targets: None,
tracing_receiver: Default::default(),
Expand Down
8 changes: 8 additions & 0 deletions client/cli/src/commands/run_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ pub struct RunCmd {
#[arg(long)]
pub no_grandpa: bool,

/// Disable BEEFY voter when running in validator mode, otherwise disable the BEEFY observer.
#[arg(long)]
pub no_beefy: bool,

/// Listen to all RPC interfaces.
/// Default is local. Note: not all RPC methods are safe to be exposed publicly. Use an RPC
/// proxy server to filter out dangerous methods. More details:
Expand Down Expand Up @@ -313,6 +317,10 @@ impl CliConfiguration for RunCmd {
Ok(self.no_grandpa)
}

fn disable_beefy(&self) -> Result<bool> {
Ok(self.no_beefy)
}

fn rpc_max_connections(&self) -> Result<u32> {
Ok(self.rpc_max_connections)
}
Expand Down
8 changes: 8 additions & 0 deletions client/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,13 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
Ok(Default::default())
}

/// Returns `Ok(true)` if BEEFY should be disabled
///
/// By default this is `false`.
fn disable_beefy(&self) -> Result<bool> {
Ok(Default::default())
}

/// Get the development key seed from the current object
///
/// By default this is `None`.
Expand Down Expand Up @@ -508,6 +515,7 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
offchain_worker: self.offchain_worker(&role)?,
force_authoring: self.force_authoring()?,
disable_grandpa: self.disable_grandpa()?,
disable_beefy: self.disable_beefy()?,
dev_key_seed: self.dev_key_seed(is_dev)?,
tracing_targets: self.tracing_targets()?,
tracing_receiver: self.tracing_receiver()?,
Expand Down
1 change: 1 addition & 0 deletions client/cli/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ mod tests {
offchain_worker: Default::default(),
force_authoring: false,
disable_grandpa: false,
disable_beefy: false,
dev_key_seed: None,
tracing_targets: None,
tracing_receiver: Default::default(),
Expand Down
2 changes: 2 additions & 0 deletions client/service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ pub struct Configuration {
pub force_authoring: bool,
/// Disable GRANDPA when running in validator mode
pub disable_grandpa: bool,
/// Disable BEEFY when running in validator mode
pub disable_beefy: bool,
/// Development key seed.
///
/// When running in development mode, the seed will be used to generate authority keys by the
Expand Down
1 change: 1 addition & 0 deletions client/service/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ fn node_config<
offchain_worker: Default::default(),
force_authoring: false,
disable_grandpa: false,
disable_beefy: false,
dev_key_seed: key_seed,
tracing_targets: None,
tracing_receiver: Default::default(),
Expand Down

0 comments on commit 2060c36

Please sign in to comment.