Skip to content

Commit

Permalink
Merge pull request #4172 from eval-exec/exec/fix-cargo-metadata
Browse files Browse the repository at this point in the history
Fix `ckb-hash` depends `blake2b-ref` multiple times
  • Loading branch information
quake authored Oct 5, 2023
2 parents 922516e + 58d4219 commit c441010
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,17 @@ bench-test:

.PHONY: ci
ci: ## Run recipes for CI.
ci: fmt clippy test bench-test check-cargotoml check-whitespaces check-dirty-rpc-doc security-audit check-crates check-licenses
ci: fmt clippy test bench-test check-cargo-metadata check-cargotoml check-whitespaces check-dirty-rpc-doc security-audit check-crates check-licenses
git diff --exit-code Cargo.lock

.PHONY: check-cargotoml
check-cargotoml:
./devtools/ci/check-cargotoml.sh

.PHONY: check-cargo-metadata
check-cargo-metadata: ## Check cargo metadata is success
cargo metadata --format-version 1 --all-features --manifest-path ./Cargo.toml &> /dev/null

.PHONY: check-whitespace
check-whitespaces:
git -c core.whitespace=-blank-at-eof diff-index --check --cached $$(git rev-parse --verify master 2>/dev/null || echo "4b825dc642cb6eb9a060e54bf8d69288fbee4904") --
Expand Down
8 changes: 4 additions & 4 deletions util/hash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ homepage = "https://github.com/nervosnetwork/ckb"
repository = "https://github.com/nervosnetwork/ckb"

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

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

[target.'cfg(target_arch = "wasm32")'.dependencies]
blake2b = { package = "blake2b-ref", version = "0.3", optional = true }
blake2b-ref = { version = "0.3", optional = true }

[dependencies]
blake2b-ref = { version = "0.3", optional = true }
blake2b-ref = { version = "0.3", optional = true }
8 changes: 6 additions & 2 deletions util/hash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@

#![no_std]

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

#[cfg(all(not(feature = "ckb-contract"), target_arch = "wasm32"))]
pub use blake2b_ref::{Blake2b, Blake2bBuilder};

#[cfg(all(not(feature = "ckb-contract"), not(target_arch = "wasm32")))]
pub use blake2b_rs::{Blake2b, Blake2bBuilder};

#[doc(hidden)]
pub const BLAKE2B_KEY: &[u8] = &[];
/// Output digest size.
Expand Down

0 comments on commit c441010

Please sign in to comment.