diff --git a/crates/blockifier/resources/versioned_constants.json b/crates/blockifier/resources/versioned_constants.json index b03c7aa515..b76d8f7528 100644 --- a/crates/blockifier/resources/versioned_constants.json +++ b/crates/blockifier/resources/versioned_constants.json @@ -1,17 +1,20 @@ { + "gateway": { + "max_calldata_length": 4000, + "max_contract_bytecode_size": 61440 + }, + "invoke_tx_max_n_steps": 3000000, + "max_recursion_depth": 50, + "validate_max_n_steps": 1000000, "vm_resource_fee_cost": { - - "bitwise_builtin":0.32, - "ec_op_builtin":5.12, - "ecdsa_builtin":10.24, - "keccak_builtin":10.24, + "bitwise_builtin": 0.32, + "ec_op_builtin": 5.12, + "ecdsa_builtin": 10.24, + "keccak_builtin": 10.24, "n_steps": 0.005, "output_builtin": 0, "pedersen_builtin": 0.16, - "poseidon_builtin":0.16, - "range_check_builtin":0.08 - }, - "invoke_tx_max_n_steps": 3000000, - "max_recursion_depth": 50, - "validate_max_n_steps": 1000000 + "poseidon_builtin": 0.16, + "range_check_builtin": 0.08 + } } diff --git a/crates/blockifier/src/versioned_constants.rs b/crates/blockifier/src/versioned_constants.rs index 5af654d47c..0a6c40bf90 100644 --- a/crates/blockifier/src/versioned_constants.rs +++ b/crates/blockifier/src/versioned_constants.rs @@ -13,6 +13,9 @@ static DEFAULT_CONSTANTS: Lazy = Lazy::new(|| { .expect("Versioned constants json file is malformed") }); +/// Contains constants for the Blockifier that may vary between versions. +/// Additional constants in the JSON file, not used by Blockifier but included for transparency, are +/// automatically ignored during deserialization. #[derive(Clone, Debug, Default, Deserialize)] pub struct VersionedConstants { // Fee related. diff --git a/crates/native_blockifier/src/py_block_executor.rs b/crates/native_blockifier/src/py_block_executor.rs index 0759812d2f..75ebbf9bd9 100644 --- a/crates/native_blockifier/src/py_block_executor.rs +++ b/crates/native_blockifier/src/py_block_executor.rs @@ -35,9 +35,10 @@ pub struct PyBlockExecutor { #[pymethods] impl PyBlockExecutor { #[new] - #[pyo3(signature = (general_config, max_recursion_depth, target_storage_config))] + #[pyo3(signature = (general_config, validate_max_n_steps, max_recursion_depth, target_storage_config))] pub fn create( general_config: PyGeneralConfig, + validate_max_n_steps: u32, max_recursion_depth: usize, target_storage_config: StorageConfig, ) -> Self { @@ -48,6 +49,7 @@ impl PyBlockExecutor { let versioned_constants = VersionedConstants { max_recursion_depth, + validate_max_n_steps, ..VersionedConstants::latest_constants().clone() }; diff --git a/crates/native_blockifier/src/py_validator.rs b/crates/native_blockifier/src/py_validator.rs index 20714ea630..a57c065f69 100644 --- a/crates/native_blockifier/src/py_validator.rs +++ b/crates/native_blockifier/src/py_validator.rs @@ -31,23 +31,24 @@ pub struct PyValidator { #[pymethods] impl PyValidator { #[new] - #[pyo3(signature = (general_config, state_reader_proxy, next_block_info, max_recursion_depth, max_nonce_for_validation_skip))] + #[pyo3(signature = (general_config, state_reader_proxy, next_block_info, validate_max_n_steps, max_recursion_depth, max_nonce_for_validation_skip))] pub fn create( general_config: PyGeneralConfig, state_reader_proxy: &PyAny, next_block_info: PyBlockInfo, + validate_max_n_steps: u32, max_recursion_depth: usize, max_nonce_for_validation_skip: PyFelt, ) -> NativeBlockifierResult { let versioned_constants = VersionedConstants { max_recursion_depth, + validate_max_n_steps, ..VersionedConstants::latest_constants().clone() }; let tx_executor = TransactionExecutor::new( PyStateReader::new(state_reader_proxy), &general_config, - // TODO(Gilad): add max_validate_n_steps override argument and override here. &versioned_constants, next_block_info, GlobalContractCache::default(),