Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 3ca1d91

Browse files
bkchrshawntabrizi
andauthored
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 <[email protected]> * Adds missing trait import Co-authored-by: Shawn Tabrizi <[email protected]>
1 parent 31af203 commit 3ca1d91

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

frame/system/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ use sp_runtime::{
112112
self, CheckEqual, AtLeast32Bit, Zero, SignedExtension, Lookup, LookupError,
113113
SimpleBitOps, Hash, Member, MaybeDisplay, BadOrigin, SaturatedConversion,
114114
MaybeSerialize, MaybeSerializeDeserialize, MaybeMallocSizeOf, StaticLookup, One, Bounded,
115-
Dispatchable, DispatchInfoOf, PostDispatchInfoOf,
115+
Dispatchable, DispatchInfoOf, PostDispatchInfoOf, Printable,
116116
},
117117
offchain::storage_lock::BlockNumberProvider,
118118
};
@@ -1591,7 +1591,10 @@ impl<T: Trait + Send + Sync> SignedExtension for CheckWeight<T> where
15911591
// Since mandatory dispatched do not get validated for being overweight, we are sensitive
15921592
// to them actually being useful. Block producers are thus not allowed to include mandatory
15931593
// extrinsics that result in error.
1594-
if info.class == DispatchClass::Mandatory && result.is_err() {
1594+
if let (DispatchClass::Mandatory, Err(e)) = (info.class, result) {
1595+
"Bad mandantory".print();
1596+
e.print();
1597+
15951598
Err(InvalidTransaction::BadMandatory)?
15961599
}
15971600

0 commit comments

Comments
 (0)