mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 07:37:57 +00:00
Include post dispatch corrected weight in extrinsic events (#6024)
* Include post dispatch corrected weight in extrinsic events * Drop the 'Post' from ApplyExtrinsicResultWithPostInfo to make it less verbose * Apply suggestions from code review Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Use proper Event type in pallet_system tests * Add test that the actual weight is returned by events * Make fn extract_actual_weight cap at pre dispatch weight * Bump spec version Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Gavin Wood <gavin@parity.io>
This commit is contained in:
committed by
GitHub
parent
81b30fe6f6
commit
80accdbf7c
@@ -19,7 +19,8 @@
|
||||
//! stage.
|
||||
|
||||
use crate::traits::{
|
||||
self, Member, MaybeDisplay, SignedExtension, Dispatchable, DispatchInfoOf, ValidateUnsigned,
|
||||
self, Member, MaybeDisplay, SignedExtension, Dispatchable, DispatchInfoOf, PostDispatchInfoOf,
|
||||
ValidateUnsigned,
|
||||
};
|
||||
use crate::transaction_validity::{TransactionValidity, TransactionSource};
|
||||
|
||||
@@ -67,7 +68,7 @@ where
|
||||
self,
|
||||
info: &DispatchInfoOf<Self::Call>,
|
||||
len: usize,
|
||||
) -> crate::ApplyExtrinsicResult {
|
||||
) -> crate::ApplyExtrinsicResultWithInfo<PostDispatchInfoOf<Self::Call>> {
|
||||
let (maybe_who, pre) = if let Some((id, extra)) = self.signed {
|
||||
let pre = Extra::pre_dispatch(extra, &id, &self.function, info, len)?;
|
||||
(Some(id), pre)
|
||||
@@ -81,8 +82,7 @@ where
|
||||
Ok(info) => info,
|
||||
Err(err) => err.post_info,
|
||||
};
|
||||
let res = res.map(|_| ()).map_err(|e| e.error);
|
||||
Extra::post_dispatch(pre, info, &post_info, len, &res)?;
|
||||
Extra::post_dispatch(pre, info, &post_info, len, &res.map(|_| ()).map_err(|e| e.error))?;
|
||||
Ok(res)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user