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

Introduce trie level cache and remove state cache #11407

Merged
merged 179 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
179 commits
Select commit Hold shift + click to select a range
d173ddf
trie state cache
cheme Sep 14, 2021
e810693
Also cache missing access on read.
cheme Sep 14, 2021
2b7f400
fix comp
cheme Sep 14, 2021
4426b99
bis
cheme Sep 14, 2021
edbe206
Merge branch 'master' into trie_state_cache
cheme Sep 14, 2021
7bf75c3
fix
cheme Sep 14, 2021
b23b1a1
use has_lru
cheme Sep 14, 2021
d3d7c8c
remove local storage cache on size 0.
cheme Sep 16, 2021
9d5e011
No cache.
cheme Sep 16, 2021
6375499
local cache only
cheme Sep 16, 2021
b5e4111
trie cache and local cache
cheme Sep 16, 2021
bc98fa6
storage cache (with local)
cheme Sep 16, 2021
ab760ea
trie cache no local cache
cheme Sep 16, 2021
e3163fe
Merge branch 'master' into trie_state_cache
cheme Oct 1, 2021
2c1886d
Merge branch 'master' into trie_state_cache
cheme Oct 1, 2021
9d4005a
Add state access benchmark
bkchr Oct 30, 2021
25ec204
Remove warnings etc
bkchr Oct 31, 2021
bec69a8
Merge remote-tracking branch 'cheme/trie_state_cache' into bkchr-stat…
bkchr Nov 1, 2021
137d5bb
Add trie cache benchmark
bkchr Nov 1, 2021
1dfc1e9
No extra "clone" required
bkchr Nov 3, 2021
c39a5d0
Change benchmark to use multiple blocks
bkchr Nov 3, 2021
79530b3
Use patches
bkchr Nov 3, 2021
779f911
Integrate shitty implementation
bkchr Nov 5, 2021
d7d72c5
Merge branch 'bkchr-state-access-benchmark' of github.com:paritytech/…
bkchr Nov 5, 2021
8ae59d3
More stuff
bkchr Nov 24, 2021
3300dbc
Merge branch 'bkchr-state-access-benchmark' of github.com:paritytech/…
bkchr Nov 24, 2021
3c7d760
Revert "Merge branch 'master' into trie_state_cache"
bkchr Nov 24, 2021
610cf0a
Improve benchmark
bkchr Nov 24, 2021
a76ed8c
Adapt to latest changes
bkchr Nov 27, 2021
24f4a00
Adapt to changes in trie
bkchr Nov 30, 2021
9b79824
Add a test that uses iterator
bkchr Nov 30, 2021
e4e9a7e
Start fixing it
bkchr Dec 11, 2021
45fb3ad
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr Dec 11, 2021
5348ac5
Remove obsolete file
bkchr Dec 11, 2021
3bba508
Make it compile
bkchr Dec 11, 2021
a20ddee
Start rewriting the trie node cache
bkchr Dec 15, 2021
3804b69
More work on the cache
bkchr Dec 16, 2021
254c99a
More docs and code etc
bkchr Dec 20, 2021
103e33a
Make data cache an optional
bkchr Dec 20, 2021
81a37b0
Tests
bkchr Dec 20, 2021
b625e6f
Remove debug stuff
bkchr Dec 21, 2021
55b19d4
Recorder
bkchr Jan 5, 2022
1b2f2be
Some docs and a simple test for the recorder
bkchr Jan 6, 2022
362edc3
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr Jan 17, 2022
e4dbf24
Compile fixes
bkchr Jan 17, 2022
846b39a
Make it compile
bkchr Jan 18, 2022
3956b38
More fixes
bkchr Jan 19, 2022
10c691c
More fixes
bkchr Jan 19, 2022
325298d
Fix fix fix
bkchr Jan 19, 2022
eb45077
Make sure cache and recorder work together for basic stuff
bkchr Jan 26, 2022
ce2c0f3
Test that data caching and recording works
bkchr Jan 28, 2022
955db3f
Test `TrieDBMut` with caching
bkchr Jan 29, 2022
900412f
Try something
bkchr Feb 7, 2022
625c7d4
Fixes, fixes, fixes
bkchr Feb 7, 2022
4a3f788
Forward the recorder
bkchr Feb 7, 2022
cc27eef
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr Feb 8, 2022
c41c62a
Make it compile
bkchr Feb 9, 2022
504dc8b
Use recorder in more places
bkchr Feb 11, 2022
a720527
Switch to new `with_optional_recorder` fn
bkchr Feb 11, 2022
2289c32
Refactor and cleanups
bkchr Feb 11, 2022
4ebf0e5
Move `ProvingBackend` tests
bkchr Feb 11, 2022
93c23b5
Simplify
bkchr Feb 11, 2022
c7eeba0
Move over all functionality to the essence
bkchr Feb 12, 2022
cfc232a
Fix compilation
bkchr Feb 16, 2022
8003510
Implement estimate encoded size for StorageProof
bkchr Feb 17, 2022
2f0b73d
Start using the `cache` everywhere
bkchr Feb 21, 2022
d6ca68b
Use the cache everywhere
bkchr Feb 22, 2022
2b6c40b
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr Feb 22, 2022
b5bd183
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr Feb 22, 2022
b7a9796
Fix compilation
bkchr Feb 22, 2022
d459b82
Fix tests
bkchr Feb 23, 2022
5fc361f
Adds `TrieBackendBuilder` and enhances the tests
bkchr Feb 25, 2022
c26880c
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr Mar 2, 2022
58ae53d
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr Mar 2, 2022
57af73d
Ensure that recorder drain checks that values are found as expected
bkchr Mar 2, 2022
784cc6e
Switch over to `TrieBackendBuilder`
bkchr Mar 2, 2022
ec7d567
Start fixing the problem with child tries and recording
bkchr Mar 3, 2022
b7d36a3
Fix recording of child tries
bkchr Mar 4, 2022
d0f81da
Make it compile
bkchr Mar 17, 2022
9e3565c
Overwrite `storage_hash` in `TrieBackend`
bkchr Mar 17, 2022
176b681
Add `storage_cache` to the benchmarks
bkchr Mar 17, 2022
bf0c130
Fix `no_std` build
bkchr Mar 21, 2022
4219edc
Speed up cache lookup
bkchr Mar 21, 2022
94d8a60
Extend the state access benchmark to also hash a runtime
bkchr Mar 21, 2022
6c0e149
Fix build
bkchr Mar 22, 2022
7d6f00e
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr Mar 22, 2022
731667f
Fix compilation
bkchr Apr 8, 2022
fab5772
Rewrite value cache
bkchr Apr 22, 2022
ea56461
Add lru cache
bkchr Apr 26, 2022
bd097d4
Ensure that the cache lru works
bkchr Apr 27, 2022
8e1bb67
Value cache should not be optional
bkchr Apr 27, 2022
f317a48
Add support for keeping the shared node cache in its bounds
bkchr May 3, 2022
33fa5e0
Make the cache configurable
bkchr May 3, 2022
55844e8
Check that the cache respects the bounds
bkchr May 3, 2022
151fca7
Adds a new test
bkchr May 3, 2022
0939285
Fixes
bkchr May 3, 2022
c87c095
Docs and some renamings
bkchr May 4, 2022
d8c076e
More docs
bkchr May 4, 2022
00f28b5
Start using the new recorder
bkchr May 5, 2022
281e971
Fix more code
bkchr May 6, 2022
01b30db
Take `self` argument
bkchr May 6, 2022
ab90360
Remove warnings
bkchr May 6, 2022
b6feed4
Fix benchmark
bkchr May 6, 2022
de4871d
Fix accounting
bkchr May 6, 2022
947a14e
Rip off the state cache
bkchr May 6, 2022
6c47d9e
Start fixing fallout after removing the state cache
bkchr May 6, 2022
7dff3ba
Make it compile after trie changes
bkchr May 11, 2022
9b15bc4
Fix test
bkchr May 12, 2022
d8036ee
Add some logging
bkchr May 12, 2022
453d5d5
Some docs
bkchr May 12, 2022
3a101af
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr May 12, 2022
4d1585f
Some fixups and clean ups
bkchr May 12, 2022
6742481
Fix benchmark
bkchr May 12, 2022
6c6e84d
Remove unneeded file
bkchr May 12, 2022
4b29a1c
Use git for patching
bkchr May 12, 2022
e041798
Make CI happy
bkchr May 12, 2022
4c69c8e
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr May 12, 2022
ae9c946
Update primitives/trie/Cargo.toml
bkchr May 13, 2022
23f9913
Update primitives/state-machine/src/trie_backend.rs
bkchr May 13, 2022
fbdbdbc
Introduce new `AsTrieBackend` trait
bkchr May 18, 2022
086d62e
Make the LocalTrieCache not clonable
bkchr May 18, 2022
334ab90
Make it work in no_std and add docs
bkchr May 18, 2022
b9df86b
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr May 18, 2022
907f916
Remove duplicate dependency
bkchr May 18, 2022
704436b
Switch to ahash for better performance
bkchr May 19, 2022
03b5ecd
Speedup value cache merge
bkchr May 19, 2022
f6f6793
Output errors on underflow
bkchr May 19, 2022
0165314
Ensure the internal LRU map doesn't grow too much
bkchr May 20, 2022
15d0752
Use const fn to calculate the value cache element size
bkchr May 20, 2022
2f205c6
Remove cache configuration
bkchr May 20, 2022
0b69785
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr May 22, 2022
88b5aca
Fix
bkchr May 23, 2022
fa5e600
Clear the cache in between for more testing
bkchr May 23, 2022
b36a3b0
Try to come up with a failing test case
bkchr May 23, 2022
f16a39e
Make the test fail
bkchr May 24, 2022
56cc4cb
Fix the child trie recording
bkchr May 24, 2022
f872917
Make everything compile after the changes to trie
bkchr Jun 9, 2022
146f327
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr Jun 9, 2022
c40814a
Adapt to latest trie-db changes
bkchr Jun 14, 2022
4e2b5e7
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr Jun 14, 2022
fdddfc5
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr Jun 15, 2022
2741ff4
Fix on stable
bkchr Jun 15, 2022
460a35e
Update primitives/trie/src/cache.rs
bkchr Jun 15, 2022
288d39d
Fix wrong merge
bkchr Jun 15, 2022
f01264d
Docs
bkchr Jun 21, 2022
31c7235
Fix warnings
bkchr Jun 21, 2022
6c9a2eb
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr Jun 21, 2022
1f20ea1
Cargo.lock
bkchr Jun 21, 2022
668bcf1
Bump pin-project
bkchr Jun 21, 2022
8cfddbe
Fix warnings
bkchr Jun 21, 2022
b704800
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr Aug 5, 2022
22d8f90
Switch to released crate version
bkchr Aug 5, 2022
12d86f2
More fixes
bkchr Aug 6, 2022
bb12455
Make clippy and rustdocs happy
bkchr Aug 6, 2022
3b27df4
More clippy
bkchr Aug 6, 2022
725dd6c
Print error when using deprecated `--state-cache-size`
bkchr Aug 8, 2022
2a321d5
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr Aug 8, 2022
c370a5a
:facepalm:
bkchr Aug 9, 2022
49ab24c
Fixes
bkchr Aug 9, 2022
4d6c9aa
Merge branch 'master' into 11407
cheme Aug 10, 2022
6559925
Fix storage_hash linkings
cheme Aug 11, 2022
3a9ad84
Update client/rpc/src/dev/mod.rs
bkchr Aug 12, 2022
451afc6
Review feedback
bkchr Aug 12, 2022
b9b833b
encode bound
cheme Aug 12, 2022
5d062cf
Merge branch 'bkchr-state-access-benchmark' of github.com:paritytech/…
cheme Aug 12, 2022
ec70328
Rework the shared value cache
bkchr Aug 15, 2022
ce78429
Improve of the cache by merging the old and new solution
bkchr Aug 16, 2022
7281e97
Merge remote-tracking branch 'origin/master' into bkchr-state-access-…
bkchr Aug 17, 2022
e0ccd1f
FMT
bkchr Aug 17, 2022
cc596dc
Please stop coming back all the time :crying:
bkchr Aug 17, 2022
80bddd6
Update primitives/trie/src/cache/shared_cache.rs
bkchr Aug 17, 2022
e87117a
Fixes
bkchr Aug 17, 2022
1f3fd7f
Make clippy happy
bkchr Aug 17, 2022
5e8665a
Ensure we don't deadlock
bkchr Aug 17, 2022
499c24a
Only use one lock to simplify the code
bkchr Aug 18, 2022
a1576fc
Do not depend on `Hasher`
bkchr Aug 18, 2022
7863ee6
Fix tests
bkchr Aug 18, 2022
0616c78
FMT
bkchr Aug 18, 2022
bd972a2
Clippy :facepalm:
bkchr Aug 18, 2022
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
32 changes: 22 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions bin/node/bench/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::{collections::HashMap, sync::Arc};

use kvdb::KeyValueDB;
use node_primitives::Hash;
use sp_trie::{trie_types::TrieDBMutV1, TrieMut};
use sp_trie::{trie_types::TrieDBMutBuilderV1, TrieMut};

use crate::simple_trie::SimpleTrie;

Expand All @@ -43,7 +43,8 @@ pub fn generate_trie(
);
let mut trie = SimpleTrie { db, overlay: &mut overlay };
{
let mut trie_db = TrieDBMutV1::<crate::simple_trie::Hasher>::new(&mut trie, &mut root);
let mut trie_db =
TrieDBMutBuilderV1::<crate::simple_trie::Hasher>::new(&mut trie, &mut root).build();
for (key, value) in key_values {
trie_db.insert(&key, &value).expect("trie insertion failed");
}
Expand Down
7 changes: 3 additions & 4 deletions bin/node/bench/src/trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use kvdb::KeyValueDB;
use lazy_static::lazy_static;
use rand::Rng;
use sp_state_machine::Backend as _;
use sp_trie::{trie_types::TrieDBMutV1, TrieMut as _};
use sp_trie::{trie_types::TrieDBMutBuilderV1, TrieMut as _};
use std::{borrow::Cow, collections::HashMap, sync::Arc};

use node_primitives::Hash;
Expand Down Expand Up @@ -180,7 +180,7 @@ impl core::Benchmark for TrieReadBenchmark {
let storage: Arc<dyn sp_state_machine::Storage<sp_core::Blake2Hasher>> =
Arc::new(Storage(db.open(self.database_type)));

let trie_backend = sp_state_machine::TrieBackend::new(storage, self.root);
let trie_backend = sp_state_machine::TrieBackendBuilder::new(storage, self.root).build();
for (warmup_key, warmup_value) in self.warmup_keys.iter() {
let value = trie_backend
.storage(&warmup_key[..])
Expand Down Expand Up @@ -286,8 +286,7 @@ impl core::Benchmark for TrieWriteBenchmark {

let mut overlay = HashMap::new();
let mut trie = SimpleTrie { db: kvdb.clone(), overlay: &mut overlay };
let mut trie_db_mut = TrieDBMutV1::from_existing(&mut trie, &mut new_root)
.expect("Failed to create TrieDBMut");
let mut trie_db_mut = TrieDBMutBuilderV1::from_existing(&mut trie, &mut new_root).build();

for (warmup_key, warmup_value) in self.warmup_keys.iter() {
let value = trie_db_mut
Expand Down
3 changes: 1 addition & 2 deletions bin/node/cli/benches/block_production.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase {
keystore: KeystoreConfig::InMemory,
keystore_remote: Default::default(),
database: DatabaseSource::RocksDb { path: root.join("db"), cache_size: 128 },
state_cache_size: 67108864,
state_cache_child_ratio: None,
trie_cache_maximum_size: Some(64 * 1024 * 1024),
state_pruning: Some(PruningMode::ArchiveAll),
blocks_pruning: BlocksPruning::All,
chain_spec: spec,
Expand Down
3 changes: 1 addition & 2 deletions bin/node/cli/benches/transaction_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase {
keystore: KeystoreConfig::InMemory,
keystore_remote: Default::default(),
database: DatabaseSource::RocksDb { path: root.join("db"), cache_size: 128 },
state_cache_size: 67108864,
state_cache_child_ratio: None,
trie_cache_maximum_size: Some(64 * 1024 * 1024),
state_pruning: Some(PruningMode::ArchiveAll),
blocks_pruning: BlocksPruning::All,
chain_spec: spec,
Expand Down
3 changes: 1 addition & 2 deletions bin/node/testing/src/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,7 @@ impl BenchDb {
keyring: &BenchKeyring,
) -> (Client, std::sync::Arc<Backend>, TaskExecutor) {
let db_config = sc_client_db::DatabaseSettings {
state_cache_size: 16 * 1024 * 1024,
state_cache_child_ratio: Some((0, 100)),
trie_cache_maximum_size: Some(16 * 1024 * 1024),
state_pruning: Some(PruningMode::ArchiveAll),
source: database_type.into_settings(dir.into()),
blocks_pruning: sc_client_db::BlocksPruning::All,
Expand Down
10 changes: 8 additions & 2 deletions client/api/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ use sp_runtime::{
Justification, Justifications, StateVersion, Storage,
};
use sp_state_machine::{
ChildStorageCollection, IndexOperation, OffchainChangesCollection, StorageCollection,
backend::AsTrieBackend, ChildStorageCollection, IndexOperation, OffchainChangesCollection,
StorageCollection,
};
use sp_storage::{ChildInfo, StorageData, StorageKey};
use std::collections::{HashMap, HashSet};
Expand Down Expand Up @@ -448,7 +449,12 @@ pub trait Backend<Block: BlockT>: AuxStore + Send + Sync {
/// Associated blockchain backend type.
type Blockchain: BlockchainBackend<Block>;
/// Associated state backend type.
type State: StateBackend<HashFor<Block>> + Send;
type State: StateBackend<HashFor<Block>>
+ Send
+ AsTrieBackend<
HashFor<Block>,
TrieBackendStorage = <Self::State as StateBackend<HashFor<Block>>>::TrieBackendStorage,
>;
/// Offchain workers local storage.
type OffchainStorage: OffchainStorage;

Expand Down
21 changes: 15 additions & 6 deletions client/basic-authorship/src/basic_authorship.rs
Original file line number Diff line number Diff line change
Expand Up @@ -855,10 +855,18 @@ mod tests {
.expect("header get error")
.expect("there should be header");

let extrinsics_num = 4;
let extrinsics = (0..extrinsics_num)
.map(|v| Extrinsic::IncludeData(vec![v as u8; 10]))
.collect::<Vec<_>>();
let extrinsics_num = 5;
let extrinsics = std::iter::once(
Transfer {
from: AccountKeyring::Alice.into(),
to: AccountKeyring::Bob.into(),
amount: 100,
nonce: 0,
}
.into_signed_tx(),
)
.chain((0..extrinsics_num - 1).map(|v| Extrinsic::IncludeData(vec![v as u8; 10])))
.collect::<Vec<_>>();

let block_limit = genesis_header.encoded_size() +
extrinsics
Expand Down Expand Up @@ -922,8 +930,9 @@ mod tests {
.unwrap();

// The block limit didn't changed, but we now include the proof in the estimation of the
// block size and thus, one less transaction should fit into the limit.
assert_eq!(block.extrinsics().len(), extrinsics_num - 2);
// block size and thus, only the `Transfer` will fit into the block. It reads more data
// than we have reserved in the block limit.
assert_eq!(block.extrinsics().len(), 1);
}

#[test]
Expand Down
3 changes: 1 addition & 2 deletions client/cli/src/commands/chain_info_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ impl ChainInfoCmd {
B: BlockT,
{
let db_config = sc_client_db::DatabaseSettings {
state_cache_size: config.state_cache_size,
state_cache_child_ratio: config.state_cache_child_ratio.map(|v| (v, 100)),
trie_cache_maximum_size: config.trie_cache_maximum_size,
state_pruning: config.state_pruning.clone(),
source: config.database.clone(),
blocks_pruning: config.blocks_pruning,
Expand Down
17 changes: 5 additions & 12 deletions client/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,18 +230,12 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
})
}

/// Get the state cache size.
/// Get the trie cache maximum size.
///
/// By default this is retrieved from `ImportParams` if it is available. Otherwise its `0`.
fn state_cache_size(&self) -> Result<usize> {
Ok(self.import_params().map(|x| x.state_cache_size()).unwrap_or_default())
}

/// Get the state cache child ratio (if any).
///
/// By default this is `None`.
fn state_cache_child_ratio(&self) -> Result<Option<usize>> {
Ok(Default::default())
/// If `None` is returned the trie cache is disabled.
bkchr marked this conversation as resolved.
Show resolved Hide resolved
fn trie_cache_maximum_size(&self) -> Result<Option<usize>> {
Ok(self.import_params().map(|x| x.trie_cache_maximum_size()).unwrap_or_default())
}

/// Get the state pruning mode.
Expand Down Expand Up @@ -533,8 +527,7 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
keystore_remote,
keystore,
database: self.database_config(&config_dir, database_cache_size, database)?,
state_cache_size: self.state_cache_size()?,
state_cache_child_ratio: self.state_cache_child_ratio()?,
trie_cache_maximum_size: self.trie_cache_maximum_size()?,
state_pruning: self.state_pruning()?,
blocks_pruning: self.blocks_pruning()?,
wasm_method: self.wasm_method()?,
Expand Down
24 changes: 20 additions & 4 deletions client/cli/src/params/import_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,30 @@ pub struct ImportParams {
pub execution_strategies: ExecutionStrategiesParams,

/// Specify the state cache size.
///
/// Providing `0` will disable the cache.
#[clap(long, value_name = "Bytes", default_value = "67108864")]
pub state_cache_size: usize,
pub trie_cache_size: usize,
arkpar marked this conversation as resolved.
Show resolved Hide resolved

/// DEPRECATED
///
/// Switch to `--trie-cache-size`.
#[clap(long)]
state_cache_size: Option<usize>,
}

impl ImportParams {
/// Specify the state cache size.
pub fn state_cache_size(&self) -> usize {
self.state_cache_size
/// Specify the trie cache maximum size.
pub fn trie_cache_maximum_size(&self) -> Option<usize> {
if self.state_cache_size.is_some() {
eprintln!("`--state-cache-size` was deprecated. Please switch to `--trie-cache-size`.");
}

if self.trie_cache_size == 0 {
None
} else {
Some(self.trie_cache_size)
}
}

/// Get the WASM execution method from the parameters
Expand Down
12 changes: 11 additions & 1 deletion client/db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ sp-state-machine = { version = "0.12.0", path = "../../primitives/state-machine"
sp-trie = { version = "6.0.0", path = "../../primitives/trie" }

[dev-dependencies]
criterion = "0.3.3"
kvdb-rocksdb = "0.15.1"
rand = "0.8.4"
tempfile = "3.1.0"
quickcheck = { version = "1.0.3", default-features = false }
tempfile = "3"
kitchensink-runtime = { path = "../../bin/node/runtime" }
sp-tracing = { version = "5.0.0", path = "../../primitives/tracing" }
substrate-test-runtime-client = { version = "2.0.0", path = "../../test-utils/runtime/client" }

Expand All @@ -46,3 +49,10 @@ default = []
test-helpers = []
runtime-benchmarks = []
rocksdb = ["kvdb-rocksdb"]

[[bench]]
name = "state_access"
harness = false

[lib]
bench = false
Loading