diff --git a/crates/blockifier/resources/versioned_constants_0_13_4.json b/crates/blockifier/resources/versioned_constants_0_13_4.json index dbb15ca39d4..5ab1a54ce8c 100644 --- a/crates/blockifier/resources/versioned_constants_0_13_4.json +++ b/crates/blockifier/resources/versioned_constants_0_13_4.json @@ -233,9 +233,9 @@ "os_resources": { "execute_syscalls": { "CallContract": { - "n_steps": 866, + "n_steps": 904, "builtin_instance_counter": { - "range_check_builtin": 15 + "range_check_builtin": 17 }, "n_memory_holes": 0 }, @@ -254,10 +254,10 @@ "n_memory_holes": 0 }, "Deploy": { - "n_steps": 1132, + "n_steps": 1174, "builtin_instance_counter": { "pedersen_builtin": 7, - "range_check_builtin": 18 + "range_check_builtin": 20 }, "n_memory_holes": 0 }, @@ -292,6 +292,13 @@ }, "n_memory_holes": 0 }, + "GetClassHashAt": { + "n_steps": 89, + "builtin_instance_counter": { + "range_check_builtin": 1 + }, + "n_memory_holes": 0 + }, "GetContractAddress": { "n_steps": 64, "builtin_instance_counter": { @@ -333,9 +340,9 @@ "n_memory_holes": 0 }, "LibraryCall": { - "n_steps": 842, + "n_steps": 880, "builtin_instance_counter": { - "range_check_builtin": 15 + "range_check_builtin": 17 }, "n_memory_holes": 0 }, @@ -347,91 +354,91 @@ "n_memory_holes": 0 }, "ReplaceClass": { - "n_steps": 104, + "n_steps": 106, "builtin_instance_counter": { "range_check_builtin": 1 }, "n_memory_holes": 0 }, "Secp256k1Add": { - "n_steps": 410, + "n_steps": 412, "builtin_instance_counter": { "range_check_builtin": 29 }, "n_memory_holes": 0 }, "Secp256k1GetPointFromX": { - "n_steps": 395, + "n_steps": 397, "builtin_instance_counter": { "range_check_builtin": 30 }, "n_memory_holes": 0 }, "Secp256k1GetXy": { - "n_steps": 207, + "n_steps": 209, "builtin_instance_counter": { "range_check_builtin": 11 }, "n_memory_holes": 0 }, "Secp256k1Mul": { - "n_steps": 76505, + "n_steps": 76507, "builtin_instance_counter": { "range_check_builtin": 7045 }, "n_memory_holes": 0 }, "Secp256k1New": { - "n_steps": 461, + "n_steps": 463, "builtin_instance_counter": { "range_check_builtin": 35 }, "n_memory_holes": 0 }, "Secp256r1Add": { - "n_steps": 593, + "n_steps": 595, "builtin_instance_counter": { "range_check_builtin": 57 }, "n_memory_holes": 0 }, "Secp256r1GetPointFromX": { - "n_steps": 514, + "n_steps": 516, "builtin_instance_counter": { "range_check_builtin": 44 }, "n_memory_holes": 0 }, "Secp256r1GetXy": { - "n_steps": 209, + "n_steps": 211, "builtin_instance_counter": { "range_check_builtin": 11 }, "n_memory_holes": 0 }, "Secp256r1Mul": { - "n_steps": 125344, + "n_steps": 125346, "builtin_instance_counter": { "range_check_builtin": 13961 }, "n_memory_holes": 0 }, "Secp256r1New": { - "n_steps": 580, + "n_steps": 582, "builtin_instance_counter": { "range_check_builtin": 49 }, "n_memory_holes": 0 }, "SendMessageToL1": { - "n_steps": 141, + "n_steps": 143, "builtin_instance_counter": { "range_check_builtin": 1 }, "n_memory_holes": 0 }, "Sha256ProcessBlock": { - "n_steps": 1865, + "n_steps": 1867, "builtin_instance_counter": { "range_check_builtin": 65, "bitwise_builtin": 1115 @@ -451,23 +458,16 @@ "range_check_builtin": 1 }, "n_memory_holes": 0 - }, - "GetClassHashAt": { - "n_steps": 89, - "builtin_instance_counter": { - "range_check_builtin": 1 - }, - "n_memory_holes": 0 } }, "execute_txs_inner": { "Declare": { "deprecated_resources": { "constant": { - "n_steps": 3203, + "n_steps": 3266, "builtin_instance_counter": { "pedersen_builtin": 16, - "range_check_builtin": 56, + "range_check_builtin": 61, "poseidon_builtin": 4 }, "n_memory_holes": 0 @@ -480,10 +480,10 @@ }, "resources": { "constant": { - "n_steps": 3346, + "n_steps": 3411, "builtin_instance_counter": { "pedersen_builtin": 4, - "range_check_builtin": 64, + "range_check_builtin": 69, "poseidon_builtin": 14 }, "n_memory_holes": 0 @@ -498,10 +498,10 @@ "DeployAccount": { "deprecated_resources": { "constant": { - "n_steps": 4161, + "n_steps": 4278, "builtin_instance_counter": { "pedersen_builtin": 23, - "range_check_builtin": 72 + "range_check_builtin": 79 }, "n_memory_holes": 0 }, @@ -515,10 +515,10 @@ }, "resources": { "constant": { - "n_steps": 4321, + "n_steps": 4438, "builtin_instance_counter": { "pedersen_builtin": 11, - "range_check_builtin": 80, + "range_check_builtin": 87, "poseidon_builtin": 10 }, "n_memory_holes": 0 @@ -535,10 +535,10 @@ "InvokeFunction": { "deprecated_resources": { "constant": { - "n_steps": 3918, + "n_steps": 4005, "builtin_instance_counter": { "pedersen_builtin": 14, - "range_check_builtin": 69 + "range_check_builtin": 73 }, "n_memory_holes": 0 }, @@ -552,10 +552,10 @@ }, "resources": { "constant": { - "n_steps": 4102, + "n_steps": 4189, "builtin_instance_counter": { "pedersen_builtin": 4, - "range_check_builtin": 77, + "range_check_builtin": 81, "poseidon_builtin": 11 }, "n_memory_holes": 0 @@ -572,10 +572,10 @@ "L1Handler": { "deprecated_resources": { "constant": { - "n_steps": 1279, + "n_steps": 1321, "builtin_instance_counter": { "pedersen_builtin": 11, - "range_check_builtin": 16 + "range_check_builtin": 18 }, "n_memory_holes": 0 }, @@ -613,7 +613,7 @@ }, "validate_max_n_steps": 1000000, "validate_max_sierra_gas": 100000000, - "min_compiler_version_for_sierra_gas": "2.8.0", + "min_compiler_version_for_sierra_gas": "100", "vm_resource_fee_cost": { "builtins": { "add_mod_builtin": [ diff --git a/crates/blockifier/src/transaction/account_transactions_test.rs b/crates/blockifier/src/transaction/account_transactions_test.rs index 2deb9e53abe..23e7f036f1f 100644 --- a/crates/blockifier/src/transaction/account_transactions_test.rs +++ b/crates/blockifier/src/transaction/account_transactions_test.rs @@ -394,7 +394,7 @@ fn test_infinite_recursion( resource_bounds: ValidResourceBounds, ) { // Limit the number of execution steps (so we quickly hit the limit). - block_context.versioned_constants.invoke_tx_max_n_steps = 4200; + block_context.versioned_constants.invoke_tx_max_n_steps = 4287; let TestInitData { mut state, account_address, contract_address, mut nonce_manager } = create_test_init_data(&block_context.chain_info, CairoVersion::Cairo0); diff --git a/crates/blockifier/src/transaction/execution_flavors_test.rs b/crates/blockifier/src/transaction/execution_flavors_test.rs index e13abc1a1df..59a7421f880 100644 --- a/crates/blockifier/src/transaction/execution_flavors_test.rs +++ b/crates/blockifier/src/transaction/execution_flavors_test.rs @@ -632,10 +632,10 @@ fn test_simulate_validate_charge_fee_mid_execution( // Second scenario: limit resources via sender bounds. Should revert if and only if step limit // is derived from sender bounds (`charge_fee` mode). - let (gas_bound, fee_bound) = gas_and_fee(6111_u32.into(), validate, &fee_type); + let (gas_bound, fee_bound) = gas_and_fee(6198_u32.into(), validate, &fee_type); // If `charge_fee` is true, execution is limited by sender bounds, so less resources will be // used. Otherwise, execution is limited by block bounds, so more resources will be used. - let (limited_gas_used, limited_fee) = gas_and_fee(7763_u32.into(), validate, &fee_type); + let (limited_gas_used, limited_fee) = gas_and_fee(7850_u32.into(), validate, &fee_type); let (unlimited_gas_used, unlimited_fee) = gas_and_fee( u64_from_usize( get_syscall_resources(SyscallSelector::CallContract).n_steps @@ -771,23 +771,19 @@ fn test_simulate_validate_charge_fee_post_execution( // If `charge_fee` is false - we do not revert, and simply report the fee and resources as used. // If `charge_fee` is true, we revert, charge the maximal allowed fee (derived from sender // bounds), and report resources base on execution steps reverted + other overhead. - let base_gas_bound = 8010_u32.into(); + let invoke_steps = u64_from_usize(get_tx_resources(TransactionType::InvokeFunction).n_steps); + let base_gas_bound = (invoke_steps + 4092).into(); let (just_not_enough_gas_bound, just_not_enough_fee_bound) = gas_and_fee(base_gas_bound, validate, &fee_type); // `__validate__` and overhead resources + number of reverted steps, comes out slightly more // than the gas bound. - let (revert_gas_usage, revert_fee) = gas_and_fee( - (u64_from_usize(get_tx_resources(TransactionType::InvokeFunction).n_steps) + 5730).into(), - validate, - &fee_type, - ); + let (revert_gas_usage, revert_fee) = + gas_and_fee((invoke_steps + 5730).into(), validate, &fee_type); let (unlimited_gas_used, unlimited_fee) = gas_and_fee( - u64_from_usize( - get_syscall_resources(SyscallSelector::CallContract).n_steps - + get_tx_resources(TransactionType::InvokeFunction).n_steps - + 5730, - ) - .into(), + (u64_from_usize(get_syscall_resources(SyscallSelector::CallContract).n_steps) + + invoke_steps + + 5730) + .into(), validate, &fee_type, ); @@ -827,20 +823,15 @@ fn test_simulate_validate_charge_fee_post_execution( // Second scenario: balance too low. // Execute a transfer, and make sure we get the expected result. let (success_actual_gas, actual_fee) = gas_and_fee( - u64_from_usize( - get_syscall_resources(SyscallSelector::CallContract).n_steps - + get_tx_resources(TransactionType::InvokeFunction).n_steps - + 4260, - ) - .into(), - validate, - &fee_type, - ); - let (fail_actual_gas, fail_actual_fee) = gas_and_fee( - u64_from_usize(get_tx_resources(TransactionType::InvokeFunction).n_steps + 2252).into(), + (u64_from_usize(get_syscall_resources(SyscallSelector::CallContract).n_steps) + + invoke_steps + + 4260) + .into(), validate, &fee_type, ); + let (fail_actual_gas, fail_actual_fee) = + gas_and_fee((invoke_steps + 2252).into(), validate, &fee_type); assert!(felt!(actual_fee.0) < current_balance); let transfer_amount = current_balance - Felt::from(actual_fee.0 / 2); let recipient = felt!(7_u8); diff --git a/crates/blockifier/src/transaction/transactions_test.rs b/crates/blockifier/src/transaction/transactions_test.rs index e6d34651724..a9cc659179e 100644 --- a/crates/blockifier/src/transaction/transactions_test.rs +++ b/crates/blockifier/src/transaction/transactions_test.rs @@ -2373,11 +2373,11 @@ fn test_l1_handler(#[values(false, true)] use_kzg_da: bool) { // (currently matches only starknet resources). let expected_gas = match use_kzg_da { true => GasVector { - l1_gas: 17899_u32.into(), + l1_gas: 17941_u32.into(), l1_data_gas: 160_u32.into(), l2_gas: 0_u32.into(), }, - false => GasVector::from_l1_gas(19593_u32.into()), + false => GasVector::from_l1_gas(19635_u32.into()), }; let expected_da_gas = match use_kzg_da { diff --git a/crates/blockifier/src/versioned_constants_test.rs b/crates/blockifier/src/versioned_constants_test.rs index 4f9b96c16fb..ed5dd6e4400 100644 --- a/crates/blockifier/src/versioned_constants_test.rs +++ b/crates/blockifier/src/versioned_constants_test.rs @@ -174,9 +174,9 @@ fn test_latest_no_panic() { #[test] fn test_syscall_gas_cost_calculation() { - const EXPECTED_CALL_CONTRACT_GAS_COST: u64 = 87650; - const EXPECTED_SECP256K1MUL_GAS_COST: u64 = 8143650; - const EXPECTED_SHA256PROCESSBLOCK_GAS_COST: u64 = 841095; + const EXPECTED_CALL_CONTRACT_GAS_COST: u64 = 91590; + const EXPECTED_SECP256K1MUL_GAS_COST: u64 = 8143850; + const EXPECTED_SHA256PROCESSBLOCK_GAS_COST: u64 = 841295; let versioned_constants = VersionedConstants::latest_constants().clone();