@@ -10,9 +10,6 @@ use apollo_gateway_types::errors::GatewaySpecError;
1010use apollo_gateway_types:: gateway_types:: SUPPORTED_TRANSACTION_VERSIONS ;
1111use apollo_mempool_types:: communication:: { MempoolClientError , MempoolClientResult } ;
1212use apollo_mempool_types:: errors:: MempoolError ;
13- use blockifier:: state:: errors:: StateError ;
14- use reqwest:: StatusCode ;
15- use serde_json:: { Error as SerdeError , Value } ;
1613use starknet_api:: block:: GasPrice ;
1714use starknet_api:: executable_transaction:: ValidateCompiledClassHashError ;
1815use starknet_api:: execution_resources:: GasAmount ;
@@ -21,8 +18,6 @@ use starknet_api::StarknetApiError;
2118use thiserror:: Error ;
2219use tracing:: { debug, error, warn} ;
2320
24- use crate :: rpc_objects:: { RpcErrorCode , RpcErrorResponse } ;
25-
2621pub type GatewayResult < T > = Result < T , StarknetError > ;
2722
2823#[ derive( Debug , Error ) ]
@@ -301,49 +296,6 @@ pub type StatelessTransactionValidatorResult<T> = Result<T, StatelessTransaction
301296
302297pub type StatefulTransactionValidatorResult < T > = Result < T , StarknetError > ;
303298
304- #[ derive( Debug , Error ) ]
305- pub enum RPCStateReaderError {
306- #[ error( "Block not found for request {0}" ) ]
307- BlockNotFound ( Value ) ,
308- #[ error( "Class hash not found for request {0}" ) ]
309- ClassHashNotFound ( Value ) ,
310- #[ error( "Contract address not found for request {0}" ) ]
311- ContractAddressNotFound ( Value ) ,
312- #[ error( "Failed to parse gas price {:?}" , 0 ) ]
313- GasPriceParsingFailure ( GasPrice ) ,
314- #[ error( "Invalid params: {0:?}" ) ]
315- InvalidParams ( Box < RpcErrorResponse > ) ,
316- #[ error( "RPC error: {0}" ) ]
317- RPCError ( StatusCode ) ,
318- #[ error( transparent) ]
319- ReqwestError ( #[ from] reqwest:: Error ) ,
320- #[ error( "Unexpected error code: {0}" ) ]
321- UnexpectedErrorCode ( RpcErrorCode ) ,
322- #[ error( transparent) ]
323- StarknetApi ( #[ from] StarknetApiError ) ,
324- }
325-
326- pub type RPCStateReaderResult < T > = Result < T , RPCStateReaderError > ;
327-
328- impl From < RPCStateReaderError > for StateError {
329- fn from ( err : RPCStateReaderError ) -> Self {
330- match err {
331- RPCStateReaderError :: ClassHashNotFound ( request) => {
332- match serde_json:: from_value ( request[ "params" ] [ "class_hash" ] . clone ( ) ) {
333- Ok ( class_hash) => StateError :: UndeclaredClassHash ( class_hash) ,
334- Err ( e) => serde_err_to_state_err ( e) ,
335- }
336- }
337- _ => StateError :: StateReadError ( err. to_string ( ) ) ,
338- }
339- }
340- }
341-
342- // Converts a serde error to the error type of the state reader.
343- pub fn serde_err_to_state_err ( err : SerdeError ) -> StateError {
344- StateError :: StateReadError ( format ! ( "Failed to parse rpc result {:?}" , err. to_string( ) ) )
345- }
346-
347299pub fn transaction_converter_err_to_deprecated_gw_err (
348300 tx_signature : & TransactionSignature ,
349301 err : TransactionConverterError ,
0 commit comments