From e2c7672c1bf345a2c95a14fa97109b2df2720dbe Mon Sep 17 00:00:00 2001 From: Joshy Orndorff Date: Wed, 29 Nov 2023 13:17:50 -0500 Subject: [PATCH 01/10] cumulus-client-cli --- cumulus/client/cli/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cumulus/client/cli/Cargo.toml b/cumulus/client/cli/Cargo.toml index 0f942feb59524..ee51e96f7f367 100644 --- a/cumulus/client/cli/Cargo.toml +++ b/cumulus/client/cli/Cargo.toml @@ -12,9 +12,9 @@ codec = { package = "parity-scale-codec", version = "3.0.0" } url = "2.4.0" # Substrate -sc-cli = { path = "../../../substrate/client/cli" } +sc-cli = { default-features = false, path = "../../../substrate/client/cli" } sc-client-api = { path = "../../../substrate/client/api" } sc-chain-spec = { path = "../../../substrate/client/chain-spec" } -sc-service = { path = "../../../substrate/client/service" } +sc-service = { default-features = false, path = "../../../substrate/client/service" } sp-core = { path = "../../../substrate/primitives/core" } sp-runtime = { path = "../../../substrate/primitives/runtime" } From 0d6de8772452f291477a927a01ec78f2caef53e3 Mon Sep 17 00:00:00 2001 From: Joshy Orndorff Date: Wed, 29 Nov 2023 13:57:35 -0500 Subject: [PATCH 02/10] substrate-test-utils --- substrate/test-utils/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/test-utils/Cargo.toml b/substrate/test-utils/Cargo.toml index 31bdc0f663a10..3bcc9d96131f4 100644 --- a/substrate/test-utils/Cargo.toml +++ b/substrate/test-utils/Cargo.toml @@ -18,4 +18,4 @@ tokio = { version = "1.22.0", features = ["macros", "time"] } [dev-dependencies] trybuild = { version = "1.0.74", features = [ "diff" ] } -sc-service = { path = "../client/service" } +sc-service = { path = "../client/service", default-features = false } From 50e24f56e69862ac782c969589eacabc50365856 Mon Sep 17 00:00:00 2001 From: Joshy Orndorff Date: Wed, 29 Nov 2023 15:01:27 -0500 Subject: [PATCH 03/10] checkpoint --- polkadot/node/metrics/Cargo.toml | 8 +++---- polkadot/node/service/Cargo.toml | 10 ++++---- polkadot/node/service/src/lib.rs | 23 +++++++++++++++---- .../node/service/src/parachains_db/mod.rs | 6 +++++ .../node/service/src/parachains_db/upgrade.rs | 20 ++++++++++++---- polkadot/node/test/client/Cargo.toml | 2 +- polkadot/node/test/service/Cargo.toml | 5 ++-- polkadot/node/test/service/src/lib.rs | 3 +++ substrate/client/db/Cargo.toml | 4 +++- 9 files changed, 59 insertions(+), 22 deletions(-) diff --git a/polkadot/node/metrics/Cargo.toml b/polkadot/node/metrics/Cargo.toml index e13ae63199ff0..c3f8bbbcfc93d 100644 --- a/polkadot/node/metrics/Cargo.toml +++ b/polkadot/node/metrics/Cargo.toml @@ -13,8 +13,9 @@ gum = { package = "tracing-gum", path = "../gum" } metered = { package = "prioritized-metered-channel", version = "0.5.1", default-features = false, features=["futures_channel"] } # Both `sc-service` and `sc-cli` are required by runtime metrics `logger_hook()`. -sc-service = { path = "../../../substrate/client/service" } -sc-cli = { path = "../../../substrate/client/cli" } +# Regarding the above comment, should they be optional dependencies then? +sc-service = { path = "../../../substrate/client/service", default-features = false } +sc-cli = { path = "../../../substrate/client/cli", default-features = false } substrate-prometheus-endpoint = { path = "../../../substrate/utils/prometheus" } sc-tracing = { path = "../../../substrate/client/tracing" } @@ -28,9 +29,8 @@ assert_cmd = "2.0.4" tempfile = "3.2.0" hyper = { version = "0.14.20", default-features = false, features = ["http1", "tcp"] } tokio = "1.24.2" -polkadot-test-service = { path = "../test/service", features=["runtime-metrics"]} +polkadot-test-service = { path = "../test/service", features=["runtime-metrics"], default-features = false} substrate-test-utils = { path = "../../../substrate/test-utils" } -sc-service = { path = "../../../substrate/client/service" } sp-keyring = { path = "../../../substrate/primitives/keyring" } prometheus-parse = {version = "0.2.2"} diff --git a/polkadot/node/service/Cargo.toml b/polkadot/node/service/Cargo.toml index 19efd1b66c450..66a983c009125 100644 --- a/polkadot/node/service/Cargo.toml +++ b/polkadot/node/service/Cargo.toml @@ -18,7 +18,7 @@ sp-mmr-primitives = { path = "../../../substrate/primitives/merkle-mountain-rang sc-block-builder = { path = "../../../substrate/client/block-builder" } sc-chain-spec = { path = "../../../substrate/client/chain-spec" } sc-client-api = { path = "../../../substrate/client/api" } -sc-client-db = { path = "../../../substrate/client/db" } +sc-client-db = { default-features = false, path = "../../../substrate/client/db" } sc-consensus = { path = "../../../substrate/client/consensus/common" } sc-consensus-slots = { path = "../../../substrate/client/consensus/slots" } sc-executor = { path = "../../../substrate/client/executor" } @@ -71,8 +71,8 @@ frame-system = { path = "../../../substrate/frame/system" } frame-system-rpc-runtime-api = { path = "../../../substrate/frame/system/rpc/runtime-api" } prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../substrate/utils/prometheus" } frame-support = { path = "../../../substrate/frame/support" } -frame-benchmarking-cli = { path = "../../../substrate/utils/frame/benchmarking-cli" } -frame-benchmarking = { path = "../../../substrate/frame/benchmarking" } +frame-benchmarking-cli = { path = "../../../substrate/utils/frame/benchmarking-cli", default-features = false } +frame-benchmarking = { path = "../../../substrate/frame/benchmarking", default-features = false } # External Crates async-trait = "0.1.57" @@ -150,10 +150,10 @@ tempfile = "3.2" [features] default = [ "db", "full-node" ] -db = [ "service/rocksdb" ] +# TODO revisit the frame benchmarking features. It only has an std feature as default. And disabling it somehow disables rocksdb. +db = [ "service/rocksdb", "sc-client-db/rocksdb", "frame-benchmarking-cli/rocksdb", "kvdb-rocksdb" ] full-node = [ - "kvdb-rocksdb", "parity-db", "polkadot-approval-distribution", "polkadot-availability-bitfield-distribution", diff --git a/polkadot/node/service/src/lib.rs b/polkadot/node/service/src/lib.rs index 70159301fc412..80220696e9e33 100644 --- a/polkadot/node/service/src/lib.rs +++ b/polkadot/node/service/src/lib.rs @@ -337,6 +337,7 @@ impl IdentifyVariant for Box { #[cfg(feature = "full-node")] pub fn open_database(db_source: &DatabaseSource) -> Result, Error> { let parachains_db = match db_source { + #[cfg(feature = "db")] DatabaseSource::RocksDb { path, .. } => parachains_db::open_creating_rocksdb( path.clone(), parachains_db::CacheSizes::default(), @@ -345,17 +346,27 @@ pub fn open_database(db_source: &DatabaseSource) -> Result, Er path.parent().ok_or(Error::DatabasePathRequired)?.into(), parachains_db::CacheSizes::default(), )?, - DatabaseSource::Auto { paritydb_path, rocksdb_path, .. } => { + DatabaseSource::Auto { paritydb_path, #[cfg(feature = "db")]rocksdb_path, .. } => { if paritydb_path.is_dir() && paritydb_path.exists() { parachains_db::open_creating_paritydb( paritydb_path.parent().ok_or(Error::DatabasePathRequired)?.into(), parachains_db::CacheSizes::default(), )? } else { - parachains_db::open_creating_rocksdb( - rocksdb_path.clone(), - parachains_db::CacheSizes::default(), - )? + #[cfg(feature = "db")] + { + parachains_db::open_creating_rocksdb( + rocksdb_path.clone(), + parachains_db::CacheSizes::default(), + )? + } + #[cfg(not(feature = "db"))] + { + parachains_db::open_creating_paritydb( + paritydb_path.parent().ok_or(Error::DatabasePathRequired)?.into(), + parachains_db::CacheSizes::default(), + )? + } } }, DatabaseSource::Custom { .. } => { @@ -1410,6 +1421,7 @@ pub fn revert_backend( Ok(()) } +#[cfg(feature = "full-node")] fn revert_chain_selection(db: Arc, hash: Hash) -> sp_blockchain::Result<()> { let config = chain_selection_subsystem::Config { col_data: parachains_db::REAL_COLUMNS.col_chain_selection_data, @@ -1424,6 +1436,7 @@ fn revert_chain_selection(db: Arc, hash: Hash) -> sp_blockchain::R .map_err(|err| sp_blockchain::Error::Backend(err.to_string())) } +#[cfg(feature = "full-node")] fn revert_approval_voting(db: Arc, hash: Hash) -> sp_blockchain::Result<()> { let config = approval_voting_subsystem::Config { col_approval_data: parachains_db::REAL_COLUMNS.col_approval_data, diff --git a/polkadot/node/service/src/parachains_db/mod.rs b/polkadot/node/service/src/parachains_db/mod.rs index 92f3f167f22fb..575c3da87648c 100644 --- a/polkadot/node/service/src/parachains_db/mod.rs +++ b/polkadot/node/service/src/parachains_db/mod.rs @@ -26,6 +26,10 @@ const LOG_TARGET: &str = "parachain::db"; /// Column configuration per version. #[cfg(any(test, feature = "full-node"))] pub(crate) mod columns { + // This v0 module is only used in tests for parity_db; not in main code. But it is + // used in both tests and main code for rocks db. This feature gating makes sure there + // is never a warning, but perhaps there is a better way? + #[cfg(any(test, feature = "db"))] pub mod v0 { pub const NUM_COLUMNS: u32 = 3; } @@ -91,6 +95,7 @@ pub const REAL_COLUMNS: ColumnsConfig = ColumnsConfig { #[derive(PartialEq, Copy, Clone)] pub(crate) enum DatabaseKind { ParityDB, + #[cfg(feature = "db")] RocksDB, } @@ -125,6 +130,7 @@ pub(crate) fn other_io_error(err: String) -> io::Error { /// Open the database on disk, creating it if it doesn't exist. #[cfg(feature = "full-node")] +#[cfg(feature = "db")] pub fn open_creating_rocksdb( root: PathBuf, cache_sizes: CacheSizes, diff --git a/polkadot/node/service/src/parachains_db/upgrade.rs b/polkadot/node/service/src/parachains_db/upgrade.rs index 1d76c79d3e323..6cb9943b5deed 100644 --- a/polkadot/node/service/src/parachains_db/upgrade.rs +++ b/polkadot/node/service/src/parachains_db/upgrade.rs @@ -107,6 +107,7 @@ pub(crate) fn try_upgrade_db_to_next_version( // This is an arbitrary future version, we don't handle it. Some(v) => return Err(Error::FutureVersion { current: CURRENT_VERSION, got: v }), // No version file. For `RocksDB` we dont need to do anything. + #[cfg(feature = "db")] None if db_kind == DatabaseKind::RocksDB => CURRENT_VERSION, // No version file. `ParityDB` did not previously have a version defined. // We handle this as a `0 -> 1` migration. @@ -153,6 +154,7 @@ fn migrate_from_version_0_to_1(path: &Path, db_kind: DatabaseKind) -> Result paritydb_migrate_from_version_0_to_1(path), + #[cfg(feature = "db")] DatabaseKind::RocksDB => rocksdb_migrate_from_version_0_to_1(path), } .and_then(|result| { @@ -166,6 +168,7 @@ fn migrate_from_version_1_to_2(path: &Path, db_kind: DatabaseKind) -> Result paritydb_migrate_from_version_1_to_2(path), + #[cfg(feature = "db")] DatabaseKind::RocksDB => rocksdb_migrate_from_version_1_to_2(path), } .and_then(|result| { @@ -178,9 +181,9 @@ fn migrate_from_version_1_to_2(path: &Path, db_kind: DatabaseKind) -> Result Result { gum::info!(target: LOG_TARGET, "Migrating parachains db from version 3 to version 4 ..."); - use polkadot_node_subsystem_util::database::{ - kvdb_impl::DbAdapter as RocksDbAdapter, paritydb_impl::DbAdapter as ParityDbAdapter, - }; + use polkadot_node_subsystem_util::database::paritydb_impl::DbAdapter as ParityDbAdapter; + #[cfg(feature = "db")] + use polkadot_node_subsystem_util::database::kvdb_impl::DbAdapter as RocksDbAdapter; use std::sync::Arc; let approval_db_config = @@ -196,6 +199,7 @@ fn migrate_from_version_3_to_4(path: &Path, db_kind: DatabaseKind) -> Result { let db_path = path .to_str() @@ -219,6 +223,7 @@ fn migrate_from_version_2_to_3(path: &Path, db_kind: DatabaseKind) -> Result paritydb_migrate_from_version_2_to_3(path), + #[cfg(feature = "db")] DatabaseKind::RocksDB => rocksdb_migrate_from_version_2_to_3(path), } .and_then(|result| { @@ -229,6 +234,7 @@ fn migrate_from_version_2_to_3(path: &Path, db_kind: DatabaseKind) -> Result Result { use kvdb_rocksdb::{Database, DatabaseConfig}; @@ -246,6 +252,7 @@ fn rocksdb_migrate_from_version_0_to_1(path: &Path) -> Result { /// Migration from version 1 to version 2: /// * the number of columns has changed from 5 to 6; +#[cfg(feature = "db")] fn rocksdb_migrate_from_version_1_to_2(path: &Path) -> Result { use kvdb_rocksdb::{Database, DatabaseConfig}; @@ -260,6 +267,7 @@ fn rocksdb_migrate_from_version_1_to_2(path: &Path) -> Result { Ok(2) } +#[cfg(feature = "db")] fn rocksdb_migrate_from_version_2_to_3(path: &Path) -> Result { use kvdb_rocksdb::{Database, DatabaseConfig}; @@ -520,6 +528,7 @@ mod tests { ); } + #[cfg(feature = "db")] #[test] fn test_rocksdb_migrate_1_to_2() { use kvdb::{DBKey, DBOp}; @@ -579,8 +588,9 @@ mod tests { ); } + #[cfg(feature = "db")] #[test] - fn test_migrate_3_to_4() { + fn test_rocksdb_migrate_3_to_4() { use kvdb_rocksdb::{Database, DatabaseConfig}; use polkadot_node_core_approval_voting::approval_db::v2::migration_helpers::v1_to_v2_sanity_check; use polkadot_node_subsystem_util::database::kvdb_impl::DbAdapter; @@ -613,6 +623,7 @@ mod tests { v1_to_v2_sanity_check(std::sync::Arc::new(db), approval_cfg, expected_candidates).unwrap(); } + #[cfg(feature = "db")] #[test] fn test_rocksdb_migrate_0_to_4() { use kvdb_rocksdb::{Database, DatabaseConfig}; @@ -682,6 +693,7 @@ mod tests { assert_eq!(db.num_columns(), columns::v3::NUM_COLUMNS as u8); } + #[cfg(feature = "db")] #[test] fn test_rocksdb_migrate_2_to_3() { use kvdb_rocksdb::{Database, DatabaseConfig}; diff --git a/polkadot/node/test/client/Cargo.toml b/polkadot/node/test/client/Cargo.toml index bc4ff74be4bb8..6232c85203dd0 100644 --- a/polkadot/node/test/client/Cargo.toml +++ b/polkadot/node/test/client/Cargo.toml @@ -17,7 +17,7 @@ polkadot-node-subsystem = { path = "../../subsystem" } # Substrate dependencies substrate-test-client = { path = "../../../../substrate/test-utils/client" } -sc-service = { path = "../../../../substrate/client/service" } +sc-service = { path = "../../../../substrate/client/service", default-features = false } sc-block-builder = { path = "../../../../substrate/client/block-builder" } sc-consensus = { path = "../../../../substrate/client/consensus/common" } sc-offchain = { path = "../../../../substrate/client/offchain" } diff --git a/polkadot/node/test/service/Cargo.toml b/polkadot/node/test/service/Cargo.toml index 437fa66b75a22..d2dbab8d8c461 100644 --- a/polkadot/node/test/service/Cargo.toml +++ b/polkadot/node/test/service/Cargo.toml @@ -21,7 +21,8 @@ polkadot-primitives = { path = "../../../primitives" } polkadot-parachain-primitives = { path = "../../../parachain" } polkadot-rpc = { path = "../../../rpc" } polkadot-runtime-common = { path = "../../../runtime/common" } -polkadot-service = { path = "../../service" } +# polkadot-service = { path = "../../service" } +polkadot-service = { default-features = false, features = ["full-node"], path = "../../service" } polkadot-node-subsystem = { path = "../../subsystem" } polkadot-node-primitives = { path = "../../primitives" } polkadot-test-runtime = { path = "../../../runtime/test-runtime" } @@ -42,7 +43,7 @@ pallet-staking = { path = "../../../../substrate/frame/staking" } pallet-balances = { path = "../../../../substrate/frame/balances" } pallet-transaction-payment = { path = "../../../../substrate/frame/transaction-payment" } sc-chain-spec = { path = "../../../../substrate/client/chain-spec" } -sc-cli = { path = "../../../../substrate/client/cli" } +sc-cli = { path = "../../../../substrate/client/cli", default-features = false } sc-client-api = { path = "../../../../substrate/client/api" } sc-consensus = { path = "../../../../substrate/client/consensus/common" } sc-network = { path = "../../../../substrate/client/network" } diff --git a/polkadot/node/test/service/src/lib.rs b/polkadot/node/test/service/src/lib.rs index 312113869bc3f..29503118051bd 100644 --- a/polkadot/node/test/service/src/lib.rs +++ b/polkadot/node/test/service/src/lib.rs @@ -163,7 +163,10 @@ pub fn node_config( transaction_pool: Default::default(), network: network_config, keystore: KeystoreConfig::InMemory, + #[cfg(feature = "db")] database: DatabaseSource::RocksDb { path: root.join("db"), cache_size: 128 }, + #[cfg(not(feature = "db"))] + database: DatabaseSource::ParityDb { path: root.join("db")}, trie_cache_maximum_size: Some(64 * 1024 * 1024), state_pruning: Default::default(), blocks_pruning: BlocksPruning::KeepFinalized, diff --git a/substrate/client/db/Cargo.toml b/substrate/client/db/Cargo.toml index cb9560b6cb62f..62b3cf2dfe893 100644 --- a/substrate/client/db/Cargo.toml +++ b/substrate/client/db/Cargo.toml @@ -37,7 +37,9 @@ sp-trie = { path = "../../primitives/trie" } [dev-dependencies] criterion = "0.4.0" -kvdb-rocksdb = "0.19.0" +# TODO Remove this comment +# For now it serves as a reminder that I completely removed a dev dependency on kvdb-rocksdb +# I guess that should be okay following the logic of the first comment in https://stackoverflow.com/questions/62989096 rand = "0.8.5" tempfile = "3.1.0" quickcheck = { version = "1.0.3", default-features = false } From f2084eb63e61245b4dd8cb8c5cc41fdc9fe4955d Mon Sep 17 00:00:00 2001 From: Joshy Orndorff Date: Wed, 29 Nov 2023 15:12:14 -0500 Subject: [PATCH 04/10] remove outdated comment --- polkadot/node/service/Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/polkadot/node/service/Cargo.toml b/polkadot/node/service/Cargo.toml index 66a983c009125..8c90a3d2c2fdd 100644 --- a/polkadot/node/service/Cargo.toml +++ b/polkadot/node/service/Cargo.toml @@ -150,7 +150,6 @@ tempfile = "3.2" [features] default = [ "db", "full-node" ] -# TODO revisit the frame benchmarking features. It only has an std feature as default. And disabling it somehow disables rocksdb. db = [ "service/rocksdb", "sc-client-db/rocksdb", "frame-benchmarking-cli/rocksdb", "kvdb-rocksdb" ] full-node = [ From 0eb8a7f63072d2aa9e27f0daa2095cdf05bfa528 Mon Sep 17 00:00:00 2001 From: Joshy Orndorff Date: Wed, 29 Nov 2023 15:12:37 -0500 Subject: [PATCH 05/10] fmt --- polkadot/node/service/src/lib.rs | 10 +++++++--- polkadot/node/service/src/parachains_db/upgrade.rs | 2 +- polkadot/node/test/service/src/lib.rs | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/polkadot/node/service/src/lib.rs b/polkadot/node/service/src/lib.rs index 80220696e9e33..94d13d2451547 100644 --- a/polkadot/node/service/src/lib.rs +++ b/polkadot/node/service/src/lib.rs @@ -346,7 +346,12 @@ pub fn open_database(db_source: &DatabaseSource) -> Result, Er path.parent().ok_or(Error::DatabasePathRequired)?.into(), parachains_db::CacheSizes::default(), )?, - DatabaseSource::Auto { paritydb_path, #[cfg(feature = "db")]rocksdb_path, .. } => { + DatabaseSource::Auto { + paritydb_path, + #[cfg(feature = "db")] + rocksdb_path, + .. + } => if paritydb_path.is_dir() && paritydb_path.exists() { parachains_db::open_creating_paritydb( paritydb_path.parent().ok_or(Error::DatabasePathRequired)?.into(), @@ -367,8 +372,7 @@ pub fn open_database(db_source: &DatabaseSource) -> Result, Er parachains_db::CacheSizes::default(), )? } - } - }, + }, DatabaseSource::Custom { .. } => { unimplemented!("No polkadot subsystem db for custom source."); }, diff --git a/polkadot/node/service/src/parachains_db/upgrade.rs b/polkadot/node/service/src/parachains_db/upgrade.rs index 6cb9943b5deed..50b4559011500 100644 --- a/polkadot/node/service/src/parachains_db/upgrade.rs +++ b/polkadot/node/service/src/parachains_db/upgrade.rs @@ -181,9 +181,9 @@ fn migrate_from_version_1_to_2(path: &Path, db_kind: DatabaseKind) -> Result Result { gum::info!(target: LOG_TARGET, "Migrating parachains db from version 3 to version 4 ..."); - use polkadot_node_subsystem_util::database::paritydb_impl::DbAdapter as ParityDbAdapter; #[cfg(feature = "db")] use polkadot_node_subsystem_util::database::kvdb_impl::DbAdapter as RocksDbAdapter; + use polkadot_node_subsystem_util::database::paritydb_impl::DbAdapter as ParityDbAdapter; use std::sync::Arc; let approval_db_config = diff --git a/polkadot/node/test/service/src/lib.rs b/polkadot/node/test/service/src/lib.rs index 29503118051bd..e9bb634b33d5c 100644 --- a/polkadot/node/test/service/src/lib.rs +++ b/polkadot/node/test/service/src/lib.rs @@ -166,7 +166,7 @@ pub fn node_config( #[cfg(feature = "db")] database: DatabaseSource::RocksDb { path: root.join("db"), cache_size: 128 }, #[cfg(not(feature = "db"))] - database: DatabaseSource::ParityDb { path: root.join("db")}, + database: DatabaseSource::ParityDb { path: root.join("db") }, trie_cache_maximum_size: Some(64 * 1024 * 1024), state_pruning: Default::default(), blocks_pruning: BlocksPruning::KeepFinalized, From 52cd32daf997d69330ba9a5fe3a0180ea8c28388 Mon Sep 17 00:00:00 2001 From: Joshy Orndorff Date: Wed, 29 Nov 2023 18:30:02 -0500 Subject: [PATCH 06/10] polkadot-cli --- polkadot/cli/Cargo.toml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/polkadot/cli/Cargo.toml b/polkadot/cli/Cargo.toml index 0c2925c76e82f..5687b13ec913a 100644 --- a/polkadot/cli/Cargo.toml +++ b/polkadot/cli/Cargo.toml @@ -28,10 +28,10 @@ sp-core = { path = "../../substrate/primitives/core" } sp-io = { path = "../../substrate/primitives/io" } sp-keyring = { path = "../../substrate/primitives/keyring" } sp-maybe-compressed-blob = { path = "../../substrate/primitives/maybe-compressed-blob" } -frame-benchmarking-cli = { path = "../../substrate/utils/frame/benchmarking-cli", optional = true } -try-runtime-cli = { path = "../../substrate/utils/frame/try-runtime/cli", optional = true } -sc-cli = { path = "../../substrate/client/cli", optional = true } -sc-service = { path = "../../substrate/client/service", optional = true } +frame-benchmarking-cli = { path = "../../substrate/utils/frame/benchmarking-cli", default-features = false, optional = true } +try-runtime-cli = { path = "../../substrate/utils/frame/try-runtime/cli", default-features = false, optional = true } +sc-cli = { path = "../../substrate/client/cli", default-features = false, optional = true } +sc-service = { path = "../../substrate/client/service", default-features = false, optional = true } polkadot-node-metrics = { path = "../node/metrics" } polkadot-node-primitives = { path = "../node/primitives" } sc-tracing = { path = "../../substrate/client/tracing", optional = true } @@ -44,7 +44,11 @@ substrate-build-script-utils = { path = "../../substrate/utils/build-script-util [features] default = [ "cli", "db", "full-node" ] -db = [ "service/db" ] +db = [ + "sc-cli?/rocksdb", + "sc-service?/rocksdb", + "service?/db", + ] cli = [ "clap", "frame-benchmarking-cli", From b217f63ed4da7533f5b48c5b3ca4b590ba3acdf7 Mon Sep 17 00:00:00 2001 From: Joshy Orndorff Date: Wed, 29 Nov 2023 18:30:11 -0500 Subject: [PATCH 07/10] try-runtime --- substrate/utils/frame/try-runtime/cli/Cargo.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/substrate/utils/frame/try-runtime/cli/Cargo.toml b/substrate/utils/frame/try-runtime/cli/Cargo.toml index 6be4306193ce4..328765d0fdad3 100644 --- a/substrate/utils/frame/try-runtime/cli/Cargo.toml +++ b/substrate/utils/frame/try-runtime/cli/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] remote-externalities = { package = "frame-remote-externalities" , path = "../../remote-externalities" } -sc-cli = { path = "../../../../client/cli" } +sc-cli = { path = "../../../../client/cli", default-features = false } sc-executor = { path = "../../../../client/executor" } sp-consensus-aura = { path = "../../../../primitives/consensus/aura" } sp-consensus-babe = { path = "../../../../primitives/consensus/babe" } @@ -47,7 +47,6 @@ zstd = { version = "0.12.4", default-features = false } assert_cmd = "2.0.10" node-primitives = { path = "../../../../bin/node/primitives" } regex = "1.7.3" -substrate-cli-test-utils = { path = "../../../../test-utils/cli" } tempfile = "3.1.0" tokio = "1.27.0" @@ -56,5 +55,4 @@ try-runtime = [ "frame-try-runtime/try-runtime", "sp-debug-derive/force-debug", "sp-runtime/try-runtime", - "substrate-cli-test-utils/try-runtime", ] From 1a1b606ab13090cd1189d34e0e7fe7f2c060e070 Mon Sep 17 00:00:00 2001 From: Joshy Orndorff Date: Wed, 29 Nov 2023 18:30:19 -0500 Subject: [PATCH 08/10] bunch of cumulus stuff --- Cargo.lock | 1 - .../relay-chain-inprocess-interface/Cargo.toml | 4 ++-- cumulus/client/relay-chain-minimal-node/Cargo.toml | 2 +- cumulus/client/relay-chain-rpc-interface/Cargo.toml | 2 +- cumulus/client/service/Cargo.toml | 4 +++- cumulus/test/service/Cargo.toml | 12 ++++++------ 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f94c87dad483c..3ca66053b2a17 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19537,7 +19537,6 @@ dependencies = [ "sp-transaction-storage-proof", "sp-version", "sp-weights", - "substrate-cli-test-utils", "substrate-rpc-client", "tempfile", "tokio", diff --git a/cumulus/client/relay-chain-inprocess-interface/Cargo.toml b/cumulus/client/relay-chain-inprocess-interface/Cargo.toml index 87f0eabd9b5cd..0142c175d6e1a 100644 --- a/cumulus/client/relay-chain-inprocess-interface/Cargo.toml +++ b/cumulus/client/relay-chain-inprocess-interface/Cargo.toml @@ -12,7 +12,7 @@ futures = "0.3.28" futures-timer = "3.0.2" # Substrate -sc-cli = { path = "../../../substrate/client/cli" } +sc-cli = { path = "../../../substrate/client/cli", default-features = false } sc-client-api = { path = "../../../substrate/client/api" } sc-telemetry = { path = "../../../substrate/client/telemetry" } sc-tracing = { path = "../../../substrate/client/tracing" } @@ -25,7 +25,7 @@ sp-state-machine = { path = "../../../substrate/primitives/state-machine" } # Polkadot polkadot-cli = { path = "../../../polkadot/cli", default-features = false, features = ["cli"] } -polkadot-service = { path = "../../../polkadot/node/service" } +polkadot-service = { path = "../../../polkadot/node/service", default-features = false } # Cumulus cumulus-primitives-core = { path = "../../primitives/core" } diff --git a/cumulus/client/relay-chain-minimal-node/Cargo.toml b/cumulus/client/relay-chain-minimal-node/Cargo.toml index ee93df09ce1a6..e49c2d284405a 100644 --- a/cumulus/client/relay-chain-minimal-node/Cargo.toml +++ b/cumulus/client/relay-chain-minimal-node/Cargo.toml @@ -26,8 +26,8 @@ polkadot-node-core-prospective-parachains = { path = "../../../polkadot/node/cor sc-authority-discovery = { path = "../../../substrate/client/authority-discovery" } sc-network = { path = "../../../substrate/client/network" } sc-network-common = { path = "../../../substrate/client/network/common" } -sc-service = { path = "../../../substrate/client/service" } sc-client-api = { path = "../../../substrate/client/api" } +sc-service = { path = "../../../substrate/client/service", default-features = false } substrate-prometheus-endpoint = { path = "../../../substrate/utils/prometheus" } sc-tracing = { path = "../../../substrate/client/tracing" } sc-utils = { path = "../../../substrate/client/utils" } diff --git a/cumulus/client/relay-chain-rpc-interface/Cargo.toml b/cumulus/client/relay-chain-rpc-interface/Cargo.toml index 0159cade23f6c..2e9e3bfdc33b1 100644 --- a/cumulus/client/relay-chain-rpc-interface/Cargo.toml +++ b/cumulus/client/relay-chain-rpc-interface/Cargo.toml @@ -23,7 +23,7 @@ sp-runtime = { path = "../../../substrate/primitives/runtime" } sp-version = { path = "../../../substrate/primitives/version" } sc-client-api = { path = "../../../substrate/client/api" } sc-rpc-api = { path = "../../../substrate/client/rpc-api" } -sc-service = { path = "../../../substrate/client/service" } +sc-service = { path = "../../../substrate/client/service", default-features = false } tokio = { version = "1.32.0", features = ["sync"] } tokio-util = { version = "0.7.8", features = ["compat"] } diff --git a/cumulus/client/service/Cargo.toml b/cumulus/client/service/Cargo.toml index f80c65128d526..e9049ef112980 100644 --- a/cumulus/client/service/Cargo.toml +++ b/cumulus/client/service/Cargo.toml @@ -14,7 +14,7 @@ sc-client-api = { path = "../../../substrate/client/api" } sc-consensus = { path = "../../../substrate/client/consensus/common" } sc-transaction-pool = { path = "../../../substrate/client/transaction-pool" } sc-rpc = { path = "../../../substrate/client/rpc" } -sc-service = { path = "../../../substrate/client/service" } +sc-service = { path = "../../../substrate/client/service", default-features = false } sc-sysinfo = { path = "../../../substrate/client/sysinfo" } sc-telemetry = { path = "../../../substrate/client/telemetry" } sc-network = { path = "../../../substrate/client/network" } @@ -33,6 +33,8 @@ polkadot-primitives = { path = "../../../polkadot/primitives" } # Cumulus cumulus-client-cli = { path = "../cli" } + +# For some reason I can enable the collator here, even though it appears to leak rocks on its own... cumulus-client-collator = { path = "../collator" } cumulus-client-consensus-common = { path = "../consensus/common" } cumulus-client-pov-recovery = { path = "../pov-recovery" } diff --git a/cumulus/test/service/Cargo.toml b/cumulus/test/service/Cargo.toml index ed8c8748cc803..da8925956c970 100644 --- a/cumulus/test/service/Cargo.toml +++ b/cumulus/test/service/Cargo.toml @@ -33,7 +33,7 @@ sc-client-api = { path = "../../../substrate/client/api" } sc-consensus = { path = "../../../substrate/client/consensus/common" } sc-executor = { path = "../../../substrate/client/executor" } sc-network = { path = "../../../substrate/client/network" } -sc-service = { path = "../../../substrate/client/service" } +sc-service = { path = "../../../substrate/client/service", default-features = false } sc-tracing = { path = "../../../substrate/client/tracing" } sc-transaction-pool = { path = "../../../substrate/client/transaction-pool" } sc-transaction-pool-api = { path = "../../../substrate/client/transaction-pool/api" } @@ -50,16 +50,16 @@ sp-tracing = { path = "../../../substrate/primitives/tracing" } sp-timestamp = { path = "../../../substrate/primitives/timestamp" } sp-consensus = { path = "../../../substrate/primitives/consensus/common" } substrate-test-client = { path = "../../../substrate/test-utils/client" } -sc-cli = { path = "../../../substrate/client/cli" } +sc-cli = { path = "../../../substrate/client/cli", default-features = false } sc-block-builder = { path = "../../../substrate/client/block-builder" } sc-executor-wasmtime = { path = "../../../substrate/client/executor/wasmtime" } sc-executor-common = { path = "../../../substrate/client/executor/common" } # Polkadot polkadot-primitives = { path = "../../../polkadot/primitives" } -polkadot-service = { path = "../../../polkadot/node/service" } +polkadot-service = { path = "../../../polkadot/node/service", default-features = false } polkadot-test-service = { path = "../../../polkadot/node/test/service" } -polkadot-cli = { path = "../../../polkadot/cli" } +polkadot-cli = { path = "../../../polkadot/cli", default-features = false } polkadot-node-subsystem = { path = "../../../polkadot/node/subsystem" } polkadot-overseer = { path = "../../../polkadot/node/overseer" } @@ -90,10 +90,10 @@ sp-authority-discovery = { path = "../../../substrate/primitives/authority-disco cumulus-test-client = { path = "../client" } # Polkadot dependencies -polkadot-test-service = { path = "../../../polkadot/node/test/service" } +polkadot-test-service = { path = "../../../polkadot/node/test/service", default-features = false } # Substrate dependencies -sc-cli = { path = "../../../substrate/client/cli" } +sc-cli = { path = "../../../substrate/client/cli", default-features = false } substrate-test-utils = { path = "../../../substrate/test-utils" } [features] From 21f61083bded35410f76dce9867efec7dea7a16b Mon Sep 17 00:00:00 2001 From: Joshy Orndorff Date: Wed, 29 Nov 2023 18:38:36 -0500 Subject: [PATCH 09/10] cumulus-test-client --- cumulus/test/client/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cumulus/test/client/Cargo.toml b/cumulus/test/client/Cargo.toml index b760b796ec9a8..f86a68e22d2ae 100644 --- a/cumulus/test/client/Cargo.toml +++ b/cumulus/test/client/Cargo.toml @@ -9,7 +9,7 @@ publish = false codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ "derive" ] } # Substrate -sc-service = { path = "../../../substrate/client/service" } +sc-service = { path = "../../../substrate/client/service", default-features = false } sc-consensus = { path = "../../../substrate/client/consensus/common" } sc-block-builder = { path = "../../../substrate/client/block-builder" } sc-executor = { path = "../../../substrate/client/executor" } From 84e28815f0ea4349161834699dde5e476db28f5e Mon Sep 17 00:00:00 2001 From: Joshy Orndorff Date: Wed, 29 Nov 2023 18:49:26 -0500 Subject: [PATCH 10/10] Mke cumulus test service use paritydb --- cumulus/test/service/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cumulus/test/service/src/lib.rs b/cumulus/test/service/src/lib.rs index fb858ce0b7144..e6af572d603e7 100644 --- a/cumulus/test/service/src/lib.rs +++ b/cumulus/test/service/src/lib.rs @@ -764,7 +764,7 @@ pub fn node_config( transaction_pool: Default::default(), network: network_config, keystore: KeystoreConfig::InMemory, - database: DatabaseSource::RocksDb { path: root.join("db"), cache_size: 128 }, + database: DatabaseSource::ParityDb { path: root.join("db") }, trie_cache_maximum_size: Some(64 * 1024 * 1024), state_pruning: Some(PruningMode::ArchiveAll), blocks_pruning: BlocksPruning::KeepAll,