Skip to content

Commit 156a759

Browse files
committed
Implemented a workaround to bypass the [issue](rust-lang/cargo#8170).
1 parent d9549ab commit 156a759

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

util/gen-types/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ check-data = []
2020
# Enable the `serialized-size` extension for CKB contract development in `no-std` env
2121
serialized-size = ["calc-hash"]
2222
# Enable all in `std` env
23-
std = ["molecule/std", "ckb-hash", "ckb-fixed-hash", "ckb-error", "ckb-occupied-capacity", "numext-fixed-uint"]
23+
std = ["molecule/std", "ckb-hash/default", "ckb-fixed-hash", "ckb-error", "ckb-occupied-capacity", "numext-fixed-uint"]
2424

2525
[dependencies]
2626
cfg-if = "1.0"
27-
ckb-hash = { path = "../hash", version = "= 0.111.0-rc11" }
2827
molecule = { version = "0.7.5", default-features = false }
28+
ckb-hash = { path = "../hash", version = "= 0.111.0-rc11", default-features = false, optional = true }
2929
ckb-fixed-hash = { path = "../fixed-hash", version = "= 0.111.0-rc11", optional = true }
3030
ckb-error = { path = "../../error", version = "= 0.111.0-rc11", optional = true }
3131
ckb-occupied-capacity = { path = "../occupied-capacity", version = "= 0.111.0-rc11", optional = true }

util/hash/Cargo.toml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ homepage = "https://github.com/nervosnetwork/ckb"
99
repository = "https://github.com/nervosnetwork/ckb"
1010

1111
[features]
12-
default = []
13-
ckb-contract = [] # This feature is used for CKB contract development
12+
default = ["blake2b"]
13+
ckb-contract = ["blake2b-ref"] # This feature is used for CKB contract development
1414

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

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

util/hash/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
1010
#![no_std]
1111

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

1417
#[doc(hidden)]
1518
pub const BLAKE2B_KEY: &[u8] = &[];

0 commit comments

Comments
 (0)