From 3ca1d91f0f53f03d95e5335ad3d7d125e379c9d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 19 Jun 2020 13:15:21 +0200 Subject: [PATCH] Print bad mandatory error (#6416) * Print bad mandatory error This prints the error that leads to bad mandatory. * Update frame/system/src/lib.rs Co-authored-by: Shawn Tabrizi * Adds missing trait import Co-authored-by: Shawn Tabrizi --- frame/system/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index b64b5d58f73d1..71e1f38770d0e 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -112,7 +112,7 @@ use sp_runtime::{ self, CheckEqual, AtLeast32Bit, Zero, SignedExtension, Lookup, LookupError, SimpleBitOps, Hash, Member, MaybeDisplay, BadOrigin, SaturatedConversion, MaybeSerialize, MaybeSerializeDeserialize, MaybeMallocSizeOf, StaticLookup, One, Bounded, - Dispatchable, DispatchInfoOf, PostDispatchInfoOf, + Dispatchable, DispatchInfoOf, PostDispatchInfoOf, Printable, }, offchain::storage_lock::BlockNumberProvider, }; @@ -1591,7 +1591,10 @@ impl SignedExtension for CheckWeight where // Since mandatory dispatched do not get validated for being overweight, we are sensitive // to them actually being useful. Block producers are thus not allowed to include mandatory // extrinsics that result in error. - if info.class == DispatchClass::Mandatory && result.is_err() { + if let (DispatchClass::Mandatory, Err(e)) = (info.class, result) { + "Bad mandantory".print(); + e.print(); + Err(InvalidTransaction::BadMandatory)? }