mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 15:11:02 +00:00
Migrate pallet-collective to the new pallet attribute macro (#9115)
* Migrate pallet-collective to the new pallet attribute macro Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Add migrations Signed-off-by: koushiro <koushiro.cqx@gmail.com> * some nits Signed-off-by: koushiro <koushiro.cqx@gmail.com> * fix some indent Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Fix Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Fix Signed-off-by: koushiro <koushiro.cqx@gmail.com> * fmt * fix migration * fix migration * fmt * finally fix migration * keep the storages public as they were * Some nits Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Fix migration Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Fix migration and Add test Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Some nits Signed-off-by: koushiro <koushiro.cqx@gmail.com> * improve test Signed-off-by: koushiro <koushiro.cqx@gmail.com> * improve test Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Revert the changes of membership Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Some nits Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Fix test Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Fix test Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Some nits Signed-off-by: koushiro <koushiro.cqx@gmail.com> * don't assert that there is something at the old prefix in the pre-migrate Signed-off-by: koushiro <koushiro.cqx@gmail.com> * cargo fmt Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
@@ -18,26 +18,25 @@
|
||||
//! Staking pallet benchmarking.
|
||||
|
||||
use super::*;
|
||||
use crate::Pallet as Collective;
|
||||
|
||||
use frame_benchmarking::{
|
||||
account, benchmarks_instance, impl_benchmark_test_suite, whitelisted_caller,
|
||||
};
|
||||
use frame_system::RawOrigin as SystemOrigin;
|
||||
use sp_runtime::traits::Bounded;
|
||||
use sp_std::mem::size_of;
|
||||
|
||||
use crate::Module as Collective;
|
||||
use frame_system::{Call as SystemCall, Pallet as System};
|
||||
use frame_benchmarking::{
|
||||
account, benchmarks_instance_pallet, impl_benchmark_test_suite, whitelisted_caller,
|
||||
};
|
||||
use frame_system::{Call as SystemCall, Pallet as System, RawOrigin as SystemOrigin};
|
||||
|
||||
const SEED: u32 = 0;
|
||||
|
||||
const MAX_BYTES: u32 = 1_024;
|
||||
|
||||
fn assert_last_event<T: Config<I>, I: Instance>(generic_event: <T as Config<I>>::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());
|
||||
}
|
||||
|
||||
benchmarks_instance! {
|
||||
benchmarks_instance_pallet! {
|
||||
set_members {
|
||||
let m in 1 .. T::MaxMembers::get();
|
||||
let n in 1 .. T::MaxMembers::get();
|
||||
@@ -53,7 +52,7 @@ benchmarks_instance! {
|
||||
}
|
||||
let old_members_count = old_members.len() as u32;
|
||||
|
||||
Collective::<T, _>::set_members(
|
||||
Collective::<T, I>::set_members(
|
||||
SystemOrigin::Root.into(),
|
||||
old_members.clone(),
|
||||
Some(last_old_member.clone()),
|
||||
@@ -67,7 +66,7 @@ benchmarks_instance! {
|
||||
for i in 0 .. p {
|
||||
// Proposals should be different so that different proposal hashes are generated
|
||||
let proposal: T::Proposal = SystemCall::<T>::remark(vec![i as u8; length]).into();
|
||||
Collective::<T, _>::propose(
|
||||
Collective::<T, I>::propose(
|
||||
SystemOrigin::Signed(last_old_member.clone()).into(),
|
||||
threshold,
|
||||
Box::new(proposal.clone()),
|
||||
@@ -80,7 +79,7 @@ benchmarks_instance! {
|
||||
for j in 2 .. m - 1 {
|
||||
let voter = &old_members[j as usize];
|
||||
let approve = true;
|
||||
Collective::<T, _>::vote(
|
||||
Collective::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
hash,
|
||||
i,
|
||||
@@ -101,7 +100,7 @@ benchmarks_instance! {
|
||||
}: _(SystemOrigin::Root, new_members.clone(), Some(last_member), T::MaxMembers::get())
|
||||
verify {
|
||||
new_members.sort();
|
||||
assert_eq!(Collective::<T, _>::members(), new_members);
|
||||
assert_eq!(Collective::<T, I>::members(), new_members);
|
||||
}
|
||||
|
||||
execute {
|
||||
@@ -120,7 +119,7 @@ benchmarks_instance! {
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
members.push(caller.clone());
|
||||
|
||||
Collective::<T, _>::set_members(SystemOrigin::Root.into(), members, None, T::MaxMembers::get())?;
|
||||
Collective::<T, I>::set_members(SystemOrigin::Root.into(), members, None, T::MaxMembers::get())?;
|
||||
|
||||
let proposal: T::Proposal = SystemCall::<T>::remark(vec![1; b as usize]).into();
|
||||
|
||||
@@ -129,7 +128,7 @@ benchmarks_instance! {
|
||||
let proposal_hash = T::Hashing::hash_of(&proposal);
|
||||
// Note that execution fails due to mis-matched origin
|
||||
assert_last_event::<T, I>(
|
||||
RawEvent::MemberExecuted(proposal_hash, Err(DispatchError::BadOrigin)).into()
|
||||
Event::MemberExecuted(proposal_hash, Err(DispatchError::BadOrigin)).into()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -150,7 +149,7 @@ benchmarks_instance! {
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
members.push(caller.clone());
|
||||
|
||||
Collective::<T, _>::set_members(SystemOrigin::Root.into(), members, None, T::MaxMembers::get())?;
|
||||
Collective::<T, I>::set_members(SystemOrigin::Root.into(), members, None, T::MaxMembers::get())?;
|
||||
|
||||
let proposal: T::Proposal = SystemCall::<T>::remark(vec![1; b as usize]).into();
|
||||
let threshold = 1;
|
||||
@@ -160,7 +159,7 @@ benchmarks_instance! {
|
||||
let proposal_hash = T::Hashing::hash_of(&proposal);
|
||||
// Note that execution fails due to mis-matched origin
|
||||
assert_last_event::<T, I>(
|
||||
RawEvent::Executed(proposal_hash, Err(DispatchError::BadOrigin)).into()
|
||||
Event::Executed(proposal_hash, Err(DispatchError::BadOrigin)).into()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -180,14 +179,14 @@ benchmarks_instance! {
|
||||
}
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
members.push(caller.clone());
|
||||
Collective::<T, _>::set_members(SystemOrigin::Root.into(), members, None, T::MaxMembers::get())?;
|
||||
Collective::<T, I>::set_members(SystemOrigin::Root.into(), members, None, T::MaxMembers::get())?;
|
||||
|
||||
let threshold = m;
|
||||
// Add previous proposals.
|
||||
for i in 0 .. p - 1 {
|
||||
// Proposals should be different so that different proposal hashes are generated
|
||||
let proposal: T::Proposal = SystemCall::<T>::remark(vec![i as u8; b as usize]).into();
|
||||
Collective::<T, _>::propose(
|
||||
Collective::<T, I>::propose(
|
||||
SystemOrigin::Signed(caller.clone()).into(),
|
||||
threshold,
|
||||
Box::new(proposal),
|
||||
@@ -195,16 +194,16 @@ benchmarks_instance! {
|
||||
)?;
|
||||
}
|
||||
|
||||
assert_eq!(Collective::<T, _>::proposals().len(), (p - 1) as usize);
|
||||
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
|
||||
|
||||
let proposal: T::Proposal = SystemCall::<T>::remark(vec![p as u8; b as usize]).into();
|
||||
|
||||
}: propose(SystemOrigin::Signed(caller.clone()), threshold, Box::new(proposal.clone()), bytes_in_storage)
|
||||
verify {
|
||||
// New proposal is recorded
|
||||
assert_eq!(Collective::<T, _>::proposals().len(), p as usize);
|
||||
assert_eq!(Collective::<T, I>::proposals().len(), p as usize);
|
||||
let proposal_hash = T::Hashing::hash_of(&proposal);
|
||||
assert_last_event::<T, I>(RawEvent::Proposed(caller, p - 1, proposal_hash, threshold).into());
|
||||
assert_last_event::<T, I>(Event::Proposed(caller, p - 1, proposal_hash, threshold).into());
|
||||
}
|
||||
|
||||
vote {
|
||||
@@ -225,7 +224,7 @@ benchmarks_instance! {
|
||||
}
|
||||
let voter: T::AccountId = account("voter", 0, SEED);
|
||||
members.push(voter.clone());
|
||||
Collective::<T, _>::set_members(SystemOrigin::Root.into(), members.clone(), None, T::MaxMembers::get())?;
|
||||
Collective::<T, I>::set_members(SystemOrigin::Root.into(), members.clone(), None, T::MaxMembers::get())?;
|
||||
|
||||
// Threshold is 1 less than the number of members so that one person can vote nay
|
||||
let threshold = m - 1;
|
||||
@@ -235,7 +234,7 @@ benchmarks_instance! {
|
||||
for i in 0 .. p {
|
||||
// Proposals should be different so that different proposal hashes are generated
|
||||
let proposal: T::Proposal = SystemCall::<T>::remark(vec![i as u8; b as usize]).into();
|
||||
Collective::<T, _>::propose(
|
||||
Collective::<T, I>::propose(
|
||||
SystemOrigin::Signed(proposer.clone()).into(),
|
||||
threshold,
|
||||
Box::new(proposal.clone()),
|
||||
@@ -249,7 +248,7 @@ benchmarks_instance! {
|
||||
for j in 0 .. m - 3 {
|
||||
let voter = &members[j as usize];
|
||||
let approve = true;
|
||||
Collective::<T, _>::vote(
|
||||
Collective::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
index,
|
||||
@@ -258,14 +257,14 @@ benchmarks_instance! {
|
||||
}
|
||||
// Voter votes aye without resolving the vote.
|
||||
let approve = true;
|
||||
Collective::<T, _>::vote(
|
||||
Collective::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
index,
|
||||
approve,
|
||||
)?;
|
||||
|
||||
assert_eq!(Collective::<T, _>::proposals().len(), p as usize);
|
||||
assert_eq!(Collective::<T, I>::proposals().len(), p as usize);
|
||||
|
||||
// Voter switches vote to nay, but does not kill the vote, just updates + inserts
|
||||
let approve = false;
|
||||
@@ -276,8 +275,8 @@ benchmarks_instance! {
|
||||
}: _(SystemOrigin::Signed(voter), last_hash.clone(), index, approve)
|
||||
verify {
|
||||
// All proposals exist and the last proposal has just been updated.
|
||||
assert_eq!(Collective::<T, _>::proposals().len(), p as usize);
|
||||
let voting = Collective::<T, _>::voting(&last_hash).ok_or("Proposal Missing")?;
|
||||
assert_eq!(Collective::<T, I>::proposals().len(), p as usize);
|
||||
let voting = Collective::<T, I>::voting(&last_hash).ok_or("Proposal Missing")?;
|
||||
assert_eq!(voting.ayes.len(), (m - 3) as usize);
|
||||
assert_eq!(voting.nays.len(), 1);
|
||||
}
|
||||
@@ -300,7 +299,7 @@ benchmarks_instance! {
|
||||
}
|
||||
let voter: T::AccountId = account("voter", 0, SEED);
|
||||
members.push(voter.clone());
|
||||
Collective::<T, _>::set_members(SystemOrigin::Root.into(), members.clone(), None, T::MaxMembers::get())?;
|
||||
Collective::<T, I>::set_members(SystemOrigin::Root.into(), members.clone(), None, T::MaxMembers::get())?;
|
||||
|
||||
// Threshold is total members so that one nay will disapprove the vote
|
||||
let threshold = m;
|
||||
@@ -310,7 +309,7 @@ benchmarks_instance! {
|
||||
for i in 0 .. p {
|
||||
// Proposals should be different so that different proposal hashes are generated
|
||||
let proposal: T::Proposal = SystemCall::<T>::remark(vec![i as u8; bytes as usize]).into();
|
||||
Collective::<T, _>::propose(
|
||||
Collective::<T, I>::propose(
|
||||
SystemOrigin::Signed(proposer.clone()).into(),
|
||||
threshold,
|
||||
Box::new(proposal.clone()),
|
||||
@@ -324,7 +323,7 @@ benchmarks_instance! {
|
||||
for j in 0 .. m - 2 {
|
||||
let voter = &members[j as usize];
|
||||
let approve = true;
|
||||
Collective::<T, _>::vote(
|
||||
Collective::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
index,
|
||||
@@ -333,18 +332,18 @@ benchmarks_instance! {
|
||||
}
|
||||
// Voter votes aye without resolving the vote.
|
||||
let approve = true;
|
||||
Collective::<T, _>::vote(
|
||||
Collective::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
index,
|
||||
approve,
|
||||
)?;
|
||||
|
||||
assert_eq!(Collective::<T, _>::proposals().len(), p as usize);
|
||||
assert_eq!(Collective::<T, I>::proposals().len(), p as usize);
|
||||
|
||||
// Voter switches vote to nay, which kills the vote
|
||||
let approve = false;
|
||||
Collective::<T, _>::vote(
|
||||
Collective::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
index,
|
||||
@@ -357,8 +356,8 @@ benchmarks_instance! {
|
||||
}: close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::max_value(), bytes_in_storage)
|
||||
verify {
|
||||
// The last proposal is removed.
|
||||
assert_eq!(Collective::<T, _>::proposals().len(), (p - 1) as usize);
|
||||
assert_last_event::<T, I>(RawEvent::Disapproved(last_hash).into());
|
||||
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
|
||||
assert_last_event::<T, I>(Event::Disapproved(last_hash).into());
|
||||
}
|
||||
|
||||
close_early_approved {
|
||||
@@ -377,7 +376,7 @@ benchmarks_instance! {
|
||||
}
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
members.push(caller.clone());
|
||||
Collective::<T, _>::set_members(SystemOrigin::Root.into(), members.clone(), None, T::MaxMembers::get())?;
|
||||
Collective::<T, I>::set_members(SystemOrigin::Root.into(), members.clone(), None, T::MaxMembers::get())?;
|
||||
|
||||
// Threshold is 2 so any two ayes will approve the vote
|
||||
let threshold = 2;
|
||||
@@ -387,7 +386,7 @@ benchmarks_instance! {
|
||||
for i in 0 .. p {
|
||||
// Proposals should be different so that different proposal hashes are generated
|
||||
let proposal: T::Proposal = SystemCall::<T>::remark(vec![i as u8; b as usize]).into();
|
||||
Collective::<T, _>::propose(
|
||||
Collective::<T, I>::propose(
|
||||
SystemOrigin::Signed(caller.clone()).into(),
|
||||
threshold,
|
||||
Box::new(proposal.clone()),
|
||||
@@ -397,7 +396,7 @@ benchmarks_instance! {
|
||||
}
|
||||
|
||||
// Caller switches vote to nay on their own proposal, allowing them to be the deciding approval vote
|
||||
Collective::<T, _>::vote(
|
||||
Collective::<T, I>::vote(
|
||||
SystemOrigin::Signed(caller.clone()).into(),
|
||||
last_hash.clone(),
|
||||
p - 1,
|
||||
@@ -408,7 +407,7 @@ benchmarks_instance! {
|
||||
for j in 2 .. m - 1 {
|
||||
let voter = &members[j as usize];
|
||||
let approve = false;
|
||||
Collective::<T, _>::vote(
|
||||
Collective::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
p - 1,
|
||||
@@ -417,19 +416,19 @@ benchmarks_instance! {
|
||||
}
|
||||
|
||||
// Member zero is the first aye
|
||||
Collective::<T, _>::vote(
|
||||
Collective::<T, I>::vote(
|
||||
SystemOrigin::Signed(members[0].clone()).into(),
|
||||
last_hash.clone(),
|
||||
p - 1,
|
||||
true,
|
||||
)?;
|
||||
|
||||
assert_eq!(Collective::<T, _>::proposals().len(), p as usize);
|
||||
assert_eq!(Collective::<T, I>::proposals().len(), p as usize);
|
||||
|
||||
// Caller switches vote to aye, which passes the vote
|
||||
let index = p - 1;
|
||||
let approve = true;
|
||||
Collective::<T, _>::vote(
|
||||
Collective::<T, I>::vote(
|
||||
SystemOrigin::Signed(caller.clone()).into(),
|
||||
last_hash.clone(),
|
||||
index, approve,
|
||||
@@ -438,8 +437,8 @@ benchmarks_instance! {
|
||||
}: close(SystemOrigin::Signed(caller), last_hash.clone(), index, Weight::max_value(), bytes_in_storage)
|
||||
verify {
|
||||
// The last proposal is removed.
|
||||
assert_eq!(Collective::<T, _>::proposals().len(), (p - 1) as usize);
|
||||
assert_last_event::<T, I>(RawEvent::Executed(last_hash, Err(DispatchError::BadOrigin)).into());
|
||||
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
|
||||
assert_last_event::<T, I>(Event::Executed(last_hash, Err(DispatchError::BadOrigin)).into());
|
||||
}
|
||||
|
||||
close_disapproved {
|
||||
@@ -458,7 +457,7 @@ benchmarks_instance! {
|
||||
}
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
members.push(caller.clone());
|
||||
Collective::<T, _>::set_members(
|
||||
Collective::<T, I>::set_members(
|
||||
SystemOrigin::Root.into(),
|
||||
members.clone(),
|
||||
Some(caller.clone()),
|
||||
@@ -473,7 +472,7 @@ benchmarks_instance! {
|
||||
for i in 0 .. p {
|
||||
// Proposals should be different so that different proposal hashes are generated
|
||||
let proposal: T::Proposal = SystemCall::<T>::remark(vec![i as u8; bytes as usize]).into();
|
||||
Collective::<T, _>::propose(
|
||||
Collective::<T, I>::propose(
|
||||
SystemOrigin::Signed(caller.clone()).into(),
|
||||
threshold,
|
||||
Box::new(proposal.clone()),
|
||||
@@ -488,7 +487,7 @@ benchmarks_instance! {
|
||||
for j in 2 .. m - 1 {
|
||||
let voter = &members[j as usize];
|
||||
let approve = true;
|
||||
Collective::<T, _>::vote(
|
||||
Collective::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
index,
|
||||
@@ -497,7 +496,7 @@ benchmarks_instance! {
|
||||
}
|
||||
|
||||
// caller is prime, prime votes nay
|
||||
Collective::<T, _>::vote(
|
||||
Collective::<T, I>::vote(
|
||||
SystemOrigin::Signed(caller.clone()).into(),
|
||||
last_hash.clone(),
|
||||
index,
|
||||
@@ -505,13 +504,13 @@ benchmarks_instance! {
|
||||
)?;
|
||||
|
||||
System::<T>::set_block_number(T::BlockNumber::max_value());
|
||||
assert_eq!(Collective::<T, _>::proposals().len(), p as usize);
|
||||
assert_eq!(Collective::<T, I>::proposals().len(), p as usize);
|
||||
|
||||
// Prime nay will close it as disapproved
|
||||
}: close(SystemOrigin::Signed(caller), last_hash, index, Weight::max_value(), bytes_in_storage)
|
||||
verify {
|
||||
assert_eq!(Collective::<T, _>::proposals().len(), (p - 1) as usize);
|
||||
assert_last_event::<T, I>(RawEvent::Disapproved(last_hash).into());
|
||||
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
|
||||
assert_last_event::<T, I>(Event::Disapproved(last_hash).into());
|
||||
}
|
||||
|
||||
close_approved {
|
||||
@@ -530,7 +529,7 @@ benchmarks_instance! {
|
||||
}
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
members.push(caller.clone());
|
||||
Collective::<T, _>::set_members(
|
||||
Collective::<T, I>::set_members(
|
||||
SystemOrigin::Root.into(),
|
||||
members.clone(),
|
||||
Some(caller.clone()),
|
||||
@@ -545,7 +544,7 @@ benchmarks_instance! {
|
||||
for i in 0 .. p {
|
||||
// Proposals should be different so that different proposal hashes are generated
|
||||
let proposal: T::Proposal = SystemCall::<T>::remark(vec![i as u8; b as usize]).into();
|
||||
Collective::<T, _>::propose(
|
||||
Collective::<T, I>::propose(
|
||||
SystemOrigin::Signed(caller.clone()).into(),
|
||||
threshold,
|
||||
Box::new(proposal.clone()),
|
||||
@@ -567,7 +566,7 @@ benchmarks_instance! {
|
||||
for j in 2 .. m - 1 {
|
||||
let voter = &members[j as usize];
|
||||
let approve = false;
|
||||
Collective::<T, _>::vote(
|
||||
Collective::<T, I>::vote(
|
||||
SystemOrigin::Signed(voter.clone()).into(),
|
||||
last_hash.clone(),
|
||||
p - 1,
|
||||
@@ -577,13 +576,13 @@ benchmarks_instance! {
|
||||
|
||||
// caller is prime, prime already votes aye by creating the proposal
|
||||
System::<T>::set_block_number(T::BlockNumber::max_value());
|
||||
assert_eq!(Collective::<T, _>::proposals().len(), p as usize);
|
||||
assert_eq!(Collective::<T, I>::proposals().len(), p as usize);
|
||||
|
||||
// Prime aye will close it as approved
|
||||
}: close(SystemOrigin::Signed(caller), last_hash, p - 1, Weight::max_value(), bytes_in_storage)
|
||||
verify {
|
||||
assert_eq!(Collective::<T, _>::proposals().len(), (p - 1) as usize);
|
||||
assert_last_event::<T, I>(RawEvent::Executed(last_hash, Err(DispatchError::BadOrigin)).into());
|
||||
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
|
||||
assert_last_event::<T, I>(Event::Executed(last_hash, Err(DispatchError::BadOrigin)).into());
|
||||
}
|
||||
|
||||
disapprove_proposal {
|
||||
@@ -601,7 +600,7 @@ benchmarks_instance! {
|
||||
}
|
||||
let caller: T::AccountId = account("caller", 0, SEED);
|
||||
members.push(caller.clone());
|
||||
Collective::<T, _>::set_members(
|
||||
Collective::<T, I>::set_members(
|
||||
SystemOrigin::Root.into(),
|
||||
members.clone(),
|
||||
Some(caller.clone()),
|
||||
@@ -616,7 +615,7 @@ benchmarks_instance! {
|
||||
for i in 0 .. p {
|
||||
// Proposals should be different so that different proposal hashes are generated
|
||||
let proposal: T::Proposal = SystemCall::<T>::remark(vec![i as u8; b as usize]).into();
|
||||
Collective::<T, _>::propose(
|
||||
Collective::<T, I>::propose(
|
||||
SystemOrigin::Signed(caller.clone()).into(),
|
||||
threshold,
|
||||
Box::new(proposal.clone()),
|
||||
@@ -626,12 +625,12 @@ benchmarks_instance! {
|
||||
}
|
||||
|
||||
System::<T>::set_block_number(T::BlockNumber::max_value());
|
||||
assert_eq!(Collective::<T, _>::proposals().len(), p as usize);
|
||||
assert_eq!(Collective::<T, I>::proposals().len(), p as usize);
|
||||
|
||||
}: _(SystemOrigin::Root, last_hash)
|
||||
verify {
|
||||
assert_eq!(Collective::<T, _>::proposals().len(), (p - 1) as usize);
|
||||
assert_last_event::<T, I>(RawEvent::Disapproved(last_hash).into());
|
||||
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
|
||||
assert_last_event::<T, I>(Event::Disapproved(last_hash).into());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user