Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 94679eb

Browse files
authored
Migrate pallet-democracy to pallet attribute macro (#8824)
* Migrate pallet-democracy to pallet attribute macro. * Metadata fix. * Trigger CI.
1 parent 437c838 commit 94679eb

File tree

5 files changed

+450
-341
lines changed

5 files changed

+450
-341
lines changed

bin/node/runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ construct_runtime!(
11311131
ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event<T>, ValidateUnsigned},
11321132
Staking: pallet_staking::{Pallet, Call, Config<T>, Storage, Event<T>},
11331133
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
1134-
Democracy: pallet_democracy::{Pallet, Call, Storage, Config, Event<T>},
1134+
Democracy: pallet_democracy::{Pallet, Call, Storage, Config<T>, Event<T>},
11351135
Council: pallet_collective::<Instance1>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>},
11361136
TechnicalCommittee: pallet_collective::<Instance2>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>},
11371137
Elections: pallet_elections_phragmen::{Pallet, Call, Storage, Event<T>, Config<T>},

frame/democracy/src/benchmarking.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ use super::*;
2121

2222
use frame_benchmarking::{benchmarks, account, whitelist_account, impl_benchmark_test_suite};
2323
use frame_support::{
24-
assert_noop, assert_ok, IterableStorageMap,
25-
traits::{Currency, Get, EnsureOrigin, OnInitialize, UnfilteredDispatchable,
26-
schedule::DispatchTime},
24+
assert_noop, assert_ok,
25+
traits::{Currency, Get, EnsureOrigin, OnInitialize, UnfilteredDispatchable, schedule::DispatchTime},
2726
};
2827
use frame_system::{RawOrigin, Pallet as System, self};
2928
use sp_runtime::traits::{Bounded, One};
@@ -69,13 +68,13 @@ fn add_referendum<T: Config>(n: u32) -> Result<ReferendumIndex, &'static str> {
6968
vote_threshold,
7069
0u32.into(),
7170
);
72-
let referendum_index: ReferendumIndex = ReferendumCount::get() - 1;
71+
let referendum_index: ReferendumIndex = ReferendumCount::<T>::get() - 1;
7372
T::Scheduler::schedule_named(
7473
(DEMOCRACY_ID, referendum_index).encode(),
7574
DispatchTime::At(1u32.into()),
7675
None,
7776
63,
78-
system::RawOrigin::Root.into(),
77+
frame_system::RawOrigin::Root.into(),
7978
Call::enact_proposal(proposal_hash, referendum_index).into(),
8079
).map_err(|_| "failed to schedule named")?;
8180
Ok(referendum_index)
@@ -360,7 +359,7 @@ benchmarks! {
360359
assert_eq!(Democracy::<T>::referendum_count(), r, "referenda not created");
361360

362361
// Launch external
363-
LastTabledWasExternal::put(false);
362+
LastTabledWasExternal::<T>::put(false);
364363

365364
let origin = T::ExternalMajorityOrigin::successful_origin();
366365
let proposal_hash = T::Hashing::hash_of(&r);
@@ -402,7 +401,7 @@ benchmarks! {
402401

403402
// Launch public
404403
assert!(add_proposal::<T>(r).is_ok(), "proposal not created");
405-
LastTabledWasExternal::put(true);
404+
LastTabledWasExternal::<T>::put(true);
406405

407406
let block_number = T::LaunchPeriod::get();
408407

@@ -760,7 +759,7 @@ benchmarks! {
760759
}: enact_proposal(RawOrigin::Root, proposal_hash, 0)
761760
verify {
762761
// Fails due to mismatched origin
763-
assert_last_event::<T>(RawEvent::Executed(0, false).into());
762+
assert_last_event::<T>(Event::<T>::Executed(0, false).into());
764763
}
765764

766765
#[extra]

0 commit comments

Comments
 (0)