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:
Arkadiy Paronyan
2022-03-04 11:30:29 +01:00
committed by GitHub
parent e6b6c8aac6
commit 2bd493ff12
15 changed files with 332 additions and 295 deletions
+3 -11
View File
@@ -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();
+1 -3
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, 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.
-1
View File
@@ -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,