mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 16:21:06 +00:00
Refactor sr_primitives. (#3214)
* refactor sr_primitives. * Fix try build error. * Line-width * Ui test. * Final fixes. * Fix build again. * bring back ui test. * Fix unsigned import. * Another ui fix. * Also refactor substrate-primitives * Fix benchmarks. * Fix doc test. * fix doc tests
This commit is contained in:
committed by
Bastian Köcher
parent
cf80af9255
commit
79feb23a22
@@ -18,7 +18,7 @@ hash-db = { version = "0.14.0", default-features = false }
|
||||
trie-db = { version = "0.14.0", default-features = false }
|
||||
trie-root = { version = "0.14.0", default-features = false }
|
||||
memory-db = { version = "0.14.0", default-features = false }
|
||||
substrate-primitives = { path = "../primitives", default-features = false }
|
||||
primitives = { package = "substrate-primitives", path = "../primitives", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
trie-bench = { version = "0.14.0" }
|
||||
@@ -36,5 +36,5 @@ std = [
|
||||
"memory-db/std",
|
||||
"trie-db/std",
|
||||
"trie-root/std",
|
||||
"substrate-primitives/std",
|
||||
"primitives/std",
|
||||
]
|
||||
|
||||
@@ -20,8 +20,8 @@ criterion_main!(benches);
|
||||
|
||||
fn benchmark(c: &mut Criterion) {
|
||||
trie_bench::standard_benchmark::<
|
||||
substrate_primitives::Blake2Hasher,
|
||||
substrate_trie::NodeCodec<substrate_primitives::Blake2Hasher>,
|
||||
primitives::Blake2Hasher,
|
||||
substrate_trie::NodeCodec<primitives::Blake2Hasher>,
|
||||
substrate_trie::TrieStream,
|
||||
>(c, "substrate-blake2");
|
||||
trie_bench::standard_benchmark::<
|
||||
|
||||
@@ -144,7 +144,7 @@ where
|
||||
///
|
||||
/// `child_trie_root` and `child_delta_trie_root` can panic if invalid value is provided to them.
|
||||
pub fn is_child_trie_key_valid<H: Hasher>(storage_key: &[u8]) -> bool {
|
||||
use substrate_primitives::storage::well_known_keys;
|
||||
use primitives::storage::well_known_keys;
|
||||
let has_right_prefix = storage_key.starts_with(b":child_storage:default:");
|
||||
if has_right_prefix {
|
||||
// This is an attempt to catch a change of `is_child_storage_key`, which
|
||||
@@ -332,7 +332,7 @@ fn branch_node(has_value: bool, has_children: impl Iterator<Item = bool>) -> [u8
|
||||
mod tests {
|
||||
use super::*;
|
||||
use codec::{Encode, Compact};
|
||||
use substrate_primitives::Blake2Hasher;
|
||||
use primitives::Blake2Hasher;
|
||||
use hash_db::{HashDB, Hasher};
|
||||
use trie_db::{DBValue, TrieMut, Trie};
|
||||
use trie_standardmap::{Alphabet, ValueMode, StandardMap};
|
||||
|
||||
Reference in New Issue
Block a user