@@ -8,7 +8,7 @@ use crate::utils::convert_log_state_update;
88use alloy:: eips:: { BlockId , BlockNumberOrTag } ;
99use alloy:: primitives:: { keccak256, Address , B256 , I256 , U256 } ;
1010use alloy:: providers:: { Provider , ProviderBuilder , ReqwestProvider , RootProvider } ;
11- use alloy:: rpc:: types:: Filter ;
11+ use alloy:: rpc:: types:: { Filter , FilteredParams } ;
1212use alloy:: sol;
1313use alloy:: sol_types:: SolValue ;
1414use alloy:: transports:: http:: { Client , Http } ;
@@ -17,7 +17,7 @@ use bitvec::macros::internal::funty::Fundamental;
1717use error:: EthereumClientError ;
1818use futures:: stream:: BoxStream ;
1919use futures:: StreamExt ;
20- use mp_convert:: { FeltExt , ToFelt } ;
20+ use mp_convert:: { FeltExt , L1TransactionHash , ToFelt } ;
2121use mp_transactions:: L1HandlerTransactionWithFee ;
2222use mp_utils:: service:: ServiceContext ;
2323use std:: str:: FromStr ;
@@ -306,6 +306,33 @@ impl SettlementLayerProvider for EthereumClient {
306306 Ok ( cancellation_timestamp. _0 != U256 :: ZERO )
307307 }
308308
309+ async fn get_messages_to_l2 (
310+ & self ,
311+ l1_tx_hash : L1TransactionHash ,
312+ ) -> Result < Vec < L1HandlerTransactionWithFee > , SettlementClientError > {
313+ let l1_tx_hash = B256 :: from ( l1_tx_hash. into_eth ( ) . 0 ) ;
314+ let receipt = self
315+ . provider
316+ . get_transaction_receipt ( l1_tx_hash)
317+ . await
318+ . map_err ( |e| -> SettlementClientError {
319+ EthereumClientError :: Rpc ( format ! ( "Failed to get transaction receipt: {}" , e) ) . into ( )
320+ } ) ?
321+ . ok_or ( SettlementClientError :: TxNotFound ) ?;
322+
323+ let filter = FilteredParams :: new ( Some ( self . l1_core_contract . LogMessageToL2_filter ( ) . filter ) ) ;
324+
325+ receipt
326+ . inner
327+ . logs ( )
328+ . iter ( )
329+ . filter ( |log| filter. filter_address ( & log. address ( ) ) && filter. filter_topics ( log. topics ( ) ) )
330+ . filter_map ( |log| log. log_decode :: < LogMessageToL2 > ( ) . ok ( ) )
331+ . map ( |log| log. inner . data )
332+ . map ( TryInto :: try_into)
333+ . collect :: < Result < Vec < L1HandlerTransactionWithFee > , _ > > ( )
334+ }
335+
309336 async fn get_block_n_timestamp ( & self , l1_block_n : u64 ) -> Result < u64 , SettlementClientError > {
310337 let block = self
311338 . provider
0 commit comments