From d3b0af2af78c4502ef735e63ea4bbeb268261133 Mon Sep 17 00:00:00 2001 From: rakita Date: Tue, 30 Nov 2021 13:00:12 +0100 Subject: [PATCH] Integrate GlobalConfig to ChainConfig --- fuel-core/src/args.rs | 2 +- fuel-core/src/chain_config.rs | 10 ++++++++++ fuel-core/src/global_config.rs | 6 ------ fuel-core/src/lib.rs | 1 - fuel-core/src/main.rs | 1 - fuel-core/src/schema/tx.rs | 2 +- fuel-core/src/service.rs | 3 +-- 7 files changed, 13 insertions(+), 12 deletions(-) delete mode 100644 fuel-core/src/global_config.rs diff --git a/fuel-core/src/args.rs b/fuel-core/src/args.rs index bb68e756b89..166201dec1b 100644 --- a/fuel-core/src/args.rs +++ b/fuel-core/src/args.rs @@ -1,4 +1,4 @@ -use crate::global_config::GlobalConfig; +use crate::chain_config::GlobalConfig; use crate::service::{Config, DbType}; use std::{env, io, net, path::PathBuf, string::ToString}; use structopt::StructOpt; diff --git a/fuel-core/src/chain_config.rs b/fuel-core/src/chain_config.rs index 776e4a30811..faf29d3b94f 100644 --- a/fuel-core/src/chain_config.rs +++ b/fuel-core/src/chain_config.rs @@ -19,6 +19,7 @@ pub struct ChainConfig { pub parent_network: BaseChainConfig, #[serde(default)] pub initial_state: Option, + pub global_config: Option, } impl ChainConfig { @@ -43,6 +44,9 @@ impl ChainConfig { coins: Some(initial_coins), ..StateConfig::default() }), + global_config: Some(GlobalConfig { + vm_backtrace: false, + }), } } } @@ -64,6 +68,12 @@ impl FromStr for ChainConfig { } } +#[skip_serializing_none] +#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)] +pub struct GlobalConfig { + pub vm_backtrace: bool, +} + #[derive(Clone, Debug, Deserialize, Serialize, PartialEq)] pub enum ProductionStrategy { Instant, diff --git a/fuel-core/src/global_config.rs b/fuel-core/src/global_config.rs deleted file mode 100644 index e1b7ff0ff1a..00000000000 --- a/fuel-core/src/global_config.rs +++ /dev/null @@ -1,6 +0,0 @@ -use core::default::Default; - -#[derive(Clone, Debug, Default)] -pub struct GlobalConfig { - pub vm_backtrace: bool, -} diff --git a/fuel-core/src/lib.rs b/fuel-core/src/lib.rs index cb89d46c74c..32fc5116b3d 100644 --- a/fuel-core/src/lib.rs +++ b/fuel-core/src/lib.rs @@ -1,7 +1,6 @@ pub mod chain_config; pub mod database; pub mod executor; -pub mod global_config; pub mod model; pub mod schema; pub mod service; diff --git a/fuel-core/src/main.rs b/fuel-core/src/main.rs index 7284ccb16ea..945cb25c1d6 100644 --- a/fuel-core/src/main.rs +++ b/fuel-core/src/main.rs @@ -7,7 +7,6 @@ mod args; pub(crate) mod chain_config; pub mod database; pub(crate) mod executor; -pub mod global_config; pub mod model; pub mod schema; pub mod service; diff --git a/fuel-core/src/schema/tx.rs b/fuel-core/src/schema/tx.rs index b4dd55875c2..fc91e5c1f1b 100644 --- a/fuel-core/src/schema/tx.rs +++ b/fuel-core/src/schema/tx.rs @@ -1,5 +1,5 @@ +use crate::chain_config::GlobalConfig; use crate::database::{transaction::OwnedTransactionIndexCursor, Database, KvStoreError}; -use crate::global_config::GlobalConfig; use crate::schema::scalars::{HexString, HexString256}; use crate::state::IterDirection; use crate::tx_pool::TxPool; diff --git a/fuel-core/src/service.rs b/fuel-core/src/service.rs index 631381e2973..7f3920d1539 100644 --- a/fuel-core/src/service.rs +++ b/fuel-core/src/service.rs @@ -1,6 +1,5 @@ -use crate::chain_config::{ChainConfig, ContractConfig, StateConfig}; +use crate::chain_config::{ChainConfig, ContractConfig, GlobalConfig, StateConfig}; use crate::database::Database; -use crate::global_config::GlobalConfig; use crate::model::coin::{Coin, CoinStatus, UtxoId}; use crate::tx_pool::TxPool; use fuel_storage::{MerkleStorage, Storage};