Skip to content

Commit

Permalink
refactor(fee): rename ResourceBoundsMapping => DeprecatedResourceBoun…
Browse files Browse the repository at this point in the history
…dsMapping
  • Loading branch information
nimrod-starkware committed Aug 19, 2024
1 parent d6c1477 commit 8139ddb
Show file tree
Hide file tree
Showing 33 changed files with 121 additions and 121 deletions.
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 @@ -6,7 +6,7 @@ use starknet_api::core::{ContractAddress, Nonce, PatriciaKey};
use starknet_api::transaction::{
ContractAddressSalt,
Fee,
ResourceBoundsMapping,
DeprecatedResourceBoundsMapping,
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 @@ -6,7 +6,7 @@ use starknet_api::transaction::{
Calldata,
ContractAddressSalt,
Fee,
ResourceBoundsMapping,
DeprecatedResourceBoundsMapping,
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 @@ -12,7 +12,7 @@ use starknet_api::transaction::{
PaymasterData,
Resource,
ResourceBounds,
ResourceBoundsMapping,
DeprecatedResourceBoundsMapping,
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::{L2ToL1Payload, DeprecatedResourceBoundsMapping};
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 @@ -20,7 +20,7 @@ use starknet_api::transaction::{
ContractAddressSalt,
Resource,
ResourceBounds,
ResourceBoundsMapping,
DeprecatedResourceBoundsMapping,
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 @@ -7,7 +7,7 @@ use starknet_api::transaction::{
DeclareTransactionV3,
Fee,
PaymasterData,
ResourceBoundsMapping,
DeprecatedResourceBoundsMapping,
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 @@ -7,7 +7,7 @@ use starknet_api::transaction::{
DeployAccountTransactionV3,
Fee,
PaymasterData,
ResourceBoundsMapping,
DeprecatedResourceBoundsMapping,
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 @@ -9,7 +9,7 @@ use starknet_api::transaction::{
InvokeTransactionV1,
InvokeTransactionV3,
PaymasterData,
ResourceBoundsMapping,
DeprecatedResourceBoundsMapping,
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
30 changes: 15 additions & 15 deletions crates/blockifier/src/transaction/account_transactions_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use starknet_api::transaction::{
ContractAddressSalt,
DeclareTransactionV2,
Fee,
ResourceBoundsMapping,
DeprecatedResourceBoundsMapping,
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,7 @@ 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 +205,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 +237,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 +286,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 +341,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 +446,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 +690,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 +798,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 +979,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 +1046,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 +1090,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 +1271,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 +1371,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 @@ -6,7 +6,7 @@ use starknet_api::felt;
use starknet_api::transaction::{
Calldata,
Fee,
ResourceBoundsMapping,
DeprecatedResourceBoundsMapping,
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
4 changes: 2 additions & 2 deletions crates/blockifier/src/transaction/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use starknet_api::transaction::{
PaymasterData,
Resource,
ResourceBounds,
ResourceBoundsMapping,
DeprecatedResourceBoundsMapping,
Tip,
TransactionHash,
TransactionSignature,
Expand Down Expand Up @@ -125,7 +125,7 @@ impl HasRelatedFeeType for TransactionInfo {
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CurrentTransactionInfo {
pub common_fields: CommonAccountFields,
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
Loading

0 comments on commit 8139ddb

Please sign in to comment.