From edafd7ed1475118df0ed77c634812073e9c75c56 Mon Sep 17 00:00:00 2001 From: Tzahi Date: Mon, 23 Dec 2024 11:41:15 +0200 Subject: [PATCH] fix(blockifier): typo in infinite_gas_for_vm_mode (#2704) --- .../src/execution/contract_address_test.rs | 2 +- .../src/execution/entry_point_test.rs | 2 +- .../src/execution/execution_utils.rs | 2 +- .../transaction/account_transactions_test.rs | 2 +- .../src/transaction/transactions_test.rs | 18 +++++++++--------- crates/blockifier/src/versioned_constants.rs | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/crates/blockifier/src/execution/contract_address_test.rs b/crates/blockifier/src/execution/contract_address_test.rs index 2b8f5927a8..aec03e509e 100644 --- a/crates/blockifier/src/execution/contract_address_test.rs +++ b/crates/blockifier/src/execution/contract_address_test.rs @@ -34,7 +34,7 @@ fn test_calculate_contract_address() { calldata, entry_point_selector: selector_from_name("test_contract_address"), storage_address: deployer_address, - initial_gas: versioned_constants.inifite_gas_for_vm_mode(), + initial_gas: versioned_constants.infinite_gas_for_vm_mode(), ..Default::default() }; let contract_address = diff --git a/crates/blockifier/src/execution/entry_point_test.rs b/crates/blockifier/src/execution/entry_point_test.rs index 845fec006a..8322b1b967 100644 --- a/crates/blockifier/src/execution/entry_point_test.rs +++ b/crates/blockifier/src/execution/entry_point_test.rs @@ -200,7 +200,7 @@ fn run_security_test( entry_point_selector: selector_from_name(entry_point_name), calldata, storage_address: security_contract.get_instance_address(0), - initial_gas: versioned_constants.inifite_gas_for_vm_mode(), + initial_gas: versioned_constants.infinite_gas_for_vm_mode(), ..Default::default() }; let error = match entry_point_call.execute_directly(state) { diff --git a/crates/blockifier/src/execution/execution_utils.rs b/crates/blockifier/src/execution/execution_utils.rs index c2c0b96276..12441a2046 100644 --- a/crates/blockifier/src/execution/execution_utils.rs +++ b/crates/blockifier/src/execution/execution_utils.rs @@ -63,7 +63,7 @@ pub fn execute_entry_point_call_wrapper( ); if current_tracked_resource == TrackedResource::CairoSteps { // Override the initial gas with a high value so it won't limit the run. - call.initial_gas = context.versioned_constants().inifite_gas_for_vm_mode(); + call.initial_gas = context.versioned_constants().infinite_gas_for_vm_mode(); } let orig_call = call.clone(); diff --git a/crates/blockifier/src/transaction/account_transactions_test.rs b/crates/blockifier/src/transaction/account_transactions_test.rs index 53468d4d64..4e091acb8c 100644 --- a/crates/blockifier/src/transaction/account_transactions_test.rs +++ b/crates/blockifier/src/transaction/account_transactions_test.rs @@ -1757,7 +1757,7 @@ fn test_initial_gas( ); assert_eq!( curr_initial_gas, - block_context.versioned_constants.inifite_gas_for_vm_mode() + block_context.versioned_constants.infinite_gas_for_vm_mode() ); started_vm_mode = true; } diff --git a/crates/blockifier/src/transaction/transactions_test.rs b/crates/blockifier/src/transaction/transactions_test.rs index a46db4032a..6a83416feb 100644 --- a/crates/blockifier/src/transaction/transactions_test.rs +++ b/crates/blockifier/src/transaction/transactions_test.rs @@ -163,8 +163,8 @@ static VERSIONED_CONSTANTS: LazyLock = LazyLock::new(VersionedConstants::create_for_testing); #[fixture] -fn inifite_gas_for_vm_mode() -> u64 { - VERSIONED_CONSTANTS.inifite_gas_for_vm_mode() +fn infinite_gas_for_vm_mode() -> u64 { + VERSIONED_CONSTANTS.infinite_gas_for_vm_mode() } #[fixture] @@ -260,7 +260,7 @@ fn expected_validate_call_info( } }; let initial_gas = match cairo_version { - CairoVersion::Cairo0 => inifite_gas_for_vm_mode(), + CairoVersion::Cairo0 => infinite_gas_for_vm_mode(), CairoVersion::Cairo1(_) => match tracked_resource { TrackedResource::CairoSteps => initial_gas_amount_from_block_context(None).0, TrackedResource::SierraGas => { @@ -547,7 +547,7 @@ fn test_invoke_tx( let expected_execute_call = CallEntryPoint { entry_point_selector: selector_from_name(constants::EXECUTE_ENTRY_POINT_NAME), initial_gas: match account_cairo_version { - CairoVersion::Cairo0 => versioned_constants.inifite_gas_for_vm_mode(), + CairoVersion::Cairo0 => versioned_constants.infinite_gas_for_vm_mode(), CairoVersion::Cairo1(_) => expected_initial_execution_gas, }, ..expected_validated_call @@ -580,7 +580,7 @@ fn test_invoke_tx( storage_address: test_contract_address, caller_address: sender_address, call_type: CallType::Call, - initial_gas: versioned_constants.inifite_gas_for_vm_mode(), + initial_gas: versioned_constants.infinite_gas_for_vm_mode(), }; let expected_return_result_retdata = Retdata(expected_return_result_calldata); @@ -2689,7 +2689,7 @@ fn test_invoke_max_sierra_gas_validate_execute( let actual_validate_initial_gas = actual_execution_info.validate_call_info.as_ref().unwrap().call.initial_gas; let expected_validate_initial_gas = match account_tracked_resource { - TrackedResource::CairoSteps => VERSIONED_CONSTANTS.inifite_gas_for_vm_mode(), + TrackedResource::CairoSteps => VERSIONED_CONSTANTS.infinite_gas_for_vm_mode(), TrackedResource::SierraGas => { versioned_constants.validate_max_sierra_gas.min(user_initial_gas).0 } @@ -2700,7 +2700,7 @@ fn test_invoke_max_sierra_gas_validate_execute( let actual_execute_initial_gas = actual_execution_info.execute_call_info.as_ref().unwrap().call.initial_gas; let expected_execute_initial_gas = match account_tracked_resource { - TrackedResource::CairoSteps => VERSIONED_CONSTANTS.inifite_gas_for_vm_mode(), + TrackedResource::CairoSteps => VERSIONED_CONSTANTS.infinite_gas_for_vm_mode(), TrackedResource::SierraGas => { versioned_constants .execute_max_sierra_gas @@ -2735,7 +2735,7 @@ fn test_invoke_max_sierra_gas_validate_execute( .gas_consumed ); } else { - assert_eq!(actual_inner_call_initial_gas, versioned_constants.inifite_gas_for_vm_mode()); + assert_eq!(actual_inner_call_initial_gas, versioned_constants.infinite_gas_for_vm_mode()); }; } @@ -2815,7 +2815,7 @@ fn test_deploy_max_sierra_gas_validate_execute( let actual_validate_initial_gas = actual_execution_info.validate_call_info.as_ref().unwrap().call.initial_gas; let expected_validate_initial_gas = match account_tracked_resource { - TrackedResource::CairoSteps => VERSIONED_CONSTANTS.inifite_gas_for_vm_mode(), + TrackedResource::CairoSteps => VERSIONED_CONSTANTS.infinite_gas_for_vm_mode(), TrackedResource::SierraGas => { versioned_constants .validate_max_sierra_gas diff --git a/crates/blockifier/src/versioned_constants.rs b/crates/blockifier/src/versioned_constants.rs index 6d5a08902d..c5ab944d72 100644 --- a/crates/blockifier/src/versioned_constants.rs +++ b/crates/blockifier/src/versioned_constants.rs @@ -266,7 +266,7 @@ impl VersionedConstants { } /// Returns the default initial gas for VM mode transactions. - pub fn inifite_gas_for_vm_mode(&self) -> u64 { + pub fn infinite_gas_for_vm_mode(&self) -> u64 { self.os_constants.gas_costs.base.default_initial_gas_cost }