Skip to content

Commit eab05bf

Browse files
committed
initial commit
0 parents  commit eab05bf

File tree

8 files changed

+428
-0
lines changed

8 files changed

+428
-0
lines changed

.github/workflows/cargo.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Cargo
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
# Make sure CI fails on all warnings
10+
env:
11+
RUSTFLAGS: "-Dwarnings"
12+
13+
jobs:
14+
check:
15+
name: Check
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions-rs/toolchain@v1
20+
with:
21+
profile: minimal
22+
toolchain: stable
23+
override: true
24+
components: rustfmt, clippy
25+
26+
- name: Check formatting
27+
uses: actions-rs/cargo@v1
28+
with:
29+
command: fmt
30+
args: --all -- --check
31+
32+
- name: Run clippy
33+
uses: actions-rs/cargo@v1
34+
with:
35+
command: clippy
36+
37+
- name: Build (default features)
38+
uses: actions-rs/cargo@v1
39+
with:
40+
command: build
41+
args: --verbose
42+
43+
- name: Build (append-only feature)
44+
uses: actions-rs/cargo@v1
45+
with:
46+
command: build
47+
args: --verbose --features append-only
48+
49+
- name: Run tests (default features)
50+
uses: actions-rs/cargo@v1
51+
with:
52+
command: test
53+
args: --verbose
54+
55+
- name: Run tests (append-only feature)
56+
uses: actions-rs/cargo@v1
57+
with:
58+
command: test
59+
args: --verbose --features append-only

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

Cargo.lock

Lines changed: 226 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[package]
2+
name = "lean-imt"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[features]
7+
append-only = [] # Append-only tree operations. Recommended for zkVM programs.
8+
9+
[dependencies]
10+
serde = { version = "1.0.218", features = ["derive"] }
11+
12+
[dev-dependencies]
13+
rand = "0.8.5"
14+
sha2 = "0.10.8"

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# LeanIMT
2+
3+
A [lean incremental Merkle tree](https://hackmd.io/@vplasencia/S1whLBN16) is a Merkle tree designed to be updated efficiently by minimizing the number of hash calculations. Such construction is useful both for onchain applications and zkVMs, where hash functions can be quite expensive to prove.
4+
5+
This library contains a binary lean incremental Merkle tree implementation in Rust, based on [Semaphore's implementation](https://github.com/privacy-scaling-explorations/zk-kit/blob/main/packages/lean-imt/src/lean-imt.ts). The library is designed to be used both inside and outside zkVM programs.

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mod proof;
2+
3+
pub use proof::*;

0 commit comments

Comments
 (0)