@@ -203,55 +203,55 @@ def run_blockchain_test(self) -> None:
203203 """
204204 Apply a block on the pre-state. Also includes system operations.
205205 """
206- block_env = self .block_environment ()
207- block_output = self .fork .BlockOutput ()
206+ try :
207+ block_env = self .block_environment ()
208+ block_output = self .fork .BlockOutput ()
208209
209- if self .fork .is_after_fork ("ethereum.prague" ):
210- self .fork .process_system_transaction (
211- block_env = block_env ,
212- target_address = self .fork .HISTORY_STORAGE_ADDRESS ,
213- data = block_env .block_hashes [- 1 ], # The parent hash
214- )
210+ if self .fork .is_after_fork ("ethereum.prague" ):
211+ self .fork .process_system_transaction (
212+ block_env = block_env ,
213+ target_address = self .fork .HISTORY_STORAGE_ADDRESS ,
214+ data = block_env .block_hashes [- 1 ], # The parent hash
215+ )
215216
216- if self .fork .is_after_fork ("ethereum.cancun" ):
217- self .fork .process_system_transaction (
218- block_env = block_env ,
219- target_address = self .fork .BEACON_ROOTS_ADDRESS ,
220- data = block_env .parent_beacon_block_root ,
221- )
217+ if self .fork .is_after_fork ("ethereum.cancun" ):
218+ self .fork .process_system_transaction (
219+ block_env = block_env ,
220+ target_address = self .fork .BEACON_ROOTS_ADDRESS ,
221+ data = block_env .parent_beacon_block_root ,
222+ )
222223
223- for i , tx in zip (self .txs .successfully_parsed , self .txs .transactions ):
224- self .backup_state ()
225- try :
226- self .fork .process_transaction (
227- block_env , block_output , tx , Uint (i )
224+ for i , tx in zip (self .txs .successfully_parsed , self .txs .transactions ):
225+ self .backup_state ()
226+ try :
227+ self .fork .process_transaction (
228+ block_env , block_output , tx , Uint (i )
229+ )
230+ except EthereumException as e :
231+ self .txs .rejected_txs [i ] = f"Failed transaction: { e !r} "
232+ self .restore_state ()
233+ self .logger .warning (f"Transaction { i } failed: { e !r} " )
234+
235+ if not self .fork .is_after_fork ("ethereum.paris" ):
236+ self .fork .pay_rewards (
237+ block_env .state ,
238+ block_env .number ,
239+ block_env .coinbase ,
240+ self .env .ommers ,
228241 )
229- except EthereumException as e :
230- self .txs .rejected_txs [i ] = f"Failed transaction: { e !r} "
231- self .restore_state ()
232- self .logger .warning (f"Transaction { i } failed: { e !r} " )
233-
234- if not self .fork .is_after_fork ("ethereum.paris" ):
235- self .fork .pay_rewards (
236- block_env .state ,
237- block_env .number ,
238- block_env .coinbase ,
239- self .env .ommers ,
240- )
241242
242- if self .fork .is_after_fork ("ethereum.shanghai" ):
243- self .fork .process_withdrawals (
244- block_env , block_output , self .env .withdrawals
245- )
243+ if self .fork .is_after_fork ("ethereum.shanghai" ):
244+ self .fork .process_withdrawals (
245+ block_env , block_output , self .env .withdrawals
246+ )
246247
247- if self .fork .is_after_fork ("ethereum.prague" ):
248- try :
249- self .fork .process_general_purpose_requests (block_env , block_output )
250- except InvalidBlock as e :
251- self .result .block_exception = f"{ e } "
248+ if self .fork .is_after_fork ("ethereum.prague" ):
249+ self .fork .process_general_purpose_requests (block_env , block_output )
252250
253- self .result .update (self , block_env , block_output )
254- self .result .rejected = self .txs .rejected_txs
251+ self .result .update (self , block_env , block_output )
252+ self .result .rejected = self .txs .rejected_txs
253+ except InvalidBlock as e :
254+ self .result .block_exception = f"{ e } "
255255
256256 def run (self ) -> int :
257257 """Run the transition and provide the relevant outputs"""
0 commit comments