Skip to content

Commit

Permalink
Implemented a workaround to bypass the [issue](rust-lang/cargo#8170).
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanYuan committed Aug 28, 2023
1 parent 5f0304b commit df3e332
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
15 changes: 9 additions & 6 deletions util/hash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ homepage = "https://github.com/nervosnetwork/ckb"
repository = "https://github.com/nervosnetwork/ckb"

[features]
default = []
ckb-contract = [] # This feature is used for CKB contract development
default = ["blake2b"]
ckb-contract = ["blake2b-ref"] # This feature is used for CKB contract development

[target.'cfg(not(any(target_arch = "wasm32", features = "ckb-contract")))'.dependencies]
blake2b = { package = "blake2b-rs", version = "0.2" }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
blake2b = { package = "blake2b-rs", version = "0.2", optional = true }

[target.'cfg(any(target_arch = "wasm32", features = "ckb-contract"))'.dependencies]
blake2b = { package = "blake2b-ref", version = "0.2.0" }
[target.'cfg(target_arch = "wasm32")'.dependencies]
blake2b = { package = "blake2b-ref", version = "0.2.0", optional = true }

[dependencies]
blake2b-ref = { version = "0.2.0", optional = true }
3 changes: 3 additions & 0 deletions util/hash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@

#![no_std]

#[cfg(feature = "default")]
pub use blake2b::{Blake2b, Blake2bBuilder};
#[cfg(feature = "ckb-contract")]
pub use blake2b_ref::{Blake2b, Blake2bBuilder};

#[doc(hidden)]
pub const BLAKE2B_KEY: &[u8] = &[];
Expand Down

0 comments on commit df3e332

Please sign in to comment.