Skip to content

Commit 0cae92f

Browse files
authored
Merge branch 'paritytech:master' into master
2 parents 35689f4 + 4ef8860 commit 0cae92f

File tree

30 files changed

+2165
-243
lines changed

30 files changed

+2165
-243
lines changed

Cargo.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/anvil-polkadot/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ tempfile.workspace = true
125125
itertools.workspace = true
126126
rand_08.workspace = true
127127
eyre.workspace = true
128+
lru = "0.16.0"
128129

129130
# cli
130131
clap = { version = "4", features = [
@@ -146,6 +147,7 @@ alloy-provider = { workspace = true, features = ["txpool-api"] }
146147
alloy-pubsub.workspace = true
147148
foundry-test-utils.workspace = true
148149
tokio = { workspace = true, features = ["full"] }
150+
assert_matches = "1.5.0"
149151
rstest = "0.26.1"
150152

151153
op-alloy-rpc-types.workspace = true

crates/anvil-polkadot/src/api_server/error.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
use crate::substrate_node::mining_engine::MiningError;
1+
use crate::substrate_node::{mining_engine::MiningError, service::BackendError};
22
use anvil_rpc::{error::RpcError, response::ResponseResult};
3-
use polkadot_sdk::pallet_revive_eth_rpc::{EthRpcError, client::ClientError};
3+
use polkadot_sdk::{
4+
pallet_revive_eth_rpc::{EthRpcError, client::ClientError},
5+
sp_api,
6+
};
47
use serde::Serialize;
58

69
#[derive(Debug, thiserror::Error)]
@@ -13,9 +16,18 @@ pub enum Error {
1316
InvalidParams(String),
1417
#[error("Revive call failed: {0}")]
1518
ReviveRpc(#[from] EthRpcError),
19+
#[error(transparent)]
20+
Backend(#[from] BackendError),
21+
#[error("Nonce overflowing the substrate nonce type")]
22+
NonceOverflow,
23+
#[error(transparent)]
24+
RuntimeApi(#[from] sp_api::ApiError),
25+
#[error("Error encountered while creating a BalanceWithDust from a U256 balance")]
26+
BalanceConversion,
1627
#[error("Internal error: {0}")]
1728
InternalError(String),
1829
}
30+
1931
impl From<subxt::Error> for Error {
2032
fn from(err: subxt::Error) -> Self {
2133
Self::ReviveRpc(EthRpcError::ClientError(err.into()))
@@ -71,12 +83,7 @@ impl<T: Serialize> ToRpcResponseResult for Result<T> {
7183
Error::InvalidParams(error_message) => {
7284
RpcError::invalid_params(error_message).into()
7385
}
74-
Error::ReviveRpc(client_error) => {
75-
RpcError::internal_error_with(format!("{client_error}")).into()
76-
}
77-
Error::InternalError(error_message) => {
78-
RpcError::internal_error_with(error_message).into()
79-
}
86+
err => RpcError::internal_error_with(format!("{err}")).into(),
8087
},
8188
}
8289
}

0 commit comments

Comments
 (0)