@@ -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 ) ]
@@ -291,49 +286,6 @@ pub type StatelessTransactionValidatorResult<T> = Result<T, StatelessTransaction
291286
292287pub type StatefulTransactionValidatorResult < T > = Result < T , StarknetError > ;
293288
294- #[ derive( Debug , Error ) ]
295- pub enum RPCStateReaderError {
296- #[ error( "Block not found for request {0}" ) ]
297- BlockNotFound ( Value ) ,
298- #[ error( "Class hash not found for request {0}" ) ]
299- ClassHashNotFound ( Value ) ,
300- #[ error( "Contract address not found for request {0}" ) ]
301- ContractAddressNotFound ( Value ) ,
302- #[ error( "Failed to parse gas price {:?}" , 0 ) ]
303- GasPriceParsingFailure ( GasPrice ) ,
304- #[ error( "Invalid params: {0:?}" ) ]
305- InvalidParams ( Box < RpcErrorResponse > ) ,
306- #[ error( "RPC error: {0}" ) ]
307- RPCError ( StatusCode ) ,
308- #[ error( transparent) ]
309- ReqwestError ( #[ from] reqwest:: Error ) ,
310- #[ error( "Unexpected error code: {0}" ) ]
311- UnexpectedErrorCode ( RpcErrorCode ) ,
312- #[ error( transparent) ]
313- StarknetApi ( #[ from] StarknetApiError ) ,
314- }
315-
316- pub type RPCStateReaderResult < T > = Result < T , RPCStateReaderError > ;
317-
318- impl From < RPCStateReaderError > for StateError {
319- fn from ( err : RPCStateReaderError ) -> Self {
320- match err {
321- RPCStateReaderError :: ClassHashNotFound ( request) => {
322- match serde_json:: from_value ( request[ "params" ] [ "class_hash" ] . clone ( ) ) {
323- Ok ( class_hash) => StateError :: UndeclaredClassHash ( class_hash) ,
324- Err ( e) => serde_err_to_state_err ( e) ,
325- }
326- }
327- _ => StateError :: StateReadError ( err. to_string ( ) ) ,
328- }
329- }
330- }
331-
332- // Converts a serde error to the error type of the state reader.
333- pub fn serde_err_to_state_err ( err : SerdeError ) -> StateError {
334- StateError :: StateReadError ( format ! ( "Failed to parse rpc result {:?}" , err. to_string( ) ) )
335- }
336-
337289pub fn transaction_converter_err_to_deprecated_gw_err (
338290 tx_signature : & TransactionSignature ,
339291 err : TransactionConverterError ,
0 commit comments