From e5ed764d391fa2f4b119cd24767d2d75567ada43 Mon Sep 17 00:00:00 2001
From: Shawn Tabrizi <shawntabrizi@gmail.com>
Date: Sat, 13 Aug 2022 16:07:10 +0100
Subject: [PATCH] Add Benchmarking Instance to Pallets (#12026)

* benchmark instance

* add benchmark instance to conviction voting

* instance on bags list

* fmt
---
 substrate/frame/bags-list/src/benchmarks.rs   |   6 +-
 .../conviction-voting/src/benchmarking.rs     | 117 ++---
 substrate/frame/referenda/src/benchmarking.rs | 408 +++++++++---------
 3 files changed, 266 insertions(+), 265 deletions(-)

diff --git a/substrate/frame/bags-list/src/benchmarks.rs b/substrate/frame/bags-list/src/benchmarks.rs
index dba0c9ee1e6..bb45da076f7 100644
--- a/substrate/frame/bags-list/src/benchmarks.rs
+++ b/substrate/frame/bags-list/src/benchmarks.rs
@@ -25,7 +25,7 @@ use frame_support::{assert_ok, traits::Get};
 use frame_system::RawOrigin as SystemOrigin;
 use sp_runtime::traits::One;
 
-frame_benchmarking::benchmarks! {
+frame_benchmarking::benchmarks_instance_pallet! {
 	rebag_non_terminal {
 		// An expensive case for rebag-ing (rebag a non-terminal node):
 		//
@@ -97,7 +97,7 @@ frame_benchmarking::benchmarks! {
 
 		// clear any pre-existing storage.
 		// NOTE: safe to call outside block production
-		List::<T>::unsafe_clear();
+		List::<T, I>::unsafe_clear();
 
 		// define our origin and destination thresholds.
 		let origin_bag_thresh = T::BagThresholds::get()[0];
@@ -146,7 +146,7 @@ frame_benchmarking::benchmarks! {
 
 		// clear any pre-existing storage.
 		// NOTE: safe to call outside block production
-		List::<T>::unsafe_clear();
+		List::<T, I>::unsafe_clear();
 
 		let bag_thresh = T::BagThresholds::get()[0];
 
diff --git a/substrate/frame/conviction-voting/src/benchmarking.rs b/substrate/frame/conviction-voting/src/benchmarking.rs
index 53ac7a07302..d4727708324 100644
--- a/substrate/frame/conviction-voting/src/benchmarking.rs
+++ b/substrate/frame/conviction-voting/src/benchmarking.rs
@@ -20,7 +20,7 @@
 use super::*;
 
 use assert_matches::assert_matches;
-use frame_benchmarking::{account, benchmarks, whitelist_account};
+use frame_benchmarking::{account, benchmarks_instance_pallet, whitelist_account};
 use frame_support::{
 	dispatch::RawOrigin,
 	traits::{fungible, Currency, Get},
@@ -34,8 +34,9 @@ const SEED: u32 = 0;
 
 /// Fill all classes as much as possible up to `MaxVotes` and return the Class with the most votes
 /// ongoing.
-fn fill_voting<T: Config>() -> (ClassOf<T>, BTreeMap<ClassOf<T>, Vec<IndexOf<T>>>) {
-	let mut r = BTreeMap::<ClassOf<T>, Vec<IndexOf<T>>>::new();
+fn fill_voting<T: Config<I>, I: 'static>(
+) -> (ClassOf<T, I>, BTreeMap<ClassOf<T, I>, Vec<IndexOf<T, I>>>) {
+	let mut r = BTreeMap::<ClassOf<T, I>, Vec<IndexOf<T, I>>>::new();
 	for class in T::Polls::classes().into_iter() {
 		for _ in 0..T::MaxVotes::get() {
 			match T::Polls::create_ongoing(class.clone()) {
@@ -48,34 +49,34 @@ fn fill_voting<T: Config>() -> (ClassOf<T>, BTreeMap<ClassOf<T>, Vec<IndexOf<T>>
 	(c, r)
 }
 
-fn funded_account<T: Config>(name: &'static str, index: u32) -> T::AccountId {
+fn funded_account<T: Config<I>, I: 'static>(name: &'static str, index: u32) -> T::AccountId {
 	let caller: T::AccountId = account(name, index, SEED);
-	T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
+	T::Currency::make_free_balance_be(&caller, BalanceOf::<T, I>::max_value());
 	caller
 }
 
-fn account_vote<T: Config>(b: BalanceOf<T>) -> AccountVote<BalanceOf<T>> {
+fn account_vote<T: Config<I>, I: 'static>(b: BalanceOf<T, I>) -> AccountVote<BalanceOf<T, I>> {
 	let v = Vote { aye: true, conviction: Conviction::Locked1x };
 
 	AccountVote::Standard { vote: v, balance: b }
 }
 
-benchmarks! {
+benchmarks_instance_pallet! {
 	where_clause {  where T::MaxVotes: core::fmt::Debug }
 
 	vote_new {
-		let caller = funded_account::<T>("caller", 0);
+		let caller = funded_account::<T, I>("caller", 0);
 		whitelist_account!(caller);
-		let account_vote = account_vote::<T>(100u32.into());
+		let account_vote = account_vote::<T, I>(100u32.into());
 
-		let (class, all_polls) = fill_voting::<T>();
+		let (class, all_polls) = fill_voting::<T, I>();
 		let polls = &all_polls[&class];
 		let r = polls.len() - 1;
 		// We need to create existing votes
 		for i in polls.iter().skip(1) {
-			ConvictionVoting::<T>::vote(RawOrigin::Signed(caller.clone()).into(), *i, account_vote)?;
+			ConvictionVoting::<T, I>::vote(RawOrigin::Signed(caller.clone()).into(), *i, account_vote)?;
 		}
-		let votes = match VotingFor::<T>::get(&caller, &class) {
+		let votes = match VotingFor::<T, I>::get(&caller, &class) {
 			Voting::Casting(Casting { votes, .. }) => votes,
 			_ => return Err("Votes are not direct".into()),
 		};
@@ -85,52 +86,52 @@ benchmarks! {
 	}: vote(RawOrigin::Signed(caller.clone()), index, account_vote)
 	verify {
 		assert_matches!(
-			VotingFor::<T>::get(&caller, &class),
+			VotingFor::<T, I>::get(&caller, &class),
 			Voting::Casting(Casting { votes, .. }) if votes.len() == (r + 1) as usize
 		);
 	}
 
 	vote_existing {
-		let caller = funded_account::<T>("caller", 0);
+		let caller = funded_account::<T, I>("caller", 0);
 		whitelist_account!(caller);
-		let old_account_vote = account_vote::<T>(100u32.into());
+		let old_account_vote = account_vote::<T, I>(100u32.into());
 
-		let (class, all_polls) = fill_voting::<T>();
+		let (class, all_polls) = fill_voting::<T, I>();
 		let polls = &all_polls[&class];
 		let r = polls.len();
 		// We need to create existing votes
 		for i in polls.iter() {
-			ConvictionVoting::<T>::vote(RawOrigin::Signed(caller.clone()).into(), *i, old_account_vote)?;
+			ConvictionVoting::<T, I>::vote(RawOrigin::Signed(caller.clone()).into(), *i, old_account_vote)?;
 		}
-		let votes = match VotingFor::<T>::get(&caller, &class) {
+		let votes = match VotingFor::<T, I>::get(&caller, &class) {
 			Voting::Casting(Casting { votes, .. }) => votes,
 			_ => return Err("Votes are not direct".into()),
 		};
 		assert_eq!(votes.len(), r, "Votes were not recorded.");
 
-		let new_account_vote = account_vote::<T>(200u32.into());
+		let new_account_vote = account_vote::<T, I>(200u32.into());
 		let index = polls[0];
 	}: vote(RawOrigin::Signed(caller.clone()), index, new_account_vote)
 	verify {
 		assert_matches!(
-			VotingFor::<T>::get(&caller, &class),
+			VotingFor::<T, I>::get(&caller, &class),
 			Voting::Casting(Casting { votes, .. }) if votes.len() == r as usize
 		);
 	}
 
 	remove_vote {
-		let caller = funded_account::<T>("caller", 0);
+		let caller = funded_account::<T, I>("caller", 0);
 		whitelist_account!(caller);
-		let old_account_vote = account_vote::<T>(100u32.into());
+		let old_account_vote = account_vote::<T, I>(100u32.into());
 
-		let (class, all_polls) = fill_voting::<T>();
+		let (class, all_polls) = fill_voting::<T, I>();
 		let polls = &all_polls[&class];
 		let r = polls.len();
 		// We need to create existing votes
 		for i in polls.iter() {
-			ConvictionVoting::<T>::vote(RawOrigin::Signed(caller.clone()).into(), *i, old_account_vote)?;
+			ConvictionVoting::<T, I>::vote(RawOrigin::Signed(caller.clone()).into(), *i, old_account_vote)?;
 		}
-		let votes = match VotingFor::<T>::get(&caller, &class) {
+		let votes = match VotingFor::<T, I>::get(&caller, &class) {
 			Voting::Casting(Casting { votes, .. }) => votes,
 			_ => return Err("Votes are not direct".into()),
 		};
@@ -140,25 +141,25 @@ benchmarks! {
 	}: _(RawOrigin::Signed(caller.clone()), Some(class.clone()), index)
 	verify {
 		assert_matches!(
-			VotingFor::<T>::get(&caller, &class),
+			VotingFor::<T, I>::get(&caller, &class),
 			Voting::Casting(Casting { votes, .. }) if votes.len() == (r - 1) as usize
 		);
 	}
 
 	remove_other_vote {
-		let caller = funded_account::<T>("caller", 0);
-		let voter = funded_account::<T>("caller", 0);
+		let caller = funded_account::<T, I>("caller", 0);
+		let voter = funded_account::<T, I>("caller", 0);
 		whitelist_account!(caller);
-		let old_account_vote = account_vote::<T>(100u32.into());
+		let old_account_vote = account_vote::<T, I>(100u32.into());
 
-		let (class, all_polls) = fill_voting::<T>();
+		let (class, all_polls) = fill_voting::<T, I>();
 		let polls = &all_polls[&class];
 		let r = polls.len();
 		// We need to create existing votes
 		for i in polls.iter() {
-			ConvictionVoting::<T>::vote(RawOrigin::Signed(voter.clone()).into(), *i, old_account_vote)?;
+			ConvictionVoting::<T, I>::vote(RawOrigin::Signed(voter.clone()).into(), *i, old_account_vote)?;
 		}
-		let votes = match VotingFor::<T>::get(&caller, &class) {
+		let votes = match VotingFor::<T, I>::get(&caller, &class) {
 			Voting::Casting(Casting { votes, .. }) => votes,
 			_ => return Err("Votes are not direct".into()),
 		};
@@ -169,7 +170,7 @@ benchmarks! {
 	}: _(RawOrigin::Signed(caller.clone()), voter.clone(), class.clone(), index)
 	verify {
 		assert_matches!(
-			VotingFor::<T>::get(&voter, &class),
+			VotingFor::<T, I>::get(&voter, &class),
 			Voting::Casting(Casting { votes, .. }) if votes.len() == (r - 1) as usize
 		);
 	}
@@ -177,44 +178,44 @@ benchmarks! {
 	delegate {
 		let r in 0 .. T::MaxVotes::get().min(T::Polls::max_ongoing().1);
 
-		let all_polls = fill_voting::<T>().1;
+		let all_polls = fill_voting::<T, I>().1;
 		let class = T::Polls::max_ongoing().0;
 		let polls = &all_polls[&class];
-		let voter = funded_account::<T>("voter", 0);
-		let caller = funded_account::<T>("caller", 0);
+		let voter = funded_account::<T, I>("voter", 0);
+		let caller = funded_account::<T, I>("caller", 0);
 		whitelist_account!(caller);
 
-		let delegated_balance: BalanceOf<T> = 1000u32.into();
-		let delegate_vote = account_vote::<T>(delegated_balance);
+		let delegated_balance: BalanceOf<T, I> = 1000u32.into();
+		let delegate_vote = account_vote::<T, I>(delegated_balance);
 
 		// We need to create existing delegations
 		for i in polls.iter().take(r as usize) {
-			ConvictionVoting::<T>::vote(RawOrigin::Signed(voter.clone()).into(), *i, delegate_vote)?;
+			ConvictionVoting::<T, I>::vote(RawOrigin::Signed(voter.clone()).into(), *i, delegate_vote)?;
 		}
 		assert_matches!(
-			VotingFor::<T>::get(&voter, &class),
+			VotingFor::<T, I>::get(&voter, &class),
 			Voting::Casting(Casting { votes, .. }) if votes.len() == r as usize
 		);
 
 	}: _(RawOrigin::Signed(caller.clone()), class.clone(), voter, Conviction::Locked1x, delegated_balance)
 	verify {
-		assert_matches!(VotingFor::<T>::get(&caller, &class), Voting::Delegating(_));
+		assert_matches!(VotingFor::<T, I>::get(&caller, &class), Voting::Delegating(_));
 	}
 
 	undelegate {
 		let r in 0 .. T::MaxVotes::get().min(T::Polls::max_ongoing().1);
 
-		let all_polls = fill_voting::<T>().1;
+		let all_polls = fill_voting::<T, I>().1;
 		let class = T::Polls::max_ongoing().0;
 		let polls = &all_polls[&class];
-		let voter = funded_account::<T>("voter", 0);
-		let caller = funded_account::<T>("caller", 0);
+		let voter = funded_account::<T, I>("voter", 0);
+		let caller = funded_account::<T, I>("caller", 0);
 		whitelist_account!(caller);
 
-		let delegated_balance: BalanceOf<T> = 1000u32.into();
-		let delegate_vote = account_vote::<T>(delegated_balance);
+		let delegated_balance: BalanceOf<T, I> = 1000u32.into();
+		let delegate_vote = account_vote::<T, I>(delegated_balance);
 
-		ConvictionVoting::<T>::delegate(
+		ConvictionVoting::<T, I>::delegate(
 			RawOrigin::Signed(caller.clone()).into(),
 			class.clone(),
 			voter.clone(),
@@ -224,31 +225,31 @@ benchmarks! {
 
 		// We need to create delegations
 		for i in polls.iter().take(r as usize) {
-			ConvictionVoting::<T>::vote(RawOrigin::Signed(voter.clone()).into(), *i, delegate_vote)?;
+			ConvictionVoting::<T, I>::vote(RawOrigin::Signed(voter.clone()).into(), *i, delegate_vote)?;
 		}
 		assert_matches!(
-			VotingFor::<T>::get(&voter, &class),
+			VotingFor::<T, I>::get(&voter, &class),
 			Voting::Casting(Casting { votes, .. }) if votes.len() == r as usize
 		);
-		assert_matches!(VotingFor::<T>::get(&caller, &class), Voting::Delegating(_));
+		assert_matches!(VotingFor::<T, I>::get(&caller, &class), Voting::Delegating(_));
 	}: _(RawOrigin::Signed(caller.clone()), class.clone())
 	verify {
-		assert_matches!(VotingFor::<T>::get(&caller, &class), Voting::Casting(_));
+		assert_matches!(VotingFor::<T, I>::get(&caller, &class), Voting::Casting(_));
 	}
 
 	unlock {
-		let caller = funded_account::<T>("caller", 0);
+		let caller = funded_account::<T, I>("caller", 0);
 		whitelist_account!(caller);
-		let normal_account_vote = account_vote::<T>(T::Currency::free_balance(&caller) - 100u32.into());
-		let big_account_vote = account_vote::<T>(T::Currency::free_balance(&caller));
+		let normal_account_vote = account_vote::<T, I>(T::Currency::free_balance(&caller) - 100u32.into());
+		let big_account_vote = account_vote::<T, I>(T::Currency::free_balance(&caller));
 
 		// Fill everything up to the max by filling all classes with votes and voting on them all.
-		let (class, all_polls) = fill_voting::<T>();
+		let (class, all_polls) = fill_voting::<T, I>();
 		assert!(all_polls.len() > 0);
 		for (class, polls) in all_polls.iter() {
 			assert!(polls.len() > 0);
 			for i in polls.iter() {
-				ConvictionVoting::<T>::vote(RawOrigin::Signed(caller.clone()).into(), *i, normal_account_vote)?;
+				ConvictionVoting::<T, I>::vote(RawOrigin::Signed(caller.clone()).into(), *i, normal_account_vote)?;
 			}
 		}
 
@@ -257,12 +258,12 @@ benchmarks! {
 
 		// Vote big on the class with the most ongoing votes of them to bump the lock and make it
 		// hard to recompute when removed.
-		ConvictionVoting::<T>::vote(RawOrigin::Signed(caller.clone()).into(), polls[0], big_account_vote)?;
+		ConvictionVoting::<T, I>::vote(RawOrigin::Signed(caller.clone()).into(), polls[0], big_account_vote)?;
 		let now_usable = <T::Currency as fungible::Inspect<T::AccountId>>::reducible_balance(&caller, false);
 		assert_eq!(orig_usable - now_usable, 100u32.into());
 
 		// Remove the vote
-		ConvictionVoting::<T>::remove_vote(RawOrigin::Signed(caller.clone()).into(), Some(class.clone()), polls[0])?;
+		ConvictionVoting::<T, I>::remove_vote(RawOrigin::Signed(caller.clone()).into(), Some(class.clone()), polls[0])?;
 
 		// We can now unlock on `class` from 200 to 100...
 	}: _(RawOrigin::Signed(caller.clone()), class, caller.clone())
diff --git a/substrate/frame/referenda/src/benchmarking.rs b/substrate/frame/referenda/src/benchmarking.rs
index dfca7cdf465..b9c64a61f51 100644
--- a/substrate/frame/referenda/src/benchmarking.rs
+++ b/substrate/frame/referenda/src/benchmarking.rs
@@ -20,7 +20,7 @@
 use super::*;
 use crate::Pallet as Referenda;
 use assert_matches::assert_matches;
-use frame_benchmarking::{account, benchmarks, whitelist_account};
+use frame_benchmarking::{account, benchmarks_instance_pallet, whitelist_account};
 use frame_support::{
 	assert_ok,
 	traits::{Currency, EnsureOrigin},
@@ -31,157 +31,157 @@ use sp_runtime::traits::{Bounded, Hash};
 const SEED: u32 = 0;
 
 #[allow(dead_code)]
-fn assert_last_event<T: Config>(generic_event: <T as Config>::Event) {
+fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::Event) {
 	frame_system::Pallet::<T>::assert_last_event(generic_event.into());
 }
 
-fn funded_account<T: Config>(name: &'static str, index: u32) -> T::AccountId {
+fn funded_account<T: Config<I>, I: 'static>(name: &'static str, index: u32) -> T::AccountId {
 	let caller: T::AccountId = account(name, index, SEED);
-	T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
+	T::Currency::make_free_balance_be(&caller, BalanceOf::<T, I>::max_value());
 	caller
 }
 
-fn create_referendum<T: Config>() -> (T::AccountId, ReferendumIndex) {
-	let caller = funded_account::<T>("caller", 0);
+fn create_referendum<T: Config<I>, I: 'static>() -> (T::AccountId, ReferendumIndex) {
+	let caller = funded_account::<T, I>("caller", 0);
 	whitelist_account!(caller);
-	assert_ok!(Referenda::<T>::submit(
+	assert_ok!(Referenda::<T, I>::submit(
 		RawOrigin::Signed(caller.clone()).into(),
 		Box::new(RawOrigin::Root.into()),
 		T::Hashing::hash_of(&0),
 		DispatchTime::After(0u32.into())
 	));
-	let index = ReferendumCount::<T>::get() - 1;
+	let index = ReferendumCount::<T, I>::get() - 1;
 	(caller, index)
 }
 
-fn place_deposit<T: Config>(index: ReferendumIndex) {
-	let caller = funded_account::<T>("caller", 0);
+fn place_deposit<T: Config<I>, I: 'static>(index: ReferendumIndex) {
+	let caller = funded_account::<T, I>("caller", 0);
 	whitelist_account!(caller);
-	assert_ok!(Referenda::<T>::place_decision_deposit(RawOrigin::Signed(caller).into(), index));
+	assert_ok!(Referenda::<T, I>::place_decision_deposit(RawOrigin::Signed(caller).into(), index));
 }
 
-fn nudge<T: Config>(index: ReferendumIndex) {
-	assert_ok!(Referenda::<T>::nudge_referendum(RawOrigin::Root.into(), index));
+fn nudge<T: Config<I>, I: 'static>(index: ReferendumIndex) {
+	assert_ok!(Referenda::<T, I>::nudge_referendum(RawOrigin::Root.into(), index));
 }
 
-fn fill_queue<T: Config>(
+fn fill_queue<T: Config<I>, I: 'static>(
 	index: ReferendumIndex,
 	spaces: u32,
 	pass_after: u32,
 ) -> Vec<ReferendumIndex> {
 	// First, create enough other referendums to fill the track.
 	let mut others = vec![];
-	for _ in 0..info::<T>(index).max_deciding {
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
+	for _ in 0..info::<T, I>(index).max_deciding {
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
 		others.push(index);
 	}
 
 	// We will also need enough referenda which are queued and passing, we want `MaxQueued - 1`
 	// in order to force the maximum amount of work to insert ours into the queue.
 	for _ in spaces..T::MaxQueued::get() {
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
-		make_passing_after::<T>(index, Perbill::from_percent(pass_after));
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
+		make_passing_after::<T, I>(index, Perbill::from_percent(pass_after));
 		others.push(index);
 	}
 
 	// Skip to when they can start being decided.
-	skip_prepare_period::<T>(index);
+	skip_prepare_period::<T, I>(index);
 
 	// Manually nudge the other referenda first to ensure that they begin.
-	others.iter().for_each(|&i| nudge::<T>(i));
+	others.iter().for_each(|&i| nudge::<T, I>(i));
 
 	others
 }
 
-fn info<T: Config>(index: ReferendumIndex) -> &'static TrackInfoOf<T> {
-	let status = Referenda::<T>::ensure_ongoing(index).unwrap();
+fn info<T: Config<I>, I: 'static>(index: ReferendumIndex) -> &'static TrackInfoOf<T, I> {
+	let status = Referenda::<T, I>::ensure_ongoing(index).unwrap();
 	T::Tracks::info(status.track).expect("Id value returned from T::Tracks")
 }
 
-fn make_passing_after<T: Config>(index: ReferendumIndex, period_portion: Perbill) {
+fn make_passing_after<T: Config<I>, I: 'static>(index: ReferendumIndex, period_portion: Perbill) {
 	// We add an extra 1 percent to handle any perbill rounding errors which may cause
 	// a proposal to not actually pass.
-	let support = info::<T>(index)
+	let support = info::<T, I>(index)
 		.min_support
 		.threshold(period_portion)
 		.saturating_add(Perbill::from_percent(1));
-	let approval = info::<T>(index)
+	let approval = info::<T, I>(index)
 		.min_approval
 		.threshold(period_portion)
 		.saturating_add(Perbill::from_percent(1));
-	Referenda::<T>::access_poll(index, |status| {
+	Referenda::<T, I>::access_poll(index, |status| {
 		if let PollStatus::Ongoing(tally, class) = status {
 			*tally = T::Tally::from_requirements(support, approval, class);
 		}
 	});
 }
 
-fn make_passing<T: Config>(index: ReferendumIndex) {
-	Referenda::<T>::access_poll(index, |status| {
+fn make_passing<T: Config<I>, I: 'static>(index: ReferendumIndex) {
+	Referenda::<T, I>::access_poll(index, |status| {
 		if let PollStatus::Ongoing(tally, class) = status {
 			*tally = T::Tally::unanimity(class);
 		}
 	});
 }
 
-fn make_failing<T: Config>(index: ReferendumIndex) {
-	Referenda::<T>::access_poll(index, |status| {
+fn make_failing<T: Config<I>, I: 'static>(index: ReferendumIndex) {
+	Referenda::<T, I>::access_poll(index, |status| {
 		if let PollStatus::Ongoing(tally, class) = status {
 			*tally = T::Tally::rejection(class);
 		}
 	});
 }
 
-fn skip_prepare_period<T: Config>(index: ReferendumIndex) {
-	let status = Referenda::<T>::ensure_ongoing(index).unwrap();
-	let prepare_period_over = status.submitted + info::<T>(index).prepare_period;
+fn skip_prepare_period<T: Config<I>, I: 'static>(index: ReferendumIndex) {
+	let status = Referenda::<T, I>::ensure_ongoing(index).unwrap();
+	let prepare_period_over = status.submitted + info::<T, I>(index).prepare_period;
 	frame_system::Pallet::<T>::set_block_number(prepare_period_over);
 }
 
-fn skip_decision_period<T: Config>(index: ReferendumIndex) {
-	let status = Referenda::<T>::ensure_ongoing(index).unwrap();
-	let decision_period_over = status.deciding.unwrap().since + info::<T>(index).decision_period;
+fn skip_decision_period<T: Config<I>, I: 'static>(index: ReferendumIndex) {
+	let status = Referenda::<T, I>::ensure_ongoing(index).unwrap();
+	let decision_period_over = status.deciding.unwrap().since + info::<T, I>(index).decision_period;
 	frame_system::Pallet::<T>::set_block_number(decision_period_over);
 }
 
-fn skip_confirm_period<T: Config>(index: ReferendumIndex) {
-	let status = Referenda::<T>::ensure_ongoing(index).unwrap();
+fn skip_confirm_period<T: Config<I>, I: 'static>(index: ReferendumIndex) {
+	let status = Referenda::<T, I>::ensure_ongoing(index).unwrap();
 	let confirm_period_over = status.deciding.unwrap().confirming.unwrap();
 	frame_system::Pallet::<T>::set_block_number(confirm_period_over);
 }
 
-fn skip_timeout_period<T: Config>(index: ReferendumIndex) {
-	let status = Referenda::<T>::ensure_ongoing(index).unwrap();
+fn skip_timeout_period<T: Config<I>, I: 'static>(index: ReferendumIndex) {
+	let status = Referenda::<T, I>::ensure_ongoing(index).unwrap();
 	let timeout_period_over = status.submitted + T::UndecidingTimeout::get();
 	frame_system::Pallet::<T>::set_block_number(timeout_period_over);
 }
 
-fn alarm_time<T: Config>(index: ReferendumIndex) -> T::BlockNumber {
-	let status = Referenda::<T>::ensure_ongoing(index).unwrap();
+fn alarm_time<T: Config<I>, I: 'static>(index: ReferendumIndex) -> T::BlockNumber {
+	let status = Referenda::<T, I>::ensure_ongoing(index).unwrap();
 	status.alarm.unwrap().0
 }
 
-fn is_confirming<T: Config>(index: ReferendumIndex) -> bool {
-	let status = Referenda::<T>::ensure_ongoing(index).unwrap();
+fn is_confirming<T: Config<I>, I: 'static>(index: ReferendumIndex) -> bool {
+	let status = Referenda::<T, I>::ensure_ongoing(index).unwrap();
 	matches!(
 		status,
 		ReferendumStatus { deciding: Some(DecidingStatus { confirming: Some(_), .. }), .. }
 	)
 }
 
-fn is_not_confirming<T: Config>(index: ReferendumIndex) -> bool {
-	let status = Referenda::<T>::ensure_ongoing(index).unwrap();
+fn is_not_confirming<T: Config<I>, I: 'static>(index: ReferendumIndex) -> bool {
+	let status = Referenda::<T, I>::ensure_ongoing(index).unwrap();
 	matches!(
 		status,
 		ReferendumStatus { deciding: Some(DecidingStatus { confirming: None, .. }), .. }
 	)
 }
 
-benchmarks! {
+benchmarks_instance_pallet! {
 	submit {
-		let caller = funded_account::<T>("caller", 0);
+		let caller = funded_account::<T, I>("caller", 0);
 		whitelist_account!(caller);
 	}: _(
 		RawOrigin::Signed(caller),
@@ -189,105 +189,105 @@ benchmarks! {
 		T::Hashing::hash_of(&0),
 		DispatchTime::After(0u32.into())
 	) verify {
-		let index = ReferendumCount::<T>::get().checked_sub(1).unwrap();
-		assert_matches!(ReferendumInfoFor::<T>::get(index), Some(ReferendumInfo::Ongoing(_)));
+		let index = ReferendumCount::<T, I>::get().checked_sub(1).unwrap();
+		assert_matches!(ReferendumInfoFor::<T, I>::get(index), Some(ReferendumInfo::Ongoing(_)));
 	}
 
 	place_decision_deposit_preparing {
-		let (caller, index) = create_referendum::<T>();
+		let (caller, index) = create_referendum::<T, I>();
 	}: place_decision_deposit(RawOrigin::Signed(caller), index)
 	verify {
-		assert!(Referenda::<T>::ensure_ongoing(index).unwrap().decision_deposit.is_some());
+		assert!(Referenda::<T, I>::ensure_ongoing(index).unwrap().decision_deposit.is_some());
 	}
 
 	place_decision_deposit_queued {
-		let (caller, index) = create_referendum::<T>();
-		fill_queue::<T>(index, 1, 90);
+		let (caller, index) = create_referendum::<T, I>();
+		fill_queue::<T, I>(index, 1, 90);
 	}: place_decision_deposit(RawOrigin::Signed(caller), index)
 	verify {
-		let track = Referenda::<T>::ensure_ongoing(index).unwrap().track;
-		assert_eq!(TrackQueue::<T>::get(&track).len() as u32, T::MaxQueued::get());
-		assert_eq!(TrackQueue::<T>::get(&track)[0], (index, 0u32.into()));
+		let track = Referenda::<T, I>::ensure_ongoing(index).unwrap().track;
+		assert_eq!(TrackQueue::<T, I>::get(&track).len() as u32, T::MaxQueued::get());
+		assert_eq!(TrackQueue::<T, I>::get(&track)[0], (index, 0u32.into()));
 	}
 
 	place_decision_deposit_not_queued {
-		let (caller, index) = create_referendum::<T>();
-		fill_queue::<T>(index, 0, 90);
+		let (caller, index) = create_referendum::<T, I>();
+		fill_queue::<T, I>(index, 0, 90);
 	}: place_decision_deposit(RawOrigin::Signed(caller), index)
 	verify {
-		let track = Referenda::<T>::ensure_ongoing(index).unwrap().track;
-		assert_eq!(TrackQueue::<T>::get(&track).len() as u32, T::MaxQueued::get());
-		assert!(TrackQueue::<T>::get(&track).into_iter().all(|(i, _)| i != index));
+		let track = Referenda::<T, I>::ensure_ongoing(index).unwrap().track;
+		assert_eq!(TrackQueue::<T, I>::get(&track).len() as u32, T::MaxQueued::get());
+		assert!(TrackQueue::<T, I>::get(&track).into_iter().all(|(i, _)| i != index));
 	}
 
 	place_decision_deposit_passing {
-		let (caller, index) = create_referendum::<T>();
-		skip_prepare_period::<T>(index);
-		make_passing::<T>(index);
+		let (caller, index) = create_referendum::<T, I>();
+		skip_prepare_period::<T, I>(index);
+		make_passing::<T, I>(index);
 	}: place_decision_deposit(RawOrigin::Signed(caller), index)
 	verify {
-		assert!(is_confirming::<T>(index));
+		assert!(is_confirming::<T, I>(index));
 	}
 
 	place_decision_deposit_failing {
-		let (caller, index) = create_referendum::<T>();
-		skip_prepare_period::<T>(index);
+		let (caller, index) = create_referendum::<T, I>();
+		skip_prepare_period::<T, I>(index);
 	}: place_decision_deposit(RawOrigin::Signed(caller), index)
 	verify {
-		assert!(is_not_confirming::<T>(index));
+		assert!(is_not_confirming::<T, I>(index));
 	}
 
 	refund_decision_deposit {
-		let (caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
-		assert_ok!(Referenda::<T>::cancel(T::CancelOrigin::successful_origin(), index));
+		let (caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
+		assert_ok!(Referenda::<T, I>::cancel(T::CancelOrigin::successful_origin(), index));
 	}: _(RawOrigin::Signed(caller), index)
 	verify {
-		assert_matches!(ReferendumInfoFor::<T>::get(index), Some(ReferendumInfo::Cancelled(_, _, None)));
+		assert_matches!(ReferendumInfoFor::<T, I>::get(index), Some(ReferendumInfo::Cancelled(_, _, None)));
 	}
 
 	cancel {
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
 	}: _<T::Origin>(T::CancelOrigin::successful_origin(), index)
 	verify {
-		assert_matches!(ReferendumInfoFor::<T>::get(index), Some(ReferendumInfo::Cancelled(..)));
+		assert_matches!(ReferendumInfoFor::<T, I>::get(index), Some(ReferendumInfo::Cancelled(..)));
 	}
 
 	kill {
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
 	}: _<T::Origin>(T::KillOrigin::successful_origin(), index)
 	verify {
-		assert_matches!(ReferendumInfoFor::<T>::get(index), Some(ReferendumInfo::Killed(..)));
+		assert_matches!(ReferendumInfoFor::<T, I>::get(index), Some(ReferendumInfo::Killed(..)));
 	}
 
 	one_fewer_deciding_queue_empty {
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
-		skip_prepare_period::<T>(index);
-		nudge::<T>(index);
-		let track = Referenda::<T>::ensure_ongoing(index).unwrap().track;
-		assert_ok!(Referenda::<T>::cancel(T::CancelOrigin::successful_origin(), index));
-		assert_eq!(DecidingCount::<T>::get(&track), 1);
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
+		skip_prepare_period::<T, I>(index);
+		nudge::<T, I>(index);
+		let track = Referenda::<T, I>::ensure_ongoing(index).unwrap().track;
+		assert_ok!(Referenda::<T, I>::cancel(T::CancelOrigin::successful_origin(), index));
+		assert_eq!(DecidingCount::<T, I>::get(&track), 1);
 	}: one_fewer_deciding(RawOrigin::Root, track)
 	verify {
-		assert_eq!(DecidingCount::<T>::get(&track), 0);
+		assert_eq!(DecidingCount::<T, I>::get(&track), 0);
 	}
 
 	one_fewer_deciding_failing {
-		let (_caller, index) = create_referendum::<T>();
+		let (_caller, index) = create_referendum::<T, I>();
 		// No spaces free in the queue.
-		let queued = fill_queue::<T>(index, 0, 90);
-		let track = Referenda::<T>::ensure_ongoing(index).unwrap().track;
-		assert_ok!(Referenda::<T>::cancel(T::CancelOrigin::successful_origin(), queued[0]));
-		assert_eq!(TrackQueue::<T>::get(&track).len() as u32, T::MaxQueued::get());
-		let deciding_count = DecidingCount::<T>::get(&track);
+		let queued = fill_queue::<T, I>(index, 0, 90);
+		let track = Referenda::<T, I>::ensure_ongoing(index).unwrap().track;
+		assert_ok!(Referenda::<T, I>::cancel(T::CancelOrigin::successful_origin(), queued[0]));
+		assert_eq!(TrackQueue::<T, I>::get(&track).len() as u32, T::MaxQueued::get());
+		let deciding_count = DecidingCount::<T, I>::get(&track);
 	}: one_fewer_deciding(RawOrigin::Root, track)
 	verify {
-		assert_eq!(DecidingCount::<T>::get(&track), deciding_count);
-		assert_eq!(TrackQueue::<T>::get(&track).len() as u32, T::MaxQueued::get() - 1);
-		assert!(queued.into_iter().skip(1).all(|i| Referenda::<T>::ensure_ongoing(i)
+		assert_eq!(DecidingCount::<T, I>::get(&track), deciding_count);
+		assert_eq!(TrackQueue::<T, I>::get(&track).len() as u32, T::MaxQueued::get() - 1);
+		assert!(queued.into_iter().skip(1).all(|i| Referenda::<T, I>::ensure_ongoing(i)
 			.unwrap()
 			.deciding
 			.map_or(true, |d| d.confirming.is_none())
@@ -295,18 +295,18 @@ benchmarks! {
 	}
 
 	one_fewer_deciding_passing {
-		let (_caller, index) = create_referendum::<T>();
+		let (_caller, index) = create_referendum::<T, I>();
 		// No spaces free in the queue.
-		let queued = fill_queue::<T>(index, 0, 0);
-		let track = Referenda::<T>::ensure_ongoing(index).unwrap().track;
-		assert_ok!(Referenda::<T>::cancel(T::CancelOrigin::successful_origin(), queued[0]));
-		assert_eq!(TrackQueue::<T>::get(&track).len() as u32, T::MaxQueued::get());
-		let deciding_count = DecidingCount::<T>::get(&track);
+		let queued = fill_queue::<T, I>(index, 0, 0);
+		let track = Referenda::<T, I>::ensure_ongoing(index).unwrap().track;
+		assert_ok!(Referenda::<T, I>::cancel(T::CancelOrigin::successful_origin(), queued[0]));
+		assert_eq!(TrackQueue::<T, I>::get(&track).len() as u32, T::MaxQueued::get());
+		let deciding_count = DecidingCount::<T, I>::get(&track);
 	}: one_fewer_deciding(RawOrigin::Root, track)
 	verify {
-		assert_eq!(DecidingCount::<T>::get(&track), deciding_count);
-		assert_eq!(TrackQueue::<T>::get(&track).len() as u32, T::MaxQueued::get() - 1);
-		assert!(queued.into_iter().skip(1).all(|i| Referenda::<T>::ensure_ongoing(i)
+		assert_eq!(DecidingCount::<T, I>::get(&track), deciding_count);
+		assert_eq!(TrackQueue::<T, I>::get(&track).len() as u32, T::MaxQueued::get() - 1);
+		assert!(queued.into_iter().skip(1).all(|i| Referenda::<T, I>::ensure_ongoing(i)
 			.unwrap()
 			.deciding
 			.map_or(true, |d| d.confirming.is_some())
@@ -315,43 +315,43 @@ benchmarks! {
 
 	nudge_referendum_requeued_insertion {
 		// First create our referendum and place the deposit. It will be failing.
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
-		fill_queue::<T>(index, 0, 90);
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
+		fill_queue::<T, I>(index, 0, 90);
 
 		// Now nudge ours, with the track now full and the queue full of referenda with votes,
 		// ours will not be in the queue.
-		nudge::<T>(index);
-		let track = Referenda::<T>::ensure_ongoing(index).unwrap().track;
-		assert!(TrackQueue::<T>::get(&track).into_iter().all(|(i, _)| i != index));
+		nudge::<T, I>(index);
+		let track = Referenda::<T, I>::ensure_ongoing(index).unwrap().track;
+		assert!(TrackQueue::<T, I>::get(&track).into_iter().all(|(i, _)| i != index));
 
 		// Now alter the voting, so that ours goes into pole-position and shifts others down.
-		make_passing::<T>(index);
+		make_passing::<T, I>(index);
 	}: nudge_referendum(RawOrigin::Root, index)
 	verify {
-		let t = TrackQueue::<T>::get(&track);
+		let t = TrackQueue::<T, I>::get(&track);
 		assert_eq!(t.len() as u32, T::MaxQueued::get());
 		assert_eq!(t[t.len() - 1].0, index);
 	}
 
 	nudge_referendum_requeued_slide {
 		// First create our referendum and place the deposit. It will be failing.
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
-		fill_queue::<T>(index, 1, 90);
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
+		fill_queue::<T, I>(index, 1, 90);
 
 		// Now nudge ours, with the track now full, ours will be queued, but with no votes, it
 		// will have the worst position.
-		nudge::<T>(index);
-		let track = Referenda::<T>::ensure_ongoing(index).unwrap().track;
-		assert_eq!(TrackQueue::<T>::get(&track).len() as u32, T::MaxQueued::get());
-		assert_eq!(TrackQueue::<T>::get(&track)[0], (index, 0u32.into()));
+		nudge::<T, I>(index);
+		let track = Referenda::<T, I>::ensure_ongoing(index).unwrap().track;
+		assert_eq!(TrackQueue::<T, I>::get(&track).len() as u32, T::MaxQueued::get());
+		assert_eq!(TrackQueue::<T, I>::get(&track)[0], (index, 0u32.into()));
 
 		// Now alter the voting, so that ours leap-frogs all into the best position.
-		make_passing::<T>(index);
+		make_passing::<T, I>(index);
 	}: nudge_referendum(RawOrigin::Root, index)
 	verify {
-		let t = TrackQueue::<T>::get(&track);
+		let t = TrackQueue::<T, I>::get(&track);
 		assert_eq!(t.len() as u32, T::MaxQueued::get());
 		assert_eq!(t[t.len() - 1].0, index);
 	}
@@ -362,159 +362,159 @@ benchmarks! {
 		// insertion at the beginning.
 
 		// First create our referendum and place the deposit. It will be failing.
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
-		fill_queue::<T>(index, 1, 0);
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
+		fill_queue::<T, I>(index, 1, 0);
 
-		let track = Referenda::<T>::ensure_ongoing(index).unwrap().track;
-		assert_eq!(TrackQueue::<T>::get(&track).len() as u32, T::MaxQueued::get() - 1);
-		assert!(TrackQueue::<T>::get(&track).into_iter().all(|(_, v)| v > 0u32.into()));
+		let track = Referenda::<T, I>::ensure_ongoing(index).unwrap().track;
+		assert_eq!(TrackQueue::<T, I>::get(&track).len() as u32, T::MaxQueued::get() - 1);
+		assert!(TrackQueue::<T, I>::get(&track).into_iter().all(|(_, v)| v > 0u32.into()));
 
 		// Then nudge ours, with the track now full, ours will be queued.
 	}: nudge_referendum(RawOrigin::Root, index)
 	verify {
-		assert_eq!(TrackQueue::<T>::get(&track).len() as u32, T::MaxQueued::get());
-		assert_eq!(TrackQueue::<T>::get(&track)[0], (index, 0u32.into()));
+		assert_eq!(TrackQueue::<T, I>::get(&track).len() as u32, T::MaxQueued::get());
+		assert_eq!(TrackQueue::<T, I>::get(&track)[0], (index, 0u32.into()));
 	}
 
 	nudge_referendum_not_queued {
 		// First create our referendum and place the deposit. It will be failing.
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
-		fill_queue::<T>(index, 0, 0);
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
+		fill_queue::<T, I>(index, 0, 0);
 
-		let track = Referenda::<T>::ensure_ongoing(index).unwrap().track;
-		assert_eq!(TrackQueue::<T>::get(&track).len() as u32, T::MaxQueued::get());
-		assert!(TrackQueue::<T>::get(&track).into_iter().all(|(_, v)| v > 0u32.into()));
+		let track = Referenda::<T, I>::ensure_ongoing(index).unwrap().track;
+		assert_eq!(TrackQueue::<T, I>::get(&track).len() as u32, T::MaxQueued::get());
+		assert!(TrackQueue::<T, I>::get(&track).into_iter().all(|(_, v)| v > 0u32.into()));
 
 		// Then nudge ours, with the track now full, ours will be queued.
 	}: nudge_referendum(RawOrigin::Root, index)
 	verify {
-		assert_eq!(TrackQueue::<T>::get(&track).len() as u32, T::MaxQueued::get());
-		assert!(TrackQueue::<T>::get(&track).into_iter().all(|(i, _)| i != index));
+		assert_eq!(TrackQueue::<T, I>::get(&track).len() as u32, T::MaxQueued::get());
+		assert!(TrackQueue::<T, I>::get(&track).into_iter().all(|(i, _)| i != index));
 	}
 
 	nudge_referendum_no_deposit {
-		let (_caller, index) = create_referendum::<T>();
-		skip_prepare_period::<T>(index);
+		let (_caller, index) = create_referendum::<T, I>();
+		skip_prepare_period::<T, I>(index);
 	}: nudge_referendum(RawOrigin::Root, index)
 	verify {
-		let status = Referenda::<T>::ensure_ongoing(index).unwrap();
+		let status = Referenda::<T, I>::ensure_ongoing(index).unwrap();
 		assert_matches!(status, ReferendumStatus { deciding: None, .. });
 	}
 
 	nudge_referendum_preparing {
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
 	}: nudge_referendum(RawOrigin::Root, index)
 	verify {
-		let status = Referenda::<T>::ensure_ongoing(index).unwrap();
+		let status = Referenda::<T, I>::ensure_ongoing(index).unwrap();
 		assert_matches!(status, ReferendumStatus { deciding: None, .. });
 	}
 
 	nudge_referendum_timed_out {
-		let (_caller, index) = create_referendum::<T>();
-		skip_timeout_period::<T>(index);
+		let (_caller, index) = create_referendum::<T, I>();
+		skip_timeout_period::<T, I>(index);
 	}: nudge_referendum(RawOrigin::Root, index)
 	verify {
-		let info = ReferendumInfoFor::<T>::get(index).unwrap();
+		let info = ReferendumInfoFor::<T, I>::get(index).unwrap();
 		assert_matches!(info, ReferendumInfo::TimedOut(..));
 	}
 
 	nudge_referendum_begin_deciding_failing {
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
-		skip_prepare_period::<T>(index);
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
+		skip_prepare_period::<T, I>(index);
 	}: nudge_referendum(RawOrigin::Root, index)
 	verify {
-		assert!(is_not_confirming::<T>(index));
+		assert!(is_not_confirming::<T, I>(index));
 	}
 
 	nudge_referendum_begin_deciding_passing {
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
-		make_passing::<T>(index);
-		skip_prepare_period::<T>(index);
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
+		make_passing::<T, I>(index);
+		skip_prepare_period::<T, I>(index);
 	}: nudge_referendum(RawOrigin::Root, index)
 	verify {
-		assert!(is_confirming::<T>(index));
+		assert!(is_confirming::<T, I>(index));
 	}
 
 	nudge_referendum_begin_confirming {
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
-		skip_prepare_period::<T>(index);
-		nudge::<T>(index);
-		assert!(!is_confirming::<T>(index));
-		make_passing::<T>(index);
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
+		skip_prepare_period::<T, I>(index);
+		nudge::<T, I>(index);
+		assert!(!is_confirming::<T, I>(index));
+		make_passing::<T, I>(index);
 	}: nudge_referendum(RawOrigin::Root, index)
 	verify {
-		assert!(is_confirming::<T>(index));
+		assert!(is_confirming::<T, I>(index));
 	}
 
 	nudge_referendum_end_confirming {
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
-		skip_prepare_period::<T>(index);
-		make_passing::<T>(index);
-		nudge::<T>(index);
-		assert!(is_confirming::<T>(index));
-		make_failing::<T>(index);
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
+		skip_prepare_period::<T, I>(index);
+		make_passing::<T, I>(index);
+		nudge::<T, I>(index);
+		assert!(is_confirming::<T, I>(index));
+		make_failing::<T, I>(index);
 	}: nudge_referendum(RawOrigin::Root, index)
 	verify {
-		assert!(!is_confirming::<T>(index));
+		assert!(!is_confirming::<T, I>(index));
 	}
 
 	nudge_referendum_continue_not_confirming {
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
-		skip_prepare_period::<T>(index);
-		nudge::<T>(index);
-		assert!(!is_confirming::<T>(index));
-		let old_alarm = alarm_time::<T>(index);
-		make_passing_after::<T>(index, Perbill::from_percent(50));
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
+		skip_prepare_period::<T, I>(index);
+		nudge::<T, I>(index);
+		assert!(!is_confirming::<T, I>(index));
+		let old_alarm = alarm_time::<T, I>(index);
+		make_passing_after::<T, I>(index, Perbill::from_percent(50));
 	}: nudge_referendum(RawOrigin::Root, index)
 	verify {
-		assert_ne!(old_alarm, alarm_time::<T>(index));
-		assert!(!is_confirming::<T>(index));
+		assert_ne!(old_alarm, alarm_time::<T, I>(index));
+		assert!(!is_confirming::<T, I>(index));
 	}
 
 	nudge_referendum_continue_confirming {
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
-		make_passing::<T>(index);
-		skip_prepare_period::<T>(index);
-		nudge::<T>(index);
-		assert!(is_confirming::<T>(index));
-		let old_alarm = alarm_time::<T>(index);
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
+		make_passing::<T, I>(index);
+		skip_prepare_period::<T, I>(index);
+		nudge::<T, I>(index);
+		assert!(is_confirming::<T, I>(index));
+		let old_alarm = alarm_time::<T, I>(index);
 	}: nudge_referendum(RawOrigin::Root, index)
 	verify {
-		assert!(is_confirming::<T>(index));
+		assert!(is_confirming::<T, I>(index));
 	}
 
 	nudge_referendum_approved {
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
-		skip_prepare_period::<T>(index);
-		make_passing::<T>(index);
-		nudge::<T>(index);
-		skip_confirm_period::<T>(index);
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
+		skip_prepare_period::<T, I>(index);
+		make_passing::<T, I>(index);
+		nudge::<T, I>(index);
+		skip_confirm_period::<T, I>(index);
 	}: nudge_referendum(RawOrigin::Root, index)
 	verify {
-		let info = ReferendumInfoFor::<T>::get(index).unwrap();
+		let info = ReferendumInfoFor::<T, I>::get(index).unwrap();
 		assert_matches!(info, ReferendumInfo::Approved(..));
 	}
 
 	nudge_referendum_rejected {
-		let (_caller, index) = create_referendum::<T>();
-		place_deposit::<T>(index);
-		skip_prepare_period::<T>(index);
-		make_failing::<T>(index);
-		nudge::<T>(index);
-		skip_decision_period::<T>(index);
+		let (_caller, index) = create_referendum::<T, I>();
+		place_deposit::<T, I>(index);
+		skip_prepare_period::<T, I>(index);
+		make_failing::<T, I>(index);
+		nudge::<T, I>(index);
+		skip_decision_period::<T, I>(index);
 	}: nudge_referendum(RawOrigin::Root, index)
 	verify {
-		let info = ReferendumInfoFor::<T>::get(index).unwrap();
+		let info = ReferendumInfoFor::<T, I>::get(index).unwrap();
 		assert_matches!(info, ReferendumInfo::Rejected(..));
 	}
 
-- 
GitLab