-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use new merkle proof structure (#232)
- Loading branch information
Showing
4 changed files
with
132 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
use merkle_cbt::{MerkleProof, MerkleTree, CBMT, H256}; | ||
use merkle_cbt::MerkleProof as ExMerkleProof; | ||
use merkle_cbt::MerkleTree as ExMerkleTree; | ||
use merkle_cbt::CBMT as ExCBMT; | ||
use merkle_cbt::H256; | ||
|
||
pub type MerkleProof = ExMerkleProof<H256>; | ||
pub type MerkleTree = ExMerkleTree<H256>; | ||
pub type CBMT = ExCBMT<H256>; | ||
|
||
pub fn merkle_root(leaves: &[H256]) -> H256 { | ||
CBMT::build_merkle_root(leaves) | ||
} | ||
|
||
pub fn build_merkle_tree(leaves: Vec<H256>) -> MerkleTree<H256> { | ||
pub fn build_merkle_tree(leaves: Vec<H256>) -> MerkleTree { | ||
CBMT::build_merkle_tree(leaves) | ||
} | ||
|
||
pub fn build_merkle_proof(leaves: &[H256], indices: &[usize]) -> Option<MerkleProof<H256>> { | ||
pub fn build_merkle_proof(leaves: &[H256], indices: &[usize]) -> Option<MerkleProof> { | ||
CBMT::build_merkle_proof(leaves, indices) | ||
} |