@@ -256,6 +256,7 @@ impl EthereumAdapter {
256256 // cached. The result is not used for anything critical, so it is fine to be lazy.
257257 async fn check_block_receipt_support_and_update_cache (
258258 & self ,
259+ alloy : Arc < dyn Provider + ' static > ,
259260 web3 : Arc < Web3 < Transport > > ,
260261 block_hash : H256 ,
261262 supports_eip_1898 : bool ,
@@ -271,11 +272,10 @@ impl EthereumAdapter {
271272 }
272273 }
273274
274- info ! ( logger, "!!!! check_block_receipt_support_and_update_cache" ) ;
275275 info ! ( logger, "Checking eth_getBlockReceipts support" ) ;
276276 let result = timeout (
277277 ENV_VARS . block_receipts_check_timeout ,
278- check_block_receipt_support ( web3, block_hash, supports_eip_1898, call_only) ,
278+ check_block_receipt_support ( alloy , web3, block_hash, supports_eip_1898, call_only) ,
279279 )
280280 . await ;
281281
@@ -1808,6 +1808,7 @@ impl EthereumAdapterTrait for EthereumAdapter {
18081808
18091809 let supports_block_receipts = self
18101810 . check_block_receipt_support_and_update_cache (
1811+ alloy. clone ( ) ,
18111812 web3. clone ( ) ,
18121813 block_hash,
18131814 self . supports_eip_1898 ,
@@ -2612,6 +2613,7 @@ async fn fetch_receipt_from_ethereum_client(
26122613 eth : & EthereumAdapter ,
26132614 transaction_hash : & H256 ,
26142615) -> anyhow:: Result < TransactionReceipt > {
2616+ println ! ( "!!!! fetch_receipt_from_ethereum_client" ) ;
26152617 match eth. web3 . eth ( ) . transaction_receipt ( * transaction_hash) . await {
26162618 Ok ( Some ( receipt) ) => Ok ( receipt) ,
26172619 Ok ( None ) => bail ! ( "Could not find transaction receipt" ) ,
@@ -2822,6 +2824,7 @@ async fn fetch_transaction_receipts_in_batch(
28222824}
28232825
28242826pub ( crate ) async fn check_block_receipt_support (
2827+ alloy : Arc < dyn Provider + ' static > ,
28252828 web3 : Arc < Web3 < impl web3:: Transport > > ,
28262829 block_hash : H256 ,
28272830 supports_eip_1898 : bool ,
@@ -2837,13 +2840,23 @@ pub(crate) async fn check_block_receipt_support(
28372840
28382841 // Fetch block receipts from the provider for the latest block.
28392842 let block_receipts_result = web3. eth ( ) . block_receipts ( BlockId :: Hash ( block_hash) ) . await ;
2843+ let hash: alloy_rpc_types:: BlockId =
2844+ alloy_rpc_types:: BlockId :: hash ( B256 :: new ( * block_hash. as_fixed_bytes ( ) ) ) ;
2845+ let block_receipts_result2 = alloy. get_block_receipts ( hash) . await ;
28402846
28412847 // Determine if the provider supports block receipts based on the fetched result.
2842- match block_receipts_result {
2848+ let ret = match block_receipts_result {
28432849 Ok ( Some ( receipts) ) if !receipts. is_empty ( ) => Ok ( ( ) ) ,
28442850 Ok ( _) => Err ( anyhow ! ( "Block receipts are empty" ) ) ,
28452851 Err ( err) => Err ( anyhow ! ( "Error fetching block receipts: {}" , err) ) ,
2846- }
2852+ } ;
2853+ let ret2 = match block_receipts_result2 {
2854+ Ok ( Some ( receipts) ) if !receipts. is_empty ( ) => Ok ( ( ) ) ,
2855+ Ok ( _) => Err ( anyhow ! ( "Block receipts are empty" ) ) ,
2856+ Err ( err) => Err ( anyhow ! ( "Error fetching block receipts: {}" , err) ) ,
2857+ } ;
2858+ assert_eq ! ( ret. is_ok( ) , ret2. is_ok( ) ) ;
2859+ ret
28472860}
28482861
28492862// Fetches transaction receipts with retries. This function acts as a dispatcher
@@ -2929,7 +2942,6 @@ async fn fetch_block_receipts_with_retry(
29292942 } )
29302943 . await
29312944 . map_err ( |_timeout| -> IngestorError { anyhow ! ( block_hash) . into ( ) } ) ?;
2932- // info!(logger, "receipts_option2: {:?}", receipts_option2);
29332945 let receipts_option3: Option < Vec < TransactionReceipt > > = convert_receipts ( receipts_option2) ;
29342946 assert_eq ! ( receipts_option, receipts_option3) ;
29352947
@@ -3755,7 +3767,12 @@ mod tests {
37553767 // transport.add_response(json_value);
37563768
37573769 let web3 = Arc :: new ( Web3 :: new ( transport. clone ( ) ) ) ;
3770+ let asserter = alloy:: transports:: mock:: Asserter :: new ( ) ;
3771+ // asserter.push(json_value);
3772+ let alloy =
3773+ Arc :: new ( alloy:: providers:: ProviderBuilder :: new ( ) . connect_mocked_client ( asserter) ) ;
37583774 let result = check_block_receipt_support (
3775+ alloy,
37593776 web3. clone ( ) ,
37603777 H256 :: zero ( ) ,
37613778 supports_eip_1898,
0 commit comments