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

Feat: covert the merkle path from celestia to nmt_rs. #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ borsh = { version = "1" }
serde_json = "1.0.96"
postcard = { version = "1.0.4", features = ["use-std"] }
tendermint = { version = "0.35.0" }
hex = "0.4.3"

[features]
default = ["std"]
Expand Down
16 changes: 16 additions & 0 deletions src/simple_merkle/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,19 @@ impl<H: Eq + Hash> PreimageWriter<H> for NoopDb {
}

impl<H: Default + Eq + Hash> PreimageDb<H> for NoopDb {}

#[cfg(test)]
mod test {
#[test]
fn test_mem_db() {
use super::*;
let mut db = MemDb::<u32>::default();
let leaf = Node::Leaf(vec![1, 2, 3]);
db.put(1, leaf.clone());
assert_eq!(db.get(&1), Some(&leaf));

let node = Node::Inner(1, 2);
db.put(2, node.clone());
assert_eq!(db.get(&2), Some(&node));
}
}
Loading