mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 07:37:57 +00:00
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:
committed by
GitHub
parent
406fa981bb
commit
5a33228ea9
@@ -19,7 +19,7 @@
|
||||
use sp_api::{ApiExt, ProvideRuntimeApi};
|
||||
use sp_core::ChangesTrieConfiguration;
|
||||
use sc_client_api::backend;
|
||||
use sp_runtime::traits::HasherFor;
|
||||
use sp_runtime::traits::HashFor;
|
||||
|
||||
use sc_block_builder::BlockBuilderApi;
|
||||
|
||||
@@ -50,7 +50,7 @@ impl<'a, A, B> BlockBuilderExt for sc_block_builder::BlockBuilder<'a, substrate_
|
||||
B: backend::Backend<substrate_test_runtime::Block>,
|
||||
// Rust bug: https://github.com/rust-lang/rust/issues/24159
|
||||
backend::StateBackendFor<B, substrate_test_runtime::Block>:
|
||||
sp_api::StateBackend<HasherFor<substrate_test_runtime::Block>>,
|
||||
sp_api::StateBackend<HashFor<substrate_test_runtime::Block>>,
|
||||
{
|
||||
fn push_transfer(&mut self, transfer: substrate_test_runtime::Transfer) -> Result<(), sp_blockchain::Error> {
|
||||
self.push(transfer.into_signed_tx())
|
||||
|
||||
@@ -33,7 +33,7 @@ pub use self::block_builder_ext::BlockBuilderExt;
|
||||
use sp_core::{sr25519, ChangesTrieConfiguration};
|
||||
use sp_core::storage::{ChildInfo, Storage, StorageChild};
|
||||
use substrate_test_runtime::genesismap::{GenesisConfig, additional_storage_with_genesis};
|
||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Hash as HashT, NumberFor, HasherFor};
|
||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Hash as HashT, NumberFor, HashFor};
|
||||
use sc_client::{
|
||||
light::fetcher::{
|
||||
Fetcher,
|
||||
@@ -82,7 +82,7 @@ pub type LightExecutor = sc_client::light::call_executor::GenesisCallExecutor<
|
||||
sc_client::LocalCallExecutor<
|
||||
sc_client::light::backend::Backend<
|
||||
sc_client_db::light::LightStorage<substrate_test_runtime::Block>,
|
||||
HasherFor<substrate_test_runtime::Block>
|
||||
HashFor<substrate_test_runtime::Block>
|
||||
>,
|
||||
NativeExecutor<LocalExecutor>
|
||||
>
|
||||
@@ -243,7 +243,7 @@ impl<B> TestClientBuilderExt<B> for TestClientBuilder<
|
||||
B: sc_client_api::backend::Backend<substrate_test_runtime::Block> + 'static,
|
||||
// Rust bug: https://github.com/rust-lang/rust/issues/24159
|
||||
<B as sc_client_api::backend::Backend<substrate_test_runtime::Block>>::State:
|
||||
sp_api::StateBackend<HasherFor<substrate_test_runtime::Block>>,
|
||||
sp_api::StateBackend<HashFor<substrate_test_runtime::Block>>,
|
||||
{
|
||||
fn genesis_init_mut(&mut self) -> &mut GenesisParameters {
|
||||
Self::genesis_init_mut(self)
|
||||
|
||||
@@ -29,7 +29,7 @@ use sc_client_api::blockchain::{Backend as BlockChainBackendT, HeaderBackend};
|
||||
use substrate_test_client::sp_consensus::BlockOrigin;
|
||||
use substrate_test_runtime::{self, Transfer};
|
||||
use sp_runtime::generic::BlockId;
|
||||
use sp_runtime::traits::{Block as BlockT, HasherFor};
|
||||
use sp_runtime::traits::{Block as BlockT, HashFor};
|
||||
use sc_block_builder::BlockBuilderProvider;
|
||||
|
||||
/// helper to test the `leaves` implementation for various backends
|
||||
@@ -37,7 +37,7 @@ pub fn test_leaves_for_backend<B: 'static>(backend: Arc<B>) where
|
||||
B: backend::Backend<substrate_test_runtime::Block>,
|
||||
// Rust bug: https://github.com/rust-lang/rust/issues/24159
|
||||
backend::StateBackendFor<B, substrate_test_runtime::Block>:
|
||||
sp_api::StateBackend<HasherFor<substrate_test_runtime::Block>>,
|
||||
sp_api::StateBackend<HashFor<substrate_test_runtime::Block>>,
|
||||
{
|
||||
// block tree:
|
||||
// G -> A1 -> A2 -> A3 -> A4 -> A5
|
||||
@@ -206,7 +206,7 @@ pub fn test_children_for_backend<B: 'static>(backend: Arc<B>) where
|
||||
B: backend::LocalBackend<substrate_test_runtime::Block>,
|
||||
// Rust bug: https://github.com/rust-lang/rust/issues/24159
|
||||
<B as backend::Backend<substrate_test_runtime::Block>>::State:
|
||||
sp_api::StateBackend<HasherFor<substrate_test_runtime::Block>>,
|
||||
sp_api::StateBackend<HashFor<substrate_test_runtime::Block>>,
|
||||
{
|
||||
// block tree:
|
||||
// G -> A1 -> A2 -> A3 -> A4 -> A5
|
||||
@@ -336,7 +336,7 @@ pub fn test_blockchain_query_by_number_gets_canonical<B: 'static>(backend: Arc<B
|
||||
B: backend::LocalBackend<substrate_test_runtime::Block>,
|
||||
// Rust bug: https://github.com/rust-lang/rust/issues/24159
|
||||
<B as backend::Backend<substrate_test_runtime::Block>>::State:
|
||||
sp_api::StateBackend<HasherFor<substrate_test_runtime::Block>>,
|
||||
sp_api::StateBackend<HashFor<substrate_test_runtime::Block>>,
|
||||
{
|
||||
// block tree:
|
||||
// G -> A1 -> A2 -> A3 -> A4 -> A5
|
||||
|
||||
Reference in New Issue
Block a user