Skip to content

Commit

Permalink
test(blockifier): migrate remaining tests to all resource bounds (exc…
Browse files Browse the repository at this point in the history
…ept execution flavors test)
  • Loading branch information
dorimedini-starkware committed Oct 12, 2024
1 parent 382a360 commit 8098654
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
6 changes: 3 additions & 3 deletions crates/blockifier/src/concurrency/fee_utils_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ use crate::transaction::objects::FeeType;
use crate::transaction::test_utils::{
account_invoke_tx,
block_context,
default_l1_resource_bounds,
default_all_resource_bounds,
};

#[rstest]
pub fn test_fill_sequencer_balance_reads(
block_context: BlockContext,
default_l1_resource_bounds: ValidResourceBounds,
default_all_resource_bounds: ValidResourceBounds,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] erc20_version: CairoVersion,
) {
let account = FeatureContract::AccountWithoutValidations(CairoVersion::Cairo1);
let account_tx = account_invoke_tx(invoke_tx_args! {
sender_address: account.get_instance_address(0),
calldata: create_trivial_calldata(account.get_instance_address(0)),
resource_bounds: default_l1_resource_bounds,
resource_bounds: default_all_resource_bounds,
});
let chain_info = &block_context.chain_info;
let state = &mut test_state_inner(chain_info, BALANCE, &[(account, 1)], erc20_version);
Expand Down
30 changes: 14 additions & 16 deletions crates/blockifier/src/transaction/account_transactions_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ fn test_insufficient_max_fee_reverts(

#[rstest]
fn test_deploy_account_constructor_storage_write(
default_l1_resource_bounds: ValidResourceBounds,
default_all_resource_bounds: ValidResourceBounds,
block_context: BlockContext,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] cairo_version: CairoVersion,
) {
Expand All @@ -1248,7 +1248,7 @@ fn test_deploy_account_constructor_storage_write(
chain_info,
deploy_account_tx_args! {
class_hash,
resource_bounds: default_l1_resource_bounds,
resource_bounds: default_all_resource_bounds,
constructor_calldata: constructor_calldata.clone(),
},
);
Expand All @@ -1274,7 +1274,7 @@ fn test_deploy_account_constructor_storage_write(
fn test_count_actual_storage_changes(
max_fee: Fee,
block_context: BlockContext,
default_l1_resource_bounds: ValidResourceBounds,
default_all_resource_bounds: ValidResourceBounds,
#[case] version: TransactionVersion,
#[case] fee_type: FeeType,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] cairo_version: CairoVersion,
Expand Down Expand Up @@ -1317,7 +1317,7 @@ fn test_count_actual_storage_changes(
let mut state = TransactionalState::create_transactional(&mut state);
let invoke_args = invoke_tx_args! {
max_fee,
resource_bounds: default_l1_resource_bounds,
resource_bounds: default_all_resource_bounds,
version,
sender_address: account_address,
calldata: write_1_calldata,
Expand Down Expand Up @@ -1455,7 +1455,7 @@ fn test_count_actual_storage_changes(
#[case::tx_version_3(TransactionVersion::THREE)]
fn test_concurrency_execute_fee_transfer(
max_fee: Fee,
default_l1_resource_bounds: ValidResourceBounds,
default_all_resource_bounds: ValidResourceBounds,
#[case] version: TransactionVersion,
) {
// TODO(Meshi, 01/06/2024): make the test so it will include changes in
Expand All @@ -1474,7 +1474,7 @@ fn test_concurrency_execute_fee_transfer(
sender_address: account.get_instance_address(0),
max_fee,
calldata: create_trivial_calldata(test_contract.get_instance_address(0)),
resource_bounds: default_l1_resource_bounds,
resource_bounds: default_all_resource_bounds,
version
});
let fee_type = &account_tx.fee_type();
Expand Down Expand Up @@ -1521,7 +1521,7 @@ fn test_concurrency_execute_fee_transfer(
sender_address: account.get_instance_address(0),
calldata: transfer_calldata,
max_fee,
resource_bounds: default_l1_resource_bounds,
resource_bounds: default_all_resource_bounds,
});

let execution_result =
Expand Down Expand Up @@ -1555,7 +1555,7 @@ fn test_concurrency_execute_fee_transfer(
#[case::tx_version_3(TransactionVersion::THREE)]
fn test_concurrent_fee_transfer_when_sender_is_sequencer(
max_fee: Fee,
default_l1_resource_bounds: ValidResourceBounds,
default_all_resource_bounds: ValidResourceBounds,
#[case] version: TransactionVersion,
) {
let mut block_context = BlockContext::create_for_account_testing();
Expand All @@ -1572,7 +1572,7 @@ fn test_concurrent_fee_transfer_when_sender_is_sequencer(
max_fee,
sender_address: account_address,
calldata: create_trivial_calldata(test_contract.get_instance_address(0)),
resource_bounds: default_l1_resource_bounds,
resource_bounds: default_all_resource_bounds,
version
});
let fee_type = &account_tx.fee_type();
Expand All @@ -1595,7 +1595,7 @@ fn test_concurrent_fee_transfer_when_sender_is_sequencer(
#[rstest]
fn test_revert_in_execute(
block_context: BlockContext,
default_l1_resource_bounds: ValidResourceBounds,
default_all_resource_bounds: ValidResourceBounds,
) {
let account = FeatureContract::AccountWithoutValidations(CairoVersion::Cairo1);
let chain_info = &block_context.chain_info;
Expand All @@ -1613,7 +1613,7 @@ fn test_revert_in_execute(
// Skip validate phase, as we want to test the revert in the execute phase.
let validate = false;
let tx_execution_info = account_invoke_tx(invoke_tx_args! {
resource_bounds: default_l1_resource_bounds,
resource_bounds: default_all_resource_bounds,
..tx_args
})
.execute(state, &block_context, true, validate)
Expand All @@ -1624,12 +1624,10 @@ fn test_revert_in_execute(
}

#[rstest]
#[case(true)]
#[case(false)]
fn test_call_contract_that_panics(
mut block_context: BlockContext,
default_l1_resource_bounds: ValidResourceBounds,
#[case] enable_reverts: bool,
default_all_resource_bounds: ValidResourceBounds,
#[values(true, false)] enable_reverts: bool,
) {
// Override enable reverts.
block_context.versioned_constants.enable_reverts = enable_reverts;
Expand Down Expand Up @@ -1664,7 +1662,7 @@ fn test_call_contract_that_panics(
state,
&block_context,
invoke_tx_args! {
resource_bounds: default_l1_resource_bounds,
resource_bounds: default_all_resource_bounds,
..tx_args
},
)
Expand Down

0 comments on commit 8098654

Please sign in to comment.