Add base-weight to System::Extrinsic* events (#12329)

* Add base-weight to events

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix test

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Oliver Tale-Yazdi
2022-09-24 17:17:44 +02:00
committed by GitHub
parent 3317eb76d5
commit 26ea6e1e48
5 changed files with 198 additions and 148 deletions
+7 -1
View File
@@ -1509,9 +1509,15 @@ impl<T: Config> Pallet<T> {
}
/// To be called immediately after an extrinsic has been applied.
///
/// Emits an `ExtrinsicSuccess` or `ExtrinsicFailed` event depending on the outcome.
/// The emitted event contains the post-dispatch corrected weight including
/// the base-weight for its dispatch class.
pub fn note_applied_extrinsic(r: &DispatchResultWithPostInfo, mut info: DispatchInfo) {
info.weight = extract_actual_weight(r, &info);
info.weight = extract_actual_weight(r, &info)
.saturating_add(T::BlockWeights::get().get(info.class).base_extrinsic);
info.pays_fee = extract_actual_pays_fee(r, &info);
Self::deposit_event(match r {
Ok(_) => Event::ExtrinsicSuccess { dispatch_info: info },
Err(err) => {