Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request paritytech#513 from subspace/force-paritydb
Browse files Browse the repository at this point in the history
Force usage of ParityDB on the node
  • Loading branch information
nazar-pc authored May 29, 2022
2 parents 640f1c8 + 609f078 commit 9693bca
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
28 changes: 24 additions & 4 deletions crates/subspace-node/src/bin/subspace-node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use frame_benchmarking_cli::BenchmarkCmd;
use futures::future::TryFutureExt;
use futures::StreamExt;
use sc_cli::{ChainSpec, CliConfiguration, SubstrateCli};
use sc_cli::{ChainSpec, CliConfiguration, Database, SubstrateCli};
use sc_service::PartialComponents;
use sp_core::crypto::Ss58AddressFormat;
use std::any::TypeId;
Expand Down Expand Up @@ -74,7 +74,13 @@ fn set_default_ss58_version<C: AsRef<dyn ChainSpec>>(chain_spec: C) {
}

fn main() -> Result<(), Error> {
let cli = Cli::from_args();
let mut cli = Cli::from_args();

cli.run
.import_params
.database_params
.database
.replace(Database::ParityDb);

match &cli.subcommand {
Some(Subcommand::Key(cmd)) => cmd.run(&cli)?,
Expand Down Expand Up @@ -204,7 +210,7 @@ fn main() -> Result<(), Error> {
.downcast_ref()
.cloned();

let secondary_chain_cli = SecondaryChainCli::new(
let mut secondary_chain_cli = SecondaryChainCli::new(
cmd.base
.base_path()?
.map(|base_path| base_path.path().to_path_buf()),
Expand All @@ -213,6 +219,13 @@ fn main() -> Result<(), Error> {
})?,
cli.secondary_chain_args.iter(),
);
secondary_chain_cli
.run
.import_params
.database_params
.database
.replace(Database::ParityDb);

let secondary_chain_config = SubstrateCli::create_configuration(
&secondary_chain_cli,
&secondary_chain_cli,
Expand Down Expand Up @@ -348,7 +361,7 @@ fn main() -> Result<(), Error> {
);
let _enter = span.enter();

let secondary_chain_cli = SecondaryChainCli::new(
let mut secondary_chain_cli = SecondaryChainCli::new(
cli.run
.base_path()?
.map(|base_path| base_path.path().to_path_buf()),
Expand All @@ -357,6 +370,13 @@ fn main() -> Result<(), Error> {
})?,
cli.secondary_chain_args.iter(),
);
secondary_chain_cli
.run
.import_params
.database_params
.database
.replace(Database::ParityDb);

let secondary_chain_config = SubstrateCli::create_configuration(
&secondary_chain_cli,
&secondary_chain_cli,
Expand Down
2 changes: 1 addition & 1 deletion cumulus/test/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ pub fn node_config(
network: network_config,
keystore: KeystoreConfig::InMemory,
keystore_remote: Default::default(),
database: DatabaseSource::RocksDb { path: root.join("db"), cache_size: 128 },
database: DatabaseSource::ParityDb { path: root.join("paritydb") },
state_cache_size: 67108864,
state_cache_child_ratio: None,
state_pruning: Some(PruningMode::ArchiveAll),
Expand Down
5 changes: 2 additions & 3 deletions test/subspace-test-service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,8 @@ pub fn node_config(
network: network_config,
keystore: KeystoreConfig::InMemory,
keystore_remote: Default::default(),
database: DatabaseSource::RocksDb {
path: root.join("db"),
cache_size: 128,
database: DatabaseSource::ParityDb {
path: root.join("paritydb"),
},
state_cache_size: 16777216,
state_cache_child_ratio: None,
Expand Down

0 comments on commit 9693bca

Please sign in to comment.