11use apollo_state_sync_types:: communication:: StateSyncClientResult ;
22use async_trait:: async_trait;
33use blockifier:: execution:: contract_class:: RunnableCompiledClass ;
4- use blockifier:: state:: errors:: StateError ;
54use blockifier:: state:: global_cache:: CompiledClasses ;
65use blockifier:: state:: state_api:: { StateReader as BlockifierStateReader , StateResult } ;
76use blockifier:: state:: state_reader_and_contract_manager:: {
@@ -15,8 +14,9 @@ use starknet_api::core::{ClassHash, CompiledClassHash, ContractAddress, Nonce};
1514use starknet_api:: state:: StorageKey ;
1615use starknet_types_core:: felt:: Felt ;
1716
17+ #[ async_trait]
1818pub trait MempoolStateReader : BlockifierStateReader + Send + Sync {
19- fn get_block_info ( & self ) -> Result < BlockInfo , StateError > ;
19+ async fn get_block_info ( & self ) -> StateResult < BlockInfo > ;
2020}
2121
2222#[ cfg_attr( test, automock) ]
@@ -69,18 +69,20 @@ impl FetchCompiledClasses for Box<dyn GatewayStateReaderWithCompiledClasses> {
6969// Therefore, for using the Box<dyn GatewayStateReaderWithCompiledClasses>, that the
7070// StateReaderFactory creates, we need to implement the MempoolStateReader trait for
7171// Box<dyn GatewayStateReaderWithCompiledClasses>.
72+ #[ async_trait]
7273impl MempoolStateReader for Box < dyn GatewayStateReaderWithCompiledClasses > {
73- fn get_block_info ( & self ) -> StateResult < BlockInfo > {
74- self . as_ref ( ) . get_block_info ( )
74+ async fn get_block_info ( & self ) -> StateResult < BlockInfo > {
75+ self . as_ref ( ) . get_block_info ( ) . await
7576 }
7677}
7778
7879impl GatewayStateReaderWithCompiledClasses for Box < dyn GatewayStateReaderWithCompiledClasses > { }
7980
81+ #[ async_trait]
8082impl MempoolStateReader
8183 for StateReaderAndContractManager < Box < dyn GatewayStateReaderWithCompiledClasses > >
8284{
83- fn get_block_info ( & self ) -> StateResult < BlockInfo > {
84- self . state_reader . get_block_info ( )
85+ async fn get_block_info ( & self ) -> StateResult < BlockInfo > {
86+ self . state_reader . get_block_info ( ) . await
8587 }
8688}
0 commit comments