Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: replace sha2 crate by sp_core::hashing for pallet-alliance
  • Loading branch information
yjhmelody committed Mar 3, 2023
commit da00eef6e96e058f60cb4e48c707224cf1934130
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions frame/alliance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
array-bytes = { version = "4.1", optional = true }
sha2 = { version = "0.10.1", default-features = false, optional = true }
log = { version = "0.4.14", default-features = false }

codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = ["derive"] }
Expand All @@ -34,7 +33,6 @@ pallet-collective = { version = "4.0.0-dev", path = "../collective", default-fea

[dev-dependencies]
array-bytes = "4.1"
sha2 = "0.10.1"
pallet-balances = { version = "4.0.0-dev", path = "../balances" }
pallet-collective = { version = "4.0.0-dev", path = "../collective" }

Expand All @@ -56,7 +54,6 @@ std = [
]
runtime-benchmarks = [
"array-bytes",
"sha2",
"frame-benchmarking/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"frame-support/runtime-benchmarks",
Expand Down
7 changes: 2 additions & 5 deletions frame/alliance/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,8 @@ fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::
}

fn cid(input: impl AsRef<[u8]>) -> Cid {
use sha2::{Digest, Sha256};
let mut hasher = Sha256::new();
hasher.update(input);
let result = hasher.finalize();
Cid::new_v0(&*result)
let result = sp_core::hashing::sha2_256(input.as_ref());
Cid::new_v0(result)
}

fn rule(input: impl AsRef<[u8]>) -> Cid {
Expand Down
7 changes: 2 additions & 5 deletions frame/alliance/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,8 @@ pub fn new_bench_ext() -> sp_io::TestExternalities {
}

pub fn test_cid() -> Cid {
use sha2::{Digest, Sha256};
let mut hasher = Sha256::new();
hasher.update(b"hello world");
let result = hasher.finalize();
Cid::new_v0(&*result)
let result = sp_core::hashing::sha2_256(b"hello world");
Cid::new_v0(result)
}

pub fn make_remark_proposal(value: u64) -> (RuntimeCall, u32, H256) {
Expand Down