mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 10:27:59 +00:00
Add call hash as parameters of multisig related event (#5499)
* Add call hash as parameters of multisig related event * update docs
This commit is contained in:
@@ -170,7 +170,8 @@ decl_event! {
|
||||
/// Events type.
|
||||
pub enum Event<T> where
|
||||
AccountId = <T as system::Trait>::AccountId,
|
||||
BlockNumber = <T as system::Trait>::BlockNumber
|
||||
BlockNumber = <T as system::Trait>::BlockNumber,
|
||||
CallHash = [u8; 32]
|
||||
{
|
||||
/// Batch of dispatches did not complete fully. Index of first failing dispatch given, as
|
||||
/// well as the error.
|
||||
@@ -178,17 +179,17 @@ decl_event! {
|
||||
/// Batch of dispatches completed fully with no error.
|
||||
BatchCompleted,
|
||||
/// A new multisig operation has begun. First param is the account that is approving,
|
||||
/// second is the multisig account.
|
||||
NewMultisig(AccountId, AccountId),
|
||||
/// second is the multisig account, third is hash of the call.
|
||||
NewMultisig(AccountId, AccountId, CallHash),
|
||||
/// A multisig operation has been approved by someone. First param is the account that is
|
||||
/// approving, third is the multisig account.
|
||||
MultisigApproval(AccountId, Timepoint<BlockNumber>, AccountId),
|
||||
/// approving, third is the multisig account, fourth is hash of the call.
|
||||
MultisigApproval(AccountId, Timepoint<BlockNumber>, AccountId, CallHash),
|
||||
/// A multisig operation has been executed. First param is the account that is
|
||||
/// approving, third is the multisig account.
|
||||
MultisigExecuted(AccountId, Timepoint<BlockNumber>, AccountId, DispatchResult),
|
||||
/// approving, third is the multisig account, fourth is hash of the call to be executed.
|
||||
MultisigExecuted(AccountId, Timepoint<BlockNumber>, AccountId, CallHash, DispatchResult),
|
||||
/// A multisig operation has been cancelled. First param is the account that is
|
||||
/// cancelling, third is the multisig account.
|
||||
MultisigCancelled(AccountId, Timepoint<BlockNumber>, AccountId),
|
||||
/// cancelling, third is the multisig account, fourth is hash of the call.
|
||||
MultisigCancelled(AccountId, Timepoint<BlockNumber>, AccountId, CallHash),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,7 +348,7 @@ decl_module! {
|
||||
if (m.approvals.len() as u16) < threshold - 1 {
|
||||
m.approvals.insert(pos, who.clone());
|
||||
<Multisigs<T>>::insert(&id, call_hash, m);
|
||||
Self::deposit_event(RawEvent::MultisigApproval(who, timepoint, id));
|
||||
Self::deposit_event(RawEvent::MultisigApproval(who, timepoint, id, call_hash));
|
||||
return Ok(())
|
||||
}
|
||||
} else {
|
||||
@@ -360,7 +361,7 @@ decl_module! {
|
||||
let _ = T::Currency::unreserve(&m.depositor, m.deposit);
|
||||
<Multisigs<T>>::remove(&id, call_hash);
|
||||
Self::deposit_event(RawEvent::MultisigExecuted(
|
||||
who, timepoint, id, result.map(|_| ()).map_err(|e| e.error)
|
||||
who, timepoint, id, call_hash, result.map(|_| ()).map_err(|e| e.error)
|
||||
));
|
||||
} else {
|
||||
ensure!(maybe_timepoint.is_none(), Error::<T>::UnexpectedTimepoint);
|
||||
@@ -374,7 +375,7 @@ decl_module! {
|
||||
depositor: who.clone(),
|
||||
approvals: vec![who.clone()],
|
||||
});
|
||||
Self::deposit_event(RawEvent::NewMultisig(who, id));
|
||||
Self::deposit_event(RawEvent::NewMultisig(who, id, call_hash));
|
||||
} else {
|
||||
return call.dispatch(frame_system::RawOrigin::Signed(id).into())
|
||||
.map(|_| ()).map_err(|e| e.error)
|
||||
@@ -444,7 +445,7 @@ decl_module! {
|
||||
if let Err(pos) = m.approvals.binary_search(&who) {
|
||||
m.approvals.insert(pos, who.clone());
|
||||
<Multisigs<T>>::insert(&id, call_hash, m);
|
||||
Self::deposit_event(RawEvent::MultisigApproval(who, timepoint, id));
|
||||
Self::deposit_event(RawEvent::MultisigApproval(who, timepoint, id, call_hash));
|
||||
} else {
|
||||
Err(Error::<T>::AlreadyApproved)?
|
||||
}
|
||||
@@ -460,7 +461,7 @@ decl_module! {
|
||||
depositor: who.clone(),
|
||||
approvals: vec![who.clone()],
|
||||
});
|
||||
Self::deposit_event(RawEvent::NewMultisig(who, id));
|
||||
Self::deposit_event(RawEvent::NewMultisig(who, id, call_hash));
|
||||
} else {
|
||||
Err(Error::<T>::NoApprovalsNeeded)?
|
||||
}
|
||||
@@ -520,7 +521,7 @@ decl_module! {
|
||||
let _ = T::Currency::unreserve(&m.depositor, m.deposit);
|
||||
<Multisigs<T>>::remove(&id, call_hash);
|
||||
|
||||
Self::deposit_event(RawEvent::MultisigCancelled(who, timepoint, id));
|
||||
Self::deposit_event(RawEvent::MultisigCancelled(who, timepoint, id, call_hash));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,10 +303,10 @@ fn multisig_2_of_3_cannot_reissue_same_call() {
|
||||
assert_eq!(Balances::free_balance(multi), 5);
|
||||
|
||||
assert_ok!(Utility::as_multi(Origin::signed(1), 2, vec![2, 3], None, call.clone()));
|
||||
assert_ok!(Utility::as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), call));
|
||||
assert_ok!(Utility::as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), call.clone()));
|
||||
|
||||
let err = DispatchError::from(BalancesError::<Test, _>::InsufficientBalance).stripped();
|
||||
expect_event(RawEvent::MultisigExecuted(3, now(), multi, Err(err)));
|
||||
expect_event(RawEvent::MultisigExecuted(3, now(), multi, call.using_encoded(blake2_256), Err(err)));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user