mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-25 04:45:42 +00:00
BREAKING: Rename Call & Event (#11981)
* rename Event to RuntimeEvent * rename Call * rename in runtimes * small fix * rename Event * small fix & rename RuntimeCall back to Call for now * small fixes * more renaming * a bit more renaming * fmt * small fix * commit * prep for renaming associated types * fix * rename associated Event type * rename to RuntimeEvent * commit * merge conflict fixes & fmt * additional renaming * fix. * fix decl_event * rename in tests * remove warnings * remove accidental rename * . * commit * update .stderr * fix in test * update .stderr * TRYBUILD=overwrite * docs * fmt * small change in docs * rename PalletEvent to Event * rename Call to RuntimeCall * renamed at wrong places :P * rename Call * rename * rename associated type * fix * fix & fmt * commit * frame-support-test * passing tests * update docs * rustdoc fix * update .stderr * wrong code in docs * merge fix * fix in error message * update .stderr * docs & error message * . * merge fix * merge fix * fmt * fmt * merge fix * more fixing * fmt * remove unused * fmt * fix Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -30,7 +30,7 @@ const SEED: u32 = 0;
|
||||
|
||||
const MAX_BYTES: u32 = 1_024;
|
||||
|
||||
fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::Event) {
|
||||
fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::RuntimeEvent) {
|
||||
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,8 @@ pub mod pallet {
|
||||
+ GetDispatchInfo;
|
||||
|
||||
/// The outer event type.
|
||||
type Event: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::Event>;
|
||||
type RuntimeEvent: From<Event<Self, I>>
|
||||
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
|
||||
/// The time-out for council motions.
|
||||
type MotionDuration: Get<Self::BlockNumber>;
|
||||
|
||||
@@ -32,7 +32,7 @@ use sp_runtime::{
|
||||
};
|
||||
|
||||
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, u64, Call, ()>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, u64, RuntimeCall, ()>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub enum Test where
|
||||
@@ -61,7 +61,8 @@ mod mock_democracy {
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config: frame_system::Config + Sized {
|
||||
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
|
||||
type RuntimeEvent: From<Event<Self>>
|
||||
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
type ExternalMajorityOrigin: EnsureOrigin<Self::Origin>;
|
||||
}
|
||||
|
||||
@@ -99,13 +100,13 @@ impl frame_system::Config for Test {
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
type Call = Call;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = H256;
|
||||
type Hashing = BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = ConstU64<250>;
|
||||
type Version = ();
|
||||
type PalletInfo = PalletInfo;
|
||||
@@ -119,8 +120,8 @@ impl frame_system::Config for Test {
|
||||
}
|
||||
impl Config<Instance1> for Test {
|
||||
type Origin = Origin;
|
||||
type Proposal = Call;
|
||||
type Event = Event;
|
||||
type Proposal = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type MotionDuration = ConstU64<3>;
|
||||
type MaxProposals = MaxProposals;
|
||||
type MaxMembers = MaxMembers;
|
||||
@@ -129,8 +130,8 @@ impl Config<Instance1> for Test {
|
||||
}
|
||||
impl Config<Instance2> for Test {
|
||||
type Origin = Origin;
|
||||
type Proposal = Call;
|
||||
type Event = Event;
|
||||
type Proposal = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type MotionDuration = ConstU64<3>;
|
||||
type MaxProposals = MaxProposals;
|
||||
type MaxMembers = MaxMembers;
|
||||
@@ -138,13 +139,13 @@ impl Config<Instance2> for Test {
|
||||
type WeightInfo = ();
|
||||
}
|
||||
impl mock_democracy::Config for Test {
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type ExternalMajorityOrigin = EnsureProportionAtLeast<u64, Instance1, 3, 4>;
|
||||
}
|
||||
impl Config for Test {
|
||||
type Origin = Origin;
|
||||
type Proposal = Call;
|
||||
type Event = Event;
|
||||
type Proposal = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type MotionDuration = ConstU64<3>;
|
||||
type MaxProposals = MaxProposals;
|
||||
type MaxMembers = MaxMembers;
|
||||
@@ -171,11 +172,13 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
ext
|
||||
}
|
||||
|
||||
fn make_proposal(value: u64) -> Call {
|
||||
Call::System(frame_system::Call::remark_with_event { remark: value.to_be_bytes().to_vec() })
|
||||
fn make_proposal(value: u64) -> RuntimeCall {
|
||||
RuntimeCall::System(frame_system::Call::remark_with_event {
|
||||
remark: value.to_be_bytes().to_vec(),
|
||||
})
|
||||
}
|
||||
|
||||
fn record(event: Event) -> EventRecord<Event, H256> {
|
||||
fn record(event: RuntimeEvent) -> EventRecord<RuntimeEvent, H256> {
|
||||
EventRecord { phase: Phase::Initialization, event, topics: vec![] }
|
||||
}
|
||||
|
||||
@@ -216,32 +219,34 @@ fn close_works() {
|
||||
assert_eq!(
|
||||
System::events(),
|
||||
vec![
|
||||
record(Event::Collective(CollectiveEvent::Proposed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
|
||||
account: 1,
|
||||
proposal_index: 0,
|
||||
proposal_hash: hash,
|
||||
threshold: 3
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 1,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 1,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 2,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 2,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Closed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Closed {
|
||||
proposal_hash: hash,
|
||||
yes: 2,
|
||||
no: 1
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Disapproved { proposal_hash: hash }))
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Disapproved {
|
||||
proposal_hash: hash
|
||||
}))
|
||||
]
|
||||
);
|
||||
});
|
||||
@@ -250,7 +255,7 @@ fn close_works() {
|
||||
#[test]
|
||||
fn proposal_weight_limit_works_on_approve() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let proposal = Call::Collective(crate::Call::set_members {
|
||||
let proposal = RuntimeCall::Collective(crate::Call::set_members {
|
||||
new_members: vec![1, 2, 3],
|
||||
prime: None,
|
||||
old_count: MaxMembers::get(),
|
||||
@@ -286,7 +291,7 @@ fn proposal_weight_limit_works_on_approve() {
|
||||
#[test]
|
||||
fn proposal_weight_limit_ignored_on_disapprove() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let proposal = Call::Collective(crate::Call::set_members {
|
||||
let proposal = RuntimeCall::Collective(crate::Call::set_members {
|
||||
new_members: vec![1, 2, 3],
|
||||
prime: None,
|
||||
old_count: MaxMembers::get(),
|
||||
@@ -342,32 +347,34 @@ fn close_with_prime_works() {
|
||||
assert_eq!(
|
||||
System::events(),
|
||||
vec![
|
||||
record(Event::Collective(CollectiveEvent::Proposed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
|
||||
account: 1,
|
||||
proposal_index: 0,
|
||||
proposal_hash: hash,
|
||||
threshold: 3
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 1,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 1,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 2,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 2,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Closed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Closed {
|
||||
proposal_hash: hash,
|
||||
yes: 2,
|
||||
no: 1
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Disapproved { proposal_hash: hash }))
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Disapproved {
|
||||
proposal_hash: hash
|
||||
}))
|
||||
]
|
||||
);
|
||||
});
|
||||
@@ -402,33 +409,33 @@ fn close_with_voting_prime_works() {
|
||||
assert_eq!(
|
||||
System::events(),
|
||||
vec![
|
||||
record(Event::Collective(CollectiveEvent::Proposed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
|
||||
account: 1,
|
||||
proposal_index: 0,
|
||||
proposal_hash: hash,
|
||||
threshold: 3
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 1,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 1,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 2,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 2,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Closed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Closed {
|
||||
proposal_hash: hash,
|
||||
yes: 3,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Approved { proposal_hash: hash })),
|
||||
record(Event::Collective(CollectiveEvent::Executed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Approved { proposal_hash: hash })),
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Executed {
|
||||
proposal_hash: hash,
|
||||
result: Err(DispatchError::BadOrigin)
|
||||
}))
|
||||
@@ -473,42 +480,42 @@ fn close_with_no_prime_but_majority_works() {
|
||||
assert_eq!(
|
||||
System::events(),
|
||||
vec![
|
||||
record(Event::CollectiveMajority(CollectiveEvent::Proposed {
|
||||
record(RuntimeEvent::CollectiveMajority(CollectiveEvent::Proposed {
|
||||
account: 1,
|
||||
proposal_index: 0,
|
||||
proposal_hash: hash,
|
||||
threshold: 5
|
||||
})),
|
||||
record(Event::CollectiveMajority(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::CollectiveMajority(CollectiveEvent::Voted {
|
||||
account: 1,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 1,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::CollectiveMajority(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::CollectiveMajority(CollectiveEvent::Voted {
|
||||
account: 2,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 2,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::CollectiveMajority(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::CollectiveMajority(CollectiveEvent::Voted {
|
||||
account: 3,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 3,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::CollectiveMajority(CollectiveEvent::Closed {
|
||||
record(RuntimeEvent::CollectiveMajority(CollectiveEvent::Closed {
|
||||
proposal_hash: hash,
|
||||
yes: 5,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::CollectiveMajority(CollectiveEvent::Approved {
|
||||
record(RuntimeEvent::CollectiveMajority(CollectiveEvent::Approved {
|
||||
proposal_hash: hash
|
||||
})),
|
||||
record(Event::CollectiveMajority(CollectiveEvent::Executed {
|
||||
record(RuntimeEvent::CollectiveMajority(CollectiveEvent::Executed {
|
||||
proposal_hash: hash,
|
||||
result: Err(DispatchError::BadOrigin)
|
||||
}))
|
||||
@@ -635,7 +642,7 @@ fn propose_works() {
|
||||
|
||||
assert_eq!(
|
||||
System::events(),
|
||||
vec![record(Event::Collective(CollectiveEvent::Proposed {
|
||||
vec![record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
|
||||
account: 1,
|
||||
proposal_index: 0,
|
||||
proposal_hash: hash,
|
||||
@@ -670,7 +677,7 @@ fn limit_active_proposals() {
|
||||
#[test]
|
||||
fn correct_validate_and_get_proposal() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let proposal = Call::Collective(crate::Call::set_members {
|
||||
let proposal = RuntimeCall::Collective(crate::Call::set_members {
|
||||
new_members: vec![1, 2, 3],
|
||||
prime: None,
|
||||
old_count: MaxMembers::get(),
|
||||
@@ -803,20 +810,20 @@ fn motions_vote_after_works() {
|
||||
assert_eq!(
|
||||
System::events(),
|
||||
vec![
|
||||
record(Event::Collective(CollectiveEvent::Proposed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
|
||||
account: 1,
|
||||
proposal_index: 0,
|
||||
proposal_hash: hash,
|
||||
threshold: 2
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 1,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 1,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 1,
|
||||
proposal_hash: hash,
|
||||
voted: false,
|
||||
@@ -915,7 +922,7 @@ fn motions_reproposing_disapproved_works() {
|
||||
#[test]
|
||||
fn motions_approval_with_enough_votes_and_lower_voting_threshold_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let proposal = Call::Democracy(mock_democracy::Call::external_propose_majority {});
|
||||
let proposal = RuntimeCall::Democracy(mock_democracy::Call::external_propose_majority {});
|
||||
let proposal_len: u32 = proposal.using_encoded(|p| p.len() as u32);
|
||||
let proposal_weight = proposal.get_dispatch_info().weight;
|
||||
let hash: H256 = proposal.blake2_256().into();
|
||||
@@ -936,33 +943,33 @@ fn motions_approval_with_enough_votes_and_lower_voting_threshold_works() {
|
||||
assert_eq!(
|
||||
System::events(),
|
||||
vec![
|
||||
record(Event::Collective(CollectiveEvent::Proposed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
|
||||
account: 1,
|
||||
proposal_index: 0,
|
||||
proposal_hash: hash,
|
||||
threshold: 2
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 1,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 1,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 2,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 2,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Closed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Closed {
|
||||
proposal_hash: hash,
|
||||
yes: 2,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Approved { proposal_hash: hash })),
|
||||
record(Event::Collective(CollectiveEvent::Executed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Approved { proposal_hash: hash })),
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Executed {
|
||||
proposal_hash: hash,
|
||||
result: Err(DispatchError::BadOrigin)
|
||||
})),
|
||||
@@ -985,41 +992,43 @@ fn motions_approval_with_enough_votes_and_lower_voting_threshold_works() {
|
||||
assert_eq!(
|
||||
System::events(),
|
||||
vec![
|
||||
record(Event::Collective(CollectiveEvent::Proposed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
|
||||
account: 1,
|
||||
proposal_index: 1,
|
||||
proposal_hash: hash,
|
||||
threshold: 2
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 1,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 1,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 2,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 2,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 3,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 3,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Closed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Closed {
|
||||
proposal_hash: hash,
|
||||
yes: 3,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Approved { proposal_hash: hash })),
|
||||
record(Event::Democracy(mock_democracy::pallet::Event::<Test>::ExternalProposed)),
|
||||
record(Event::Collective(CollectiveEvent::Executed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Approved { proposal_hash: hash })),
|
||||
record(RuntimeEvent::Democracy(
|
||||
mock_democracy::pallet::Event::<Test>::ExternalProposed
|
||||
)),
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Executed {
|
||||
proposal_hash: hash,
|
||||
result: Ok(())
|
||||
})),
|
||||
@@ -1048,32 +1057,34 @@ fn motions_disapproval_works() {
|
||||
assert_eq!(
|
||||
System::events(),
|
||||
vec![
|
||||
record(Event::Collective(CollectiveEvent::Proposed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
|
||||
account: 1,
|
||||
proposal_index: 0,
|
||||
proposal_hash: hash,
|
||||
threshold: 3
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 1,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 1,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 2,
|
||||
proposal_hash: hash,
|
||||
voted: false,
|
||||
yes: 1,
|
||||
no: 1
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Closed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Closed {
|
||||
proposal_hash: hash,
|
||||
yes: 1,
|
||||
no: 1
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Disapproved { proposal_hash: hash })),
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Disapproved {
|
||||
proposal_hash: hash
|
||||
})),
|
||||
]
|
||||
);
|
||||
});
|
||||
@@ -1099,33 +1110,33 @@ fn motions_approval_works() {
|
||||
assert_eq!(
|
||||
System::events(),
|
||||
vec![
|
||||
record(Event::Collective(CollectiveEvent::Proposed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
|
||||
account: 1,
|
||||
proposal_index: 0,
|
||||
proposal_hash: hash,
|
||||
threshold: 2
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 1,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 1,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 2,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 2,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Closed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Closed {
|
||||
proposal_hash: hash,
|
||||
yes: 2,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Approved { proposal_hash: hash })),
|
||||
record(Event::Collective(CollectiveEvent::Executed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Approved { proposal_hash: hash })),
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Executed {
|
||||
proposal_hash: hash,
|
||||
result: Err(DispatchError::BadOrigin)
|
||||
})),
|
||||
@@ -1149,7 +1160,7 @@ fn motion_with_no_votes_closes_with_disapproval() {
|
||||
));
|
||||
assert_eq!(
|
||||
System::events()[0],
|
||||
record(Event::Collective(CollectiveEvent::Proposed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
|
||||
account: 1,
|
||||
proposal_index: 0,
|
||||
proposal_hash: hash,
|
||||
@@ -1173,7 +1184,7 @@ fn motion_with_no_votes_closes_with_disapproval() {
|
||||
// Events show that the close ended in a disapproval.
|
||||
assert_eq!(
|
||||
System::events()[1],
|
||||
record(Event::Collective(CollectiveEvent::Closed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Closed {
|
||||
proposal_hash: hash,
|
||||
yes: 0,
|
||||
no: 3
|
||||
@@ -1181,7 +1192,7 @@ fn motion_with_no_votes_closes_with_disapproval() {
|
||||
);
|
||||
assert_eq!(
|
||||
System::events()[2],
|
||||
record(Event::Collective(CollectiveEvent::Disapproved { proposal_hash: hash }))
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Disapproved { proposal_hash: hash }))
|
||||
);
|
||||
})
|
||||
}
|
||||
@@ -1241,27 +1252,29 @@ fn disapprove_proposal_works() {
|
||||
assert_eq!(
|
||||
System::events(),
|
||||
vec![
|
||||
record(Event::Collective(CollectiveEvent::Proposed {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Proposed {
|
||||
account: 1,
|
||||
proposal_index: 0,
|
||||
proposal_hash: hash,
|
||||
threshold: 2
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 1,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 1,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Voted {
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Voted {
|
||||
account: 2,
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 2,
|
||||
no: 0
|
||||
})),
|
||||
record(Event::Collective(CollectiveEvent::Disapproved { proposal_hash: hash })),
|
||||
record(RuntimeEvent::Collective(CollectiveEvent::Disapproved {
|
||||
proposal_hash: hash
|
||||
})),
|
||||
]
|
||||
);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user