From 3dbdcd527a0ba4d7c1a1849e096e457f175c49fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Thu, 18 Jun 2020 23:41:25 +0200 Subject: [PATCH 1/3] Print bad mandatory error This prints the error that leads to bad mandatory. --- frame/system/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index b64b5d58f73d1..18e17e58a8ecb 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -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(); + err.print(); + Err(InvalidTransaction::BadMandatory)? } From 2217be851cb0cd5fa8b3c42d5dedc6cc49e1dfa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 19 Jun 2020 00:21:23 +0200 Subject: [PATCH 2/3] Update frame/system/src/lib.rs Co-authored-by: Shawn Tabrizi --- frame/system/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index 18e17e58a8ecb..83d473dda19c6 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -1593,7 +1593,7 @@ impl SignedExtension for CheckWeight where // extrinsics that result in error. if let (DispatchClass::Mandatory, Err(e)) = (info.class, result) { "Bad mandantory".print(); - err.print(); + e.print(); Err(InvalidTransaction::BadMandatory)? } From daf7eecd1579e759a9d6043205f68410fa5e6899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 19 Jun 2020 09:40:00 +0200 Subject: [PATCH 3/3] Adds missing trait import --- frame/system/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index 83d473dda19c6..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, };