engine error: remove faulty/unused From (#11404)

This commit is contained in:
Niklas Adolfsson 2020-01-24 14:52:12 +01:00 committed by Andronik Ordian
parent e1d06efe60
commit bbc6fb5db6

View File

@ -16,12 +16,11 @@
use std::fmt; use std::fmt;
use derive_more::From;
use ethereum_types::{Address, H64, H256}; use ethereum_types::{Address, H64, H256};
use unexpected::{Mismatch, OutOfBounds}; use unexpected::{Mismatch, OutOfBounds};
/// Voting errors. /// Voting errors.
#[derive(Debug, From)] #[derive(Debug)]
pub enum EngineError { pub enum EngineError {
/// Signature or author field does not belong to an authority. /// Signature or author field does not belong to an authority.
NotAuthorized(Address), NotAuthorized(Address),
@ -78,11 +77,11 @@ impl fmt::Display for EngineError {
use self::EngineError::*; use self::EngineError::*;
let msg = match *self { let msg = match *self {
CliqueMissingCheckpoint(ref hash) => format!("Missing checkpoint block: {}", hash), CliqueMissingCheckpoint(ref hash) => format!("Missing checkpoint block: {}", hash),
CliqueMissingVanity => format!("Extra data is missing vanity data"), CliqueMissingVanity => "Extra data is missing vanity data".into(),
CliqueMissingSignature => format!("Extra data is missing signature"), CliqueMissingSignature => "Extra data is missing signature".into(),
CliqueCheckpointInvalidSigners(len) => format!("Checkpoint block list was of length: {} of checkpoint but CliqueCheckpointInvalidSigners(len) => format!("Checkpoint block list was of length: {} of checkpoint but
it needs to be bigger than zero and a divisible by 20", len), it needs to be bigger than zero and a divisible by 20", len),
CliqueCheckpointNoSigner => format!("Checkpoint block list of signers was empty"), CliqueCheckpointNoSigner => "Checkpoint block list of signers was empty".into(),
CliqueInvalidNonce(ref mis) => format!("Unexpected nonce {} expected {} or {}", mis, 0_u64, u64::max_value()), CliqueInvalidNonce(ref mis) => format!("Unexpected nonce {} expected {} or {}", mis, 0_u64, u64::max_value()),
CliqueWrongAuthorCheckpoint(ref oob) => format!("Unexpected checkpoint author: {}", oob), CliqueWrongAuthorCheckpoint(ref oob) => format!("Unexpected checkpoint author: {}", oob),
CliqueFaultyRecoveredSigners(ref mis) => format!("Faulty recovered signers {:?}", mis), CliqueFaultyRecoveredSigners(ref mis) => format!("Faulty recovered signers {:?}", mis),
@ -98,9 +97,9 @@ impl fmt::Display for EngineError {
SystemCallResultDecoding(ref msg) => format!("Failed to decode the result of a system call: {}", msg), SystemCallResultDecoding(ref msg) => format!("Failed to decode the result of a system call: {}", msg),
SystemCallResultInvalid(ref msg) => format!("The result of a system call is invalid: {}", msg), SystemCallResultInvalid(ref msg) => format!("The result of a system call is invalid: {}", msg),
MalformedMessage(ref msg) => format!("Received malformed consensus message: {}", msg), MalformedMessage(ref msg) => format!("Received malformed consensus message: {}", msg),
RequiresClient => format!("Call requires client but none registered"), RequiresClient => "Call requires client but none registered".into(),
RequiresSigner => format!("Call requires signer but none registered"), RequiresSigner => "Call requires signer but none registered".into(),
InvalidEngine => format!("Invalid engine specification or implementation"), InvalidEngine => "Invalid engine specification or implementation".into(),
MissingParent(ref hash) => format!("Parent Epoch is missing from database: {}", hash), MissingParent(ref hash) => format!("Parent Epoch is missing from database: {}", hash),
}; };