mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +00:00
Refactored block body database scheme (#10779)
* Refactored tx storage database scheme * Bump parity-db * fmt * Fix handling invalid index size + test * Removed superflous result * Minor changes * fmt
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
use crate::{
|
||||
build_network_future,
|
||||
client::{Client, ClientConfig},
|
||||
config::{Configuration, KeystoreConfig, PrometheusConfig, TransactionStorageMode},
|
||||
config::{Configuration, KeystoreConfig, PrometheusConfig},
|
||||
error::Error,
|
||||
metrics::MetricsService,
|
||||
start_rpc_servers, RpcHandlers, SpawnTaskHandle, TaskManager, TransactionPoolAdapter,
|
||||
@@ -39,7 +39,7 @@ use sc_executor::RuntimeVersionOf;
|
||||
use sc_keystore::LocalKeystore;
|
||||
use sc_network::{
|
||||
block_request_handler::{self, BlockRequestHandler},
|
||||
config::{Role, SyncMode},
|
||||
config::Role,
|
||||
light_client_requests::{self, handler::LightClientRequestHandler},
|
||||
state_request_handler::{self, StateRequestHandler},
|
||||
warp_request_handler::{self, RequestHandler as WarpSyncRequestHandler, WarpSyncProvider},
|
||||
@@ -264,7 +264,6 @@ where
|
||||
state_pruning: config.state_pruning.clone(),
|
||||
source: config.database.clone(),
|
||||
keep_blocks: config.keep_blocks.clone(),
|
||||
transaction_storage: config.transaction_storage.clone(),
|
||||
};
|
||||
|
||||
let backend = new_db_backend(db_config)?;
|
||||
@@ -842,7 +841,7 @@ where
|
||||
}
|
||||
};
|
||||
|
||||
let mut network_params = sc_network::config::Params {
|
||||
let network_params = sc_network::config::Params {
|
||||
role: config.role.clone(),
|
||||
executor: {
|
||||
let spawn_handle = Clone::clone(&spawn_handle);
|
||||
@@ -869,13 +868,6 @@ where
|
||||
light_client_request_protocol_config,
|
||||
};
|
||||
|
||||
// Storage chains don't keep full block history and can't be synced in full mode.
|
||||
// Force fast sync when storage chain mode is enabled.
|
||||
if matches!(config.transaction_storage, TransactionStorageMode::StorageChain) {
|
||||
network_params.network_config.sync_mode =
|
||||
SyncMode::Fast { storage_chain_mode: true, skip_proofs: false };
|
||||
}
|
||||
|
||||
let has_bootnodes = !network_params.network_config.boot_nodes.is_empty();
|
||||
let network_mut = sc_network::NetworkWorker::new(network_params)?;
|
||||
let network = network_mut.service().clone();
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
//! Service configuration.
|
||||
|
||||
pub use sc_client_api::execution_extensions::{ExecutionStrategies, ExecutionStrategy};
|
||||
pub use sc_client_db::{Database, DatabaseSource, KeepBlocks, PruningMode, TransactionStorageMode};
|
||||
pub use sc_client_db::{Database, DatabaseSource, KeepBlocks, PruningMode};
|
||||
pub use sc_executor::WasmExecutionMethod;
|
||||
pub use sc_network::{
|
||||
config::{
|
||||
@@ -71,8 +71,6 @@ pub struct Configuration {
|
||||
pub state_pruning: PruningMode,
|
||||
/// Number of blocks to keep in the db.
|
||||
pub keep_blocks: KeepBlocks,
|
||||
/// Transaction storage scheme.
|
||||
pub transaction_storage: TransactionStorageMode,
|
||||
/// Chain configuration.
|
||||
pub chain_spec: Box<dyn ChainSpec>,
|
||||
/// Wasm execution method.
|
||||
|
||||
@@ -58,7 +58,6 @@ pub use self::{
|
||||
};
|
||||
pub use config::{
|
||||
BasePath, Configuration, DatabaseSource, KeepBlocks, PruningMode, Role, RpcMethods, TaskType,
|
||||
TransactionStorageMode,
|
||||
};
|
||||
pub use sc_chain_spec::{
|
||||
ChainSpec, ChainType, Extension as ChainSpecExtension, GenericChainSpec, NoExtension,
|
||||
|
||||
@@ -23,9 +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, TransactionStorageMode,
|
||||
};
|
||||
use sc_client_db::{Backend, DatabaseSettings, DatabaseSource, KeepBlocks, PruningMode};
|
||||
use sc_consensus::{
|
||||
BlockCheckParams, BlockImport, BlockImportParams, ForkChoiceStrategy, ImportResult,
|
||||
};
|
||||
@@ -1203,7 +1201,6 @@ fn doesnt_import_blocks_that_revert_finality() {
|
||||
state_cache_child_ratio: None,
|
||||
state_pruning: PruningMode::ArchiveAll,
|
||||
keep_blocks: KeepBlocks::All,
|
||||
transaction_storage: TransactionStorageMode::BlockBody,
|
||||
source: DatabaseSource::RocksDb { path: tmp.path().into(), cache_size: 1024 },
|
||||
},
|
||||
u64::MAX,
|
||||
@@ -1419,7 +1416,6 @@ fn returns_status_for_pruned_blocks() {
|
||||
state_cache_child_ratio: None,
|
||||
state_pruning: PruningMode::keep_blocks(1),
|
||||
keep_blocks: KeepBlocks::All,
|
||||
transaction_storage: TransactionStorageMode::BlockBody,
|
||||
source: DatabaseSource::RocksDb { path: tmp.path().into(), cache_size: 1024 },
|
||||
},
|
||||
u64::MAX,
|
||||
|
||||
@@ -30,7 +30,7 @@ use sc_service::{
|
||||
client::Client,
|
||||
config::{BasePath, DatabaseSource, KeystoreConfig},
|
||||
ChainSpecExtension, Configuration, Error, GenericChainSpec, KeepBlocks, Role, RuntimeGenesis,
|
||||
SpawnTaskHandle, TaskManager, TransactionStorageMode,
|
||||
SpawnTaskHandle, TaskManager,
|
||||
};
|
||||
use sc_transaction_pool_api::TransactionPool;
|
||||
use sp_api::BlockId;
|
||||
@@ -235,7 +235,6 @@ fn node_config<
|
||||
state_cache_child_ratio: None,
|
||||
state_pruning: Default::default(),
|
||||
keep_blocks: KeepBlocks::All,
|
||||
transaction_storage: TransactionStorageMode::BlockBody,
|
||||
chain_spec: Box::new((*spec).clone()),
|
||||
wasm_method: sc_service::config::WasmExecutionMethod::Interpreted,
|
||||
wasm_runtime_overrides: Default::default(),
|
||||
|
||||
Reference in New Issue
Block a user