change HashFor to HashingFor (#2828)

* change HashFor to HashingFor

* update lockfile for {"substrate", "polkadot"}

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
Marijn Schouten
2023-07-25 19:42:42 +02:00
committed by GitHub
parent bc5a52678a
commit c1b95feaac
7 changed files with 282 additions and 281 deletions
@@ -19,7 +19,7 @@ use cumulus_primitives_core::{
relay_chain, AbridgedHostConfiguration, AbridgedHrmpChannel, ParaId,
};
use scale_info::TypeInfo;
use sp_runtime::traits::HashFor;
use sp_runtime::traits::HashingFor;
use sp_state_machine::{Backend, TrieBackend, TrieBackendBuilder};
use sp_std::vec::Vec;
use sp_trie::{HashDBT, MemoryDB, StorageProof, EMPTY_PREFIX};
@@ -114,7 +114,7 @@ pub enum ReadEntryErr {
fn read_entry<T, B>(backend: &B, key: &[u8], fallback: Option<T>) -> Result<T, ReadEntryErr>
where
T: Decode,
B: Backend<HashFor<relay_chain::Block>>,
B: Backend<HashingFor<relay_chain::Block>>,
{
backend
.storage(key)
@@ -133,7 +133,7 @@ where
fn read_optional_entry<T, B>(backend: &B, key: &[u8]) -> Result<Option<T>, ReadEntryErr>
where
T: Decode,
B: Backend<HashFor<relay_chain::Block>>,
B: Backend<HashingFor<relay_chain::Block>>,
{
match read_entry(backend, key, None) {
Ok(v) => Ok(Some(v)),
@@ -147,7 +147,8 @@ where
/// This state proof is extracted from the relay chain block we are building on top of.
pub struct RelayChainStateProof {
para_id: ParaId,
trie_backend: TrieBackend<MemoryDB<HashFor<relay_chain::Block>>, HashFor<relay_chain::Block>>,
trie_backend:
TrieBackend<MemoryDB<HashingFor<relay_chain::Block>>, HashingFor<relay_chain::Block>>,
}
impl RelayChainStateProof {
@@ -160,7 +161,7 @@ impl RelayChainStateProof {
relay_parent_storage_root: relay_chain::Hash,
proof: StorageProof,
) -> Result<Self, Error> {
let db = proof.into_memory_db::<HashFor<relay_chain::Block>>();
let db = proof.into_memory_db::<HashingFor<relay_chain::Block>>();
if !db.contains(&relay_parent_storage_root, EMPTY_PREFIX) {
return Err(Error::RootMismatch)
}
@@ -30,17 +30,17 @@ use frame_support::traits::{ExecuteBlock, ExtrinsicCall, Get, IsSubType};
use sp_core::storage::{ChildInfo, StateVersion};
use sp_externalities::{set_and_run_with_externalities, Externalities};
use sp_io::KillStorageResult;
use sp_runtime::traits::{Block as BlockT, Extrinsic, HashFor, Header as HeaderT};
use sp_runtime::traits::{Block as BlockT, Extrinsic, HashingFor, Header as HeaderT};
use sp_std::prelude::*;
use sp_trie::MemoryDB;
type TrieBackend<B> = sp_state_machine::TrieBackend<
MemoryDB<HashFor<B>>,
HashFor<B>,
trie_cache::CacheProvider<HashFor<B>>,
MemoryDB<HashingFor<B>>,
HashingFor<B>,
trie_cache::CacheProvider<HashingFor<B>>,
>;
type Ext<'a, B> = sp_state_machine::Ext<'a, HashFor<B>, TrieBackend<B>>;
type Ext<'a, B> = sp_state_machine::Ext<'a, HashingFor<B>, TrieBackend<B>>;
fn with_externalities<F: FnOnce(&mut dyn Externalities) -> R, R>(f: F) -> R {
sp_externalities::with_externalities(f).expect("Environmental externalities not set.")