Skip to content

Commit

Permalink
Initial sealable trie implementation (#1)
Browse files Browse the repository at this point in the history
As per the documentation, the sealable trie data structure is a Merkle
Patricia Trie with an additional feature where values can be sealed
such that they can no longer be changed but also can no longer be
accessed.  The second property allows the trie to remove nodes keeping
sealed values thus reducing storage requirements for the trie.

As often is the case, there’s room to add more tests to the code, but
for the large part the trie is functional.
  • Loading branch information
mina86 authored Aug 14, 2023
1 parent 8e514e6 commit 0d0928b
Show file tree
Hide file tree
Showing 19 changed files with 4,238 additions and 13 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
name: PR Checks
on:
pull_request:
branches:
- '*'
push:
branches:
- master

jobs:
misc:
name: Miscellaneous checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt

- name: Check formatting
run: cargo fmt --all --check

- name: Install cargo-deny
run: cargo install cargo-deny

- name: Check bans
run: cargo-deny --all-features check bans

stable:
name: Rust stable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt

- name: Run tests
run: cargo test

nightly:
name: Rust nightly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: miri

- name: Run tests
run: cargo test

- name: Run tests with Miri
run: cargo miri test -- --skip ::stress_test
26 changes: 13 additions & 13 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# binop_separator = "Back"
# blank_lines_lower_bound = 0
# blank_lines_upper_bound = 3
# brace_style = "PreferSameLine"
# color = "Auto"
# condense_wildcard_suffixes = true
# fn_single_line = true
# format_macro_matchers = true
# format_strings = true
# group_imports = "StdExternalCrate"
# normalize_doc_attributes = true
# overflow_delimited_expr = true

binop_separator = "Back"
blank_lines_lower_bound = 0
blank_lines_upper_bound = 3
color = "Auto"
condense_wildcard_suffixes = true
fn_single_line = true
format_macro_matchers = true
format_strings = true
group_imports = "StdExternalCrate"
imports_granularity = "Module"
max_width = 80
newline_style = "Unix"
normalize_doc_attributes = true
overflow_delimited_expr = true
reorder_imports = true
reorder_modules = true
use_field_init_shorthand = true
use_small_heuristics = "Max"
use_try_shorthand = true
19 changes: 19 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[workspace.package]
version = "0.0.0"
authors = ["Michal Nazarewicz <[email protected]>"]
edition = "2021"
rust-version = "1.71.0"

[workspace]
members = [
"sealable-trie",
]
resolver = "2"

[workspace.dependencies]
base64 = { version = "0.21", default-features = false, features = ["alloc"] }
derive_more = "0.99.17"
pretty_assertions = "1.4.0"
rand = { version = "0.8.5" }
sha2 = { version = "0.10.7", default-features = false }
strum = { version = "0.25.0", default-features = false, features = ["derive"] }
12 changes: 12 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[sources]
unknown-registry = "deny"
unknown-git = "deny"
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
allow-git = []

[bans]
multiple-versions = "deny"
skip = [
# derive_more still uses old syn
{ name = "syn", version = "1.0.*" },
]
14 changes: 14 additions & 0 deletions sealable-trie/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "sealable-trie"
version = "0.0.0"
edition = "2021"

[dependencies]
base64.workspace = true
derive_more.workspace = true
sha2.workspace = true
strum.workspace = true

[dev-dependencies]
pretty_assertions.workspace = true
rand.workspace = true
Loading

0 comments on commit 0d0928b

Please sign in to comment.