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
…1307)

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/starkware-libs/sequencer/1307)
<!-- Reviewable:end -->
  • Loading branch information
dorimedini-starkware authored Oct 15, 2024
1 parent b27e000 commit c66d3c2
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 c66d3c2

Please sign in to comment.