Rename --pruning and --keep-blocks to be more similar to one another (#11934)

* rename prunning and keep-blocks flags

* Add aliases in keep-blocks and pruning for backward compatibility

* Rename in code variables from  and  to  and
This commit is contained in:
Nikos Kontakis
2022-08-08 11:31:26 +02:00
committed by GitHub
parent a314484865
commit 20c49b20a7
16 changed files with 79 additions and 79 deletions
+1 -1
View File
@@ -207,7 +207,7 @@ where
state_cache_child_ratio: config.state_cache_child_ratio.map(|v| (v, 100)),
state_pruning: config.state_pruning.clone(),
source: config.database.clone(),
keep_blocks: config.keep_blocks,
blocks_pruning: config.blocks_pruning,
};
let backend = new_db_backend(db_config)?;
+2 -2
View File
@@ -19,7 +19,7 @@
//! Service configuration.
pub use sc_client_api::execution_extensions::{ExecutionStrategies, ExecutionStrategy};
pub use sc_client_db::{Database, DatabaseSource, KeepBlocks, PruningMode};
pub use sc_client_db::{BlocksPruning, Database, DatabaseSource, PruningMode};
pub use sc_executor::WasmExecutionMethod;
#[cfg(feature = "wasmtime")]
pub use sc_executor::WasmtimeInstantiationStrategy;
@@ -79,7 +79,7 @@ pub struct Configuration {
/// Number of blocks to keep in the db.
///
/// NOTE: only finalized blocks are subject for removal!
pub keep_blocks: KeepBlocks,
pub blocks_pruning: BlocksPruning,
/// Chain configuration.
pub chain_spec: Box<dyn ChainSpec>,
/// Wasm execution method.
+1 -1
View File
@@ -60,7 +60,7 @@ pub use self::{
error::Error,
};
pub use config::{
BasePath, Configuration, DatabaseSource, KeepBlocks, PruningMode, Role, RpcMethods, TaskType,
BasePath, BlocksPruning, Configuration, DatabaseSource, PruningMode, Role, RpcMethods, TaskType,
};
pub use sc_chain_spec::{
ChainSpec, ChainType, Extension as ChainSpecExtension, GenericChainSpec, NoExtension,
@@ -23,7 +23,7 @@ use sc_block_builder::BlockBuilderProvider;
use sc_client_api::{
in_mem, BlockBackend, BlockchainEvents, FinalityNotifications, StorageProvider,
};
use sc_client_db::{Backend, DatabaseSettings, DatabaseSource, KeepBlocks, PruningMode};
use sc_client_db::{Backend, BlocksPruning, DatabaseSettings, DatabaseSource, PruningMode};
use sc_consensus::{
BlockCheckParams, BlockImport, BlockImportParams, ForkChoiceStrategy, ImportResult,
};
@@ -1200,7 +1200,7 @@ fn doesnt_import_blocks_that_revert_finality() {
state_cache_size: 1 << 20,
state_cache_child_ratio: None,
state_pruning: Some(PruningMode::ArchiveAll),
keep_blocks: KeepBlocks::All,
blocks_pruning: BlocksPruning::All,
source: DatabaseSource::RocksDb { path: tmp.path().into(), cache_size: 1024 },
},
u64::MAX,
@@ -1426,8 +1426,8 @@ fn returns_status_for_pruned_blocks() {
DatabaseSettings {
state_cache_size: 1 << 20,
state_cache_child_ratio: None,
state_pruning: Some(PruningMode::keep_blocks(1)),
keep_blocks: KeepBlocks::All,
state_pruning: Some(PruningMode::blocks_pruning(1)),
blocks_pruning: BlocksPruning::All,
source: DatabaseSource::RocksDb { path: tmp.path().into(), cache_size: 1024 },
},
u64::MAX,
+3 -3
View File
@@ -29,8 +29,8 @@ use sc_network::{
use sc_service::{
client::Client,
config::{BasePath, DatabaseSource, KeystoreConfig},
ChainSpecExtension, Configuration, Error, GenericChainSpec, KeepBlocks, Role, RuntimeGenesis,
SpawnTaskHandle, TaskManager,
BlocksPruning, ChainSpecExtension, Configuration, Error, GenericChainSpec, Role,
RuntimeGenesis, SpawnTaskHandle, TaskManager,
};
use sc_transaction_pool_api::TransactionPool;
use sp_api::BlockId;
@@ -234,7 +234,7 @@ fn node_config<
state_cache_size: 16777216,
state_cache_child_ratio: None,
state_pruning: Default::default(),
keep_blocks: KeepBlocks::All,
blocks_pruning: BlocksPruning::All,
chain_spec: Box::new((*spec).clone()),
wasm_method: sc_service::config::WasmExecutionMethod::Interpreted,
wasm_runtime_overrides: Default::default(),