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

New crate for compact trie proofs. #30

Closed
wants to merge 1 commit into from
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ members = [
"test-support/trie-standardmap",
"test-support/trie-bench",
"trie-db",
"trie-proof",
"trie-root"
]
4 changes: 2 additions & 2 deletions trie-db/src/iter_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ macro_rules! exponential_out {
type CacheNode<HO> = Option<ChildReference<HO>>;

#[inline(always)]
fn new_vec_slice_buffer<HO>() -> [CacheNode<HO>; 16] {
fn new_vec_slice_buffer<HO: Copy>() -> [CacheNode<HO>; 16] {
exponential_out!(@3, [None, None])
}

Expand Down Expand Up @@ -314,7 +314,7 @@ pub fn trie_visit<T, I, A, B, F>(input: I, callback: &mut F)
}

/// Visitor trait to implement when using `trie_visit`.
pub trait ProcessEncodedNode<HO> {
pub trait ProcessEncodedNode<HO: Copy> {
/// Function call with prefix, encoded value and a boolean indicating if the
/// node is the root for each node of the trie.
///
Expand Down
2 changes: 1 addition & 1 deletion trie-db/src/triedb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ impl Crumb {
}
}

/// Iterator for going through all values in the trie.
/// Iterator for going through all values in the trie in pre-order traversal order.
pub struct TrieDBIterator<'a, L: TrieLayout> {
db: &'a TrieDB<'a, L>,
trail: Vec<Crumb>,
Expand Down
3 changes: 2 additions & 1 deletion trie-db/src/triedbmut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ enum Stored<H> {
}

/// Used to build a collection of child nodes from a collection of `NodeHandle`s
pub enum ChildReference<HO> { // `HO` is e.g. `H256`, i.e. the output of a `Hasher`
#[derive(Clone, Copy)]
pub enum ChildReference<HO: Copy> { // `HO` is e.g. `H256`, i.e. the output of a `Hasher`
Hash(HO),
Inline(HO, usize), // usize is the length of the node data we store in the `H::Out`
}
Expand Down
27 changes: 27 additions & 0 deletions trie-proof/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[package]
name = "trie-proof"
version = "0.15.2"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Compact proof generation and verification for Merkle-Patricia trie"
repository = "https://github.com/paritytech/trie"
license = "Apache-2.0"
edition = "2018"

[dependencies]
hash-db = { path = "../hash-db", default-features = false, version = "0.15.2" }
memory-db = { path = "../memory-db", default-features = false, version = "0.15.2" }
parity-scale-codec = { version = "1.0.3", features = ["derive"] }
trie-db = { path = "../trie-db", default-features = false, version = "0.15.2" }

[dev-dependencies]
keccak-hasher = { path = "../test-support/keccak-hasher", version = "0.15.2" }
reference-trie = { path = "../test-support/reference-trie", version = "0.15.2" }

[features]
default = ["std"]
std = [
"hash-db/std",
"memory-db/std",
"parity-scale-codec/std",
"trie-db/std",
]
Loading