diff --git a/prdoc/pr_8925.prdoc b/prdoc/pr_8925.prdoc new file mode 100644 index 0000000000000..4113bc41b493c --- /dev/null +++ b/prdoc/pr_8925.prdoc @@ -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 diff --git a/substrate/frame/multisig/src/lib.rs b/substrate/frame/multisig/src/lib.rs index b428d9210243d..d6694893974ce 100644 --- a/substrate/frame/multisig/src/lib.rs +++ b/substrate/frame/multisig/src/lib.rs @@ -318,12 +318,20 @@ pub mod pallet { ensure!(!other_signatories.is_empty(), Error::::TooFewSignatories); let other_signatories_len = other_signatories.len(); ensure!(other_signatories_len < max_sigs, Error::::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 { + approving: who, + timepoint: Self::timepoint(), + multisig: id, + call_hash, + result: result.map(|_| ()).map_err(|e| e.error), + }); result .map(|post_dispatch_info| { @@ -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)) ); } diff --git a/substrate/frame/multisig/src/tests.rs b/substrate/frame/multisig/src/tests.rs index a5206342c762e..8366eb58fc1ca 100644 --- a/substrate/frame/multisig/src/tests.rs +++ b/substrate/frame/multisig/src/tests.rs @@ -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); }); }