Skip to content

Commit

Permalink
test(blockifier): add all resource bounds to stateful validator test
Browse files Browse the repository at this point in the history
  • Loading branch information
dorimedini-starkware committed Oct 10, 2024
1 parent 3098d59 commit 541e3ca
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions crates/blockifier/src/blockifier/stateful_validator_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::transaction::account_transaction::AccountTransaction;
use crate::transaction::test_utils::{
block_context,
create_account_tx_for_validate_test_nonce_0,
default_all_resource_bounds,
default_l1_resource_bounds,
FaultyAccountTxCreatorArgs,
INVALID,
Expand All @@ -33,7 +34,8 @@ fn test_tx_validator(
#[case] validate_constructor: bool,
#[case] tx_version: TransactionVersion,
block_context: BlockContext,
default_l1_resource_bounds: ValidResourceBounds,
#[values(default_l1_resource_bounds(), default_all_resource_bounds())]
resource_bounds: ValidResourceBounds,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] cairo_version: CairoVersion,
) {
let chain_info = &block_context.chain_info;
Expand All @@ -54,7 +56,7 @@ fn test_tx_validator(
validate_constructor,
// TODO(Arni, 1/5/2024): Add test for insufficient maximal resources.
max_fee: BALANCE,
resource_bounds: default_l1_resource_bounds,
resource_bounds,
..Default::default()
};

Expand All @@ -75,7 +77,10 @@ fn test_tx_validator(
}

#[rstest]
fn test_tx_validator_skip_validate(default_l1_resource_bounds: ValidResourceBounds) {
fn test_tx_validator_skip_validate(
#[values(default_l1_resource_bounds(), default_all_resource_bounds())]
resource_bounds: ValidResourceBounds,
) {
let block_context = BlockContext::create_for_testing();
let faulty_account = FeatureContract::FaultyAccount(CairoVersion::Cairo1);
let state = test_state(&block_context.chain_info, BALANCE, &[(faulty_account, 1)]);
Expand All @@ -87,7 +92,7 @@ fn test_tx_validator_skip_validate(default_l1_resource_bounds: ValidResourceBoun
tx_version: TransactionVersion::THREE,
sender_address: faulty_account.get_instance_address(0),
class_hash: faulty_account.get_class_hash(),
resource_bounds: default_l1_resource_bounds,
resource_bounds,
..Default::default()
});

Expand Down

0 comments on commit 541e3ca

Please sign in to comment.