Reduce usage of Blake2Hasher (#5132)

This reduces the usage of `Blake2Hasher` in the code base and replaces
it with `BlakeTwo256`. The most important change is the removal of the
custom extern function for `Blake2Hasher`. The runtime `Hash` trait is
now also simplified and directly requires that the implementing type
implements `Hashable`.
This commit is contained in:
Benjamin Kampmann
2020-03-05 08:51:03 +01:00
committed by GitHub
parent 406fa981bb
commit 5a33228ea9
64 changed files with 372 additions and 451 deletions
+3 -9
View File
@@ -20,14 +20,8 @@ use frame_support::{
traits::Currency,
weights::GetDispatchInfo,
};
use sp_core::{
Blake2Hasher, NeverNativeValue, map,
storage::Storage,
};
use sp_runtime::{
Fixed64, Perbill,
traits::Convert,
};
use sp_core::{NeverNativeValue, map, storage::Storage};
use sp_runtime::{Fixed64, Perbill, traits::{Convert, BlakeTwo256}};
use node_runtime::{
CheckedExtrinsic, Call, Runtime, Balances, TransactionPayment, TransactionBaseFee,
TransactionByteFee, WeightFeeCoefficient,
@@ -136,7 +130,7 @@ fn transaction_fee_is_correct_ultimate() {
// - 1 MILLICENTS in substrate node.
// - 1 milli-dot based on current polkadot runtime.
// (this baed on assigning 0.1 CENT to the cheapest tx with `weight = 100`)
let mut t = TestExternalities::<Blake2Hasher>::new_with_code(COMPACT_CODE, Storage {
let mut t = TestExternalities::<BlakeTwo256>::new_with_code(COMPACT_CODE, Storage {
top: map![
<frame_system::Account<Runtime>>::hashed_key_for(alice()) => {
(0u32, 0u8, 100 * DOLLARS, 0 * DOLLARS, 0 * DOLLARS, 0 * DOLLARS).encode()