Skip to content

Commit

Permalink
switch to single subtrie crate dep (#1)
Browse files Browse the repository at this point in the history
Maintain a single 'subtrie' crate.
  • Loading branch information
cheme authored Apr 2, 2024
1 parent 2af70c2 commit 61c6261
Show file tree
Hide file tree
Showing 98 changed files with 5,213 additions and 4,601 deletions.
18 changes: 6 additions & 12 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

steps:
- name: Checkout Sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -37,29 +37,23 @@ jobs:
command: test
args: --workspace

- name: Check trie-db Without Std
- name: Check subtrie Without Std
uses: actions-rs/cargo@v1
with:
command: check
args: --manifest-path trie-db/Cargo.toml --no-default-features
args: --manifest-path subtrie/Cargo.toml --no-default-features

- name: Check memory-db Without Std
- name: Check subtrie-test With bench
uses: actions-rs/cargo@v1
with:
command: check
args: --manifest-path memory-db/Cargo.toml --no-default-features

- name: Check trie-root Without Std
uses: actions-rs/cargo@v1
with:
command: check
args: --manifest-path trie-root/Cargo.toml --no-default-features
args: --manifest-path test/Cargo.toml --benches

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand Down
15 changes: 3 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
[workspace]
members = [
"hash-db",
"memory-db",
"hash256-std-hasher",
"test-support/keccak-hasher",
"test-support/reference-trie",
"test-support/trie-standardmap",
"test-support/trie-bench",
"trie-db",
"trie-db/test",
"trie-eip1186",
"trie-eip1186/test",
"trie-root",
"trie-root/test"
"subtrie",
"test",
"reference-trie",
]
33 changes: 2 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,11 @@
A generic implementation of the Base-16 Modified Merkle Tree ("Trie") data structure,
provided under the Apache2 license.

The implementation comes in two formats:

- Trie DB (`trie-db` crate) which can be combined with a backend database to provide
a persistent trie structure whose contents can be modified and whose root hash
is recalculated efficiently.
- Trie Root (`trie-root` crate) which provides a closed-form function that accepts a
enumeration of keys and values and provides a root calculated entirely in-memory and
closed form.

Trie Hash alone is able to be used in `no_std` builds by disabling its (default)
`std` feature.
Implementation is in `subtrie` crate.

In addition to these, several support crates are provided:

- `hash-db` crate, used to provide `Hasher` (trait for all things that
can make cryptographic hashes) and `HashDB` (trait for databases that can have byte
slices pushed into them and allow for them to be retrieved based on their hash).
Suitable for `no_std`, though in this case will only provide `Hasher`.
- `memory-db` crate, contains `MemoryDB`, an implementation of a `HashDB` using only
in in-memory map.
- `hash256-std-hasher` crate, an implementation of a `std::hash::Hasher` for 32-byte
keys that have already been hashed. Useful to build the backing `HashMap` for `MemoryDB`.

There are also three crates used only for testing:

- `keccak-hasher` crate, an implementation of `Hasher` based on the Keccak-256 algorithm.
- `reference-trie` crate, an implementation of a simple trie format; this provides both
a `NodeCodec` and `TrieStream` implementation making it suitable for both Trie DB and
Trie Root.
- `trie-standardmap` crate, a key/value generation tool for creating large test datasets
to specific qualities.
- `trie-bench` crate, a comprehensive standard benchmarking tool for trie format
implementations. Works using the `criterion` project so benchmarking can be done with
the stable rustc branch.
Testing in `reference-trie` crate and `trie-db-test`.

In the spirit of all things Rust, this aims to be reliable, secure, and high performance.

Expand Down
10 changes: 0 additions & 10 deletions hash-db/CHANGELOG.md

This file was deleted.

14 changes: 0 additions & 14 deletions hash-db/Cargo.toml

This file was deleted.

4 changes: 0 additions & 4 deletions hash-db/README.md

This file was deleted.

216 changes: 0 additions & 216 deletions hash-db/src/lib.rs

This file was deleted.

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
Loading

0 comments on commit 61c6261

Please sign in to comment.