Associated type Hasher for QueryPreimage, StorePreimage and Bounded (#1720)

I hope it's enough to fix #1701 
the only solution I found to make it happen is to put an associated type
to the `Bounded` enum as well.
@liamaharon @kianenigma @bkchr 

Polkadot address: 12poSUQPtcF1HUPQGY3zZu2P8emuW9YnsPduA4XG3oCEfJVp

---------

Signed-off-by: muraca <mmuraca247@gmail.com>
Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Matteo Muraca
2023-09-27 14:46:14 +02:00
committed by GitHub
parent 7cbe0c76ef
commit 8b061a5c5d
20 changed files with 189 additions and 159 deletions
@@ -25,7 +25,6 @@ use frame_support::{
traits::{Currency, EnsureOrigin, Get, OnInitialize, UnfilteredDispatchable},
};
use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin};
use sp_core::H256;
use sp_runtime::{traits::Bounded, BoundedVec};
use crate::Pallet as Democracy;
@@ -46,7 +45,7 @@ fn make_proposal<T: Config>(n: u32) -> BoundedCallOf<T> {
<T as Config>::Preimages::bound(call).unwrap()
}
fn add_proposal<T: Config>(n: u32) -> Result<H256, &'static str> {
fn add_proposal<T: Config>(n: u32) -> Result<T::Hash, &'static str> {
let other = funded_account::<T>("proposer", n);
let value = T::MinimumDeposit::get();
let proposal = make_proposal::<T>(n);
@@ -55,7 +54,7 @@ fn add_proposal<T: Config>(n: u32) -> Result<H256, &'static str> {
}
// add a referendum with a metadata.
fn add_referendum<T: Config>(n: u32) -> (ReferendumIndex, H256, PreimageHash) {
fn add_referendum<T: Config>(n: u32) -> (ReferendumIndex, T::Hash, T::Hash) {
let vote_threshold = VoteThreshold::SimpleMajority;
let proposal = make_proposal::<T>(n);
let hash = proposal.hash();
@@ -85,7 +84,7 @@ fn assert_has_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
}
// note a new preimage.
fn note_preimage<T: Config>() -> PreimageHash {
fn note_preimage<T: Config>() -> T::Hash {
use core::sync::atomic::{AtomicU8, Ordering};
use sp_std::borrow::Cow;
// note a new preimage on every function invoke.