11use std:: path:: Path ;
22
3+ use apollo_integration_tests:: state_reader:: EXPECTED_PROOF_FLOW_GENESIS_GLOBAL_ROOT ;
34use blockifier:: execution:: contract_class:: TrackedResource ;
45use blockifier:: test_utils:: dict_state_reader:: DictStateReader ;
56use blockifier:: test_utils:: get_valid_virtual_os_program_hash;
67use blockifier:: transaction:: test_utils:: ExpectedExecutionInfo ;
78use blockifier_test_utils:: cairo_versions:: { CairoVersion , RunnableCairo1 } ;
89use blockifier_test_utils:: calldata:: create_calldata;
910use blockifier_test_utils:: contracts:: FeatureContract ;
11+ use blockifier_test_utils:: fee_token_addresses:: EXPECTED_STRK_FEE_TOKEN_ADDRESS ;
1012use rstest:: rstest;
1113use starknet_api:: abi:: abi_utils:: selector_from_name;
1214use starknet_api:: block:: { BlockInfo , BlockNumber , BlockTimestamp } ;
1315use starknet_api:: core:: EthAddress ;
16+ use starknet_api:: hash:: StateRoots ;
1417use starknet_api:: test_utils:: { CURRENT_BLOCK_TIMESTAMP , TEST_SEQUENCER_ADDRESS } ;
1518use starknet_api:: transaction:: fields:: { ProofFacts , TransactionSignature } ;
1619use starknet_api:: transaction:: {
@@ -22,7 +25,9 @@ use starknet_api::transaction::{
2225use starknet_api:: { calldata, contract_address, invoke_tx_args} ;
2326use starknet_types_core:: felt:: Felt ;
2427
28+ use crate :: initial_state:: create_default_initial_state_data;
2529use crate :: test_manager:: {
30+ block_context_for_flow_tests,
2631 EventPredicateExpectation ,
2732 TestBuilder ,
2833 TestBuilderConfig ,
@@ -308,3 +313,35 @@ async fn generate_proof_fixtures() {
308313 . expect ( "write proof_facts.json" ) ;
309314 std:: fs:: write ( & proof_path, output. proof . 0 . as_slice ( ) ) . expect ( "write proof.bin" ) ;
310315}
316+
317+ /// Guards against drift between the STRK fee token address used by the proof-flow integration
318+ /// test and the one produced by the virtual OS test pipeline. Run with `UPDATE_EXPECT=1` to refresh
319+ /// the constant in `blockifier_test_utils::fee_token_addresses`, then regenerate the proof fixtures
320+ /// by running `cargo +nightly-2025-07-14 test -p starknet_os_flow_tests --features
321+ /// starknet_transaction_prover/stwo_proving --release generate_proof_fixtures -- --ignored`.
322+ #[ test]
323+ fn proof_flow_chain_info_matches_virtual_os_test ( ) {
324+ let virtual_os_strk_fee_token_address = block_context_for_flow_tests ( BlockNumber ( 0 ) , false )
325+ . chain_info ( )
326+ . fee_token_addresses
327+ . strk_fee_token_address ;
328+ EXPECTED_STRK_FEE_TOKEN_ADDRESS . assert_eq ( & virtual_os_strk_fee_token_address. to_hex_string ( ) ) ;
329+ }
330+
331+ /// Guards against drift between the genesis global root the proof-flow integration test seeds into
332+ /// storage and the initial global root produced by the virtual OS test pipeline. Run with
333+ /// `UPDATE_EXPECT=1` to refresh the constant in `apollo_integration_tests::state_reader`, then
334+ /// regenerate the proof fixtures by running `cargo +nightly-2025-07-14 test -p
335+ /// starknet_os_flow_tests --features starknet_transaction_prover/stwo_proving --release
336+ /// generate_proof_fixtures -- --ignored`.
337+ #[ tokio:: test( flavor = "multi_thread" ) ]
338+ async fn proof_flow_global_root_matches_virtual_os_test ( ) {
339+ let ( initial_state_data, [ ] ) =
340+ create_default_initial_state_data :: < DictStateReader , 0 > ( [ ] ) . await ;
341+ let virtual_os_global_root = StateRoots {
342+ contracts_trie_root_hash : initial_state_data. initial_state . contracts_trie_root_hash ,
343+ classes_trie_root_hash : initial_state_data. initial_state . classes_trie_root_hash ,
344+ }
345+ . global_root ( ) ;
346+ EXPECTED_PROOF_FLOW_GENESIS_GLOBAL_ROOT . assert_eq ( & virtual_os_global_root. 0 . to_hex_string ( ) ) ;
347+ }
0 commit comments