@@ -14,20 +14,14 @@ use blockifier::state::state_api::StateResult;
1414use indexmap:: IndexMap ;
1515use pretty_assertions:: assert_eq;
1616use serde:: { Deserialize , Serialize } ;
17- use starknet_api:: block:: BlockNumber ;
1817use starknet_api:: contract_class:: ContractClass ;
1918use starknet_api:: core:: { ChainId , ClassHash , CompiledClassHash , ContractAddress , Nonce } ;
2019use starknet_api:: state:: { SierraContractClass , StorageKey } ;
2120use starknet_types_core:: felt:: Felt ;
2221
2322use crate :: state_reader:: errors:: ReexecutionError ;
24- use crate :: state_reader:: offline_state_reader:: {
25- OfflineConsecutiveStateReaders ,
26- SerializableDataPrevBlock ,
27- SerializableOfflineReexecutionData ,
28- } ;
23+ use crate :: state_reader:: offline_state_reader:: OfflineConsecutiveStateReaders ;
2924use crate :: state_reader:: reexecution_state_reader:: ConsecutiveReexecutionStateReaders ;
30- use crate :: state_reader:: test_state_reader:: ConsecutiveTestStateReaders ;
3125
3226pub static RPC_NODE_URL : LazyLock < String > = LazyLock :: new ( || {
3327 env:: var ( "TEST_URL" )
@@ -246,65 +240,6 @@ pub fn reexecute_block_for_testing(block_number: u64) {
246240 println ! ( "Reexecution test for block {block_number} passed successfully." ) ;
247241}
248242
249- pub fn write_block_reexecution_data_to_file (
250- block_number : BlockNumber ,
251- full_file_path : String ,
252- node_url : String ,
253- chain_id : ChainId ,
254- contract_class_manager : ContractClassManager ,
255- ) {
256- let config = RpcStateReaderConfig :: from_url ( node_url) ;
257-
258- let consecutive_state_readers = ConsecutiveTestStateReaders :: new (
259- block_number. prev ( ) . expect ( "Should not run with block 0" ) ,
260- Some ( config) ,
261- chain_id. clone ( ) ,
262- true ,
263- contract_class_manager,
264- ) ;
265-
266- let serializable_data_next_block =
267- consecutive_state_readers. get_serializable_data_next_block ( ) . unwrap ( ) ;
268-
269- let old_block_hash = consecutive_state_readers. get_old_block_hash ( ) . unwrap ( ) ;
270-
271- // Run the reexecution and get the state maps and contract class mapping.
272- let ( block_state, expected_state_diff, actual_state_diff) =
273- consecutive_state_readers. reexecute_block ( ) ;
274-
275- // Warn if state diffs don't match, but continue writing the file.
276- let expected_comparable = ComparableStateDiff :: from ( expected_state_diff) ;
277- let actual_comparable = ComparableStateDiff :: from ( actual_state_diff) ;
278- if expected_comparable != actual_comparable {
279- println ! (
280- "WARNING: State diff mismatch for block {block_number}. Expected and actual state \
281- diffs do not match."
282- ) ;
283- }
284-
285- let block_state = block_state. unwrap ( ) ;
286- let serializable_data_prev_block = SerializableDataPrevBlock {
287- state_maps : block_state. get_initial_reads ( ) . unwrap ( ) . into ( ) ,
288- contract_class_mapping : block_state
289- . state
290- . state_reader
291- . get_contract_class_mapping_dumper ( )
292- . unwrap ( ) ,
293- } ;
294-
295- // Write the reexecution data to a json file.
296- SerializableOfflineReexecutionData {
297- serializable_data_prev_block,
298- serializable_data_next_block,
299- chain_id,
300- old_block_hash,
301- }
302- . write_to_file ( & full_file_path)
303- . unwrap ( ) ;
304-
305- println ! ( "RPC replies required for reexecuting block {block_number} written to json file." ) ;
306- }
307-
308243/// Asserts equality between two `CommitmentStateDiff` structs, ignoring insertion order.
309244#[ macro_export]
310245macro_rules! assert_eq_state_diff {
0 commit comments