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): add all resource bounds to stateful validator test #1307

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
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
Loading