@@ -21,8 +21,8 @@ use crate::execution::constants::{
2121} ;
2222use crate :: execution:: errors:: ExecutionError ;
2323use crate :: execution:: proof:: {
24- ordered_trie_root_noop_encoder, verify_account_proof, verify_code_hash_proof ,
25- verify_storage_proof,
24+ ordered_trie_root_noop_encoder, verify_account_proof, verify_block_receipts ,
25+ verify_code_hash_proof , verify_storage_proof,
2626} ;
2727use crate :: execution:: rpc:: ExecutionRpc ;
2828use crate :: execution:: state:: State ;
@@ -66,8 +66,7 @@ impl<N: NetworkSpec, R: ExecutionRpc<N>> ExecutionSpec<N> for ExecutionInnerRpcC
6666 . get_proof ( address, slots, block. header ( ) . number ( ) . into ( ) )
6767 . await ?;
6868
69- self . verify_proof_to_account ( proof, & block, include_code)
70- . await
69+ self . verify_account_proof ( proof, & block, include_code) . await
7170 }
7271
7372 async fn get_transaction_receipt ( & self , tx_hash : B256 ) -> Result < Option < N :: ReceiptResponse > > {
@@ -88,7 +87,7 @@ impl<N: NetworkSpec, R: ExecutionRpc<N>> ExecutionSpec<N> for ExecutionInnerRpcC
8887 . rpc
8988 . get_block_receipts ( block_id)
9089 . await ?
91- . ok_or ( eyre :: eyre! ( ExecutionError :: NoReceiptsForBlock ( tag) ) ) ?;
90+ . ok_or ( ExecutionError :: NoReceiptsForBlock ( tag) ) ?;
9291
9392 let receipts_encoded = receipts. iter ( ) . map ( N :: encode_receipt) . collect :: < Vec < _ > > ( ) ;
9493 let expected_receipt_root = ordered_trie_root_noop_encoder ( & receipts_encoded) ;
@@ -136,7 +135,7 @@ impl<N: NetworkSpec, R: ExecutionRpc<N>> ExecutionSpec<N> for ExecutionInnerRpcC
136135 Ok ( logs)
137136 }
138137
139- async fn create_access_list (
138+ async fn create_extended_access_list (
140139 & self ,
141140 tx : & N :: TransactionRequest ,
142141 block_id : Option < BlockId > ,
@@ -208,6 +207,14 @@ impl<N: NetworkSpec, R: ExecutionRpc<N>> ExecutionSpec<N> for ExecutionInnerRpcC
208207 & self ,
209208 block_id : BlockId ,
210209 full_tx : bool ,
210+ ) -> Result < Option < N :: BlockResponse > > {
211+ self . state . get_block_by_id ( block_id, full_tx) . await
212+ }
213+
214+ async fn get_untrusted_block (
215+ & self ,
216+ block_id : BlockId ,
217+ full_tx : bool ,
211218 ) -> Result < Option < N :: BlockResponse > > {
212219 self . rpc . get_block ( block_id, full_tx. into ( ) ) . await
213220 }
@@ -216,7 +223,21 @@ impl<N: NetworkSpec, R: ExecutionRpc<N>> ExecutionSpec<N> for ExecutionInnerRpcC
216223 & self ,
217224 block_id : BlockId ,
218225 ) -> Result < Option < Vec < N :: ReceiptResponse > > > {
219- self . rpc . get_block_receipts ( block_id) . await
226+ let block = self . state . get_block_by_id ( block_id, false ) . await ?;
227+ let Some ( block) = block else {
228+ return Ok ( None ) ;
229+ } ;
230+ let block_num = block. header ( ) . number ( ) ;
231+
232+ let receipts = self
233+ . rpc
234+ . get_block_receipts ( block_num. into ( ) )
235+ . await ?
236+ . ok_or ( ExecutionError :: NoReceiptsForBlock ( block_num. into ( ) ) ) ?;
237+
238+ verify_block_receipts :: < N > ( & receipts, & block) ?;
239+
240+ Ok ( Some ( receipts) )
220241 }
221242
222243 async fn send_raw_transaction ( & self , bytes : & [ u8 ] ) -> Result < B256 > {
@@ -241,7 +262,7 @@ impl<N: NetworkSpec, R: ExecutionRpc<N>> ExecutionSpec<N> for ExecutionInnerRpcC
241262}
242263
243264impl < N : NetworkSpec , R : ExecutionRpc < N > > ExecutionInnerRpcClient < N , R > {
244- async fn verify_proof_to_account (
265+ async fn verify_account_proof (
245266 & self ,
246267 proof : EIP1186AccountProofResponse ,
247268 block : & N :: BlockResponse ,
@@ -302,10 +323,9 @@ impl<N: NetworkSpec, R: ExecutionRpc<N>> ExecutionInnerRpcClient<N, R> {
302323
303324 // Collect all (proven) tx receipts for all block numbers
304325 let blocks_receipts_fut = block_nums. into_iter ( ) . map ( |block_num| async move {
305- let tag = BlockTag :: Number ( block_num) ;
306- // ToDo(@eshaan7): use verified version of `get_block_receipts`
307- let receipts = self . rpc . get_block_receipts ( block_num. into ( ) ) . await ;
308- receipts?. ok_or_else ( || eyre:: eyre!( ExecutionError :: NoReceiptsForBlock ( tag) ) )
326+ let receipts = self . get_block_receipts ( block_num. into ( ) ) . await ;
327+ receipts?
328+ . ok_or_else ( || eyre:: eyre!( ExecutionError :: NoReceiptsForBlock ( block_num. into( ) ) ) )
309329 } ) ;
310330 let blocks_receipts = try_join_all ( blocks_receipts_fut) . await ?;
311331 let receipts = blocks_receipts. into_iter ( ) . flatten ( ) . collect :: < Vec < _ > > ( ) ;
@@ -504,7 +524,7 @@ mod tests {
504524 }
505525
506526 #[ tokio:: test]
507- async fn test_create_access_list ( ) {
527+ async fn test_create_extended_access_list ( ) {
508528 let client = get_client ( ) . await ;
509529 let address = rpc_proof ( ) . address ;
510530 let block_beneficiary = rpc_block ( ) . header . beneficiary ;
@@ -514,7 +534,7 @@ mod tests {
514534 . value ( U256 :: ZERO ) ;
515535
516536 let response = client
517- . create_access_list ( & tx, BlockId :: latest ( ) . into ( ) )
537+ . create_extended_access_list ( & tx, BlockId :: latest ( ) . into ( ) )
518538 . await
519539 . unwrap ( ) ;
520540
@@ -548,6 +568,19 @@ mod tests {
548568 assert_eq ! ( response, rpc_block( ) ) ;
549569 }
550570
571+ #[ tokio:: test]
572+ async fn test_get_untrusted_block ( ) {
573+ let client = get_client ( ) . await ;
574+
575+ let response = client
576+ . get_untrusted_block ( BlockId :: latest ( ) , false )
577+ . await
578+ . unwrap ( )
579+ . unwrap ( ) ;
580+
581+ assert_eq ! ( response, rpc_block( ) ) ;
582+ }
583+
551584 #[ tokio:: test]
552585 async fn test_get_block_receipts ( ) {
553586 let client = get_client ( ) . await ;
0 commit comments