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

Commit

Permalink
frame_system::remark: Allow any kind of origin (#14260)
Browse files Browse the repository at this point in the history
* frame_system::remark: Allow any kind of origin

There should be no downside in allowing any kind of origin for `remark`.

* Fix tests
  • Loading branch information
bkchr authored Jun 4, 2023
1 parent 715b246 commit e0752b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion frame/alliance/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ fn close_works() {
})),
record(mock::RuntimeEvent::AllianceMotion(AllianceMotionEvent::Executed {
proposal_hash: hash,
result: Err(DispatchError::BadOrigin),
result: Ok(()),
}))
]
);
Expand Down
8 changes: 4 additions & 4 deletions frame/collective/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ benchmarks_instance_pallet! {
let proposal_hash = T::Hashing::hash_of(&proposal);
// Note that execution fails due to mis-matched origin
assert_last_event::<T, I>(
Event::MemberExecuted { proposal_hash, result: Err(DispatchError::BadOrigin) }.into()
Event::MemberExecuted { proposal_hash, result: Ok(()) }.into()
);
}

Expand Down Expand Up @@ -162,7 +162,7 @@ benchmarks_instance_pallet! {
let proposal_hash = T::Hashing::hash_of(&proposal);
// Note that execution fails due to mis-matched origin
assert_last_event::<T, I>(
Event::Executed { proposal_hash, result: Err(DispatchError::BadOrigin) }.into()
Event::Executed { proposal_hash, result: Ok(()) }.into()
);
}

Expand Down Expand Up @@ -441,7 +441,7 @@ benchmarks_instance_pallet! {
verify {
// The last proposal is removed.
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
assert_last_event::<T, I>(Event::Executed { proposal_hash: last_hash, result: Err(DispatchError::BadOrigin) }.into());
assert_last_event::<T, I>(Event::Executed { proposal_hash: last_hash, result: Ok(()) }.into());
}

close_disapproved {
Expand Down Expand Up @@ -595,7 +595,7 @@ benchmarks_instance_pallet! {
}: close(SystemOrigin::Signed(caller), last_hash, p - 1, Weight::MAX, bytes_in_storage)
verify {
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
assert_last_event::<T, I>(Event::Executed { proposal_hash: last_hash, result: Err(DispatchError::BadOrigin) }.into());
assert_last_event::<T, I>(Event::Executed { proposal_hash: last_hash, result: Ok(()) }.into());
}

disapprove_proposal {
Expand Down
5 changes: 2 additions & 3 deletions frame/system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,10 @@ pub mod pallet {
impl<T: Config> Pallet<T> {
/// Make some on-chain remark.
///
/// - `O(1)`
/// Can be executed by every `origin`.
#[pallet::call_index(0)]
#[pallet::weight(T::SystemWeightInfo::remark(_remark.len() as u32))]
pub fn remark(origin: OriginFor<T>, _remark: Vec<u8>) -> DispatchResultWithPostInfo {
ensure_signed_or_root(origin)?;
pub fn remark(_origin: OriginFor<T>, _remark: Vec<u8>) -> DispatchResultWithPostInfo {
Ok(().into())
}

Expand Down

0 comments on commit e0752b1

Please sign in to comment.