Remove the --unsafe-pruning CLI-argument (step 1) (#10995)

* sc-client-db: utils::open_database(...) — return OpenDbError so that the caller could tell the `OpenDbError::DoesNotExist` clearly

* sc-client-db: utils::open_database(..) — accept the `create: bool` argument

* sc-client-db: pruning — optional argument in the DatabaseSettings

* sc-state-db: Split `Error<E>` into separate `Error<E>` and `StateDbError`

* StateDb::open: choose the pruning-mode depending on the requested and stored values

* sc-state-db: test for different combinations of stored and requested pruning-modes

* CLI-argument: mark the unsafe-pruning as deprecated

* Fix tests

* tests: do not specify --pruning when running the substrate over the existing storage

* fix types for benches

* cargo fmt

* Check whether the pruning-mode and sync-mode are compatible

* cargo fmt

* parity-db: 0.3.11 -> 0.3.12

* sc-state-db: MetaDb::set_meta — a better doc-test

* cargo fmt

* make MetaDb read-only again!

* Remove the stray newline (and run the CI once again please)

* Last nitpicks

* A more comprehensive error message
This commit is contained in:
Roman Gafiyatullin
2022-05-06 13:07:44 +03:00
committed by GitHub
parent 994f8076b1
commit 729cba9d9e
23 changed files with 546 additions and 338 deletions
@@ -37,7 +37,6 @@ async fn benchmark_block_works() {
.args(["benchmark", "block", "--dev"])
.arg("-d")
.arg(base_dir.path())
.args(["--pruning", "archive"])
.args(["--from", "1", "--to", "1"])
.args(["--repeat", "1"])
.args(["--execution", "wasm", "--wasm-execution", "compiled"])
@@ -31,7 +31,7 @@ async fn check_block_works() {
common::run_node_for_a_while(base_path.path(), &["--dev", "--no-hardware-benchmarks"]).await;
let status = Command::new(cargo_bin("substrate"))
.args(&["check-block", "--dev", "--pruning", "archive", "-d"])
.args(&["check-block", "--dev", "-d"])
.arg(base_path.path())
.arg("1")
.status()
@@ -79,9 +79,9 @@ impl<'a> ExportImportRevertExecutor<'a> {
// Adding "--binary" if need be.
let arguments: Vec<&str> = match format_opt {
FormatOpt::Binary => {
vec![&sub_command_str, "--dev", "--pruning", "archive", "--binary", "-d"]
vec![&sub_command_str, "--dev", "--binary", "-d"]
},
FormatOpt::Json => vec![&sub_command_str, "--dev", "--pruning", "archive", "-d"],
FormatOpt::Json => vec![&sub_command_str, "--dev", "-d"],
};
let tmp: TempDir;
@@ -161,7 +161,7 @@ impl<'a> ExportImportRevertExecutor<'a> {
/// Runs the `revert` command.
fn run_revert(&self) {
let output = Command::new(cargo_bin("substrate"))
.args(&["revert", "--dev", "--pruning", "archive", "-d"])
.args(&["revert", "--dev", "-d"])
.arg(&self.base_path.path())
.output()
.unwrap();
@@ -31,7 +31,7 @@ async fn inspect_works() {
common::run_node_for_a_while(base_path.path(), &["--dev", "--no-hardware-benchmarks"]).await;
let status = Command::new(cargo_bin("substrate"))
.args(&["inspect", "--dev", "--pruning", "archive", "-d"])
.args(&["inspect", "--dev", "-d"])
.arg(base_path.path())
.args(&["block", "1"])
.status()