Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/rpc/methods/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,6 @@ impl EthHash {
}
}

impl FromStr for EthHash {
type Err = anyhow::Error;

fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(EthHash(ethereum_types::H256::from_str(s)?))
}
}

impl From<Cid> for EthHash {
fn from(cid: Cid) -> Self {
let (_, digest, _) = cid.hash().into_inner();
Expand Down Expand Up @@ -3722,7 +3714,7 @@ impl RpcMethod<1> for EthTraceTransaction {
ctx: Ctx<impl Blockstore + Send + Sync + 'static>,
(tx_hash,): Self::Params,
) -> Result<Self::Ok, ServerError> {
let eth_hash = EthHash::from_str(&tx_hash)?;
let eth_hash = EthHash::from_str(&tx_hash).context("invalid transaction hash")?;
let eth_txn = get_eth_transaction_by_hash(&ctx, &eth_hash, None)
.await?
.ok_or(ServerError::internal_error("transaction not found", None))?;
Expand Down
12 changes: 2 additions & 10 deletions src/rpc/methods/eth/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ impl GetStorageAtParams {
JsonSchema,
derive_more::From,
derive_more::Into,
derive_more::FromStr,
)]
pub struct EthAddress(
#[schemars(with = "String")]
Expand Down Expand Up @@ -211,16 +212,6 @@ impl EthAddress {
}
}

impl FromStr for EthAddress {
type Err = anyhow::Error;

fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(EthAddress(
ethereum_types::Address::from_str(s).map_err(|e| anyhow::anyhow!("{e}"))?,
))
}
}

impl TryFrom<&[u8]> for EthAddress {
type Error = anyhow::Error;

Expand Down Expand Up @@ -398,6 +389,7 @@ impl TryFrom<EthCallMessage> for Message {
displaydoc::Display,
derive_more::From,
derive_more::Into,
derive_more::FromStr,
)]
#[displaydoc("{0:#x}")]
pub struct EthHash(#[schemars(with = "String")] pub ethereum_types::H256);
Expand Down
Loading