Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Add keep-blocks archive params #13068

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,20 @@ async fn remember_state_pruning_works() {
// This should load state pruning settings from the db.
common::run_node_for_a_while(base_path.path(), &["--dev", "--no-hardware-benchmarks"]).await;
}

#[tokio::test]
#[cfg(unix)]
async fn remember_blocks_pruning_works() {
let base_path = tempdir().expect("could not create a temp dir");

// First run with `--blocks-pruning=archive`.
common::run_node_for_a_while(
base_path.path(),
&["--dev", "--blocks-pruning=archive", "--no-hardware-benchmarks"],
)
.await;

// Then run again without specifying the state pruning.
// This should load state pruning settings from the db.
common::run_node_for_a_while(base_path.path(), &["--dev", "--no-hardware-benchmarks"]).await;
}
4 changes: 3 additions & 1 deletion utils/frame/benchmarking-cli/src/block/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ You should see after some seconds that it started to produce blocks:
```
You can now kill the node with `Ctrl+C`. Then measure how long it takes to execute these blocks:
```sh
cargo run --profile=production -- benchmark block --from 1 --to 1 --dev -d /tmp/dev --pruning archive
cargo run --profile=production -- benchmark block --from 1 --to 1 --dev -d /tmp/dev --pruning archive --keep-blocks archive
```
This will benchmark the first block. If you killed the node at a later point, you can measure multiple blocks.
```pre
Expand All @@ -105,6 +105,7 @@ Since this block is empty, its not very interesting.
- `--repeat` How often each block should be measured.
- [`--db`]
- [`--pruning`]
- [`--keep-blocks`]

License: Apache-2.0

Expand All @@ -116,3 +117,4 @@ License: Apache-2.0

[`--db`]: ../shared/README.md#arguments
[`--pruning`]: ../shared/README.md#arguments
[`--keep-blocks`]: ../shared/README.md#arguments
2 changes: 1 addition & 1 deletion utils/frame/benchmarking-cli/src/block/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use super::bench::{Benchmark, BenchmarkParams};
/// And wait some time to let it produce 3 blocks. Then benchmark them with:
///
/// $ substrate benchmark-block --from 1 --to 3 --dev -d /tmp/my-dev
/// --execution wasm --wasm-execution compiled --pruning archive
/// --execution wasm --wasm-execution compiled --pruning archive --keep-blocks archive
///
/// The output will be similar to this:
///
Expand Down
1 change: 1 addition & 0 deletions utils/frame/benchmarking-cli/src/shared/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Contains code that is shared among multiple sub-commands.
- `--weight-path` Set the file or directory to write the weight files to.
- `--db` The database backend to use. This depends on your snapshot.
- `--pruning` Set the pruning mode of the node. Some benchmarks require you to set this to `archive`.
- `--keep-blocks` Set the pruning mode of the node. Some benchmarks require you to set this to `archive`.
- `--base-path` The location on the disk that should be used for the benchmarks. You can try this on different disks or even on a mounted RAM-disk. It is important to use the same location that will later-on be used to store the chain data to get the correct results.
- `--header` Optional file header which will be prepended to the weight output file. Can be used for adding LICENSE headers.

Expand Down