Skip to content

Commit

Permalink
Fix unit tests and add no-std check
Browse files Browse the repository at this point in the history
  • Loading branch information
en committed Nov 24, 2021
1 parent 2495f91 commit 45b9712
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ codec = { package = "parity-scale-codec", version = "2.0.0", default-features =
hex = { version = "0.4", default-features = false, features = ["alloc"] }
libsecp256k1 = { version = "0.7.0", features = ["static-context"], default-features = false }
mmr-lib = { package = "ckb-merkle-mountain-range", default-features = false, version = "0.3.1" }
# getrandom = { version = "0.2", features = ["js"] }

[dev-dependencies]
hex-literal = "0.3.1"
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
check:
cargo check --no-default-features --target=wasm32-unknown-unknown
2 changes: 0 additions & 2 deletions src/commitment.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#[cfg(not(feature = "std"))]
use alloc::string::String;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
#[cfg(not(feature = "std"))]
use core::cmp;
Expand Down
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ extern crate alloc;
use alloc::string::String;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
#[cfg(not(feature = "std"))]
use core::result;

use beefy_merkle_tree::{merkle_root, verify_proof, Keccak256};
use borsh::{BorshDeserialize, BorshSerialize};
Expand Down
4 changes: 1 addition & 3 deletions src/mmr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
use alloc::vec;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
#[cfg(not(feature = "std"))]
use core::convert::Into;

use crate::BeefyNextAuthoritySet;
use beefy_merkle_tree::{Hash, Keccak256};
Expand Down Expand Up @@ -333,7 +331,7 @@ mod tests {
];

for i in 0..leaves.len() {
assert_eq!(verify_leaf_proof(root, leaves[i].clone(), proofs[i].clone()).is_ok(), true);
assert_eq!(verify_leaf_proof(root, leaves[i].clone(), proofs[i].clone()), Ok(true));
}
}
}

0 comments on commit 45b9712

Please sign in to comment.