Skip to content

Commit 2af70c2

Browse files
authored
Fix TrieDBRawIterator::prefix_then_seek (paritytech#190)
* Use libfuzzer-sys from crates.io * Copy-paste substrate's trie layout into the reference trie * Fix `TrieDBRawIterator::prefix_then_seek` * Bump `trie-db` to 0.27.1 and `reference-trie` to 0.29.1 * Update changelogs * Add PR URL to the changelogs
1 parent 5137efe commit 2af70c2

File tree

12 files changed

+1005
-31
lines changed

12 files changed

+1005
-31
lines changed

test-support/reference-trie/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog].
66

77
## [Unreleased]
88

9+
## [0.29.1] - 2023-03-17
10+
- Add substrate trie layouts [#190](https://github.com/paritytech/trie/pull/190)
911

1012
## [0.29.0] - 2023-03-14
1113
- Update dependencies. [#188](https://github.com/paritytech/trie/pull/188) and [#187](https://github.com/paritytech/trie/pull/187)

test-support/reference-trie/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "reference-trie"
3-
version = "0.29.0"
3+
version = "0.29.1"
44
authors = ["Parity Technologies <admin@parity.io>"]
55
description = "Simple reference trie format"
66
repository = "https://github.com/paritytech/trie/"
@@ -14,6 +14,7 @@ trie-db = { path = "../../trie-db", default-features = false, version = "0.27.0"
1414
trie-root = { path = "../../trie-root", default-features = false, version = "0.18.0" }
1515
parity-scale-codec = { version = "3.0.0", features = ["derive"] }
1616
hashbrown = { version = "0.13.2", default-features = false, features = ["ahash"] }
17+
paste = "1.0.12"
1718

1819
[dev-dependencies]
1920
trie-bench = { path = "../trie-bench" }

test-support/reference-trie/src/lib.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use trie_db::{
2828
pub use trie_root::TrieStream;
2929
use trie_root::{Hasher, Value as TrieStreamValue};
3030

31+
mod substrate;
3132
mod substrate_like;
3233
pub mod node {
3334
pub use trie_db::node::Node;
@@ -38,6 +39,9 @@ pub use substrate_like::{
3839
NodeCodec as ReferenceNodeCodecNoExtMeta, ReferenceTrieStreamNoExt,
3940
};
4041

42+
pub use paste::paste;
43+
pub use substrate::{LayoutV0 as SubstrateV0, LayoutV1 as SubstrateV1};
44+
4145
/// Reference hasher is a keccak hasher.
4246
pub type RefHasher = keccak_hasher::KeccakHasher;
4347

@@ -59,6 +63,22 @@ macro_rules! test_layouts {
5963
};
6064
}
6165

66+
#[macro_export]
67+
macro_rules! test_layouts_substrate {
68+
($test:ident) => {
69+
$crate::paste! {
70+
#[test]
71+
fn [<$test _substrate_v0>]() {
72+
$test::<$crate::SubstrateV0<$crate::RefHasher>>();
73+
}
74+
#[test]
75+
fn [<$test _substrate_v1>]() {
76+
$test::<$crate::SubstrateV1<$crate::RefHasher>>();
77+
}
78+
}
79+
};
80+
}
81+
6282
/// Apply a test method on every test layouts.
6383
#[macro_export]
6484
macro_rules! test_layouts_no_meta {

0 commit comments

Comments
 (0)