Skip to content

Commit a5aa16c

Browse files
blockifier: add a client side proving test state
1 parent 81a768e commit a5aa16c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

crates/blockifier/src/test_utils/initial_test_state.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use crate::state::state_reader_and_contract_manager::{
1818
};
1919
use crate::test_utils::contracts::FeatureContractData;
2020
use crate::test_utils::dict_state_reader::DictStateReader;
21+
use crate::test_utils::generate_block_hash_storage_updates;
2122

2223
/// Utility to fund an account.
2324
pub fn fund_account(
@@ -83,7 +84,6 @@ pub fn setup_test_state(
8384
}
8485
}
8586

86-
// TODO(Meshi): Add block hash storage updates.
8787
pub fn test_state(
8888
chain_info: &ChainInfo,
8989
initial_balances: Fee,
@@ -104,13 +104,16 @@ pub fn test_state(
104104
.iter()
105105
.map(|(feature_contract, i)| ((*feature_contract).into(), *i))
106106
.collect();
107-
test_state_inner(
107+
let mut state = test_state_inner(
108108
chain_info,
109109
initial_balances,
110110
&contract_instances_vec[..],
111111
&HashVersion::V2,
112112
erc20_version,
113-
)
113+
);
114+
let block_hash_mapping = generate_block_hash_storage_updates();
115+
state.state.storage_view.extend(block_hash_mapping.storage);
116+
state
114117
}
115118

116119
pub fn test_state_with_contract_manager(

crates/blockifier/src/transaction/transactions_test.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,8 @@ fn test_invoke_tx(
599599
#[case] mut expected_arguments: ExpectedResultTestInvokeTx,
600600
#[case] account_cairo_version: CairoVersion,
601601
#[values(false, true)] use_kzg_da: bool,
602+
#[values(ProofFacts::default(), ProofFacts::snos_proof_facts_for_testing())]
603+
proof_facts: ProofFacts,
602604
) {
603605
let block_context = &BlockContext::create_for_account_testing_with_kzg(use_kzg_da);
604606
let versioned_constants = &block_context.versioned_constants;
@@ -614,6 +616,7 @@ fn test_invoke_tx(
614616
sender_address: account_contract_address,
615617
calldata: Calldata(Arc::clone(&calldata.0)),
616618
resource_bounds,
619+
proof_facts,
617620
});
618621

619622
// Extract invoke transaction fields for testing, as it is consumed when creating an account

0 commit comments

Comments
 (0)