diff --git a/substrate/client/db/Cargo.toml b/substrate/client/db/Cargo.toml index 32e6f9daa2..18f94b39d7 100644 --- a/substrate/client/db/Cargo.toml +++ b/substrate/client/db/Cargo.toml @@ -47,3 +47,6 @@ tempfile = "3" [features] default = [] test-helpers = [] +with-kvdb-rocksdb = ["kvdb-rocksdb"] +with-parity-db = ["parity-db"] +with-subdb = [] diff --git a/substrate/client/db/src/lib.rs b/substrate/client/db/src/lib.rs index 9fb8f3c8c0..f75693ec9f 100644 --- a/substrate/client/db/src/lib.rs +++ b/substrate/client/db/src/lib.rs @@ -31,20 +31,20 @@ pub mod light; pub mod offchain; -#[cfg(any(feature = "kvdb-rocksdb", test))] +#[cfg(any(feature = "with-kvdb-rocksdb", test))] pub mod bench; mod children; mod cache; mod changes_tries_storage; mod storage_cache; -#[cfg(any(feature = "kvdb-rocksdb", test))] +#[cfg(any(feature = "with-kvdb-rocksdb", test))] mod upgrade; mod utils; mod stats; -#[cfg(feature = "parity-db")] +#[cfg(feature = "with-parity-db")] mod parity_db; -#[cfg(feature = "subdb")] +#[cfg(feature = "with-subdb")] mod subdb; use std::sync::Arc; @@ -91,7 +91,7 @@ use log::{trace, debug, warn}; pub use sp_database::Database; pub use sc_state_db::PruningMode; -#[cfg(any(feature = "kvdb-rocksdb", test))] +#[cfg(any(feature = "with-kvdb-rocksdb", test))] pub use bench::BenchmarkingState; const MIN_BLOCKS_TO_KEEP_CHANGES_TRIES_FOR: u32 = 32768; diff --git a/substrate/client/db/src/utils.rs b/substrate/client/db/src/utils.rs index 80b08b3a6e..d66d5abfea 100644 --- a/substrate/client/db/src/utils.rs +++ b/substrate/client/db/src/utils.rs @@ -36,7 +36,7 @@ use crate::{DatabaseSettings, DatabaseSettingsSrc, Database, DbHash}; /// Number of columns in the db. Must be the same for both full && light dbs. /// Otherwise RocksDb will fail to open database && check its type. -#[cfg(any(feature = "kvdb-rocksdb", feature = "test-helpers", test))] +#[cfg(any(feature = "with-kvdb-rocksdb", feature = "test-helpers", test))] pub const NUM_COLUMNS: u32 = 11; /// Meta column. The set of keys in the column is shared by full && light storages. pub const COLUMN_META: u32 = 0; @@ -219,7 +219,7 @@ pub fn open_database( ); let db: Arc> = match &config.source { - #[cfg(any(feature = "kvdb-rocksdb", test))] + #[cfg(any(feature = "with-kvdb-rocksdb", test))] DatabaseSettingsSrc::RocksDb { path, cache_size } => { // first upgrade database to required version crate::upgrade::upgrade_db::(&path, db_type)?; @@ -255,27 +255,27 @@ pub fn open_database( .map_err(|err| sp_blockchain::Error::Backend(format!("{}", err)))?; sp_database::as_database(db) }, - #[cfg(not(any(feature = "kvdb-rocksdb", test)))] + #[cfg(not(any(feature = "with-kvdb-rocksdb", test)))] DatabaseSettingsSrc::RocksDb { .. } => { - return db_open_error("kvdb-rocksdb"); + return db_open_error("with-kvdb-rocksdb"); }, - #[cfg(feature = "subdb")] + #[cfg(feature = "with-subdb")] DatabaseSettingsSrc::SubDb { path } => { crate::subdb::open(&path, NUM_COLUMNS) .map_err(|e| sp_blockchain::Error::Backend(format!("{:?}", e)))? }, - #[cfg(not(feature = "subdb"))] + #[cfg(not(feature = "with-subdb"))] DatabaseSettingsSrc::SubDb { .. } => { - return db_open_error("subdb"); + return db_open_error("with-subdb"); }, - #[cfg(feature = "parity-db")] + #[cfg(feature = "with-parity-db")] DatabaseSettingsSrc::ParityDb { path } => { crate::parity_db::open(&path) .map_err(|e| sp_blockchain::Error::Backend(format!("{:?}", e)))? }, - #[cfg(not(feature = "parity-db"))] + #[cfg(not(feature = "with-parity-db"))] DatabaseSettingsSrc::ParityDb { .. } => { - return db_open_error("parity-db"); + return db_open_error("with-parity-db"); }, DatabaseSettingsSrc::Custom(db) => db.clone(), }; diff --git a/substrate/client/executor/runtime-test/src/lib.rs b/substrate/client/executor/runtime-test/src/lib.rs index 15a4177048..dc6bab759e 100644 --- a/substrate/client/executor/runtime-test/src/lib.rs +++ b/substrate/client/executor/runtime-test/src/lib.rs @@ -1,5 +1,4 @@ #![cfg_attr(not(feature = "std"), no_std)] -#![cfg_attr(feature = "strict", deny(warnings))] // Make the WASM binary available. #[cfg(feature = "std")] diff --git a/substrate/client/service/Cargo.toml b/substrate/client/service/Cargo.toml index fc5991bc3f..acc75d6890 100644 --- a/substrate/client/service/Cargo.toml +++ b/substrate/client/service/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] default = ["db"] # The RocksDB feature activates the RocksDB database backend. If it is not activated, and you pass # a path to a database, an error will be produced at runtime. -db = ["sc-client-db/kvdb-rocksdb", "sc-client-db/parity-db"] +db = ["sc-client-db/with-kvdb-rocksdb", "sc-client-db/with-parity-db"] wasmtime = [ "sc-executor/wasmtime", ] diff --git a/substrate/client/transaction-pool/src/lib.rs b/substrate/client/transaction-pool/src/lib.rs index b91992a47d..ad238e6241 100644 --- a/substrate/client/transaction-pool/src/lib.rs +++ b/substrate/client/transaction-pool/src/lib.rs @@ -28,7 +28,7 @@ mod metrics; pub mod error; -#[cfg(any(feature = "test-helpers", test))] +#[cfg(test)] pub mod testing; pub use sc_transaction_graph as txpool; diff --git a/substrate/utils/frame/benchmarking-cli/Cargo.toml b/substrate/utils/frame/benchmarking-cli/Cargo.toml index d9a8dd67e7..d7a3ddc587 100644 --- a/substrate/utils/frame/benchmarking-cli/Cargo.toml +++ b/substrate/utils/frame/benchmarking-cli/Cargo.toml @@ -26,4 +26,4 @@ codec = { version = "1.3.0", package = "parity-scale-codec" } [features] default = ["db"] -db = ["sc-client-db/kvdb-rocksdb", "sc-client-db/parity-db"] +db = ["sc-client-db/with-kvdb-rocksdb", "sc-client-db/with-parity-db"]