Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
change HashFor to HashingFor
Browse files Browse the repository at this point in the history
  • Loading branch information
deepink-mas committed Jul 5, 2023
1 parent bf07cd8 commit 9d7e74c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions client/collator/src/service.rs
Expand Up @@ -24,7 +24,7 @@ use sc_client_api::BlockBackend;
use sp_api::{ApiExt, ProvideRuntimeApi};
use sp_consensus::BlockStatus;
use sp_core::traits::SpawnNamed;
use sp_runtime::traits::{Block as BlockT, HashFor, Header as HeaderT, Zero};
use sp_runtime::traits::{Block as BlockT, HashingFor, Header as HeaderT, Zero};

use cumulus_client_consensus_common::ParachainCandidate;
use polkadot_node_primitives::{
Expand Down Expand Up @@ -213,7 +213,7 @@ where

let compact_proof = match candidate
.proof
.into_compact_proof::<HashFor<Block>>(*parent_header.state_root())
.into_compact_proof::<HashingFor<Block>>(*parent_header.state_root())
{
Ok(proof) => proof,
Err(e) => {
Expand Down
4 changes: 2 additions & 2 deletions client/consensus/aura/src/unstable_reimpl.rs
Expand Up @@ -55,7 +55,7 @@ use sp_inherents::{CreateInherentDataProviders, InherentData, InherentDataProvid
use sp_keystore::KeystorePtr;
use sp_runtime::{
generic::Digest,
traits::{Block as BlockT, HashFor, Header as HeaderT, Member},
traits::{Block as BlockT, HashingFor, Header as HeaderT, Member},
};
use sp_state_machine::StorageChanges;
use std::{convert::TryFrom, error::Error, fmt::Debug, hash::Hash, sync::Arc, time::Duration};
Expand Down Expand Up @@ -318,7 +318,7 @@ async fn create_inherent_data<B: BlockT>(

fn seal<B: BlockT, T, P>(
pre_sealed: B,
storage_changes: StorageChanges<T, HashFor<B>>,
storage_changes: StorageChanges<T, HashingFor<B>>,
author_pub: &P::Public,
keystore: &KeystorePtr,
) -> Result<BlockImportParams<B, T>, Box<dyn Error>>
Expand Down
10 changes: 5 additions & 5 deletions pallets/parachain-system/src/relay_state_snapshot.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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)
Expand All @@ -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)),
Expand All @@ -147,7 +147,7 @@ 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 {
Expand All @@ -160,7 +160,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)
}
Expand Down
6 changes: 3 additions & 3 deletions pallets/parachain-system/src/validate_block/implementation.rs
Expand Up @@ -30,13 +30,13 @@ 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>>;
type TrieBackend<B> = sp_state_machine::TrieBackend<MemoryDB<HashingFor<B>>, 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.")
Expand Down
2 changes: 1 addition & 1 deletion polkadot-parachain/src/rpc.rs
Expand Up @@ -59,7 +59,7 @@ where
C::Api: BlockBuilder<Block>,
P: TransactionPool + Sync + Send + 'static,
B: sc_client_api::Backend<Block> + Send + Sync + 'static,
B::State: sc_client_api::backend::StateBackend<sp_runtime::traits::HashFor<Block>>,
B::State: sc_client_api::backend::StateBackend<sp_runtime::traits::HashingFor<Block>>,
{
use frame_rpc_system::{System, SystemApiServer};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
Expand Down
4 changes: 2 additions & 2 deletions test/relay-sproof-builder/src/lib.rs
Expand Up @@ -18,7 +18,7 @@ use cumulus_primitives_core::{
relay_chain, AbridgedHostConfiguration, AbridgedHrmpChannel, ParaId,
};
use polkadot_primitives::UpgradeGoAhead;
use sp_runtime::traits::HashFor;
use sp_runtime::traits::HashingFor;
use sp_state_machine::MemoryDB;
use sp_std::collections::btree_map::BTreeMap;

Expand Down Expand Up @@ -104,7 +104,7 @@ impl RelayStateSproofBuilder {
pub fn into_state_root_and_proof(
self,
) -> (polkadot_primitives::Hash, sp_state_machine::StorageProof) {
let (db, root) = MemoryDB::<HashFor<polkadot_primitives::Block>>::default_with_root();
let (db, root) = MemoryDB::<HashingFor<polkadot_primitives::Block>>::default_with_root();
let state_version = Default::default(); // for test using default.
let mut backend = sp_state_machine::TrieBackendBuilder::new(db, root).build();

Expand Down

0 comments on commit 9d7e74c

Please sign in to comment.