11use std:: path:: Path ;
22
3+ use apollo_integration_tests:: state_reader:: {
4+ integration_test_genesis_global_root,
5+ proof_flow_chain_info,
6+ } ;
37use blockifier:: execution:: contract_class:: TrackedResource ;
48use blockifier:: test_utils:: dict_state_reader:: DictStateReader ;
59use blockifier:: test_utils:: get_valid_virtual_os_program_hash;
@@ -11,6 +15,7 @@ use rstest::rstest;
1115use starknet_api:: abi:: abi_utils:: selector_from_name;
1216use starknet_api:: block:: { BlockInfo , BlockNumber , BlockTimestamp } ;
1317use starknet_api:: core:: EthAddress ;
18+ use starknet_api:: hash:: StateRoots ;
1419use starknet_api:: test_utils:: { CURRENT_BLOCK_TIMESTAMP , TEST_SEQUENCER_ADDRESS } ;
1520use starknet_api:: transaction:: fields:: { ProofFacts , TransactionSignature } ;
1621use starknet_api:: transaction:: {
@@ -22,7 +27,9 @@ use starknet_api::transaction::{
2227use starknet_api:: { calldata, contract_address, invoke_tx_args} ;
2328use starknet_types_core:: felt:: Felt ;
2429
30+ use crate :: initial_state:: create_default_initial_state_data;
2531use crate :: test_manager:: {
32+ block_context_for_flow_tests,
2633 EventPredicateExpectation ,
2734 TestBuilder ,
2835 TestBuilderConfig ,
@@ -308,3 +315,42 @@ async fn generate_proof_fixtures() {
308315 . expect ( "write proof_facts.json" ) ;
309316 std:: fs:: write ( & proof_path, output. proof . 0 . as_slice ( ) ) . expect ( "write proof.bin" ) ;
310317}
318+
319+ /// Guards against drift between the chain info used by the proof-flow integration test.
320+ #[ test]
321+ fn proof_flow_chain_info_matches_virtual_os_test ( ) {
322+ let virtual_os_chain_info =
323+ block_context_for_flow_tests ( BlockNumber ( 0 ) , false ) . chain_info ( ) . clone ( ) ;
324+ let integration_test_chain_info = proof_flow_chain_info ( ) ;
325+ assert_eq ! (
326+ virtual_os_chain_info. fee_token_addresses. strk_fee_token_address,
327+ integration_test_chain_info. fee_token_addresses. strk_fee_token_address,
328+ "The proof flow integration test uses a different STRK fee token address than the virtual \
329+ OS test. Please update the STRK fee token address in the proof flow integration test to \
330+ match the virtual OS test and regenerate the proof fixtures (run `cargo \
331+ +nightly-2025-07-14 test -p starknet_os_flow_tests --features stwo_proving --release \
332+ generate_proof_fixtures -- --ignored`).",
333+ ) ;
334+ }
335+
336+ /// Guards against drift between the genesis global root the proof-flow integration test seeds into
337+ /// storage and the initial global root produced used to generate the proof fixtures.
338+ #[ tokio:: test( flavor = "multi_thread" ) ]
339+ async fn proof_flow_global_root_matches_virtual_os_test ( ) {
340+ let ( initial_state_data, [ ] ) =
341+ create_default_initial_state_data :: < DictStateReader , 0 > ( [ ] ) . await ;
342+ let virtual_os_global_root = StateRoots {
343+ contracts_trie_root_hash : initial_state_data. initial_state . contracts_trie_root_hash ,
344+ classes_trie_root_hash : initial_state_data. initial_state . classes_trie_root_hash ,
345+ }
346+ . global_root ( ) ;
347+ let integration_test_global_root = integration_test_genesis_global_root ( ) ;
348+ assert_eq ! (
349+ virtual_os_global_root, integration_test_global_root,
350+ "The proof flow integration test uses a different global root than the virtual
351+ OS test. Please update the global root in the proof flow integration test to match the \
352+ virtual OS test and regenerate the proof fixtures (run `cargo +nightly-2025-07-14 test \
353+ -p starknet_os_flow_tests --features stwo_proving --release generate_proof_fixtures -- \
354+ --ignored`)."
355+ ) ;
356+ }
0 commit comments