Use log::error! for bad mandatory (#8521)

To make the life of people easier ;)
This commit is contained in:
Bastian Köcher
2021-04-04 13:42:11 +02:00
committed by GitHub
parent 1740177462
commit 4e334f59d6
3 changed files with 5 additions and 7 deletions
@@ -650,7 +650,7 @@ mod tests {
#[test] #[test]
#[should_panic(expected = "Invalid unsigned submission must produce invalid block and \ #[should_panic(expected = "Invalid unsigned submission must produce invalid block and \
deprive validator from their authoring reward.: \ deprive validator from their authoring reward.: \
DispatchError::Module { index: 2, error: 1, message: \ Module { index: 2, error: 1, message: \
Some(\"PreDispatchWrongWinnerCount\") }")] Some(\"PreDispatchWrongWinnerCount\") }")]
fn unfeasible_solution_panics() { fn unfeasible_solution_panics() {
ExtBuilder::default().build_and_execute(|| { ExtBuilder::default().build_and_execute(|| {
@@ -18,7 +18,7 @@
use crate::{limits::BlockWeights, Config, Pallet}; use crate::{limits::BlockWeights, Config, Pallet};
use codec::{Encode, Decode}; use codec::{Encode, Decode};
use sp_runtime::{ use sp_runtime::{
traits::{SignedExtension, DispatchInfoOf, Dispatchable, PostDispatchInfoOf, Printable}, traits::{SignedExtension, DispatchInfoOf, Dispatchable, PostDispatchInfoOf},
transaction_validity::{ transaction_validity::{
ValidTransaction, TransactionValidityError, InvalidTransaction, TransactionValidity, ValidTransaction, TransactionValidityError, InvalidTransaction, TransactionValidity,
TransactionPriority, TransactionPriority,
@@ -248,9 +248,7 @@ impl<T: Config + Send + Sync> SignedExtension for CheckWeight<T> where
// to them actually being useful. Block producers are thus not allowed to include mandatory // to them actually being useful. Block producers are thus not allowed to include mandatory
// extrinsics that result in error. // extrinsics that result in error.
if let (DispatchClass::Mandatory, Err(e)) = (info.class, result) { if let (DispatchClass::Mandatory, Err(e)) = (info.class, result) {
"Bad mandatory".print(); log::error!(target: "runtime::system", "Bad mandatory: {:?}", e);
e.print();
Err(InvalidTransaction::BadMandatory)? Err(InvalidTransaction::BadMandatory)?
} }
+2 -2
View File
@@ -450,7 +450,7 @@ pub type DispatchResult = sp_std::result::Result<(), DispatchError>;
pub type DispatchResultWithInfo<T> = sp_std::result::Result<T, DispatchErrorWithPostInfo<T>>; pub type DispatchResultWithInfo<T> = sp_std::result::Result<T, DispatchErrorWithPostInfo<T>>;
/// Reason why a dispatch call failed. /// Reason why a dispatch call failed.
#[derive(Eq, Clone, Copy, Encode, Decode, RuntimeDebug)] #[derive(Eq, Clone, Copy, Encode, Decode, Debug)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub enum DispatchError { pub enum DispatchError {
/// Some error occurred. /// Some error occurred.
@@ -535,7 +535,7 @@ impl From<crate::traits::StoredMapError> for DispatchError {
} }
/// Description of what went wrong when trying to complete an operation on a token. /// Description of what went wrong when trying to complete an operation on a token.
#[derive(Eq, PartialEq, Clone, Copy, Encode, Decode, RuntimeDebug)] #[derive(Eq, PartialEq, Clone, Copy, Encode, Decode, Debug)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub enum TokenError { pub enum TokenError {
/// Funds are unavailable. /// Funds are unavailable.