Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(blockifier): max validate\execute gas less than max possible sierra gas #2687

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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")]
Expand Down Expand Up @@ -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.
Expand All @@ -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)
};
Expand Down
Loading