Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
776f324
fuse commit of no extension branch.
cheme Feb 15, 2019
4eae594
Tabify.
cheme Feb 19, 2019
5d79a12
Implementation for trie_root.
cheme Feb 22, 2019
fe603e8
Merge branch '12' into n_ext_trie_key, try to complete for no_ext, tests
cheme Mar 21, 2019
e7b299c
Fix test
cheme Mar 22, 2019
2ca4542
Fuzz of prefix seems ok for pr 12, no_ext things are totally broken.
cheme Mar 22, 2019
cfeb96a
Fix iter_build key indexes.
cheme Mar 22, 2019
e38532c
Merge branch 'master' into n_ext_trie_key, tests are broken again
cheme Apr 1, 2019
1d9be11
Fix merge regression
cheme Apr 2, 2019
f1fdcbd
No error found : need more tests (after evos).
cheme Apr 2, 2019
bd5b735
Put a no_ext header specific scheme (with second bit as in substrate).
cheme Apr 2, 2019
e727fbd
Fix decoding issue of iter
cheme Apr 2, 2019
b3c988c
Reset fuzzer to right no_ext impl, found a failing test (in comment).
cheme Apr 2, 2019
bdd99c0
Find and fix fuzzing error (a missing branch child ix).
cheme Apr 3, 2019
ac36fc9
Removing bench blobs.
cheme Apr 3, 2019
42c2eba
Minor change (remove dead branch, and useless encoding, also panic on
cheme Apr 8, 2019
84ff90d
Use a unique trait for spec (layout) : hasher, nodecodec and alogorithm
cheme Apr 9, 2019
e092a0c
Fuse triedbmut code, before remove NoExt variant
cheme Apr 9, 2019
3bd3127
Fix merge and remove triedbmutnoext variant.
cheme Apr 9, 2019
a8b73f6
No instance for Layout (NodeCodec should have one at some point), to
cheme Apr 9, 2019
1c34745
Apply layout trait to non mut trie too.
cheme Apr 9, 2019
12842a6
Nibbleslice using inner trait to define multiple encoding: this is
cheme Apr 10, 2019
4478ece
NibbleVec move size arelated methods.
cheme Apr 10, 2019
318e7c8
Reverse padding in nibble
cheme Apr 11, 2019
b30698a
start testing, first broken part see triedbmut advance println
cheme Apr 11, 2019
097fec5
Fix offset issue of nodecodec
cheme Apr 12, 2019
f892c76
Switch remaining tests to use postfix for no ext
cheme Apr 12, 2019
57a86c5
Switch header encoding scheme. Failing test is related to the
cheme Apr 12, 2019
0cab2eb
TrieStream implementation : warning it is not parameterized.
cheme Apr 16, 2019
f21398b
Back to prefix padded nibble (TODO see if removal of all previous change
cheme Apr 17, 2019
d36ba7d
Simplification of nibleslice, not stabilized yet (many unused and some
cheme Apr 18, 2019
bc1ae2b
fix stack of prefix on commit
cheme Apr 18, 2019
4ddb1eb
fix into_part method
cheme Apr 19, 2019
da335d4
fix fuzz1
cheme Apr 19, 2019
f276ace
bad work on fixing fix: buf is needed only for terminal and recursive is
cheme Apr 19, 2019
c5d907d
small cleaning
cheme Apr 19, 2019
71e8fab
Fix remove issue, will need more test (playpen on noext and check
cheme Apr 20, 2019
0c7efd1
clean up prefixkeymut before merge with keyvec
cheme Apr 22, 2019
8ee9798
implement, still 2 failing test (note on remove I did change prefix a…
cheme Apr 22, 2019
241eb4a
nightly debug format
cheme Apr 20, 2019
107027b
Use keyvec instead of keymut.
cheme Apr 22, 2019
ca950b9
ref padding constant
cheme Apr 23, 2019
ba7de31
remove PartialKey (same as NibbleSlice in this state).
cheme Apr 23, 2019
5de3fbe
no ext error from playpen
cheme Apr 23, 2019
cf2b5e3
Fix playpen error.
cheme Apr 23, 2019
2e8cd6a
fix some warnings
cheme Apr 24, 2019
6c69177
use nibblevec instead of vec in iter, TODO still need remove a useless
cheme Apr 24, 2019
fbe84fb
end of switch Vec<u8> to NibbleVec, this will need a bench.
cheme Apr 24, 2019
50fec85
make a nibble module to share field between vec and slice
cheme Apr 25, 2019
275f5b8
push_pop on quarter
cheme Apr 25, 2019
6fd7531
in progress - append_partial
cheme Apr 28, 2019
959da6c
partial & prefix cannot be simply option but (nb_nibble, aligned_val)…
cheme Apr 30, 2019
dd93050
switch partial to (u8, u8)
cheme Apr 30, 2019
b756248
Replace prefix option by index bytes
cheme May 1, 2019
9e45eda
clean code from padding_bitmask a bit
cheme May 2, 2019
9657a15
Fix regression
cheme May 2, 2019
3bfe451
fuzz1 and 2 passing
cheme May 3, 2019
757f630
a few fix, next needed are combine_key and shifted_key
cheme May 3, 2019
2704459
fix a few test
cheme May 4, 2019
d844cd2
fix range iter
cheme May 5, 2019
8f428f1
remove a few todos and fix bench (except memdb).
cheme May 6, 2019
e88dbc2
cleaning
cheme May 6, 2019
8a4f75e
Abstract buff size of iter_build
cheme May 6, 2019
398c915
plug iter_build on TrieLayout
cheme May 6, 2019
38c4899
Make children slice variable length depending on trait.
cheme May 7, 2019
45009f8
Clone and debug for kf function
cheme May 8, 2019
1c40a98
nibble vec append fix
cheme May 8, 2019
c4ace9a
right vec append fix
cheme May 9, 2019
530f5f1
Add debug assertion to help implementation of codec.
cheme May 9, 2019
a8bcdf5
fix
cheme May 9, 2019
28271c2
lookup advance branch for other than 16
cheme May 9, 2019
57bb429
no_std update
cheme May 10, 2019
bce5c66
Fix no ext key lookup
cheme May 13, 2019
f9430e0
smaller empty prefix result
cheme May 13, 2019
0ada0af
Fix wasm code (rust std doc for usize is unaccurate).
cheme May 13, 2019
1a09044
bench len/size factor 2
cheme May 14, 2019
7cec6af
Add test with values on encode_size, fix debug output (previous change
cheme May 23, 2019
b13bb9a
indent
cheme May 23, 2019
06f5360
do not allow decoding of longer length node (encoding still truncate)
cheme May 30, 2019
ed68da6
format
cheme May 31, 2019
feb0660
Legacy prefix tools.
cheme Jun 4, 2019
776a1f3
Fix legacy prefix
cheme Jun 4, 2019
43b3225
Some documentation, and switch `masked_right` semantic to be similar to
cheme Jun 5, 2019
727837d
Documentation improvement and breaking long lines.
cheme Jun 5, 2019
8d1b2ae
some additional formatting
cheme Jun 5, 2019
a5a95bd
Remove BM from NodeCodec (specific to some implementation only).
cheme Jun 5, 2019
be66ce2
Invalid asumption about prefix ordering of key, fix doc and implement
cheme Jun 6, 2019
ddd24d2
OrderedPrefix instance.
cheme Jun 7, 2019
fec4a79
inprogress
cheme Jun 9, 2019
b45762d
No exessive buffer len, simplify flush_branch.
cheme Jun 9, 2019
0218331
fix quarter error
cheme Jun 10, 2019
82c920a
Merge branch 'master' into n_ext_trie
cheme Jun 22, 2019
a2f31c5
iter_build instance with print trace.
cheme Jun 22, 2019
65b748a
gen impl over H.
cheme Jun 22, 2019
56b1398
no_std
cheme Jun 25, 2019
4c381d7
Merge branch 'n_ext_trie' of github.com:cheme/trie into n_ext_trie
cheme Jun 25, 2019
2efca9b
fix no_std bis
cheme Jun 25, 2019
fcb70e2
no_std tierce
cheme Jun 25, 2019
116978f
quick bench trie mut against trie root.
cheme Jul 3, 2019
af7f2bb
memory db building iter_build benches
cheme Jul 3, 2019
6d38133
Merge branch 'master' into n_ext_trie
cheme Jul 8, 2019
5eb9b99
update versioning
cheme Jul 8, 2019
0a29389
Small doc changes and formatting fixes.
cheme Jul 22, 2019
5e1126a
ChildBitmap renamed to more generic BitMap.
cheme Jul 22, 2019
c8e66cd
Renaming of LayOut to Layout.
cheme Jul 22, 2019
bb2588e
replace _ix with _index, bm with bitmap, and Ix with Index.
cheme Jul 22, 2019
202bc74
Removing padding length from prefix.
cheme Jul 24, 2019
0de2f85
Renamings.
cheme Jul 24, 2019
93e9c13
Remove substrate from comment.
cheme Jul 24, 2019
699cdc0
First pass of renamaings.
cheme Jul 26, 2019
68e3832
Line length bellow 100.
cheme Jul 26, 2019
19f92fb
add after comma space and after closure paramater space.
cheme Jul 26, 2019
4f3bb58
Renaming of variables and methods.
cheme Jul 26, 2019
a65724d
Some line length.
cheme Jul 26, 2019
502740b
Rename subtrait of TrieLayout to full names.
cheme Jul 29, 2019
b6e8f9c
Replace 'masked_' by 'pad_'.
cheme Jul 29, 2019
5ada0fe
documentation small fixes.
cheme Jul 29, 2019
2fe240c
Restore new line at end.
cheme Jul 29, 2019
5a81906
Remove old feature.
cheme Jul 29, 2019
fb0e822
Merge branch 'master' into n_ext_trie
cheme Jul 31, 2019
8a9cc47
Remove multiple trie radix support.
cheme Jul 31, 2019
d9a12d0
Comment.
cheme Jul 31, 2019
869b4ce
formatting, and remove unused BitMap trait.
cheme Aug 1, 2019
9b94482
Removing: radix related cache struct from iter_build.
cheme Aug 1, 2019
5b9b022
No assumption on biggest_depth.
cheme Aug 1, 2019
79d71b6
fixing biggest depth correctly.
cheme Aug 1, 2019
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
Prev Previous commit
Next Next commit
remove a few todos and fix bench (except memdb).
  • Loading branch information
cheme committed May 6, 2019
commit 8f428f17ee8b88783f6ee66f46fa39484bbc9d65
17 changes: 9 additions & 8 deletions memory-db/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ extern crate memory_db;
extern crate keccak_hasher;

use memory_db::MemoryDB;
use memory_db::HashKey;
use keccak_hasher::KeccakHasher;
use hash_db::{HashDB, Hasher};
use hash_db::{HashDB, Hasher, EMPTY_PREFIX};

fn instantiation(b: &mut Criterion) {
b.bench_function("instantiation", |b| b.iter(|| {
MemoryDB::<KeccakHasher, Vec<u8>>::default();
MemoryDB::<KeccakHasher, HashKey<KeccakHasher>, Vec<u8>>::default();
}));
}

Expand All @@ -52,19 +53,19 @@ fn compare_to_null_in_const(b: &mut Criterion) {
}

fn contains_with_non_null_key(b: &mut Criterion) {
let mut m = MemoryDB::<KeccakHasher, Vec<u8>>::default();
let mut m = MemoryDB::<KeccakHasher, HashKey<KeccakHasher>, Vec<u8>>::default();
let key = KeccakHasher::hash(b"abc");
m.insert(b"abcefghijklmnopqrstuvxyz");
m.insert(EMPTY_PREFIX, b"abcefghijklmnopqrstuvxyz");
b.bench_function("contains_with_non_null_key", |b| b.iter(|| {
m.contains(&key);
m.contains(&key, EMPTY_PREFIX);
}));
}

fn contains_with_null_key(b: &mut Criterion) {
let mut m = MemoryDB::<KeccakHasher, Vec<u8>>::default();
let mut m = MemoryDB::<KeccakHasher, HashKey<KeccakHasher>, Vec<u8>>::default();
let null_key = KeccakHasher::hash(&[0u8][..]);
m.insert(b"abcefghijklmnopqrstuvxyz");
m.insert(EMPTY_PREFIX, b"abcefghijklmnopqrstuvxyz");
b.bench_function("contains_with_null_key", |b| b.iter(|| {
m.contains(&null_key);
m.contains(&null_key, EMPTY_PREFIX);
}));
}
3 changes: 1 addition & 2 deletions test-support/reference-trie/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ extern crate trie_bench;

fn benchmark(c: &mut Criterion) {
trie_bench::standard_benchmark::<
keccak_hasher::KeccakHasher,
reference_trie::ReferenceNodeCodec,
reference_trie::LayoutOri,
reference_trie::ReferenceTrieStream,
>(c, "ref");
}
9 changes: 5 additions & 4 deletions test-support/reference-trie/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1005,16 +1005,17 @@ pub fn compare_impl_no_ext_q(

if root != root_new {
{
let db : &dyn hash_db::HashDB<_,_> = &memdb;
let t = RefTrieDBNoExtQ::new(&db, &root).unwrap();
let db : &dyn hash_db::HashDB<_,_> = &hashdb;
let t = RefTrieDBNoExtQ::new(&db, &root_new).unwrap();
println!("{:?}", t);
for a in t.iter().unwrap() {
println!("a:{:?}", a);
}
}

{
let db : &dyn hash_db::HashDB<_,_> = &hashdb;
let t = RefTrieDBNoExtQ::new(&db, &root_new).unwrap();
let db : &dyn hash_db::HashDB<_,_> = &memdb;
let t = RefTrieDBNoExtQ::new(&db, &root).unwrap();
println!("{:?}", t);
for a in t.iter().unwrap() {
println!("a:{:?}", a);
Expand Down
4 changes: 2 additions & 2 deletions trie-db/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extern crate trie_standardmap;
extern crate trie_db;
extern crate rand;
use trie_standardmap::{Alphabet, StandardMap, ValueMode};
use trie_db::NibbleSlice;
use trie_db::{NibbleSlice, NibbleHalf};

fn nibble_common_prefix(b: &mut Criterion) {
let st = StandardMap {
Expand All @@ -39,7 +39,7 @@ fn nibble_common_prefix(b: &mut Criterion) {
let (keys, values): (Vec<_>, Vec<_>) = st.make().into_iter().unzip();
b.bench_function("nibble_common_prefix", move |b| {
let mixed: Vec<_> = keys.iter().zip(values.iter().rev()).map(|pair| {
(NibbleSlice::new(pair.0), NibbleSlice::new(pair.1))
(NibbleSlice::<NibbleHalf>::new(pair.0), NibbleSlice::<NibbleHalf>::new(pair.1))
}).collect();

b.iter(&mut ||{
Expand Down
30 changes: 3 additions & 27 deletions trie-db/src/iter_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,6 @@ use crate::nibble::NibbleSlice;
use crate::nibble::NibbleOps;
use node_codec::NodeCodec;

// TODO EMCH use L instead of HC (aka TrieLayout)
// TODO EMCH move to NibbleOps to use right constants
fn biggest_depth<N: NibbleOps>(v1: &[u8], v2: &[u8]) -> usize {
// sorted assertion preventing out of bound
for a in 0..v1.len() {
if v1[a] == v2[a] {
} else {
return a * N::NIBBLE_PER_BYTE + N::left_common(v1[a], v2[a]);
}
}
return v1.len() * N::NIBBLE_PER_BYTE;
}

// warn! start at 0 // TODO change biggest_depth??
// warn! slow don't loop on that when possible
#[inline(always)]
fn nibble_at<N: NibbleOps>(v1: &[u8], ix: usize) -> u8 {
N::at_left(
(ix % N::NIBBLE_PER_BYTE) as u8,
v1[ix / N::NIBBLE_PER_BYTE]
)
}

/*
// TODO remove for nibbleslice api TODO can be variable size
Expand Down Expand Up @@ -138,7 +116,7 @@ where
target_depth: usize,
(k2, v2): &(impl AsRef<[u8]>,impl AsRef<[u8]>),
) {
let nibble_value = nibble_at::<N>(&k2.as_ref()[..], target_depth);
let nibble_value = N::left_nibble_at(&k2.as_ref()[..], target_depth);
// is it a branch value (two candidate same ix)
let nkey = NibbleSlice::<N>::new_offset(&k2.as_ref()[..],target_depth+1);
// Note: fwiu, having fixed key size, all values are in leaf (no value in
Expand Down Expand Up @@ -199,7 +177,7 @@ where
self.standard_ext(&ref_branch.as_ref()[..], cb_ext, branch_d, is_root, nkey)
};
// put hash in parent
let nibble: u8 = nibble_at::<N>(&ref_branch.as_ref()[..],d);
let nibble: u8 = N::left_nibble_at(&ref_branch.as_ref()[..],d);
self.set_node(d, nibble as usize, Some(h));
}
}
Expand Down Expand Up @@ -322,16 +300,14 @@ fn trie_visit_inner<H, C, N, I, A, B, F>(input: I, cb_ext: &mut F, no_ext: bool)

for (k, v) in iter_input {
//println!("!{:?},{:?}",&k.as_ref(),&v.as_ref());
let common_depth = biggest_depth::<N>(&prev_val.0.as_ref()[..], &k.as_ref()[..]);
let common_depth = N::biggest_depth(&prev_val.0.as_ref()[..], &k.as_ref()[..]);
// 0 is a reserved value : could use option
let depth_item = common_depth;
if common_depth == prev_val.0.as_ref().len() * N::NIBBLE_PER_BYTE {
//println!("stack {} ", common_depth);
// the new key include the previous one : branch value case
// just stored value at branch depth
// TODO EMCH bound check and extend depth queue
depth_queue.set_elt(common_depth, Some(prev_val.1));

} else if depth_item >= prev_depth {
//println!("fv {}", depth_item);
// put prev with next (common branch prev val can be flush)
Expand Down
23 changes: 21 additions & 2 deletions trie-db/src/nibble/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ pub trait NibbleOps: Default + Clone + PartialEq + Eq + PartialOrd + Ord + Copy
const NIBBLE_LEN : usize = TWO_EXP[8 / Self::NIBBLE_PER_BYTE]; //2usize.pow(8 as u32 / Self::NIBBLE_PER_BYTE as u32);
/// padding bitmasks (could be calculated with a constant function).
/// First is bit mask to apply, second is right shift needed.
/// TODO EMCH check that array acts as constant
const PADDING_BITMASK: &'static [(u8, usize)];
/// las ix for nible
const LAST_N_IX: usize = Self::NIBBLE_PER_BYTE - 1;
Expand All @@ -59,13 +58,21 @@ pub trait NibbleOps: Default + Clone + PartialEq + Eq + PartialOrd + Ord + Copy
b & Self::PADDING_BITMASK[ix as usize].0
}
/// get value at ix from a right first byte
/// TODO EMCH here left or right does not make lot of sense
#[inline(always)]
fn at_left(ix: u8, b: u8) -> u8 {
(b & Self::PADDING_BITMASK[ix as usize].0)
>> Self::PADDING_BITMASK[ix as usize].1
}

/// get nibble for left aligned array
#[inline(always)]
fn left_nibble_at(v1: &[u8], ix: usize) -> u8 {
Self::at_left(
(ix % Self::NIBBLE_PER_BYTE) as u8,
v1[ix / Self::NIBBLE_PER_BYTE]
)
}

/// push u8 nib value at ix into a existing byte
#[inline(always)]
fn push_at_left(ix: u8, v: u8, into: u8) -> u8 {
Expand Down Expand Up @@ -95,6 +102,18 @@ pub trait NibbleOps: Default + Clone + PartialEq + Eq + PartialOrd + Ord + Copy
(s1, s2)
}

/// get biggest common depth between two left aligned packed nibble arrays
fn biggest_depth(v1: &[u8], v2: &[u8]) -> usize {
// sorted assertion preventing out of bound
for a in 0..v1.len() {
if v1[a] == v2[a] {
} else {
return a * Self::NIBBLE_PER_BYTE + Self::left_common(v1[a], v2[a]);
}
}
return v1.len() * Self::NIBBLE_PER_BYTE;
}

/// number of common bit between two left pad byte
#[inline(always)]
fn left_common(a: u8, b: u8) -> usize {
Expand Down
47 changes: 47 additions & 0 deletions trie-db/src/nibble/nibblevec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,24 @@ impl<N: NibbleOps> NibbleVec<N> {
}
}

/// push a full partial.
pub fn append(&mut self, v: &NibbleVec<N>) {

if v.len == 0 { return; }
let offset = self.len % N::NIBBLE_PER_BYTE;
let last_ix = self.len / N::NIBBLE_PER_BYTE;
if offset > 0 {
let (s1, s2) = N::split_shifts(offset);
self.inner[last_ix] = N::masked_left(offset as u8, self.inner[last_ix]) | (v.inner[0] >> s2);
(0..v.len() - 1).for_each(|i|self.inner.push(v.inner[i] << s1 | v.inner[i+1] >> s2));
} else {
(0..v.inner.len()).for_each(|i|self.inner.push(v.inner[i]));
}
self.len += v.len;
}



/// push a full partial.
pub fn append_partial(&mut self, (o_n, sl): Partial) {
for i in (1..=o_n.0).rev() {
Expand All @@ -133,6 +151,35 @@ impl<N: NibbleOps> NibbleVec<N> {
self.len += sl.len() * N::NIBBLE_PER_BYTE;
}

/// append slice or nibble
pub fn append_slice_nibble(
&mut self,
o_sl: Option<&NibbleSlice<N>>,
o_ix: Option<u8>
) -> usize {
let mut res = 0;
if let Some(sl) = o_sl {
self.append_partial(sl.right());
res += sl.len();
}
if let Some(ix) = o_ix {
self.push(ix);
res += 1;
}
res
}
/// clone then append slice or nibble
pub fn clone_append_slice_nibble(
&self,
o_sl: Option<&NibbleSlice<N>>,
o_ix: Option<u8>
) -> Self {
let mut p = self.clone();
p.append_slice_nibble(o_sl, o_ix);
p
}


/// Get the underlying byte slice.
pub fn inner(&self) -> &[u8] {
&self.inner[..]
Expand Down
3 changes: 0 additions & 3 deletions trie-db/src/node_codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ pub trait NodeCodec<H: Hasher, N: NibbleOps>: Sized {
/// Codec error type
type Error: Error;

// TODO EMCH since refact to use nibble ops: use of this method is super awkward
// -> making reference code implement statically other nibble could be the simpler
// way of fixing that
/// Get the hashed null node.
fn hashed_null_node() -> H::Out;

Expand Down
16 changes: 4 additions & 12 deletions trie-db/src/triedb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use super::node::{Node, OwnedNode};
use node_codec::NodeCodec;
use super::lookup::Lookup;
use super::{Result, DBValue, Trie, TrieItem, TrieError, TrieIterator, Query, TrieLayOut, CError, TrieHash};
use triedbmut::{concat_key_clone};
use super::nibble::NibbleVec;
#[cfg(feature = "std")]
use ::std::fmt;
Expand Down Expand Up @@ -175,7 +174,7 @@ where
.field("item", &TrieAwareDebugNode{
trie: self.trie,
node_key: item,
partial_key: concat_key_clone(&self.partial_key, Some(&slice), None),
partial_key: self.partial_key.clone_append_slice_nibble(Some(&slice), None),
index: None,
})
.finish(),
Expand All @@ -187,7 +186,7 @@ where
trie: self.trie,
index: Some(i as u8),
node_key: n,
partial_key: concat_key_clone(&self.partial_key, None, Some(i as u8)),
partial_key: self.partial_key.clone_append_slice_nibble(None, Some(i as u8)),
})
.collect();
match (f.debug_struct("Node::Branch"), self.index) {
Expand All @@ -206,7 +205,7 @@ where
trie: self.trie,
index: Some(i as u8),
node_key: n,
partial_key: concat_key_clone(&self.partial_key, Some(&slice), Some(i as u8)),
partial_key: self.partial_key.clone_append_slice_nibble(Some(&slice), Some(i as u8)),
}).collect();
match (f.debug_struct("Node::NibbledBranch"), self.index) {
(ref mut d, Some(ref i)) => d.field("index", i),
Expand Down Expand Up @@ -421,14 +420,7 @@ impl<'a, L: TrieLayOut> TrieDBIterator<'a, L> {
&OwnedNode::Leaf(ref n, _)
| &OwnedNode::Extension(ref n, _)
| &OwnedNode::NibbledBranch(ref n, _)
=> {
if let Some(part) = n.as_nibbleslice() {
key_nibbles.append_partial(part.right());
} else {
// TODO EMCH range_iter on nibble vec or simply cat of two nibblevec
(0..n.len()).for_each(|i|key_nibbles.push(n.at(i)));
}
},
=> key_nibbles.append(n),
_ => {}
}
}
Expand Down
Loading