mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 17:11:02 +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
@@ -21,10 +21,7 @@
|
||||
use super::*;
|
||||
use codec::Decode;
|
||||
use sp_std::prelude::*;
|
||||
use sp_runtime::{
|
||||
traits::{Dispatchable, BlakeTwo256, IdentityLookup},
|
||||
testing::{H256, Header},
|
||||
};
|
||||
use sp_runtime::{traits::{BlakeTwo256, IdentityLookup}, testing::{H256, Header}};
|
||||
use frame_support::{dispatch::DispatchResult, decl_module, impl_outer_origin};
|
||||
use frame_system::{RawOrigin, ensure_signed, ensure_none};
|
||||
|
||||
@@ -166,4 +163,4 @@ fn benchmarks_macro_works_for_non_dispatchable() {
|
||||
).expect("failed to create closure");
|
||||
|
||||
assert_eq!(closure(), Ok(()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ where
|
||||
let mut buf = Vec::new();
|
||||
storage_root.using_encoded(|encoded| buf.extend_from_slice(encoded));
|
||||
buf.extend_from_slice(code_hash.as_ref());
|
||||
RawTombstoneContractInfo(Hasher::hash(&buf[..]), PhantomData)
|
||||
RawTombstoneContractInfo(<Hasher as Hash>::hash(&buf[..]), PhantomData)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
use sp_std::prelude::*;
|
||||
use codec::{Encode, Decode};
|
||||
use sp_runtime::KeyTypeId;
|
||||
use sp_runtime::traits::{Convert, OpaqueKeys, Hash as HashT};
|
||||
use sp_runtime::traits::{Convert, OpaqueKeys};
|
||||
use frame_support::{decl_module, decl_storage};
|
||||
use frame_support::{Parameter, print};
|
||||
use sp_trie::{MemoryDB, Trie, TrieMut, Recorder, EMPTY_PREFIX};
|
||||
@@ -155,14 +155,12 @@ impl<T: Trait, I> crate::SessionManager<T::ValidatorId> for NoteHistoricalRoot<T
|
||||
}
|
||||
}
|
||||
|
||||
type HasherOf<T> = <<T as frame_system::Trait>::Hashing as HashT>::Hasher;
|
||||
|
||||
/// A tuple of the validator's ID and their full identification.
|
||||
pub type IdentificationTuple<T> = (<T as crate::Trait>::ValidatorId, <T as Trait>::FullIdentification);
|
||||
|
||||
/// a trie instance for checking and generating proofs.
|
||||
pub struct ProvingTrie<T: Trait> {
|
||||
db: MemoryDB<HasherOf<T>>,
|
||||
db: MemoryDB<T::Hashing>,
|
||||
root: T::Hash,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user