File tree Expand file tree Collapse file tree 2 files changed +3
-19
lines changed
Expand file tree Collapse file tree 2 files changed +3
-19
lines changed Original file line number Diff line number Diff line change @@ -283,14 +283,6 @@ impl EthHash {
283283 }
284284}
285285
286- impl FromStr for EthHash {
287- type Err = anyhow:: Error ;
288-
289- fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
290- Ok ( EthHash ( ethereum_types:: H256 :: from_str ( s) ?) )
291- }
292- }
293-
294286impl From < Cid > for EthHash {
295287 fn from ( cid : Cid ) -> Self {
296288 let ( _, digest, _) = cid. hash ( ) . into_inner ( ) ;
@@ -3722,7 +3714,7 @@ impl RpcMethod<1> for EthTraceTransaction {
37223714 ctx : Ctx < impl Blockstore + Send + Sync + ' static > ,
37233715 ( tx_hash, ) : Self :: Params ,
37243716 ) -> Result < Self :: Ok , ServerError > {
3725- let eth_hash = EthHash :: from_str ( & tx_hash) ?;
3717+ let eth_hash = EthHash :: from_str ( & tx_hash) . context ( "invalid transaction hash" ) ?;
37263718 let eth_txn = get_eth_transaction_by_hash ( & ctx, & eth_hash, None )
37273719 . await ?
37283720 . ok_or ( ServerError :: internal_error ( "transaction not found" , None ) ) ?;
Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ impl GetStorageAtParams {
111111 JsonSchema ,
112112 derive_more:: From ,
113113 derive_more:: Into ,
114+ derive_more:: FromStr ,
114115) ]
115116pub struct EthAddress (
116117 #[ schemars( with = "String" ) ]
@@ -211,16 +212,6 @@ impl EthAddress {
211212 }
212213}
213214
214- impl FromStr for EthAddress {
215- type Err = anyhow:: Error ;
216-
217- fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
218- Ok ( EthAddress (
219- ethereum_types:: Address :: from_str ( s) . map_err ( |e| anyhow:: anyhow!( "{e}" ) ) ?,
220- ) )
221- }
222- }
223-
224215impl TryFrom < & [ u8 ] > for EthAddress {
225216 type Error = anyhow:: Error ;
226217
@@ -398,6 +389,7 @@ impl TryFrom<EthCallMessage> for Message {
398389 displaydoc:: Display ,
399390 derive_more:: From ,
400391 derive_more:: Into ,
392+ derive_more:: FromStr ,
401393) ]
402394#[ displaydoc( "{0:#x}" ) ]
403395pub struct EthHash ( #[ schemars( with = "String" ) ] pub ethereum_types:: H256 ) ;
You can’t perform that action at this time.
0 commit comments