From 68cf88fba4f8b17bc871032e2384fc8bea6e7d79 Mon Sep 17 00:00:00 2001 From: Eval EXEC Date: Fri, 29 Sep 2023 09:43:57 +0800 Subject: [PATCH] Introduce `blake2b-wasm` as crate alias of `blake2b-ref` Signed-off-by: Eval EXEC --- util/hash/Cargo.toml | 13 +++++++++---- util/hash/src/lib.rs | 6 +++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/util/hash/Cargo.toml b/util/hash/Cargo.toml index 95cc8bb2e7..5cf389749b 100644 --- a/util/hash/Cargo.toml +++ b/util/hash/Cargo.toml @@ -9,9 +9,14 @@ homepage = "https://github.com/nervosnetwork/ckb" repository = "https://github.com/nervosnetwork/ckb" [features] -default = ["blake2b-ref", "blake2b-rs"] -ckb-contract = ["blake2b-ref"] # This feature is used for CKB contract development +default = ["blake2b-wasm", "blake2b-native"] +ckb-contract = ["blake2b-wasm"] # This feature is used for CKB contract development + +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +blake2b-native = {package="blake2b-rs", version = "0.2", optional = true} + +[target.'cfg(target_arch = "wasm32")'.dependencies] +blake2b-wasm = { package="blake2b-ref", version = "0.3", optional = true} [dependencies] -blake2b-ref = { version = "0.3", optional = true} -blake2b-rs = { version = "0.2", optional = true} +blake2b-wasm = { package="blake2b-ref", version = "0.3", optional = true} diff --git a/util/hash/src/lib.rs b/util/hash/src/lib.rs index b988f041f5..ddf3fc4ae3 100644 --- a/util/hash/src/lib.rs +++ b/util/hash/src/lib.rs @@ -10,13 +10,13 @@ #![no_std] #[cfg(feature = "ckb-contract")] -pub use blake2b_ref::{Blake2b, Blake2bBuilder}; +pub use blake2b_wasm::{Blake2b, Blake2bBuilder}; #[cfg(all(not(feature = "ckb-contract"), target_arch = "wasm32"))] -pub use blake2b_ref::{Blake2b, Blake2bBuilder}; +pub use blake2b_wasm::{Blake2b, Blake2bBuilder}; #[cfg(all(not(feature = "ckb-contract"), not(target_arch = "wasm32")))] -pub use blake2b_rs::{Blake2b, Blake2bBuilder}; +pub use blake2b_native::{Blake2b, Blake2bBuilder}; #[doc(hidden)] pub const BLAKE2B_KEY: &[u8] = &[];