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
@@ -16,7 +16,7 @@
//! Block import helpers.
use sp_runtime::traits::{Block as BlockT, DigestItemFor, Header as HeaderT, NumberFor, HasherFor};
use sp_runtime::traits::{Block as BlockT, DigestItemFor, Header as HeaderT, NumberFor, HashFor};
use sp_runtime::Justification;
use serde::{Serialize, Deserialize};
use std::borrow::Cow;
@@ -139,7 +139,7 @@ pub struct BlockImportParams<Block: BlockT, Transaction> {
/// The changes to the storage to create the state for the block. If this is `Some(_)`,
/// the block import will not need to re-execute the block for importing it.
pub storage_changes: Option<
sp_state_machine::StorageChanges<Transaction, HasherFor<Block>, NumberFor<Block>>
sp_state_machine::StorageChanges<Transaction, HashFor<Block>, NumberFor<Block>>
>,
/// Is this block finalized already?
/// `true` implies instant finality.
@@ -32,7 +32,7 @@ use std::sync::Arc;
use std::time::Duration;
use sp_runtime::{
generic::BlockId, traits::{Block as BlockT, DigestFor, NumberFor, HasherFor},
generic::BlockId, traits::{Block as BlockT, DigestFor, NumberFor, HashFor},
};
use futures::prelude::*;
pub use sp_inherents::InherentData;
@@ -93,7 +93,7 @@ pub struct Proposal<Block: BlockT, Transaction> {
/// Optional proof that was recorded while building the block.
pub proof: Option<sp_state_machine::StorageProof>,
/// The storage changes while building this block.
pub storage_changes: sp_state_machine::StorageChanges<Transaction, HasherFor<Block>, NumberFor<Block>>,
pub storage_changes: sp_state_machine::StorageChanges<Transaction, HashFor<Block>, NumberFor<Block>>,
}
/// Used as parameter to [`Proposer`] to tell the requirement on recording a proof.