mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 23:51:01 +00:00
include dispatch result in the Executed event (#9315)
* include dispatch result in the Executed event * fix * trigger CI
This commit is contained in:
@@ -25,7 +25,7 @@ use frame_support::{
|
|||||||
traits::{Currency, Get, EnsureOrigin, OnInitialize, UnfilteredDispatchable, schedule::DispatchTime},
|
traits::{Currency, Get, EnsureOrigin, OnInitialize, UnfilteredDispatchable, schedule::DispatchTime},
|
||||||
};
|
};
|
||||||
use frame_system::{RawOrigin, Pallet as System, self};
|
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;
|
use crate::Pallet as Democracy;
|
||||||
|
|
||||||
@@ -759,7 +759,7 @@ benchmarks! {
|
|||||||
}: enact_proposal(RawOrigin::Root, proposal_hash, 0)
|
}: enact_proposal(RawOrigin::Root, proposal_hash, 0)
|
||||||
verify {
|
verify {
|
||||||
// Fails due to mismatched origin
|
// 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]
|
#[extra]
|
||||||
|
|||||||
@@ -512,8 +512,8 @@ pub mod pallet {
|
|||||||
NotPassed(ReferendumIndex),
|
NotPassed(ReferendumIndex),
|
||||||
/// A referendum has been cancelled. \[ref_index\]
|
/// A referendum has been cancelled. \[ref_index\]
|
||||||
Cancelled(ReferendumIndex),
|
Cancelled(ReferendumIndex),
|
||||||
/// A proposal has been enacted. \[ref_index, is_ok\]
|
/// A proposal has been enacted. \[ref_index, result\]
|
||||||
Executed(ReferendumIndex, bool),
|
Executed(ReferendumIndex, DispatchResult),
|
||||||
/// An account has delegated their vote to another account. \[who, target\]
|
/// An account has delegated their vote to another account. \[who, target\]
|
||||||
Delegated(T::AccountId, T::AccountId),
|
Delegated(T::AccountId, T::AccountId),
|
||||||
/// An \[account\] has cancelled a previous delegation operation.
|
/// An \[account\] has cancelled a previous delegation operation.
|
||||||
@@ -1654,8 +1654,9 @@ impl<T: Config> Pallet<T> {
|
|||||||
debug_assert!(err_amount.is_zero());
|
debug_assert!(err_amount.is_zero());
|
||||||
Self::deposit_event(Event::<T>::PreimageUsed(proposal_hash, provider, deposit));
|
Self::deposit_event(Event::<T>::PreimageUsed(proposal_hash, provider, deposit));
|
||||||
|
|
||||||
let ok = proposal.dispatch(frame_system::RawOrigin::Root.into()).is_ok();
|
let res = proposal.dispatch(frame_system::RawOrigin::Root.into())
|
||||||
Self::deposit_event(Event::<T>::Executed(index, ok));
|
.map(|_| ()).map_err(|e| e.error);
|
||||||
|
Self::deposit_event(Event::<T>::Executed(index, res));
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user