mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 20:21:03 +00:00
Democracy weight (#5828)
This commit is contained in:
@@ -34,7 +34,6 @@ const MAX_USERS: u32 = 1000;
|
||||
const MAX_REFERENDUMS: u32 = 100;
|
||||
const MAX_PROPOSALS: u32 = 100;
|
||||
const MAX_SECONDERS: u32 = 100;
|
||||
const MAX_VETOERS: u32 = 100;
|
||||
const MAX_BYTES: u32 = 16_384;
|
||||
|
||||
fn assert_last_event<T: Trait>(generic_event: <T as Trait>::Event) {
|
||||
@@ -56,7 +55,11 @@ fn add_proposal<T: Trait>(n: u32) -> Result<T::Hash, &'static str> {
|
||||
let value = T::MinimumDeposit::get();
|
||||
let proposal_hash: T::Hash = T::Hashing::hash_of(&n);
|
||||
|
||||
Democracy::<T>::propose(RawOrigin::Signed(other).into(), proposal_hash, value.into())?;
|
||||
Democracy::<T>::propose(
|
||||
RawOrigin::Signed(other).into(),
|
||||
proposal_hash,
|
||||
value.into(),
|
||||
)?;
|
||||
|
||||
Ok(proposal_hash)
|
||||
}
|
||||
@@ -134,15 +137,15 @@ benchmarks! {
|
||||
// Create s existing "seconds"
|
||||
for i in 0 .. s {
|
||||
let seconder = funded_account::<T>("seconder", i);
|
||||
Democracy::<T>::second(RawOrigin::Signed(seconder).into(), 0)?;
|
||||
Democracy::<T>::second(RawOrigin::Signed(seconder).into(), 0, u32::max_value())?;
|
||||
}
|
||||
|
||||
let deposits = Democracy::<T>::deposit_of(0).ok_or("Proposal not created")?;
|
||||
assert_eq!(deposits.1.len(), (s + 1) as usize, "Seconds not recorded");
|
||||
}: _(RawOrigin::Signed(caller), 0)
|
||||
assert_eq!(deposits.0.len(), (s + 1) as usize, "Seconds not recorded");
|
||||
}: _(RawOrigin::Signed(caller), 0, u32::max_value())
|
||||
verify {
|
||||
let deposits = Democracy::<T>::deposit_of(0).ok_or("Proposal not created")?;
|
||||
assert_eq!(deposits.1.len(), (s + 2) as usize, "`second` benchmark did not work");
|
||||
assert_eq!(deposits.0.len(), (s + 2) as usize, "`second` benchmark did not work");
|
||||
}
|
||||
|
||||
vote_new {
|
||||
@@ -300,7 +303,7 @@ benchmarks! {
|
||||
// Worst case scenario, we external propose a previously blacklisted proposal
|
||||
external_propose {
|
||||
let p in 1 .. MAX_PROPOSALS;
|
||||
let v in 1 .. MAX_VETOERS;
|
||||
let v in 1 .. MAX_VETOERS as u32;
|
||||
|
||||
let origin = T::ExternalOrigin::successful_origin();
|
||||
let proposal_hash = T::Hashing::hash_of(&p);
|
||||
@@ -361,7 +364,7 @@ benchmarks! {
|
||||
|
||||
veto_external {
|
||||
// Existing veto-ers
|
||||
let v in 0 .. MAX_VETOERS;
|
||||
let v in 0 .. MAX_VETOERS as u32;
|
||||
|
||||
let proposal_hash: T::Hash = T::Hashing::hash_of(&v);
|
||||
|
||||
@@ -685,7 +688,7 @@ benchmarks! {
|
||||
assert!(Preimages::<T>::contains_key(proposal_hash));
|
||||
|
||||
let caller = funded_account::<T>("caller", 0);
|
||||
}: _(RawOrigin::Signed(caller), proposal_hash.clone())
|
||||
}: _(RawOrigin::Signed(caller), proposal_hash.clone(), u32::max_value())
|
||||
verify {
|
||||
let proposal_hash = T::Hashing::hash(&encoded_proposal[..]);
|
||||
assert!(!Preimages::<T>::contains_key(proposal_hash));
|
||||
|
||||
Reference in New Issue
Block a user