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

refactor(fee): rename ResourceBoundsMapping => DeprecatedResourceBoundsMapping #504

Merged
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions crates/blockifier/src/concurrency/fee_utils_test.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use num_bigint::BigUint;
use rstest::rstest;
use starknet_api::felt;
use starknet_api::transaction::{Fee, ResourceBoundsMapping};
use starknet_api::transaction::{DeprecatedResourceBoundsMapping, Fee};
use starknet_types_core::felt::Felt;

use crate::concurrency::fee_utils::{add_fee_to_sequencer_balance, fill_sequencer_balance_reads};
Expand All @@ -19,7 +19,7 @@ use crate::transaction::test_utils::{account_invoke_tx, block_context, max_resou
#[rstest]
pub fn test_fill_sequencer_balance_reads(
block_context: BlockContext,
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] erc20_version: CairoVersion,
) {
let account = FeatureContract::AccountWithoutValidations(CairoVersion::Cairo1);
Expand Down
4 changes: 2 additions & 2 deletions crates/blockifier/src/concurrency/versioned_state_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use starknet_api::core::{
Nonce,
PatriciaKey,
};
use starknet_api::transaction::{Calldata, ContractAddressSalt, ResourceBoundsMapping};
use starknet_api::transaction::{Calldata, ContractAddressSalt, DeprecatedResourceBoundsMapping};
use starknet_api::{calldata, class_hash, contract_address, felt, patricia_key};

use crate::abi::abi_utils::{get_fee_token_var_address, get_storage_var_address};
Expand Down Expand Up @@ -201,7 +201,7 @@ fn test_versioned_state_proxy() {

#[rstest]
// Test parallel execution of two transactions that use the same versioned state.
fn test_run_parallel_txs(max_resource_bounds: ResourceBoundsMapping) {
fn test_run_parallel_txs(max_resource_bounds: DeprecatedResourceBoundsMapping) {
let block_context = BlockContext::create_for_account_testing();
let chain_info = &block_context.chain_info;
let zero_bounds = true;
Expand Down
10 changes: 5 additions & 5 deletions crates/blockifier/src/concurrency/worker_logic_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use rstest::rstest;
use starknet_api::core::{ContractAddress, Nonce, PatriciaKey};
use starknet_api::transaction::{
ContractAddressSalt,
DeprecatedResourceBoundsMapping,
Fee,
ResourceBoundsMapping,
TransactionVersion,
};
use starknet_api::{contract_address, felt, patricia_key};
Expand Down Expand Up @@ -256,7 +256,7 @@ fn test_commit_tx_when_sender_is_sequencer() {
}

#[rstest]
fn test_worker_execute(max_resource_bounds: ResourceBoundsMapping) {
fn test_worker_execute(max_resource_bounds: DeprecatedResourceBoundsMapping) {
// Settings.
let block_context = BlockContext::create_for_account_testing();
let account_contract = FeatureContract::AccountWithoutValidations(CairoVersion::Cairo1);
Expand Down Expand Up @@ -430,7 +430,7 @@ fn test_worker_execute(max_resource_bounds: ResourceBoundsMapping) {
}

#[rstest]
fn test_worker_validate(max_resource_bounds: ResourceBoundsMapping) {
fn test_worker_validate(max_resource_bounds: DeprecatedResourceBoundsMapping) {
// Settings.
let block_context = BlockContext::create_for_account_testing();
let account_contract = FeatureContract::AccountWithoutValidations(CairoVersion::Cairo1);
Expand Down Expand Up @@ -537,7 +537,7 @@ fn test_worker_validate(max_resource_bounds: ResourceBoundsMapping) {
#[case::declare_cairo1(CairoVersion::Cairo1, TransactionVersion::THREE)]
fn test_deploy_before_declare(
max_fee: Fee,
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
#[case] cairo_version: CairoVersion,
#[case] version: TransactionVersion,
) {
Expand Down Expand Up @@ -629,7 +629,7 @@ fn test_deploy_before_declare(
}

#[rstest]
fn test_worker_commit_phase(max_resource_bounds: ResourceBoundsMapping) {
fn test_worker_commit_phase(max_resource_bounds: DeprecatedResourceBoundsMapping) {
// Settings.
let block_context = BlockContext::create_for_account_testing();
let account_contract = FeatureContract::AccountWithoutValidations(CairoVersion::Cairo1);
Expand Down
4 changes: 2 additions & 2 deletions crates/blockifier/src/execution/stack_trace_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use starknet_api::core::{calculate_contract_address, Nonce};
use starknet_api::transaction::{
Calldata,
ContractAddressSalt,
DeprecatedResourceBoundsMapping,
Fee,
ResourceBoundsMapping,
TransactionSignature,
TransactionVersion,
};
Expand Down Expand Up @@ -599,7 +599,7 @@ An ASSERT_EQ instruction failed: 1 != 0.
/// point selector).
fn test_contract_ctor_frame_stack_trace(
block_context: BlockContext,
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] cairo_version: CairoVersion,
) {
let chain_info = &block_context.chain_info;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use starknet_api::felt;
use starknet_api::transaction::{
AccountDeploymentData,
Calldata,
DeprecatedResourceBoundsMapping,
Fee,
PaymasterData,
Resource,
ResourceBounds,
ResourceBoundsMapping,
Tip,
TransactionHash,
TransactionVersion,
Expand Down Expand Up @@ -213,7 +213,7 @@ fn test_get_execution_info(
only_query,
..Default::default()
},
resource_bounds: ResourceBoundsMapping(BTreeMap::from([
resource_bounds: DeprecatedResourceBoundsMapping(BTreeMap::from([
(
Resource::L1Gas,
// TODO(Ori, 1/2/2024): Write an indicative expect message explaining why
Expand Down
4 changes: 2 additions & 2 deletions crates/blockifier/src/fee/actual_cost_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rstest::{fixture, rstest};
use starknet_api::transaction::{L2ToL1Payload, ResourceBoundsMapping};
use starknet_api::transaction::{DeprecatedResourceBoundsMapping, L2ToL1Payload};
use starknet_types_core::felt::Felt;

use crate::context::BlockContext;
Expand Down Expand Up @@ -286,7 +286,7 @@ fn test_calculate_tx_gas_usage_basic<'a>(#[values(false, true)] use_kzg_da: bool
// resources are taken into account).
#[rstest]
fn test_calculate_tx_gas_usage(
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
#[values(false, true)] use_kzg_da: bool,
) {
let account_cairo_version = CairoVersion::Cairo0;
Expand Down
6 changes: 3 additions & 3 deletions crates/blockifier/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ use starknet_api::state::StorageKey;
use starknet_api::transaction::{
Calldata,
ContractAddressSalt,
DeprecatedResourceBoundsMapping,
Resource,
ResourceBounds,
ResourceBoundsMapping,
TransactionVersion,
};
use starknet_api::{contract_address, felt, patricia_key};
Expand Down Expand Up @@ -211,8 +211,8 @@ pub fn trivial_external_entry_point_with_address(
}
}

fn default_testing_resource_bounds() -> ResourceBoundsMapping {
ResourceBoundsMapping::try_from(vec![
fn default_testing_resource_bounds() -> DeprecatedResourceBoundsMapping {
DeprecatedResourceBoundsMapping::try_from(vec![
(Resource::L1Gas, ResourceBounds { max_amount: 0, max_price_per_unit: 1 }),
// TODO(Dori, 1/2/2024): When fee market is developed, change the default price of
// L2 gas.
Expand Down
4 changes: 2 additions & 2 deletions crates/blockifier/src/test_utils/declare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use starknet_api::transaction::{
DeclareTransactionV0V1,
DeclareTransactionV2,
DeclareTransactionV3,
DeprecatedResourceBoundsMapping,
Fee,
PaymasterData,
ResourceBoundsMapping,
Tip,
TransactionHash,
TransactionSignature,
Expand All @@ -25,7 +25,7 @@ pub struct DeclareTxArgs {
pub signature: TransactionSignature,
pub sender_address: ContractAddress,
pub version: TransactionVersion,
pub resource_bounds: ResourceBoundsMapping,
pub resource_bounds: DeprecatedResourceBoundsMapping,
pub tip: Tip,
pub nonce_data_availability_mode: DataAvailabilityMode,
pub fee_data_availability_mode: DataAvailabilityMode,
Expand Down
4 changes: 2 additions & 2 deletions crates/blockifier/src/test_utils/deploy_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use starknet_api::transaction::{
ContractAddressSalt,
DeployAccountTransactionV1,
DeployAccountTransactionV3,
DeprecatedResourceBoundsMapping,
Fee,
PaymasterData,
ResourceBoundsMapping,
Tip,
TransactionHash,
TransactionSignature,
Expand All @@ -23,7 +23,7 @@ pub struct DeployAccountTxArgs {
pub signature: TransactionSignature,
pub deployer_address: ContractAddress,
pub version: TransactionVersion,
pub resource_bounds: ResourceBoundsMapping,
pub resource_bounds: DeprecatedResourceBoundsMapping,
pub tip: Tip,
pub nonce_data_availability_mode: DataAvailabilityMode,
pub fee_data_availability_mode: DataAvailabilityMode,
Expand Down
4 changes: 2 additions & 2 deletions crates/blockifier/src/test_utils/invoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use starknet_api::data_availability::DataAvailabilityMode;
use starknet_api::transaction::{
AccountDeploymentData,
Calldata,
DeprecatedResourceBoundsMapping,
Fee,
InvokeTransactionV0,
InvokeTransactionV1,
InvokeTransactionV3,
PaymasterData,
ResourceBoundsMapping,
Tip,
TransactionHash,
TransactionSignature,
Expand All @@ -28,7 +28,7 @@ pub struct InvokeTxArgs {
pub sender_address: ContractAddress,
pub calldata: Calldata,
pub version: TransactionVersion,
pub resource_bounds: ResourceBoundsMapping,
pub resource_bounds: DeprecatedResourceBoundsMapping,
pub tip: Tip,
pub nonce_data_availability_mode: DataAvailabilityMode,
pub fee_data_availability_mode: DataAvailabilityMode,
Expand Down
33 changes: 18 additions & 15 deletions crates/blockifier/src/transaction/account_transactions_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use starknet_api::transaction::{
Calldata,
ContractAddressSalt,
DeclareTransactionV2,
DeprecatedResourceBoundsMapping,
Fee,
ResourceBoundsMapping,
TransactionHash,
TransactionVersion,
};
Expand Down Expand Up @@ -80,7 +80,7 @@ use crate::{
};

#[rstest]
fn test_circuit(block_context: BlockContext, max_resource_bounds: ResourceBoundsMapping) {
fn test_circuit(block_context: BlockContext, max_resource_bounds: DeprecatedResourceBoundsMapping) {
let test_contract = FeatureContract::TestContract(CairoVersion::Cairo1);
let account = FeatureContract::AccountWithoutValidations(CairoVersion::Cairo1);
let chain_info = &block_context.chain_info;
Expand Down Expand Up @@ -114,7 +114,10 @@ fn test_circuit(block_context: BlockContext, max_resource_bounds: ResourceBounds
}

#[rstest]
fn test_rc96_holes(block_context: BlockContext, max_resource_bounds: ResourceBoundsMapping) {
fn test_rc96_holes(
block_context: BlockContext,
max_resource_bounds: DeprecatedResourceBoundsMapping,
) {
let test_contract = FeatureContract::TestContract(CairoVersion::Cairo1);
let account = FeatureContract::AccountWithoutValidations(CairoVersion::Cairo1);
let chain_info = &block_context.chain_info;
Expand Down Expand Up @@ -205,7 +208,7 @@ fn test_enforce_fee_false_works(block_context: BlockContext, #[case] version: Tr
fn test_account_flow_test(
block_context: BlockContext,
max_fee: Fee,
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
#[values(TransactionVersion::ZERO, TransactionVersion::ONE, TransactionVersion::THREE)]
tx_version: TransactionVersion,
#[values(true, false)] only_query: bool,
Expand Down Expand Up @@ -237,7 +240,7 @@ fn test_account_flow_test(
fn test_invoke_tx_from_non_deployed_account(
block_context: BlockContext,
max_fee: Fee,
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
#[case] tx_version: TransactionVersion,
) {
let TestInitData { mut state, account_address, contract_address: _, mut nonce_manager } =
Expand Down Expand Up @@ -286,7 +289,7 @@ fn test_infinite_recursion(
#[values(true, false)] success: bool,
#[values(true, false)] normal_recurse: bool,
mut block_context: BlockContext,
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
) {
// Limit the number of execution steps (so we quickly hit the limit).
block_context.versioned_constants.invoke_tx_max_n_steps = 4100;
Expand Down Expand Up @@ -341,7 +344,7 @@ fn test_infinite_recursion(
fn test_max_fee_limit_validate(
block_context: BlockContext,
#[case] version: TransactionVersion,
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
) {
let chain_info = &block_context.chain_info;
let TestInitData { mut state, account_address, contract_address, mut nonce_manager } =
Expand Down Expand Up @@ -446,7 +449,7 @@ fn test_recursion_depth_exceeded(
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] cairo_version: CairoVersion,
block_context: BlockContext,
max_fee: Fee,
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
) {
let TestInitData { mut state, account_address, contract_address, mut nonce_manager } =
create_test_init_data(&block_context.chain_info, cairo_version);
Expand Down Expand Up @@ -690,7 +693,7 @@ fn recursive_function_calldata(
#[case(TransactionVersion::THREE)]
fn test_reverted_reach_steps_limit(
max_fee: Fee,
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
mut block_context: BlockContext,
#[case] version: TransactionVersion,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] cairo_version: CairoVersion,
Expand Down Expand Up @@ -798,7 +801,7 @@ fn test_reverted_reach_steps_limit(
/// asserts false. We test deltas between consecutive depths, and further depths.
fn test_n_reverted_steps(
block_context: BlockContext,
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] cairo_version: CairoVersion,
) {
let TestInitData { mut state, account_address, contract_address, mut nonce_manager } =
Expand Down Expand Up @@ -979,7 +982,7 @@ fn test_max_fee_to_max_steps_conversion(
/// recorded and max_fee is charged.
fn test_insufficient_max_fee_reverts(
block_context: BlockContext,
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] cairo_version: CairoVersion,
) {
let TestInitData { mut state, account_address, contract_address, mut nonce_manager } =
Expand Down Expand Up @@ -1046,7 +1049,7 @@ fn test_insufficient_max_fee_reverts(

#[rstest]
fn test_deploy_account_constructor_storage_write(
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
block_context: BlockContext,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] cairo_version: CairoVersion,
) {
Expand Down Expand Up @@ -1090,7 +1093,7 @@ fn test_deploy_account_constructor_storage_write(
fn test_count_actual_storage_changes(
max_fee: Fee,
block_context: BlockContext,
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
#[case] version: TransactionVersion,
#[case] fee_type: FeeType,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] cairo_version: CairoVersion,
Expand Down Expand Up @@ -1271,7 +1274,7 @@ fn test_count_actual_storage_changes(
#[case::tx_version_3(TransactionVersion::THREE)]
fn test_concurrency_execute_fee_transfer(
max_fee: Fee,
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
#[case] version: TransactionVersion,
) {
// TODO(Meshi, 01/06/2024): make the test so it will include changes in
Expand Down Expand Up @@ -1371,7 +1374,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,
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
#[case] version: TransactionVersion,
) {
let mut block_context = BlockContext::create_for_account_testing();
Expand Down
6 changes: 3 additions & 3 deletions crates/blockifier/src/transaction/execution_flavors_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use starknet_api::core::ContractAddress;
use starknet_api::felt;
use starknet_api::transaction::{
Calldata,
DeprecatedResourceBoundsMapping,
Fee,
ResourceBoundsMapping,
TransactionSignature,
TransactionVersion,
};
Expand Down Expand Up @@ -349,7 +349,7 @@ fn test_simulate_validate_charge_fee_fail_validate(
#[values(CairoVersion::Cairo0)] cairo_version: CairoVersion,
#[case] version: TransactionVersion,
#[case] fee_type: FeeType,
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
) {
let block_context = BlockContext::create_for_account_testing();
let max_fee = Fee(MAX_FEE);
Expand Down Expand Up @@ -411,7 +411,7 @@ fn test_simulate_validate_charge_fee_mid_execution(
#[values(CairoVersion::Cairo0)] cairo_version: CairoVersion,
#[case] version: TransactionVersion,
#[case] fee_type: FeeType,
max_resource_bounds: ResourceBoundsMapping,
max_resource_bounds: DeprecatedResourceBoundsMapping,
) {
let block_context = BlockContext::create_for_account_testing();
let chain_info = &block_context.chain_info;
Expand Down
Loading
Loading