From ab573917f2cf6e3cd80dd0efd36fd8fe4e79452d Mon Sep 17 00:00:00 2001 From: aner-starkware <147302140+aner-starkware@users.noreply.github.com> Date: Tue, 17 Dec 2024 18:40:40 +0200 Subject: [PATCH] test(blockifier): max validate\execute gas less than max possible sierra gas (#2687) --- .../execution/syscalls/syscall_tests/out_of_gas.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/blockifier/src/execution/syscalls/syscall_tests/out_of_gas.rs b/crates/blockifier/src/execution/syscalls/syscall_tests/out_of_gas.rs index f61213fe16..e93e26c6be 100644 --- a/crates/blockifier/src/execution/syscalls/syscall_tests/out_of_gas.rs +++ b/crates/blockifier/src/execution/syscalls/syscall_tests/out_of_gas.rs @@ -2,7 +2,6 @@ use starknet_api::abi::abi_utils::selector_from_name; use starknet_api::{calldata, felt}; use test_case::test_case; -#[cfg(feature = "cairo_native")] use crate::abi::constants::MAX_POSSIBLE_SIERRA_GAS; use crate::context::ChainInfo; use crate::execution::call_info::CallExecution; @@ -12,6 +11,7 @@ use crate::retdata; use crate::test_utils::contracts::FeatureContract; use crate::test_utils::initial_test_state::test_state; use crate::test_utils::{trivial_external_entry_point_new, CairoVersion, RunnableCairo1, BALANCE}; +use crate::versioned_constants::VersionedConstants; #[cfg_attr(feature = "cairo_native", test_case(RunnableCairo1::Native; "Native"))] #[test_case(RunnableCairo1::Casm; "VM")] @@ -41,6 +41,14 @@ fn test_out_of_gas(runnable_version: RunnableCairo1) { ); } +#[test] +fn test_total_tx_limits_less_than_max_sierra_gas() { + assert!( + VersionedConstants::create_for_testing().initial_gas_no_user_l2_bound().0 + <= MAX_POSSIBLE_SIERRA_GAS + ); +} + #[cfg(feature = "cairo_native")] #[test] /// Tests that Native can handle deep recursion calls without overflowing the stack. @@ -57,7 +65,6 @@ fn test_stack_overflow() { let entry_point_call = CallEntryPoint { calldata: calldata![depth], entry_point_selector: selector_from_name("test_stack_overflow"), - // TODO(Aner): assert that the total tx limits are <= MAX_POSSIBLE_SIERRA_GAS. initial_gas: MAX_POSSIBLE_SIERRA_GAS, ..trivial_external_entry_point_new(test_contract) };