From 6df2ff2748db059f9982706c18f07077ef9cc563 Mon Sep 17 00:00:00 2001 From: MujkicA <32431923+MujkicA@users.noreply.github.com> Date: Thu, 25 Jan 2024 00:11:58 +0100 Subject: [PATCH] Remove dev consensus key (#1614) This PR adds the following changes: - removes `consensus_dev_key since the `produce_block` functionality can now be controlled through the `debug` flag - uses the dev consensus key in the debug mode regardless of the trigger mode --- CHANGELOG.md | 1 + bin/fuel-core/src/cli/run.rs | 20 +++++++------------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b791cb34ec..45353b28927 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ Description of the upcoming release here. - [#1601](https://github.com/FuelLabs/fuel-core/pull/1601): Fix formatting in docs and check that `cargo doc` passes in the CI. #### Breaking +- [#1614](https://github.com/FuelLabs/fuel-core/pull/#1614): Use the default consensus key regardless of trigger mode. The change is breaking because it removes the `--dev-keys` argument. If the `debug` flag is set, the default consensus key will be used, regardless of the trigger mode. - [#1596](https://github.com/FuelLabs/fuel-core/pull/1596) Make `Consensus` type a version-able enum - [#1593](https://github.com/FuelLabs/fuel-core/pull/1593) Make `Block` type a version-able enum - [#1576](https://github.com/FuelLabs/fuel-core/pull/1576): The change moves the implementation of the storage traits for required tables from `fuel-core` to `fuel-core-storage` crate. The change also adds a more flexible configuration of the encoding/decoding per the table and allows the implementation of specific behaviors for the table in a much easier way. It unifies the encoding between database, SMTs, and iteration, preventing mismatching bytes representation on the Rust type system level. Plus, it increases the re-usage of the code by applying the same blueprint to other tables. diff --git a/bin/fuel-core/src/cli/run.rs b/bin/fuel-core/src/cli/run.rs index 9b1faeff4ad..8adca85411e 100644 --- a/bin/fuel-core/src/cli/run.rs +++ b/bin/fuel-core/src/cli/run.rs @@ -142,11 +142,6 @@ pub struct Command { #[clap(flatten)] pub poa_trigger: PoATriggerArgs, - /// Use a default insecure consensus key for testing purposes. - /// This will not be enabled by default in the future. - #[arg(long = "dev-keys", default_value = "true", env)] - pub consensus_dev_key: bool, - /// The block's fee recipient public key. /// /// If not set, `consensus_key` is used as the provider of the `Address`. @@ -226,7 +221,6 @@ impl Command { min_gas_price, consensus_key, poa_trigger, - consensus_dev_key, coinbase_recipient, #[cfg(feature = "relayer")] relayer_args, @@ -266,9 +260,14 @@ impl Command { info!("Block production disabled"); } + let consensus_key = load_consensus_key(consensus_key)?; + if consensus_key.is_some() && trigger == Trigger::Never { + warn!("Consensus key configured but block production is disabled!"); + } + // if consensus key is not configured, fallback to dev consensus key - let consensus_key = load_consensus_key(consensus_key)?.or_else(|| { - if consensus_dev_key && trigger != Trigger::Never { + let consensus_key = consensus_key.or_else(|| { + if debug { let key = default_consensus_dev_key(); warn!( "Fuel Core is using an insecure test key for consensus. Public key: {}", @@ -276,15 +275,10 @@ impl Command { ); Some(Secret::new(key.into())) } else { - // if consensus dev key is disabled, use no key None } }); - if consensus_key.is_some() && trigger == Trigger::Never { - warn!("Consensus key configured but block production is disabled!") - } - let coinbase_recipient = if let Some(coinbase_recipient) = coinbase_recipient { Some( ContractId::from_str(coinbase_recipient.as_str())