Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
refactor(execution): add max_state_diff_size to PyBlockExecutor's cre…
Browse files Browse the repository at this point in the history
…ate_for_testing (#1805)
  • Loading branch information
Yoni-Starkware authored Apr 25, 2024
1 parent f17234d commit 20a6a9e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
20 changes: 17 additions & 3 deletions crates/native_blockifier/src/py_block_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,26 @@ impl PyBlockExecutor {
}

#[cfg(any(feature = "testing", test))]
#[pyo3(signature = (general_config, path))]
#[pyo3(signature = (general_config, path, max_state_diff_size))]
#[staticmethod]
fn create_for_testing(general_config: PyGeneralConfig, path: std::path::PathBuf) -> Self {
fn create_for_testing(
general_config: PyGeneralConfig,
path: std::path::PathBuf,
max_state_diff_size: usize,
) -> Self {
use blockifier::bouncer::BouncerWeights;
use blockifier::state::global_cache::GLOBAL_CONTRACT_CACHE_SIZE_FOR_TEST;
Self {
bouncer_config: BouncerConfig::max(),
bouncer_config: BouncerConfig {
block_max_capacity: BouncerWeights {
state_diff_size: max_state_diff_size,
..BouncerWeights::max(false)
},
block_max_capacity_with_keccak: BouncerWeights {
state_diff_size: max_state_diff_size,
..BouncerWeights::max(true)
},
},
storage: Box::new(PapyrusStorage::new_for_testing(
path,
&general_config.starknet_os_config.chain_id,
Expand Down
2 changes: 1 addition & 1 deletion crates/native_blockifier/src/py_block_executor_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn global_contract_cache_update() {

let temp_storage_path = tempfile::tempdir().unwrap().into_path();
let mut block_executor =
PyBlockExecutor::create_for_testing(PyGeneralConfig::default(), temp_storage_path);
PyBlockExecutor::create_for_testing(PyGeneralConfig::default(), temp_storage_path, 4000);
block_executor
.append_block(
0,
Expand Down

0 comments on commit 20a6a9e

Please sign in to comment.