11use std:: path:: Path ;
22
3+ use apollo_integration_tests:: state_reader:: {
4+ EXPECTED_PROOF_FLOW_GENESIS_GLOBAL_ROOT ,
5+ EXPECTED_PROOF_FLOW_STRK_FEE_TOKEN_ADDRESS ,
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,36 @@ 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 STRK fee token address used by the proof-flow integration
320+ /// test and the one produced by the virtual OS test pipeline. Run with `UPDATE_EXPECT=1` to refresh
321+ /// the constant in `apollo_integration_tests::state_reader`, then regenerate the proof fixtures by
322+ /// running `cargo +nightly-2025-07-14 test -p starknet_os_flow_tests --features
323+ /// starknet_transaction_prover/stwo_proving --release generate_proof_fixtures -- --ignored`.
324+ #[ test]
325+ fn proof_flow_chain_info_matches_virtual_os_test ( ) {
326+ let virtual_os_strk_fee_token_address = block_context_for_flow_tests ( BlockNumber ( 0 ) , false )
327+ . chain_info ( )
328+ . fee_token_addresses
329+ . strk_fee_token_address ;
330+ EXPECTED_PROOF_FLOW_STRK_FEE_TOKEN_ADDRESS
331+ . assert_eq ( & virtual_os_strk_fee_token_address. to_hex_string ( ) ) ;
332+ }
333+
334+ /// Guards against drift between the genesis global root the proof-flow integration test seeds into
335+ /// storage and the initial global root produced by the virtual OS test pipeline. Run with
336+ /// `UPDATE_EXPECT=1` to refresh the constant in `apollo_integration_tests::state_reader`, then
337+ /// regenerate the proof fixtures by running `cargo +nightly-2025-07-14 test -p
338+ /// starknet_os_flow_tests --features starknet_transaction_prover/stwo_proving --release
339+ /// generate_proof_fixtures -- --ignored`.
340+ #[ tokio:: test( flavor = "multi_thread" ) ]
341+ async fn proof_flow_global_root_matches_virtual_os_test ( ) {
342+ let ( initial_state_data, [ ] ) =
343+ create_default_initial_state_data :: < DictStateReader , 0 > ( [ ] ) . await ;
344+ let virtual_os_global_root = StateRoots {
345+ contracts_trie_root_hash : initial_state_data. initial_state . contracts_trie_root_hash ,
346+ classes_trie_root_hash : initial_state_data. initial_state . classes_trie_root_hash ,
347+ }
348+ . global_root ( ) ;
349+ EXPECTED_PROOF_FLOW_GENESIS_GLOBAL_ROOT . assert_eq ( & virtual_os_global_root. 0 . to_hex_string ( ) ) ;
350+ }
0 commit comments