Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions prdoc/pr_8925.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: 'Multisig::as_multi_threshold_1: Send `MultisigExecuted` event'
doc:
- audience: Runtime User
description: |-
So the behavior is the same as `as_multi` when it comes to sending an event.

Closes: https://github.com/paritytech/polkadot-sdk/issues/8924
crates:
- name: pallet-multisig
bump: patch
16 changes: 12 additions & 4 deletions substrate/frame/multisig/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,20 @@ pub mod pallet {
ensure!(!other_signatories.is_empty(), Error::<T>::TooFewSignatories);
let other_signatories_len = other_signatories.len();
ensure!(other_signatories_len < max_sigs, Error::<T>::TooManySignatories);
let signatories = Self::ensure_sorted_and_insert(other_signatories, who)?;
let signatories = Self::ensure_sorted_and_insert(other_signatories, who.clone())?;

let id = Self::multi_account_id(&signatories, 1);

let call_len = call.using_encoded(|c| c.len());
let result = call.dispatch(RawOrigin::Signed(id).into());
let (call_len, call_hash) = call.using_encoded(|c| (c.len(), blake2_256(&c)));
let result = call.dispatch(RawOrigin::Signed(id.clone()).into());

Self::deposit_event(Event::MultisigExecuted {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only difference is that this will not appear when the call is returning an error, as we then revert all the changes. (rollback of the transaction)

Copy link
Copy Markdown
Member Author

@bkchr bkchr Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked to Valentin. He is fine with the pr how it is.

approving: who,
timepoint: Self::timepoint(),
multisig: id,
call_hash,
result: result.map(|_| ()).map_err(|e| e.error),
});

result
.map(|post_dispatch_info| {
Expand Down Expand Up @@ -582,7 +590,7 @@ pub mod pallet {
let remaining_unreserved = T::Currency::unreserve(&who, excess);
if !remaining_unreserved.is_zero() {
defensive!(
"Failed to unreserve for full amount for multisig. (Call Hash, Requested, Actual): ",
"Failed to unreserve for full amount for multisig. (Call Hash, Requested, Actual): ",
(call_hash, excess, excess.saturating_sub(remaining_unreserved))
);
}
Expand Down
10 changes: 10 additions & 0 deletions substrate/frame/multisig/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,16 @@ fn multisig_1_of_3_works() {
call_transfer(6, 15)
));

System::assert_last_event(
pallet_multisig::Event::MultisigExecuted {
approving: 1,
timepoint: now(),
multisig: multi,
call_hash: hash,
result: Ok(()),
}
.into(),
);
assert_eq!(Balances::free_balance(6), 15);
});
}
Expand Down
Loading