mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-23 09:35:42 +00:00
Replace error-chain for client error (#2231)
* WIP: convert client error * Remove error_chain for client error * Ignore tx-pool error deprecation warning * Update Cargo.lock files * Fix tests * Increment impl_version * Derive From impls, remove allow(missing_docs) * Remove space * Remove redundant into()s * Blockchain Error source * Bump impl version
This commit is contained in:
committed by
Bastian Köcher
parent
1e0c1d8850
commit
7f59cdb900
@@ -19,7 +19,7 @@ use std::collections::{HashMap, HashSet};
|
||||
use client::{CallExecutor, Client};
|
||||
use client::backend::Backend;
|
||||
use client::blockchain::HeaderBackend;
|
||||
use client::error::{Error as ClientError, ErrorKind as ClientErrorKind};
|
||||
use client::error::Error as ClientError;
|
||||
use parity_codec::{Encode, Decode};
|
||||
use grandpa::voter_set::VoterSet;
|
||||
use grandpa::{Error as GrandpaError};
|
||||
@@ -64,7 +64,7 @@ impl<Block: BlockT<Hash=H256>> GrandpaJustification<Block> {
|
||||
|
||||
let error = || {
|
||||
let msg = "invalid precommits for target commit".to_string();
|
||||
Err(Error::Client(ClientErrorKind::BadJustification(msg).into()))
|
||||
Err(Error::Client(ClientError::BadJustification(msg)))
|
||||
};
|
||||
|
||||
for signed in commit.precommits.iter() {
|
||||
@@ -104,12 +104,12 @@ impl<Block: BlockT<Hash=H256>> GrandpaJustification<Block> {
|
||||
{
|
||||
let justification = GrandpaJustification::<Block>::decode(&mut &*encoded).ok_or_else(|| {
|
||||
let msg = "failed to decode grandpa justification".to_string();
|
||||
ClientError::from(ClientErrorKind::BadJustification(msg))
|
||||
ClientError::from(ClientError::BadJustification(msg))
|
||||
})?;
|
||||
|
||||
if (justification.commit.target_hash, justification.commit.target_number) != finalized_target {
|
||||
let msg = "invalid commit target in grandpa justification".to_string();
|
||||
Err(ClientErrorKind::BadJustification(msg).into())
|
||||
Err(ClientError::BadJustification(msg))
|
||||
} else {
|
||||
justification.verify(set_id, voters).map(|_| justification)
|
||||
}
|
||||
@@ -132,7 +132,7 @@ impl<Block: BlockT<Hash=H256>> GrandpaJustification<Block> {
|
||||
Ok(ref result) if result.ghost().is_some() => {},
|
||||
_ => {
|
||||
let msg = "invalid commit in grandpa justification".to_string();
|
||||
return Err(ClientErrorKind::BadJustification(msg).into());
|
||||
return Err(ClientError::BadJustification(msg));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ impl<Block: BlockT<Hash=H256>> GrandpaJustification<Block> {
|
||||
self.round,
|
||||
set_id,
|
||||
) {
|
||||
return Err(ClientErrorKind::BadJustification(
|
||||
return Err(ClientError::BadJustification(
|
||||
"invalid signature for precommit in grandpa justification".to_string()).into());
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ impl<Block: BlockT<Hash=H256>> GrandpaJustification<Block> {
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
return Err(ClientErrorKind::BadJustification(
|
||||
return Err(ClientError::BadJustification(
|
||||
"invalid precommit ancestry proof in grandpa justification".to_string()).into());
|
||||
},
|
||||
}
|
||||
@@ -174,7 +174,7 @@ impl<Block: BlockT<Hash=H256>> GrandpaJustification<Block> {
|
||||
.collect();
|
||||
|
||||
if visited_hashes != ancestry_hashes {
|
||||
return Err(ClientErrorKind::BadJustification(
|
||||
return Err(ClientError::BadJustification(
|
||||
"invalid precommit ancestries in grandpa justification with unused headers".to_string()).into());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user