Skip to content

Commit

Permalink
test(cairo_native): add native to transactions test
Browse files Browse the repository at this point in the history
  • Loading branch information
meship-starkware committed Jan 3, 2025
1 parent 3806aa2 commit a8b9ee1
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 52 deletions.
30 changes: 30 additions & 0 deletions crates/blockifier/src/test_utils/test_templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,33 @@ fn cairo_version(
cairo_version: CairoVersion,
) {
}

#[cfg(not(feature = "cairo_native"))]
#[template]
#[rstest]
fn two_cairo_versions(
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1(RunnableCairo1::Casm))]
cairo_version: CairoVersion,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1(RunnableCairo1::Casm))]
other_cairo_version: CairoVersion,
) {
}

#[cfg(feature = "cairo_native")]
#[template]
#[rstest]
fn two_cairo_versions(
#[values(
CairoVersion::Cairo0,
CairoVersion::Cairo1(RunnableCairo1::Casm),
CairoVersion::Cairo1(RunnableCairo1::Native)
)]
cairo_version: CairoVersion,
#[values(
CairoVersion::Cairo0,
CairoVersion::Cairo1(RunnableCairo1::Casm),
CairoVersion::Cairo1(RunnableCairo1::Native)
)]
other_cairo_version: CairoVersion,
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use cairo_vm::vm::runners::cairo_runner::ResourceTracker;
use num_traits::Inv;
use pretty_assertions::{assert_eq, assert_ne};
use rstest::rstest;
use rstest_reuse::apply;
use starknet_api::abi::abi_utils::{
get_fee_token_var_address,
get_storage_var_address,
Expand Down Expand Up @@ -75,6 +76,7 @@ use crate::state::state_api::{State, StateReader};
use crate::test_utils::contracts::FeatureContract;
use crate::test_utils::initial_test_state::{fund_account, test_state};
use crate::test_utils::syscall::build_recurse_calldata;
use crate::test_utils::test_templates::cairo_version;
use crate::test_utils::{
create_calldata,
create_trivial_calldata,
Expand Down Expand Up @@ -583,13 +585,12 @@ fn test_max_fee_limit_validate(
assert!(error_trace.contains("no remaining steps") | error_trace.contains("Out of gas"))
}

#[rstest]
#[apply(cairo_version)]
#[case::v1(TransactionVersion::ONE, default_all_resource_bounds())]
#[case::l1_bounds(TransactionVersion::THREE, default_l1_resource_bounds())]
#[case::all_bounds(TransactionVersion::THREE, default_all_resource_bounds())]
fn test_recursion_depth_exceeded(
#[case] tx_version: TransactionVersion,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1(RunnableCairo1::Casm))]
cairo_version: CairoVersion,
block_context: BlockContext,
max_fee: Fee,
Expand Down
Loading

0 comments on commit a8b9ee1

Please sign in to comment.