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

Query plan proofs #196

Open
wants to merge 154 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
1742a43
init query plan
cheme Mar 29, 2023
62ba01d
api draft
cheme Mar 29, 2023
dfee73c
forgot read limit
cheme Mar 29, 2023
69bf900
equivalent to seek
cheme Mar 29, 2023
2def8cb
factor a bit
cheme Mar 30, 2023
1fc155b
use a stack struct
cheme Mar 30, 2023
a4e6a03
init a test
cheme Mar 30, 2023
a902d93
don t rely on codec output
cheme Mar 30, 2023
3e21351
~ check for full node, need debugging, then need restart impl and test,
cheme Mar 30, 2023
989011c
factor code a bit
cheme Mar 31, 2023
03e0b8e
missing err
cheme Mar 31, 2023
0339177
iter on verify
cheme Mar 31, 2023
9a900bb
fix
cheme Mar 31, 2023
549edea
fix basis tests.
cheme Mar 31, 2023
446fcf6
fixing key and avoid unsafe (smallvec internally).
cheme Mar 31, 2023
c6484cd
some api
cheme Mar 31, 2023
8d7e804
in progress, better halt handling
cheme Mar 31, 2023
062fafc
fix full state restart
cheme Apr 1, 2023
bd19ee4
proto restart
cheme Apr 1, 2023
c1c2a47
fix
cheme Apr 2, 2023
fe0d312
ok for full range
cheme Apr 2, 2023
d3edf03
working but extension
cheme Apr 2, 2023
147d2c0
fix record after seek
cheme Apr 2, 2023
ad23a49
api
cheme Apr 3, 2023
e44c8f5
more api change
cheme Apr 3, 2023
e92a75a
multiple on value iter check incremental
cheme Apr 3, 2023
adb970b
impl iteration iterative check.
cheme Apr 3, 2023
2cc716c
limited cache support
cheme Apr 11, 2023
1e7b790
compact proof record, no halting
cheme Apr 12, 2023
3119bf2
compact no restore with all threshold
cheme Apr 12, 2023
818e67b
fix
cheme Apr 13, 2023
8bffb85
extension requires refact, TODO later
cheme Apr 13, 2023
7f8342d
iterative
cheme Apr 14, 2023
a384795
check for concate of partial proofs
cheme Apr 14, 2023
44ef72c
compact fine
cheme Apr 14, 2023
f9e9971
restore test
cheme Apr 18, 2023
b09b50d
change trait
cheme Apr 18, 2023
3ff93b0
write proof (need to access inline next)
cheme Apr 19, 2023
8a28b5c
put iter out of main function
cheme Apr 19, 2023
d6bf22e
access inline (broken)
cheme Apr 19, 2023
f5bb146
initial code
cheme Apr 19, 2023
6b3244c
TODO hash only access to implement and test
cheme Apr 28, 2023
2b8403a
pass hash only to access value
cheme May 2, 2023
60d0268
skip record in favor of hash
cheme May 2, 2023
e1277be
hash
cheme May 2, 2023
b35169b
test full iter batch
cheme May 2, 2023
b043815
fix a bit ops
cheme May 2, 2023
786295d
add substrate v1
cheme May 3, 2023
0ce65c4
mark inline for content
cheme May 3, 2023
209b854
switch
cheme May 3, 2023
5971330
factor and fix
cheme May 3, 2023
b08708a
ok full content (TODO partial ones)
cheme May 3, 2023
b78b836
public
cheme May 3, 2023
5140a38
more pub
cheme May 3, 2023
24ec3f9
fix
cheme May 3, 2023
4928623
fix fix
cheme May 3, 2023
dc69303
some api to restart
cheme May 3, 2023
e40823a
test case for multi
cheme May 5, 2023
5d5603a
ok first
cheme May 5, 2023
3bbf2d2
unused param
cheme Jun 13, 2023
38a4622
fix some warnings
cheme Jun 13, 2023
9ea09ac
rem scale codec dependency
cheme Jun 13, 2023
da82a7d
plug content read iter (unimpl)
cheme Jun 14, 2023
de946ec
pop on next
cheme Jun 14, 2023
2bf158a
pending
cheme Jun 14, 2023
b9c4172
some impl
cheme Jun 14, 2023
c6a8e1d
iter no resume ok
cheme Jun 14, 2023
f18a7d1
switch from recorder to stack
cheme Jun 15, 2023
97c7440
halted state as mut ptr
cheme Jun 15, 2023
6545b06
some fixes
cheme Jun 15, 2023
93998b8
mark hash to avoid useless keypop
cheme Jun 15, 2023
5481493
fixes, awkward
cheme Jun 15, 2023
7bcabbe
split test
cheme Jun 15, 2023
a380028
split a bit
cheme Jun 15, 2023
8c52ce5
fix warns
cheme Jun 15, 2023
afa9425
move test and fuzzing logic
cheme Jun 16, 2023
0398bf1
fuzzing
cheme Jun 16, 2023
fa6f27c
use check proof in test
cheme Jun 16, 2023
aa0821a
fuzzer and test for full node no limit.
cheme Jun 16, 2023
f5ea967
fix
cheme Jun 16, 2023
c9d81c1
fail (attempt to iter prefix on untouched prefix).
cheme Jun 16, 2023
5bfd50e
fix prefix not fully stacked
cheme Jun 19, 2023
3a110e6
transition between values is broken.
cheme Jun 19, 2023
1264641
start rewrite
cheme Jun 21, 2023
bc8e6ac
simplify by moving seek correctly
cheme Jun 21, 2023
fa16709
prev asumption do not hold
cheme Jun 21, 2023
c830a30
fix next condition (content is not)
cheme Jun 22, 2023
86d37a3
some fixes
cheme Jun 22, 2023
185c305
register all after start at
cheme Jun 22, 2023
e77ef00
stack into don t need moving slice query at all
cheme Jun 22, 2023
8806d49
fix logic
cheme Jun 23, 2023
418adb8
fix
cheme Jun 23, 2023
eda16fe
fuzz for split (need to rework the iteration logic: is faster than no…
cheme Jun 23, 2023
b407d90
fix initial condition
cheme Jun 23, 2023
310e60c
failing fuzz
cheme Jun 23, 2023
2ae891a
better logic
cheme Jun 23, 2023
df5fd7c
update criterion
cheme Jun 23, 2023
5eca055
add query plan check (broken (start and end prefix are not emitted)).
cheme Jun 23, 2023
40b80b2
naive implementation
cheme Jun 23, 2023
4bd7bc1
fix a bit more
cheme Jun 23, 2023
d137293
a fix
cheme Jun 27, 2023
ce6eb29
fix query plan iter
cheme Jun 27, 2023
e087947
fix
cheme Jun 27, 2023
f0f4123
fix, into means follows child ix.
cheme Jun 27, 2023
39f044b
different approach
cheme Jun 28, 2023
9b50c3a
clean
cheme Jun 28, 2023
eb939e6
add fuzzers
cheme Jun 29, 2023
3f5d83c
fix fuzzer.
cheme Jun 29, 2023
3e0b1ea
error
cheme Jun 29, 2023
19d4c53
fix but root not checked
cheme Jun 30, 2023
b0a26f5
fix check of root
cheme Jun 30, 2023
900c1a3
cache already use
cheme Jun 30, 2023
6636a69
next issue
cheme Jun 30, 2023
e1d4ec0
unstack missing start update.
cheme Jun 30, 2023
8d992e9
cleaning
cheme Jul 3, 2023
a29509f
bad copy pasting, need rewrite
cheme Jul 3, 2023
1f56d19
useless check, will be done on sequence and at value
cheme Jul 3, 2023
8970ae8
start, next fix hash only.
cheme Jul 3, 2023
11393a6
it ok
cheme Jul 4, 2023
952b9da
more
cheme Jul 4, 2023
78dae9e
directio
cheme Jul 4, 2023
b5fff03
more
cheme Jul 4, 2023
74be877
pass full iter on content, next split
cheme Jul 4, 2023
1d90e0d
more
cheme Jul 5, 2023
b57a378
cannot find if halted due to inline nodes.
cheme Jul 5, 2023
cf55be9
suspend proof op
cheme Jul 5, 2023
2ca04b8
store inline children to return.
cheme Jul 7, 2023
363cd1b
plug process inline unimplemented call
cheme Jul 7, 2023
589157f
inline iterator test
cheme Jul 7, 2023
361c742
fix a bit
cheme Jul 31, 2023
debdb30
verify content need rewrite: way too many state variable, also:
cheme Jul 31, 2023
fff5dde
Removing content proof code.
cheme Aug 1, 2023
7d2406d
rem useless is_inlie
cheme Aug 1, 2023
e537914
rem ignore unordered
cheme Aug 1, 2023
5fa784d
remove proof recorder trait.
cheme Aug 1, 2023
e094f75
nostd
cheme Aug 1, 2023
99f62cf
rem switch query plan into
cheme Aug 1, 2023
794c176
std
cheme Aug 1, 2023
82fe104
rem todos
cheme Aug 1, 2023
f18da5d
mod errors
cheme Aug 1, 2023
6d0a279
error
cheme Aug 1, 2023
eedbf84
error not verify error
cheme Aug 1, 2023
b139440
more errro
cheme Aug 1, 2023
2a5e464
clean
cheme Aug 1, 2023
9cb92a1
no more record inline node
cheme Aug 1, 2023
df72ed4
kind rather than is_compact
cheme Aug 1, 2023
290a56a
more
cheme Aug 1, 2023
8e51c25
no more todos
cheme Aug 1, 2023
3c305e3
restore some changes
cheme Aug 1, 2023
d42fd14
restore no cache previous behavior
cheme Aug 1, 2023
d218181
fix imports warnings
cheme Aug 1, 2023
e262647
renaming
cheme Aug 1, 2023
cfd1ccd
clean a bit more
cheme Aug 1, 2023
be88436
fmt
cheme Aug 1, 2023
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
2 changes: 1 addition & 1 deletion hash256-std-hasher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ harness = false
crunchy = "0.2.1"

[dev-dependencies]
criterion = "0.4.0"
criterion = "0.5.1"

[features]
default = ["std"]
Expand Down
2 changes: 1 addition & 1 deletion memory-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ hash-db = { version = "0.16.0", path = "../hash-db", default-features = false }

[dev-dependencies]
keccak-hasher = { path = "../test-support/keccak-hasher" }
criterion = "0.4.0"
criterion = "0.5.1"

[features]
default = ["std"]
Expand Down
2 changes: 1 addition & 1 deletion test-support/reference-trie/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ paste = "1.0.12"

[dev-dependencies]
trie-bench = { path = "../trie-bench" }
criterion = "0.4.0"
criterion = "0.5.1"

[[bench]]
name = "bench"
Expand Down
6 changes: 6 additions & 0 deletions test-support/reference-trie/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ macro_rules! test_layouts {
($test:ident, $test_internal:ident) => {
#[test]
fn $test() {
eprintln!("Running with layout `SubstrateV1`");
$test_internal::<$crate::SubstrateV1<$crate::RefHasher>>();
eprintln!("Running with layout `HashedValueNoExtThreshold`");
$test_internal::<$crate::HashedValueNoExtThreshold<1>>();
eprintln!("Running with layout `HashedValueNoExt`");
Expand Down Expand Up @@ -599,6 +601,8 @@ impl<'a> Input for ByteSliceInput<'a> {
// `const HASHED_NULL_NODE: <KeccakHasher as Hasher>::Out = <KeccakHasher as Hasher>::Out( … … )`.
// Perhaps one day soon?
impl<H: Hasher> NodeCodec for ReferenceNodeCodec<H> {
const DELTA_COMPACT_OMITTED_NODE: usize = 32;
const DELTA_COMPACT_OMITTED_VALUE: usize = 30;
type Error = CodecError;
type HashOut = H::Out;

Expand Down Expand Up @@ -753,6 +757,8 @@ impl<H: Hasher> NodeCodec for ReferenceNodeCodec<H> {
}

impl<H: Hasher> NodeCodec for ReferenceNodeCodecNoExt<H> {
const DELTA_COMPACT_OMITTED_NODE: usize = 32;
const DELTA_COMPACT_OMITTED_VALUE: usize = 30;
type Error = CodecError;
type HashOut = <H as Hasher>::Out;

Expand Down
2 changes: 2 additions & 0 deletions test-support/reference-trie/src/substrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ impl<H> NodeCodecT for NodeCodec<H>
where
H: Hasher,
{
const DELTA_COMPACT_OMITTED_NODE: usize = 32;
const DELTA_COMPACT_OMITTED_VALUE: usize = 30;
const ESCAPE_HEADER: Option<u8> = Some(trie_constants::ESCAPE_COMPACT_HEADER);
type Error = Error<H::Out>;
type HashOut = H::Out;
Expand Down
2 changes: 2 additions & 0 deletions test-support/reference-trie/src/substrate_like.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ impl<H> NodeCodecT for NodeCodec<H>
where
H: Hasher,
{
const DELTA_COMPACT_OMITTED_NODE: usize = 32;
const DELTA_COMPACT_OMITTED_VALUE: usize = 30;
const ESCAPE_HEADER: Option<u8> = Some(trie_constants::ESCAPE_COMPACT_HEADER);
type Error = Error;
type HashOut = H::Out;
Expand Down
2 changes: 1 addition & 1 deletion test-support/trie-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ hash-db = { path = "../../hash-db" , version = "0.16.0"}
memory-db = { path = "../../memory-db", version = "0.32.0" }
trie-root = { path = "../../trie-root", version = "0.18.0" }
trie-db = { path = "../../trie-db", version = "0.27.0" }
criterion = "0.4.0"
criterion = "0.5.1"
parity-scale-codec = "3.0.0"
19 changes: 19 additions & 0 deletions trie-db/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ memory-db = { path = "../../memory-db", version = "0.32.0" }
reference-trie = { path = "../../test-support/reference-trie", version = "0.29.0" }
arbitrary = { version = "1.3.0", features = ["derive"] }
array-bytes = "6.0.0"
lazy_static = "1.4.0"

[dependencies.trie-db]
path = ".."
[dependencies.trie-db-test]
path = "../test"

[dependencies.libfuzzer-sys]
version = "0.4.6"
Expand Down Expand Up @@ -68,3 +71,19 @@ path = "fuzz_targets/trie_proof_invalid.rs"
[[bin]]
name = "prefix_seek_iter"
path = "fuzz_targets/prefix_seek_iter.rs"

[[bin]]
name = "query_plan_1"
path = "fuzz_targets/query_plan_1.rs"

[[bin]]
name = "query_plan_2"
path = "fuzz_targets/query_plan_2.rs"

[[bin]]
name = "query_plan_3"
path = "fuzz_targets/query_plan_3.rs"

[[bin]]
name = "query_plan_4"
path = "fuzz_targets/query_plan_4.rs"
2 changes: 1 addition & 1 deletion trie-db/fuzz/fuzz_targets/no_ext_insert.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_main]

use libfuzzer_sys::fuzz_target;
use trie_db_fuzz::fuzz_that_no_extension_insert;
use trie_db_test::fuzz::fuzz_that_no_extension_insert;

fuzz_target!(|data: &[u8]| {
// fuzzed code goes here
Expand Down
2 changes: 1 addition & 1 deletion trie-db/fuzz/fuzz_targets/no_ext_insert_rem.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_main]

use libfuzzer_sys::fuzz_target;
use trie_db_fuzz::fuzz_that_no_extension_insert_remove;
use trie_db_test::fuzz::fuzz_that_no_extension_insert_remove;

fuzz_target!(|data: &[u8]| {
// fuzzed code goes here
Expand Down
2 changes: 1 addition & 1 deletion trie-db/fuzz/fuzz_targets/prefix_iter.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_main]

use libfuzzer_sys::fuzz_target;
use trie_db_fuzz::fuzz_prefix_iter;
use trie_db_test::fuzz::fuzz_prefix_iter;

fuzz_target!(|data: &[u8]| {
fuzz_prefix_iter::<reference_trie::NoExtensionLayout>(data);
Expand Down
2 changes: 1 addition & 1 deletion trie-db/fuzz/fuzz_targets/prefix_seek_iter.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_main]

use libfuzzer_sys::fuzz_target;
use trie_db_fuzz::{fuzz_prefix_seek_iter, PrefixSeekTestInput};
use trie_db_test::fuzz::{fuzz_prefix_seek_iter, PrefixSeekTestInput};

fuzz_target!(|data: PrefixSeekTestInput| {
fuzz_prefix_seek_iter::<reference_trie::SubstrateV1<reference_trie::RefHasher>>(data);
Expand Down
15 changes: 15 additions & 0 deletions trie-db/fuzz/fuzz_targets/query_plan_1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#![no_main]
use lazy_static::lazy_static;
use libfuzzer_sys::fuzz_target;
use reference_trie::{RefHasher, SubstrateV1};
use trie_db_test::fuzz::query_plan::{
build_state, fuzz_query_plan, ArbitraryQueryPlan, FuzzContext, CONF1,
};

lazy_static! {
static ref CONTEXT: FuzzContext<SubstrateV1<RefHasher>> = build_state(CONF1);
}

fuzz_target!(|plan: ArbitraryQueryPlan| {
fuzz_query_plan::<SubstrateV1<RefHasher>>(&CONTEXT, plan);
});
36 changes: 36 additions & 0 deletions trie-db/fuzz/fuzz_targets/query_plan_2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#![no_main]
use lazy_static::lazy_static;
use libfuzzer_sys::fuzz_target;
use reference_trie::{RefHasher, SubstrateV1};
use trie_db_test::fuzz::query_plan::{
build_state, fuzz_query_plan_conf, ArbitraryQueryPlan, FuzzContext, CONF1,
};
use arbitrary::Arbitrary;

lazy_static! {
static ref CONTEXT: FuzzContext<SubstrateV1<RefHasher>> = build_state(CONF1);
}

#[derive(Debug, Clone, Copy, Arbitrary)]
#[repr(usize)]
enum SplitSize {
One = 1,
Two = 2,
Three = 3,
More = 10,
MoreMore = 50,
}

#[derive(Debug, Clone, Copy, Eq, PartialEq, Arbitrary)]
enum SplitKind {
Stateless,
Stateful,
}

fuzz_target!(|input: (ArbitraryQueryPlan, SplitSize, SplitKind)| {
let (plan, split_size, split_kind) = input;
let mut conf = CONTEXT.conf.clone();
conf.limit = split_size as usize;
conf.proof_spawn_with_persistence = split_kind == SplitKind::Stateful;
fuzz_query_plan_conf::<SubstrateV1<RefHasher>>(&CONTEXT, conf, plan);
});
15 changes: 15 additions & 0 deletions trie-db/fuzz/fuzz_targets/query_plan_3.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#![no_main]
use lazy_static::lazy_static;
use libfuzzer_sys::fuzz_target;
use reference_trie::{RefHasher, SubstrateV1};
use trie_db_test::fuzz::query_plan::{
build_state, fuzz_query_plan, ArbitraryQueryPlan, FuzzContext, CONF2,
};

lazy_static! {
static ref CONTEXT: FuzzContext<SubstrateV1<RefHasher>> = build_state(CONF2);
}

fuzz_target!(|plan: ArbitraryQueryPlan| {
fuzz_query_plan::<SubstrateV1<RefHasher>>(&CONTEXT, plan);
});
36 changes: 36 additions & 0 deletions trie-db/fuzz/fuzz_targets/query_plan_4.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#![no_main]
use lazy_static::lazy_static;
use libfuzzer_sys::fuzz_target;
use reference_trie::{RefHasher, SubstrateV1};
use trie_db_test::fuzz::query_plan::{
build_state, fuzz_query_plan_conf, ArbitraryQueryPlan, FuzzContext, CONF2,
};
use arbitrary::Arbitrary;

lazy_static! {
static ref CONTEXT: FuzzContext<SubstrateV1<RefHasher>> = build_state(CONF2);
}

#[derive(Debug, Clone, Copy, Arbitrary)]
#[repr(usize)]
enum SplitSize {
One = 1,
Two = 2,
Three = 3,
More = 10,
MoreMore = 50,
}

#[derive(Debug, Clone, Copy, Eq, PartialEq, Arbitrary)]
enum SplitKind {
Stateless,
Stateful,
}

fuzz_target!(|input: (ArbitraryQueryPlan, SplitSize, SplitKind)| {
let (plan, split_size, split_kind) = input;
let mut conf = CONTEXT.conf.clone();
conf.limit = split_size as usize;
conf.proof_spawn_with_persistence = split_kind == SplitKind::Stateful;
fuzz_query_plan_conf::<SubstrateV1<RefHasher>>(&CONTEXT, conf, plan);
});
2 changes: 1 addition & 1 deletion trie-db/fuzz/fuzz_targets/seek_iter.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_main]

use libfuzzer_sys::fuzz_target;
use trie_db_fuzz::fuzz_seek_iter;
use trie_db_test::fuzz::fuzz_seek_iter;

fuzz_target!(|data: &[u8]| {
fuzz_seek_iter::<reference_trie::NoExtensionLayout>(data);
Expand Down
2 changes: 1 addition & 1 deletion trie-db/fuzz/fuzz_targets/trie_codec_proof.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_main]

use libfuzzer_sys::fuzz_target;
use trie_db_fuzz::fuzz_that_trie_codec_proofs;
use trie_db_test::fuzz::fuzz_that_trie_codec_proofs;

fuzz_target!(|data: &[u8]| {
fuzz_that_trie_codec_proofs::<reference_trie::ExtensionLayout>(data);
Expand Down
2 changes: 1 addition & 1 deletion trie-db/fuzz/fuzz_targets/trie_proof_invalid.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_main]

use libfuzzer_sys::fuzz_target;
use trie_db_fuzz::fuzz_that_verify_rejects_invalid_proofs;
use trie_db_test::fuzz::fuzz_that_verify_rejects_invalid_proofs;

fuzz_target!(|data: &[u8]| {
fuzz_that_verify_rejects_invalid_proofs::<reference_trie::ExtensionLayout>(data);
Expand Down
2 changes: 1 addition & 1 deletion trie-db/fuzz/fuzz_targets/trie_proof_valid.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_main]

use libfuzzer_sys::fuzz_target;
use trie_db_fuzz::fuzz_that_verify_accepts_valid_proofs;
use trie_db_test::fuzz::fuzz_that_verify_accepts_valid_proofs;

fuzz_target!(|data: &[u8]| {
fuzz_that_verify_accepts_valid_proofs::<reference_trie::ExtensionLayout>(data);
Expand Down
2 changes: 1 addition & 1 deletion trie-db/fuzz/fuzz_targets/trie_root.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_main]

use libfuzzer_sys::fuzz_target;
use trie_db_fuzz::fuzz_that_reference_trie_root;
use trie_db_test::fuzz::fuzz_that_reference_trie_root;

fuzz_target!(|data: &[u8]| {
fuzz_that_reference_trie_root::<reference_trie::NoExtensionLayout>(data);
Expand Down
2 changes: 1 addition & 1 deletion trie-db/fuzz/fuzz_targets/trie_root_fix_len.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_main]

use libfuzzer_sys::fuzz_target;
use trie_db_fuzz::fuzz_that_reference_trie_root_fix_length;
use trie_db_test::fuzz::fuzz_that_reference_trie_root_fix_length;

fuzz_target!(|data: &[u8]| {
fuzz_that_reference_trie_root_fix_length::<reference_trie::NoExtensionLayout>(data);
Expand Down
2 changes: 1 addition & 1 deletion trie-db/fuzz/fuzz_targets/trie_root_new.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_main]

use libfuzzer_sys::fuzz_target;
use trie_db_fuzz::fuzz_that_compare_implementations;
use trie_db_test::fuzz::fuzz_that_compare_implementations;

fuzz_target!(|data: &[u8]| {
// fuzzed code goes here
Expand Down
14 changes: 13 additions & 1 deletion trie-db/src/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,18 @@ enum Status {

#[cfg_attr(feature = "std", derive(Debug))]
#[derive(Eq, PartialEq)]
struct Crumb<H: Hasher> {
pub struct Crumb<H: Hasher> {
hash: Option<H::Out>,
node: Arc<OwnedNode<DBValue>>,
status: Status,
}

impl<H: Hasher> Clone for Crumb<H> {
fn clone(&self) -> Self {
Self { hash: self.hash.clone(), node: self.node.clone(), status: self.status.clone() }
}
}

impl<H: Hasher> Crumb<H> {
/// Move on to next status in the node's sequence.
fn increment(&mut self) {
Expand All @@ -64,6 +70,12 @@ pub struct TrieDBRawIterator<L: TrieLayout> {
key_nibbles: NibbleVec,
}

impl<L: TrieLayout> Clone for TrieDBRawIterator<L> {
fn clone(&self) -> Self {
Self { trail: self.trail.clone(), key_nibbles: self.key_nibbles.clone() }
}
}

impl<L: TrieLayout> TrieDBRawIterator<L> {
/// Create a new empty iterator.
pub fn empty() -> Self {
Expand Down
1 change: 1 addition & 0 deletions trie-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ use node::NodeOwned;

pub mod node;
pub mod proof;
pub mod query_plan;
pub mod recorder;
pub mod sectriedb;
pub mod sectriedbmut;
Expand Down
3 changes: 0 additions & 3 deletions trie-db/src/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ where
NodeOwned::Leaf(slice, value) =>
return if partial == *slice {
let value = (*value).clone();
drop(node);
load_value_owned(
value,
nibble_key.original_data_as_prefix(),
Expand Down Expand Up @@ -395,7 +394,6 @@ where
NodeOwned::Branch(children, value) =>
if partial.is_empty() {
return if let Some(value) = value.clone() {
drop(node);
load_value_owned(
value,
nibble_key.original_data_as_prefix(),
Expand Down Expand Up @@ -433,7 +431,6 @@ where

if partial.len() == slice.len() {
return if let Some(value) = value.clone() {
drop(node);
load_value_owned(
value,
nibble_key.original_data_as_prefix(),
Expand Down
Loading