Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polymesh v6 monthly 2023 03 update version #36

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
251 changes: 134 additions & 117 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion primitives/state-machine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ array-bytes = "4.1"
pretty_assertions = "1.2.1"
rand = "0.8.5"
sp-runtime = { version = "7.0.0", path = "../runtime" }
trie-db = "0.27.1"
trie-db = "0.28.0"
assert_matches = "1.5"

[features]
Expand Down
14 changes: 7 additions & 7 deletions primitives/trie/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ harness = false

[dependencies]
ahash = { version = "0.8.2", optional = true }
codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false }
hashbrown = { version = "0.12.3", optional = true }
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false }
hashbrown = { version = "0.13.2", optional = true }
hash-db = { version = "0.16.0", default-features = false }
lazy_static = { version = "1.4.0", optional = true }
memory-db = { version = "0.32.0", default-features = false }
nohash-hasher = { version = "0.2.0", optional = true }
parking_lot = { version = "0.12.1", optional = true }
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
thiserror = { version = "1.0.30", optional = true }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
thiserror = { version = "1.0.48", optional = true }
tracing = { version = "0.1.29", optional = true }
trie-db = { version = "0.27.0", default-features = false }
trie-db = { version = "0.28.0", default-features = false }
trie-root = { version = "0.18.0", default-features = false }
sp-core = { version = "7.0.0", default-features = false, path = "../core" }
sp-std = { version = "5.0.0", default-features = false, path = "../std" }
schnellru = { version = "0.2.1", optional = true }

[dev-dependencies]
array-bytes = "4.1"
array-bytes = "6.1"
criterion = "0.4.0"
trie-bench = "0.37.0"
trie-bench = "0.38.0"
trie-standardmap = "0.16.0"
sp-runtime = { version = "7.0.0", path = "../runtime" }

Expand Down
10 changes: 7 additions & 3 deletions primitives/trie/src/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,13 @@ const LOCAL_NODE_CACHE_MAX_INLINE_SIZE: usize = 512 * 1024;
const LOCAL_VALUE_CACHE_MAX_INLINE_SIZE: usize = 512 * 1024;

/// The maximum size of the memory allocated on the heap by the local cache, in bytes.
const LOCAL_NODE_CACHE_MAX_HEAP_SIZE: usize = 2 * 1024 * 1024;
///
/// The size of the node cache should always be bigger than the value cache. The value
/// cache is only holding weak references to the actual values found in the nodes and
/// we account for the size of the node as part of the node cache.
const LOCAL_NODE_CACHE_MAX_HEAP_SIZE: usize = 8 * 1024 * 1024;
/// Same as [`LOCAL_NODE_CACHE_MAX_HEAP_SIZE`].
const LOCAL_VALUE_CACHE_MAX_HEAP_SIZE: usize = 4 * 1024 * 1024;
const LOCAL_VALUE_CACHE_MAX_HEAP_SIZE: usize = 2 * 1024 * 1024;

/// The size of the shared cache.
#[derive(Debug, Clone, Copy)]
Expand Down Expand Up @@ -525,7 +529,7 @@ impl<'a, H: Hasher> TrieCache<'a, H> {
/// `storage_root` is the new storage root that was obtained after finishing all operations
/// using the [`TrieDBMut`](trie_db::TrieDBMut).
pub fn merge_into(self, local: &LocalTrieCache<H>, storage_root: H::Out) {
let cache = if let ValueCache::Fresh(cache) = self.value_cache { cache } else { return };
let ValueCache::Fresh(cache) = self.value_cache else { return };

if !cache.is_empty() {
let mut value_cache = local.value_cache.lock();
Expand Down
10 changes: 3 additions & 7 deletions primitives/trie/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ pub use storage_proof::{CompactProof, StorageProof};
/// Trie codec reexport, mainly child trie support
/// for trie compact proof.
pub use trie_codec::{decode_compact, encode_compact, Error as CompactProofError};
pub use trie_db::proof::VerifyError;
use trie_db::proof::{generate_proof, verify_proof};
use trie_db::proof::{generate_proof, verify_proof, VerifyError};
/// Various re-exports from the `trie-db` crate.
pub use trie_db::{
nibble_ops,
Expand Down Expand Up @@ -647,7 +646,7 @@ mod tests {
count: 1000,
};
let mut d = st.make();
d.sort_by(|&(ref a, _), &(ref b, _)| a.cmp(b));
d.sort_by(|(a, _), (b, _)| a.cmp(b));
let dr = d.iter().map(|v| (&v.0[..], &v.1[..])).collect();
check_input(&dr);
}
Expand Down Expand Up @@ -716,10 +715,7 @@ mod tests {
t
}

fn unpopulate_trie<'db, T: TrieConfiguration>(
t: &mut TrieDBMut<'db, T>,
v: &[(Vec<u8>, Vec<u8>)],
) {
fn unpopulate_trie<T: TrieConfiguration>(t: &mut TrieDBMut<'_, T>, v: &[(Vec<u8>, Vec<u8>)]) {
for i in v {
let key: &[u8] = &i.0;
t.remove(key).unwrap();
Expand Down
Loading
Loading