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

Commit

Permalink
Use log::error! for bad mandatory (#8521)
Browse files Browse the repository at this point in the history
To make the life of people easier ;)
  • Loading branch information
bkchr committed Apr 4, 2021
1 parent 2ab715f commit 67adfea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion frame/election-provider-multi-phase/src/unsigned.rs
Expand Up @@ -650,7 +650,7 @@ mod tests {
#[test]
#[should_panic(expected = "Invalid unsigned submission must produce invalid block and \
deprive validator from their authoring reward.: \
DispatchError::Module { index: 2, error: 1, message: \
Module { index: 2, error: 1, message: \
Some(\"PreDispatchWrongWinnerCount\") }")]
fn unfeasible_solution_panics() {
ExtBuilder::default().build_and_execute(|| {
Expand Down
6 changes: 2 additions & 4 deletions frame/system/src/extensions/check_weight.rs
Expand Up @@ -18,7 +18,7 @@
use crate::{limits::BlockWeights, Config, Pallet};
use codec::{Encode, Decode};
use sp_runtime::{
traits::{SignedExtension, DispatchInfoOf, Dispatchable, PostDispatchInfoOf, Printable},
traits::{SignedExtension, DispatchInfoOf, Dispatchable, PostDispatchInfoOf},
transaction_validity::{
ValidTransaction, TransactionValidityError, InvalidTransaction, TransactionValidity,
TransactionPriority,
Expand Down Expand Up @@ -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
// extrinsics that result in error.
if let (DispatchClass::Mandatory, Err(e)) = (info.class, result) {
"Bad mandatory".print();
e.print();

log::error!(target: "runtime::system", "Bad mandatory: {:?}", e);
Err(InvalidTransaction::BadMandatory)?
}

Expand Down
4 changes: 2 additions & 2 deletions primitives/runtime/src/lib.rs
Expand Up @@ -450,7 +450,7 @@ pub type DispatchResult = sp_std::result::Result<(), DispatchError>;
pub type DispatchResultWithInfo<T> = sp_std::result::Result<T, DispatchErrorWithPostInfo<T>>;

/// 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))]
pub enum DispatchError {
/// Some error occurred.
Expand Down Expand Up @@ -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.
#[derive(Eq, PartialEq, Clone, Copy, Encode, Decode, RuntimeDebug)]
#[derive(Eq, PartialEq, Clone, Copy, Encode, Decode, Debug)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub enum TokenError {
/// Funds are unavailable.
Expand Down

0 comments on commit 67adfea

Please sign in to comment.