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

include dispatch result in the Executed event #9315

Merged
4 commits merged into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
  • Loading branch information
xlc committed Jul 9, 2021
commit ce58ea3baf823ad133cea9d010f3199b05e76efb
4 changes: 2 additions & 2 deletions frame/democracy/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use frame_support::{
traits::{Currency, Get, EnsureOrigin, OnInitialize, UnfilteredDispatchable, schedule::DispatchTime},
};
use frame_system::{RawOrigin, Pallet as System, self};
use sp_runtime::traits::{Bounded, One};
use sp_runtime::traits::{Bounded, One, BadOrigin};

use crate::Pallet as Democracy;

Expand Down Expand Up @@ -759,7 +759,7 @@ benchmarks! {
}: enact_proposal(RawOrigin::Root, proposal_hash, 0)
verify {
// Fails due to mismatched origin
assert_last_event::<T>(Event::<T>::Executed(0, false).into());
assert_last_event::<T>(Event::<T>::Executed(0, Err(BadOrigin.into())).into());
}

#[extra]
Expand Down
3 changes: 2 additions & 1 deletion frame/democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1652,7 +1652,8 @@ impl<T: Config> Pallet<T> {
debug_assert!(err_amount.is_zero());
Self::deposit_event(Event::<T>::PreimageUsed(proposal_hash, provider, deposit));

let res = proposal.dispatch(frame_system::RawOrigin::Root.into());
let res = proposal.dispatch(frame_system::RawOrigin::Root.into())
.map(|_| ()).map_err(|e| e.error);
Self::deposit_event(Event::<T>::Executed(index, res));

Ok(())
Expand Down