From 618cb7893b031d5a82588e027c3e19f5ccc95cf9 Mon Sep 17 00:00:00 2001
From: nimrod-starkware <143319383+nimrod-starkware@users.noreply.github.com>
Date: Sun, 25 Aug 2024 11:11:09 +0300
Subject: [PATCH] refactor(fee): rename ResourceBoundsMapping =>
DeprecatedResourceBoundsMapping (#504)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This change is [](https://reviewable.io/reviews/starkware-libs/sequencer/504)
---
.../src/concurrency/fee_utils_test.rs | 4 +--
.../src/concurrency/versioned_state_test.rs | 4 +--
.../src/concurrency/worker_logic_test.rs | 10 +++---
.../src/execution/stack_trace_test.rs | 4 +--
.../syscall_tests/get_execution_info.rs | 4 +--
crates/blockifier/src/fee/actual_cost_test.rs | 4 +--
crates/blockifier/src/test_utils.rs | 6 ++--
crates/blockifier/src/test_utils/declare.rs | 4 +--
.../src/test_utils/deploy_account.rs | 4 +--
crates/blockifier/src/test_utils/invoke.rs | 4 +--
.../transaction/account_transactions_test.rs | 33 ++++++++++--------
.../src/transaction/execution_flavors_test.rs | 6 ++--
crates/blockifier/src/transaction/objects.rs | 4 +--
.../src/transaction/post_execution_test.rs | 11 ++++--
.../blockifier/src/transaction/test_utils.rs | 8 ++---
.../src/transaction/transactions_test.rs | 26 +++++++-------
crates/mempool/src/mempool.rs | 4 +--
.../src/starknet_api_test_utils.rs | 2 +-
crates/native_blockifier/src/py_declare.rs | 4 +--
.../src/py_deploy_account.rs | 4 +--
.../src/py_invoke_function.rs | 4 +--
.../native_blockifier/src/py_transaction.rs | 4 ++-
crates/papyrus_common/src/transaction_hash.rs | 4 +--
.../src/converters/transaction.rs | 34 +++++++++----------
.../src/converters/transaction_test.rs | 19 ++++++-----
crates/papyrus_rpc/src/v0_6/transaction.rs | 6 ++--
crates/papyrus_rpc/src/v0_7/transaction.rs | 6 ++--
.../src/serialization/serializers.rs | 10 +++---
crates/papyrus_test_utils/src/lib.rs | 10 +++---
.../src/executable_transaction.rs | 4 +--
crates/starknet_api/src/rpc_transaction.rs | 6 ++--
crates/starknet_api/src/transaction.rs | 16 +++++----
crates/starknet_api/src/transaction_hash.rs | 4 +--
.../src/reader/objects/test_utils.rs | 8 ++---
.../src/reader/objects/transaction.rs | 8 ++---
.../src/writer/objects/transaction.rs | 8 ++---
36 files changed, 157 insertions(+), 144 deletions(-)
diff --git a/crates/blockifier/src/concurrency/fee_utils_test.rs b/crates/blockifier/src/concurrency/fee_utils_test.rs
index 8e7e15033e..dba9053156 100644
--- a/crates/blockifier/src/concurrency/fee_utils_test.rs
+++ b/crates/blockifier/src/concurrency/fee_utils_test.rs
@@ -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};
@@ -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);
diff --git a/crates/blockifier/src/concurrency/versioned_state_test.rs b/crates/blockifier/src/concurrency/versioned_state_test.rs
index a453153421..71a6c460e1 100644
--- a/crates/blockifier/src/concurrency/versioned_state_test.rs
+++ b/crates/blockifier/src/concurrency/versioned_state_test.rs
@@ -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};
@@ -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;
diff --git a/crates/blockifier/src/concurrency/worker_logic_test.rs b/crates/blockifier/src/concurrency/worker_logic_test.rs
index ec6b8a6575..0833734a66 100644
--- a/crates/blockifier/src/concurrency/worker_logic_test.rs
+++ b/crates/blockifier/src/concurrency/worker_logic_test.rs
@@ -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};
@@ -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);
@@ -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);
@@ -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,
) {
@@ -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);
diff --git a/crates/blockifier/src/execution/stack_trace_test.rs b/crates/blockifier/src/execution/stack_trace_test.rs
index 73f6c887be..414a3da5fa 100644
--- a/crates/blockifier/src/execution/stack_trace_test.rs
+++ b/crates/blockifier/src/execution/stack_trace_test.rs
@@ -5,8 +5,8 @@ use starknet_api::core::{calculate_contract_address, Nonce};
use starknet_api::transaction::{
Calldata,
ContractAddressSalt,
+ DeprecatedResourceBoundsMapping,
Fee,
- ResourceBoundsMapping,
TransactionSignature,
TransactionVersion,
};
@@ -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;
diff --git a/crates/blockifier/src/execution/syscalls/syscall_tests/get_execution_info.rs b/crates/blockifier/src/execution/syscalls/syscall_tests/get_execution_info.rs
index 02e4f37dc9..fb6f4d0c9d 100644
--- a/crates/blockifier/src/execution/syscalls/syscall_tests/get_execution_info.rs
+++ b/crates/blockifier/src/execution/syscalls/syscall_tests/get_execution_info.rs
@@ -8,11 +8,11 @@ use starknet_api::felt;
use starknet_api::transaction::{
AccountDeploymentData,
Calldata,
+ DeprecatedResourceBoundsMapping,
Fee,
PaymasterData,
Resource,
ResourceBounds,
- ResourceBoundsMapping,
Tip,
TransactionHash,
TransactionVersion,
@@ -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
diff --git a/crates/blockifier/src/fee/actual_cost_test.rs b/crates/blockifier/src/fee/actual_cost_test.rs
index acddd480c1..06cccec6a6 100644
--- a/crates/blockifier/src/fee/actual_cost_test.rs
+++ b/crates/blockifier/src/fee/actual_cost_test.rs
@@ -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;
@@ -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;
diff --git a/crates/blockifier/src/test_utils.rs b/crates/blockifier/src/test_utils.rs
index de9529449a..b2afd89626 100644
--- a/crates/blockifier/src/test_utils.rs
+++ b/crates/blockifier/src/test_utils.rs
@@ -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};
@@ -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.
diff --git a/crates/blockifier/src/test_utils/declare.rs b/crates/blockifier/src/test_utils/declare.rs
index 6973d18ca7..ab5470c130 100644
--- a/crates/blockifier/src/test_utils/declare.rs
+++ b/crates/blockifier/src/test_utils/declare.rs
@@ -5,9 +5,9 @@ use starknet_api::transaction::{
DeclareTransactionV0V1,
DeclareTransactionV2,
DeclareTransactionV3,
+ DeprecatedResourceBoundsMapping,
Fee,
PaymasterData,
- ResourceBoundsMapping,
Tip,
TransactionHash,
TransactionSignature,
@@ -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,
diff --git a/crates/blockifier/src/test_utils/deploy_account.rs b/crates/blockifier/src/test_utils/deploy_account.rs
index f3157add88..1ae7a58340 100644
--- a/crates/blockifier/src/test_utils/deploy_account.rs
+++ b/crates/blockifier/src/test_utils/deploy_account.rs
@@ -5,9 +5,9 @@ use starknet_api::transaction::{
ContractAddressSalt,
DeployAccountTransactionV1,
DeployAccountTransactionV3,
+ DeprecatedResourceBoundsMapping,
Fee,
PaymasterData,
- ResourceBoundsMapping,
Tip,
TransactionHash,
TransactionSignature,
@@ -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,
diff --git a/crates/blockifier/src/test_utils/invoke.rs b/crates/blockifier/src/test_utils/invoke.rs
index 42ae6ba854..b1e025bc0e 100644
--- a/crates/blockifier/src/test_utils/invoke.rs
+++ b/crates/blockifier/src/test_utils/invoke.rs
@@ -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,
@@ -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,
diff --git a/crates/blockifier/src/transaction/account_transactions_test.rs b/crates/blockifier/src/transaction/account_transactions_test.rs
index 4054c028d2..933c2bae65 100644
--- a/crates/blockifier/src/transaction/account_transactions_test.rs
+++ b/crates/blockifier/src/transaction/account_transactions_test.rs
@@ -12,8 +12,8 @@ use starknet_api::transaction::{
Calldata,
ContractAddressSalt,
DeclareTransactionV2,
+ DeprecatedResourceBoundsMapping,
Fee,
- ResourceBoundsMapping,
TransactionHash,
TransactionVersion,
};
@@ -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;
@@ -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;
@@ -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,
@@ -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 } =
@@ -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;
@@ -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 } =
@@ -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);
@@ -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,
@@ -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 } =
@@ -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 } =
@@ -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,
) {
@@ -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,
@@ -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
@@ -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();
diff --git a/crates/blockifier/src/transaction/execution_flavors_test.rs b/crates/blockifier/src/transaction/execution_flavors_test.rs
index a7537b49fe..608feac892 100644
--- a/crates/blockifier/src/transaction/execution_flavors_test.rs
+++ b/crates/blockifier/src/transaction/execution_flavors_test.rs
@@ -5,8 +5,8 @@ use starknet_api::core::ContractAddress;
use starknet_api::felt;
use starknet_api::transaction::{
Calldata,
+ DeprecatedResourceBoundsMapping,
Fee,
- ResourceBoundsMapping,
TransactionSignature,
TransactionVersion,
};
@@ -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);
@@ -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;
diff --git a/crates/blockifier/src/transaction/objects.rs b/crates/blockifier/src/transaction/objects.rs
index 43b601ca92..5b6a697211 100644
--- a/crates/blockifier/src/transaction/objects.rs
+++ b/crates/blockifier/src/transaction/objects.rs
@@ -8,11 +8,11 @@ use starknet_api::core::{ContractAddress, Nonce};
use starknet_api::data_availability::DataAvailabilityMode;
use starknet_api::transaction::{
AccountDeploymentData,
+ DeprecatedResourceBoundsMapping,
Fee,
PaymasterData,
Resource,
ResourceBounds,
- ResourceBoundsMapping,
Tip,
TransactionHash,
TransactionSignature,
@@ -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,
diff --git a/crates/blockifier/src/transaction/post_execution_test.rs b/crates/blockifier/src/transaction/post_execution_test.rs
index 08d00350aa..bb6dd8f43c 100644
--- a/crates/blockifier/src/transaction/post_execution_test.rs
+++ b/crates/blockifier/src/transaction/post_execution_test.rs
@@ -2,7 +2,12 @@ use assert_matches::assert_matches;
use rstest::rstest;
use starknet_api::core::{ContractAddress, PatriciaKey};
use starknet_api::state::StorageKey;
-use starknet_api::transaction::{Calldata, Fee, ResourceBoundsMapping, TransactionVersion};
+use starknet_api::transaction::{
+ Calldata,
+ DeprecatedResourceBoundsMapping,
+ Fee,
+ TransactionVersion,
+};
use starknet_api::{felt, patricia_key};
use starknet_types_core::felt::Felt;
@@ -67,7 +72,7 @@ fn calldata_for_write_and_transfer(
#[case(TransactionVersion::THREE, FeeType::Strk)]
fn test_revert_on_overdraft(
max_fee: Fee,
- max_resource_bounds: ResourceBoundsMapping,
+ max_resource_bounds: DeprecatedResourceBoundsMapping,
block_context: BlockContext,
#[case] version: TransactionVersion,
#[case] fee_type: FeeType,
@@ -212,7 +217,7 @@ fn test_revert_on_overdraft(
#[case(TransactionVersion::THREE, "Insufficient max L1 gas", true)]
fn test_revert_on_resource_overuse(
max_fee: Fee,
- max_resource_bounds: ResourceBoundsMapping,
+ max_resource_bounds: DeprecatedResourceBoundsMapping,
block_context: BlockContext,
#[case] version: TransactionVersion,
#[case] expected_error_prefix: &str,
diff --git a/crates/blockifier/src/transaction/test_utils.rs b/crates/blockifier/src/transaction/test_utils.rs
index 72d400157f..621a69052c 100644
--- a/crates/blockifier/src/transaction/test_utils.rs
+++ b/crates/blockifier/src/transaction/test_utils.rs
@@ -3,13 +3,13 @@ use starknet_api::core::{ClassHash, ContractAddress, Nonce};
use starknet_api::transaction::{
Calldata,
ContractAddressSalt,
+ DeprecatedResourceBoundsMapping,
Fee,
InvokeTransactionV0,
InvokeTransactionV1,
InvokeTransactionV3,
Resource,
ResourceBounds,
- ResourceBoundsMapping,
TransactionHash,
TransactionSignature,
TransactionVersion,
@@ -82,7 +82,7 @@ pub fn max_fee() -> Fee {
}
#[fixture]
-pub fn max_resource_bounds() -> ResourceBoundsMapping {
+pub fn max_resource_bounds() -> DeprecatedResourceBoundsMapping {
l1_resource_bounds(MAX_L1_GAS_AMOUNT, MAX_L1_GAS_PRICE)
}
@@ -291,8 +291,8 @@ pub fn run_invoke_tx(
/// Creates a `ResourceBoundsMapping` with the given `max_amount` and `max_price` for L1 gas limits.
/// No guarantees on the values of the other resources bounds.
-pub fn l1_resource_bounds(max_amount: u64, max_price: u128) -> ResourceBoundsMapping {
- ResourceBoundsMapping::try_from(vec![
+pub fn l1_resource_bounds(max_amount: u64, max_price: u128) -> DeprecatedResourceBoundsMapping {
+ DeprecatedResourceBoundsMapping::try_from(vec![
(Resource::L1Gas, ResourceBounds { max_amount, max_price_per_unit: max_price }),
(Resource::L2Gas, ResourceBounds { max_amount: 0, max_price_per_unit: 0 }),
])
diff --git a/crates/blockifier/src/transaction/transactions_test.rs b/crates/blockifier/src/transaction/transactions_test.rs
index d2cc57470a..4e61d1a94e 100644
--- a/crates/blockifier/src/transaction/transactions_test.rs
+++ b/crates/blockifier/src/transaction/transactions_test.rs
@@ -13,12 +13,12 @@ use starknet_api::deprecated_contract_class::EntryPointType;
use starknet_api::state::StorageKey;
use starknet_api::transaction::{
Calldata,
+ DeprecatedResourceBoundsMapping,
EventContent,
EventData,
EventKey,
Fee,
L2ToL1Payload,
- ResourceBoundsMapping,
TransactionSignature,
TransactionVersion,
};
@@ -382,7 +382,7 @@ fn add_kzg_da_resources_to_resources_mapping(
},
CairoVersion::Cairo1)]
fn test_invoke_tx(
- max_resource_bounds: ResourceBoundsMapping,
+ max_resource_bounds: DeprecatedResourceBoundsMapping,
#[case] expected_arguments: ExpectedResultTestInvokeTx,
#[case] account_cairo_version: CairoVersion,
#[values(false, true)] use_kzg_da: bool,
@@ -575,7 +575,7 @@ fn verify_storage_after_invoke_advanced_operations(
#[rstest]
fn test_invoke_tx_advanced_operations(
block_context: BlockContext,
- max_resource_bounds: ResourceBoundsMapping,
+ max_resource_bounds: DeprecatedResourceBoundsMapping,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] cairo_version: CairoVersion,
) {
let block_context = &block_context;
@@ -817,7 +817,7 @@ fn assert_failure_if_resource_bounds_exceed_balance(
#[rstest]
fn test_max_fee_exceeds_balance(
block_context: BlockContext,
- max_resource_bounds: ResourceBoundsMapping,
+ max_resource_bounds: DeprecatedResourceBoundsMapping,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] account_cairo_version: CairoVersion,
) {
let block_context = &block_context;
@@ -973,7 +973,7 @@ fn test_insufficient_resource_bounds(
#[rstest]
fn test_actual_fee_gt_resource_bounds(
block_context: BlockContext,
- max_resource_bounds: ResourceBoundsMapping,
+ max_resource_bounds: DeprecatedResourceBoundsMapping,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] account_cairo_version: CairoVersion,
) {
let block_context = &block_context;
@@ -1013,7 +1013,7 @@ fn test_actual_fee_gt_resource_bounds(
#[rstest]
fn test_invalid_nonce(
block_context: BlockContext,
- max_resource_bounds: ResourceBoundsMapping,
+ max_resource_bounds: DeprecatedResourceBoundsMapping,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] account_cairo_version: CairoVersion,
) {
let account_contract = FeatureContract::AccountWithoutValidations(account_cairo_version);
@@ -1133,7 +1133,7 @@ fn declare_expected_state_changes_count(version: TransactionVersion) -> StateCha
#[case(TransactionVersion::TWO, CairoVersion::Cairo1)]
#[case(TransactionVersion::THREE, CairoVersion::Cairo1)]
fn test_declare_tx(
- max_resource_bounds: ResourceBoundsMapping,
+ max_resource_bounds: DeprecatedResourceBoundsMapping,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] account_cairo_version: CairoVersion,
#[case] tx_version: TransactionVersion,
#[case] empty_contract_version: CairoVersion,
@@ -1286,7 +1286,7 @@ fn test_declare_tx(
fn test_deploy_account_tx(
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] cairo_version: CairoVersion,
#[values(false, true)] use_kzg_da: bool,
- max_resource_bounds: ResourceBoundsMapping,
+ max_resource_bounds: DeprecatedResourceBoundsMapping,
) {
let block_context = &BlockContext::create_for_account_testing_with_kzg(use_kzg_da);
let versioned_constants = &block_context.versioned_constants;
@@ -1453,7 +1453,7 @@ fn test_deploy_account_tx(
#[rstest]
fn test_fail_deploy_account_undeclared_class_hash(
block_context: BlockContext,
- max_resource_bounds: ResourceBoundsMapping,
+ max_resource_bounds: DeprecatedResourceBoundsMapping,
) {
let block_context = &block_context;
let chain_info = &block_context.chain_info;
@@ -1684,7 +1684,7 @@ fn test_validate_accounts_tx(
#[rstest]
fn test_valid_flag(
block_context: BlockContext,
- max_resource_bounds: ResourceBoundsMapping,
+ max_resource_bounds: DeprecatedResourceBoundsMapping,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] account_cairo_version: CairoVersion,
#[values(CairoVersion::Cairo0, CairoVersion::Cairo1)] test_contract_cairo_version: CairoVersion,
) {
@@ -1712,7 +1712,7 @@ fn test_valid_flag(
#[rstest]
fn test_only_query_flag(
block_context: BlockContext,
- max_resource_bounds: ResourceBoundsMapping,
+ max_resource_bounds: DeprecatedResourceBoundsMapping,
#[values(true, false)] only_query: bool,
) {
let account_balance = BALANCE;
@@ -1954,7 +1954,7 @@ fn test_l1_handler(#[values(false, true)] use_kzg_da: bool) {
#[rstest]
fn test_execute_tx_with_invalid_transaction_version(
block_context: BlockContext,
- max_resource_bounds: ResourceBoundsMapping,
+ max_resource_bounds: DeprecatedResourceBoundsMapping,
) {
let cairo_version = CairoVersion::Cairo0;
let account = FeatureContract::AccountWithoutValidations(cairo_version);
@@ -2027,7 +2027,7 @@ fn max_event_data() -> usize {
}))]
fn test_emit_event_exceeds_limit(
block_context: BlockContext,
- max_resource_bounds: ResourceBoundsMapping,
+ max_resource_bounds: DeprecatedResourceBoundsMapping,
#[case] event_keys: Vec,
#[case] event_data: Vec,
#[case] n_emitted_events: usize,
diff --git a/crates/mempool/src/mempool.rs b/crates/mempool/src/mempool.rs
index 38ed52e26f..9d600ebba8 100644
--- a/crates/mempool/src/mempool.rs
+++ b/crates/mempool/src/mempool.rs
@@ -2,7 +2,7 @@ use std::collections::HashMap;
use starknet_api::core::{ContractAddress, Nonce};
use starknet_api::executable_transaction::Transaction;
-use starknet_api::transaction::{Resource, ResourceBoundsMapping, Tip, TransactionHash};
+use starknet_api::transaction::{DeprecatedResourceBoundsMapping, Resource, Tip, TransactionHash};
use starknet_mempool_types::errors::MempoolError;
use starknet_mempool_types::mempool_types::{Account, AccountState, MempoolInput, MempoolResult};
@@ -200,7 +200,7 @@ pub struct TransactionReference {
pub nonce: Nonce,
pub tx_hash: TransactionHash,
pub tip: Tip,
- pub resource_bounds: ResourceBoundsMapping,
+ pub resource_bounds: DeprecatedResourceBoundsMapping,
}
impl TransactionReference {
diff --git a/crates/mempool_test_utils/src/starknet_api_test_utils.rs b/crates/mempool_test_utils/src/starknet_api_test_utils.rs
index bdebfec378..58dc3fb12e 100644
--- a/crates/mempool_test_utils/src/starknet_api_test_utils.rs
+++ b/crates/mempool_test_utils/src/starknet_api_test_utils.rs
@@ -23,9 +23,9 @@ use starknet_api::transaction::{
AccountDeploymentData,
Calldata,
ContractAddressSalt,
+ DeprecatedResourceBoundsMapping as ExecutableResourceBoundsMapping,
PaymasterData,
ResourceBounds,
- ResourceBoundsMapping as ExecutableResourceBoundsMapping,
Tip,
TransactionHash,
TransactionSignature,
diff --git a/crates/native_blockifier/src/py_declare.rs b/crates/native_blockifier/src/py_declare.rs
index eb0988a3c8..9e01caaaaf 100644
--- a/crates/native_blockifier/src/py_declare.rs
+++ b/crates/native_blockifier/src/py_declare.rs
@@ -10,9 +10,9 @@ use starknet_api::transaction::{
DeclareTransactionV0V1,
DeclareTransactionV2,
DeclareTransactionV3,
+ DeprecatedResourceBoundsMapping,
Fee,
PaymasterData,
- ResourceBoundsMapping,
Tip,
TransactionHash,
TransactionSignature,
@@ -88,7 +88,7 @@ impl TryFrom for DeclareTransactionV3 {
type Error = NativeBlockifierInputError;
fn try_from(tx: PyDeclareTransactionV3) -> Result {
Ok(Self {
- resource_bounds: ResourceBoundsMapping::try_from(tx.resource_bounds)?,
+ resource_bounds: DeprecatedResourceBoundsMapping::try_from(tx.resource_bounds)?,
tip: Tip(tx.tip),
signature: TransactionSignature(from_py_felts(tx.signature)),
nonce: Nonce(tx.nonce.0),
diff --git a/crates/native_blockifier/src/py_deploy_account.rs b/crates/native_blockifier/src/py_deploy_account.rs
index 2b2833472a..a5671842a0 100644
--- a/crates/native_blockifier/src/py_deploy_account.rs
+++ b/crates/native_blockifier/src/py_deploy_account.rs
@@ -10,9 +10,9 @@ use starknet_api::transaction::{
ContractAddressSalt,
DeployAccountTransactionV1,
DeployAccountTransactionV3,
+ DeprecatedResourceBoundsMapping,
Fee,
PaymasterData,
- ResourceBoundsMapping,
Tip,
TransactionHash,
TransactionSignature,
@@ -64,7 +64,7 @@ impl TryFrom for DeployAccountTransactionV3 {
type Error = NativeBlockifierInputError;
fn try_from(tx: PyDeployAccountTransactionV3) -> Result {
Ok(Self {
- resource_bounds: ResourceBoundsMapping::try_from(tx.resource_bounds)?,
+ resource_bounds: DeprecatedResourceBoundsMapping::try_from(tx.resource_bounds)?,
tip: Tip(tx.tip),
signature: TransactionSignature(from_py_felts(tx.signature)),
nonce: Nonce(tx.nonce.0),
diff --git a/crates/native_blockifier/src/py_invoke_function.rs b/crates/native_blockifier/src/py_invoke_function.rs
index 9735435394..64f7559917 100644
--- a/crates/native_blockifier/src/py_invoke_function.rs
+++ b/crates/native_blockifier/src/py_invoke_function.rs
@@ -9,12 +9,12 @@ use starknet_api::data_availability::DataAvailabilityMode;
use starknet_api::transaction::{
AccountDeploymentData,
Calldata,
+ DeprecatedResourceBoundsMapping,
Fee,
InvokeTransactionV0,
InvokeTransactionV1,
InvokeTransactionV3,
PaymasterData,
- ResourceBoundsMapping,
Tip,
TransactionHash,
TransactionSignature,
@@ -87,7 +87,7 @@ impl TryFrom for InvokeTransactionV3 {
type Error = NativeBlockifierInputError;
fn try_from(tx: PyInvokeTransactionV3) -> Result {
Ok(Self {
- resource_bounds: ResourceBoundsMapping::try_from(tx.resource_bounds)?,
+ resource_bounds: DeprecatedResourceBoundsMapping::try_from(tx.resource_bounds)?,
tip: Tip(tx.tip),
signature: TransactionSignature(from_py_felts(tx.signature)),
nonce: Nonce(tx.nonce.0),
diff --git a/crates/native_blockifier/src/py_transaction.rs b/crates/native_blockifier/src/py_transaction.rs
index 7b84d89d71..443ed57c90 100644
--- a/crates/native_blockifier/src/py_transaction.rs
+++ b/crates/native_blockifier/src/py_transaction.rs
@@ -68,7 +68,9 @@ impl From for starknet_api::transaction::ResourceBounds {
#[derive(Clone, FromPyObject)]
pub struct PyResourceBoundsMapping(pub BTreeMap);
-impl TryFrom for starknet_api::transaction::ResourceBoundsMapping {
+impl TryFrom
+ for starknet_api::transaction::DeprecatedResourceBoundsMapping
+{
type Error = StarknetApiError;
fn try_from(py_resource_bounds_mapping: PyResourceBoundsMapping) -> Result {
let resource_bounds_vec: Vec<(Resource, ResourceBounds)> = py_resource_bounds_mapping
diff --git a/crates/papyrus_common/src/transaction_hash.rs b/crates/papyrus_common/src/transaction_hash.rs
index 6aa13d88da..6b4da55441 100644
--- a/crates/papyrus_common/src/transaction_hash.rs
+++ b/crates/papyrus_common/src/transaction_hash.rs
@@ -16,6 +16,7 @@ use starknet_api::transaction::{
DeployAccountTransactionV1,
DeployAccountTransactionV3,
DeployTransaction,
+ DeprecatedResourceBoundsMapping,
InvokeTransaction,
InvokeTransactionV0,
InvokeTransactionV1,
@@ -23,7 +24,6 @@ use starknet_api::transaction::{
L1HandlerTransaction,
Resource,
ResourceBounds,
- ResourceBoundsMapping,
Tip,
Transaction,
TransactionHash,
@@ -220,7 +220,7 @@ pub(crate) fn ascii_as_felt(ascii_str: &str) -> Result {
// An implementation of the SNIP: https://github.com/EvyatarO/SNIPs/blob/snip-8/SNIPS/snip-8.md
fn get_tip_resource_bounds_hash(
- resource_bounds_mapping: &ResourceBoundsMapping,
+ resource_bounds_mapping: &DeprecatedResourceBoundsMapping,
tip: &Tip,
) -> Result {
let l1_resource_bounds =
diff --git a/crates/papyrus_protobuf/src/converters/transaction.rs b/crates/papyrus_protobuf/src/converters/transaction.rs
index 0e30dee01b..a929942c1a 100644
--- a/crates/papyrus_protobuf/src/converters/transaction.rs
+++ b/crates/papyrus_protobuf/src/converters/transaction.rs
@@ -17,6 +17,7 @@ use starknet_api::transaction::{
DeployAccountTransactionV1,
DeployAccountTransactionV3,
DeployTransaction,
+ DeprecatedResourceBoundsMapping,
Fee,
FullTransaction,
InvokeTransaction,
@@ -27,7 +28,6 @@ use starknet_api::transaction::{
PaymasterData,
Resource,
ResourceBounds,
- ResourceBoundsMapping,
Tip,
Transaction,
TransactionHash,
@@ -440,11 +440,11 @@ impl From for protobuf::transaction::DeployAccountV1
impl TryFrom for DeployAccountTransactionV3 {
type Error = ProtobufConversionError;
fn try_from(value: protobuf::transaction::DeployAccountV3) -> Result {
- let resource_bounds = ResourceBoundsMapping::try_from(value.resource_bounds.ok_or(
- ProtobufConversionError::MissingField {
+ let resource_bounds = DeprecatedResourceBoundsMapping::try_from(
+ value.resource_bounds.ok_or(ProtobufConversionError::MissingField {
field_description: "DeployAccountV3::resource_bounds",
- },
- )?)?;
+ })?,
+ )?;
let tip = Tip(value.tip);
@@ -550,10 +550,10 @@ impl From for protobuf::transaction::DeployAccountV3
}
}
-impl TryFrom for ResourceBoundsMapping {
+impl TryFrom for DeprecatedResourceBoundsMapping {
type Error = ProtobufConversionError;
fn try_from(value: protobuf::ResourceBounds) -> Result {
- let mut resource_bounds = ResourceBoundsMapping::default();
+ let mut resource_bounds = DeprecatedResourceBoundsMapping::default();
let Some(l1_gas) = value.l1_gas else {
return Err(ProtobufConversionError::MissingField {
field_description: "ResourceBounds::l1_gas",
@@ -601,8 +601,8 @@ impl TryFrom for ResourceBoundsMapping {
}
}
-impl From for protobuf::ResourceBounds {
- fn from(value: ResourceBoundsMapping) -> Self {
+impl From for protobuf::ResourceBounds {
+ fn from(value: DeprecatedResourceBoundsMapping) -> Self {
let mut res = protobuf::ResourceBounds::default();
let resource_bounds_default = ResourceBounds::default();
@@ -756,11 +756,11 @@ impl From for protobuf::transaction::InvokeV1 {
impl TryFrom for InvokeTransactionV3 {
type Error = ProtobufConversionError;
fn try_from(value: protobuf::transaction::InvokeV3) -> Result {
- let resource_bounds = ResourceBoundsMapping::try_from(value.resource_bounds.ok_or(
- ProtobufConversionError::MissingField {
+ let resource_bounds = DeprecatedResourceBoundsMapping::try_from(
+ value.resource_bounds.ok_or(ProtobufConversionError::MissingField {
field_description: "InvokeV3::resource_bounds",
- },
- )?)?;
+ })?,
+ )?;
let tip = Tip(value.tip);
@@ -1074,11 +1074,11 @@ impl From for protobuf::transaction::DeclareV2 {
impl TryFrom for DeclareTransactionV3 {
type Error = ProtobufConversionError;
fn try_from(value: protobuf::transaction::DeclareV3) -> Result {
- let resource_bounds = ResourceBoundsMapping::try_from(value.resource_bounds.ok_or(
- ProtobufConversionError::MissingField {
+ let resource_bounds = DeprecatedResourceBoundsMapping::try_from(
+ value.resource_bounds.ok_or(ProtobufConversionError::MissingField {
field_description: "DeclareV3::resource_bounds",
- },
- )?)?;
+ })?,
+ )?;
let tip = Tip(value.tip);
diff --git a/crates/papyrus_protobuf/src/converters/transaction_test.rs b/crates/papyrus_protobuf/src/converters/transaction_test.rs
index ceab228afd..82387f1539 100644
--- a/crates/papyrus_protobuf/src/converters/transaction_test.rs
+++ b/crates/papyrus_protobuf/src/converters/transaction_test.rs
@@ -8,13 +8,13 @@ use starknet_api::transaction::{
DeployAccountTransaction,
DeployAccountTransactionOutput,
DeployTransactionOutput,
+ DeprecatedResourceBoundsMapping,
FullTransaction,
InvokeTransaction,
InvokeTransactionOutput,
L1HandlerTransactionOutput,
Resource,
ResourceBounds,
- ResourceBoundsMapping,
Transaction as StarknetApiTransaction,
TransactionHash,
TransactionOutput,
@@ -196,12 +196,13 @@ lazy_static! {
da_gas_consumed: GasVector::default(),
gas_consumed: GasVector::default(),
};
- static ref RESOURCE_BOUNDS_MAPPING: ResourceBoundsMapping = ResourceBoundsMapping(
- [
- (Resource::L1Gas, ResourceBounds { max_amount: 0x5, max_price_per_unit: 0x6 }),
- (Resource::L2Gas, ResourceBounds { max_amount: 0x5, max_price_per_unit: 0x6 }),
- ]
- .into_iter()
- .collect(),
- );
+ static ref RESOURCE_BOUNDS_MAPPING: DeprecatedResourceBoundsMapping =
+ DeprecatedResourceBoundsMapping(
+ [
+ (Resource::L1Gas, ResourceBounds { max_amount: 0x5, max_price_per_unit: 0x6 }),
+ (Resource::L2Gas, ResourceBounds { max_amount: 0x5, max_price_per_unit: 0x6 }),
+ ]
+ .into_iter()
+ .collect(),
+ );
}
diff --git a/crates/papyrus_rpc/src/v0_6/transaction.rs b/crates/papyrus_rpc/src/v0_6/transaction.rs
index 4a91dba054..9bed607338 100644
--- a/crates/papyrus_rpc/src/v0_6/transaction.rs
+++ b/crates/papyrus_rpc/src/v0_6/transaction.rs
@@ -151,14 +151,14 @@ pub struct ResourceBoundsMapping {
pub l2_gas: ResourceBounds,
}
-impl From for starknet_api::transaction::ResourceBoundsMapping {
+impl From for starknet_api::transaction::DeprecatedResourceBoundsMapping {
fn from(value: ResourceBoundsMapping) -> Self {
Self([(Resource::L1Gas, value.l1_gas), (Resource::L2Gas, value.l2_gas)].into())
}
}
-impl From for ResourceBoundsMapping {
- fn from(value: starknet_api::transaction::ResourceBoundsMapping) -> Self {
+impl From for ResourceBoundsMapping {
+ fn from(value: starknet_api::transaction::DeprecatedResourceBoundsMapping) -> Self {
Self {
l1_gas: value.0.get(&Resource::L1Gas).cloned().unwrap_or_default(),
l2_gas: value.0.get(&Resource::L2Gas).cloned().unwrap_or_default(),
diff --git a/crates/papyrus_rpc/src/v0_7/transaction.rs b/crates/papyrus_rpc/src/v0_7/transaction.rs
index b57d3c6097..8f4596b664 100644
--- a/crates/papyrus_rpc/src/v0_7/transaction.rs
+++ b/crates/papyrus_rpc/src/v0_7/transaction.rs
@@ -154,14 +154,14 @@ pub struct ResourceBoundsMapping {
pub l2_gas: ResourceBounds,
}
-impl From for starknet_api::transaction::ResourceBoundsMapping {
+impl From for starknet_api::transaction::DeprecatedResourceBoundsMapping {
fn from(value: ResourceBoundsMapping) -> Self {
Self([(Resource::L1Gas, value.l1_gas), (Resource::L2Gas, value.l2_gas)].into())
}
}
-impl From for ResourceBoundsMapping {
- fn from(value: starknet_api::transaction::ResourceBoundsMapping) -> Self {
+impl From for ResourceBoundsMapping {
+ fn from(value: starknet_api::transaction::DeprecatedResourceBoundsMapping) -> Self {
Self {
l1_gas: value.0.get(&Resource::L1Gas).cloned().unwrap_or_default(),
l2_gas: value.0.get(&Resource::L2Gas).cloned().unwrap_or_default(),
diff --git a/crates/papyrus_storage/src/serialization/serializers.rs b/crates/papyrus_storage/src/serialization/serializers.rs
index 95923339d9..2b19e9b01b 100644
--- a/crates/papyrus_storage/src/serialization/serializers.rs
+++ b/crates/papyrus_storage/src/serialization/serializers.rs
@@ -89,6 +89,7 @@ use starknet_api::transaction::{
DeployAccountTransactionV3,
DeployTransaction,
DeployTransactionOutput,
+ DeprecatedResourceBoundsMapping,
Event,
EventContent,
EventData,
@@ -109,7 +110,6 @@ use starknet_api::transaction::{
PaymasterData,
Resource,
ResourceBounds,
- ResourceBoundsMapping,
RevertedTransactionExecutionStatus,
Tip,
Transaction,
@@ -211,7 +211,7 @@ auto_storage_serde! {
pub sender_address: ContractAddress,
}
pub struct DeclareTransactionV3 {
- pub resource_bounds: ResourceBoundsMapping,
+ pub resource_bounds: DeprecatedResourceBoundsMapping,
pub tip: Tip,
pub signature: TransactionSignature,
pub nonce: Nonce,
@@ -361,7 +361,7 @@ auto_storage_serde! {
pub max_amount: u64,
pub max_price_per_unit: u128,
}
- pub struct ResourceBoundsMapping(pub BTreeMap);
+ pub struct DeprecatedResourceBoundsMapping(pub BTreeMap);
pub struct SequencerContractAddress(pub ContractAddress);
pub struct Signature {
pub r: Felt,
@@ -1162,7 +1162,7 @@ auto_storage_serde_conditionally_compressed! {
}
pub struct DeployAccountTransactionV3 {
- pub resource_bounds: ResourceBoundsMapping,
+ pub resource_bounds: DeprecatedResourceBoundsMapping,
pub tip: Tip,
pub signature: TransactionSignature,
pub nonce: Nonce,
@@ -1198,7 +1198,7 @@ auto_storage_serde_conditionally_compressed! {
}
pub struct InvokeTransactionV3 {
- pub resource_bounds: ResourceBoundsMapping,
+ pub resource_bounds: DeprecatedResourceBoundsMapping,
pub tip: Tip,
pub signature: TransactionSignature,
pub nonce: Nonce,
diff --git a/crates/papyrus_test_utils/src/lib.rs b/crates/papyrus_test_utils/src/lib.rs
index c552cc35f1..20c39d27ee 100644
--- a/crates/papyrus_test_utils/src/lib.rs
+++ b/crates/papyrus_test_utils/src/lib.rs
@@ -112,6 +112,7 @@ use starknet_api::transaction::{
DeployAccountTransactionV3,
DeployTransaction,
DeployTransactionOutput,
+ DeprecatedResourceBoundsMapping,
Event,
EventContent,
EventData,
@@ -132,7 +133,6 @@ use starknet_api::transaction::{
PaymasterData,
Resource,
ResourceBounds,
- ResourceBoundsMapping,
RevertedTransactionExecutionStatus,
Tip,
Transaction,
@@ -517,7 +517,7 @@ auto_impl_get_test_instance! {
pub sender_address: ContractAddress,
}
pub struct DeclareTransactionV3 {
- pub resource_bounds: ResourceBoundsMapping,
+ pub resource_bounds: DeprecatedResourceBoundsMapping,
pub tip: Tip,
pub signature: TransactionSignature,
pub nonce: Nonce,
@@ -550,7 +550,7 @@ auto_impl_get_test_instance! {
pub constructor_calldata: Calldata,
}
pub struct DeployAccountTransactionV3 {
- pub resource_bounds: ResourceBoundsMapping,
+ pub resource_bounds: DeprecatedResourceBoundsMapping,
pub tip: Tip,
pub signature: TransactionSignature,
pub nonce: Nonce,
@@ -657,7 +657,7 @@ auto_impl_get_test_instance! {
pub calldata: Calldata,
}
pub struct InvokeTransactionV3 {
- pub resource_bounds: ResourceBoundsMapping,
+ pub resource_bounds: DeprecatedResourceBoundsMapping,
pub tip: Tip,
pub signature: TransactionSignature,
pub nonce: Nonce,
@@ -722,7 +722,7 @@ auto_impl_get_test_instance! {
pub max_amount: u64,
pub max_price_per_unit: u128,
}
- pub struct ResourceBoundsMapping(pub BTreeMap);
+ pub struct DeprecatedResourceBoundsMapping(pub BTreeMap);
pub struct SequencerContractAddress(pub ContractAddress);
pub struct Signature {
pub r: Felt,
diff --git a/crates/starknet_api/src/executable_transaction.rs b/crates/starknet_api/src/executable_transaction.rs
index ae0e219d54..6a2246f7d8 100644
--- a/crates/starknet_api/src/executable_transaction.rs
+++ b/crates/starknet_api/src/executable_transaction.rs
@@ -8,8 +8,8 @@ use crate::transaction::{
AccountDeploymentData,
Calldata,
ContractAddressSalt,
+ DeprecatedResourceBoundsMapping,
PaymasterData,
- ResourceBoundsMapping,
Tip,
TransactionHash,
TransactionSignature,
@@ -83,7 +83,7 @@ impl Transaction {
}
}
- pub fn resource_bounds(&self) -> Option<&ResourceBoundsMapping> {
+ pub fn resource_bounds(&self) -> Option<&DeprecatedResourceBoundsMapping> {
match self {
Transaction::Declare(declare_tx) => match &declare_tx.tx {
crate::transaction::DeclareTransaction::V3(tx_v3) => Some(&tx_v3.resource_bounds),
diff --git a/crates/starknet_api/src/rpc_transaction.rs b/crates/starknet_api/src/rpc_transaction.rs
index b5a34a5e60..2c402c2d9b 100644
--- a/crates/starknet_api/src/rpc_transaction.rs
+++ b/crates/starknet_api/src/rpc_transaction.rs
@@ -199,10 +199,10 @@ pub struct ResourceBoundsMapping {
pub l2_gas: ResourceBounds,
}
-impl From for crate::transaction::ResourceBoundsMapping {
- fn from(mapping: ResourceBoundsMapping) -> crate::transaction::ResourceBoundsMapping {
+impl From for crate::transaction::DeprecatedResourceBoundsMapping {
+ fn from(mapping: ResourceBoundsMapping) -> crate::transaction::DeprecatedResourceBoundsMapping {
let map =
BTreeMap::from([(Resource::L1Gas, mapping.l1_gas), (Resource::L2Gas, mapping.l2_gas)]);
- crate::transaction::ResourceBoundsMapping(map)
+ crate::transaction::DeprecatedResourceBoundsMapping(map)
}
}
diff --git a/crates/starknet_api/src/transaction.rs b/crates/starknet_api/src/transaction.rs
index fc8fe2e570..5aa8cdcb08 100644
--- a/crates/starknet_api/src/transaction.rs
+++ b/crates/starknet_api/src/transaction.rs
@@ -216,7 +216,7 @@ impl TransactionHasher for DeclareTransactionV2 {
/// A declare V3 transaction.
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct DeclareTransactionV3 {
- pub resource_bounds: ResourceBoundsMapping,
+ pub resource_bounds: DeprecatedResourceBoundsMapping,
pub tip: Tip,
pub signature: TransactionSignature,
pub nonce: Nonce,
@@ -325,7 +325,7 @@ impl TransactionHasher for DeployAccountTransactionV1 {
/// A deploy account V3 transaction.
#[derive(Debug, Clone, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord)]
pub struct DeployAccountTransactionV3 {
- pub resource_bounds: ResourceBoundsMapping,
+ pub resource_bounds: DeprecatedResourceBoundsMapping,
pub tip: Tip,
pub signature: TransactionSignature,
pub nonce: Nonce,
@@ -462,7 +462,7 @@ impl TransactionHasher for InvokeTransactionV1 {
/// An invoke V3 transaction.
#[derive(Debug, Clone, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord)]
pub struct InvokeTransactionV3 {
- pub resource_bounds: ResourceBoundsMapping,
+ pub resource_bounds: DeprecatedResourceBoundsMapping,
pub tip: Tip,
pub signature: TransactionSignature,
pub nonce: Nonce,
@@ -933,9 +933,9 @@ where
/// A mapping from execution resources to their corresponding fee bounds..
#[derive(Clone, Debug, Default, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
// TODO(Nimrod): Remove this struct definition.
-pub struct ResourceBoundsMapping(pub BTreeMap);
+pub struct DeprecatedResourceBoundsMapping(pub BTreeMap);
-impl TryFrom> for ResourceBoundsMapping {
+impl TryFrom> for DeprecatedResourceBoundsMapping {
type Error = StarknetApiError;
fn try_from(
resource_resource_bounds_pairs: Vec<(Resource, ResourceBounds)>,
@@ -980,9 +980,11 @@ impl AllResourceBounds {
}
}
-impl TryFrom for ValidResourceBounds {
+impl TryFrom for ValidResourceBounds {
type Error = StarknetApiError;
- fn try_from(resource_bounds_mapping: ResourceBoundsMapping) -> Result {
+ fn try_from(
+ resource_bounds_mapping: DeprecatedResourceBoundsMapping,
+ ) -> Result {
if let (Some(l1_bounds), Some(l2_bounds)) = (
resource_bounds_mapping.0.get(&Resource::L1Gas),
resource_bounds_mapping.0.get(&Resource::L2Gas),
diff --git a/crates/starknet_api/src/transaction_hash.rs b/crates/starknet_api/src/transaction_hash.rs
index b769d64072..cb01a4c451 100644
--- a/crates/starknet_api/src/transaction_hash.rs
+++ b/crates/starknet_api/src/transaction_hash.rs
@@ -15,6 +15,7 @@ use crate::transaction::{
DeployAccountTransactionV1,
DeployAccountTransactionV3,
DeployTransaction,
+ DeprecatedResourceBoundsMapping,
InvokeTransaction,
InvokeTransactionV0,
InvokeTransactionV1,
@@ -22,7 +23,6 @@ use crate::transaction::{
L1HandlerTransaction,
Resource,
ResourceBounds,
- ResourceBoundsMapping,
Tip,
Transaction,
TransactionHash,
@@ -176,7 +176,7 @@ pub(crate) fn ascii_as_felt(ascii_str: &str) -> Result {
// An implementation of the SNIP: https://github.com/EvyatarO/SNIPs/blob/snip-8/SNIPS/snip-8.md
fn get_tip_resource_bounds_hash(
- resource_bounds_mapping: &ResourceBoundsMapping,
+ resource_bounds_mapping: &DeprecatedResourceBoundsMapping,
tip: &Tip,
) -> Result {
let l1_resource_bounds =
diff --git a/crates/starknet_client/src/reader/objects/test_utils.rs b/crates/starknet_client/src/reader/objects/test_utils.rs
index 942bf7b7dc..3876eeb723 100644
--- a/crates/starknet_client/src/reader/objects/test_utils.rs
+++ b/crates/starknet_client/src/reader/objects/test_utils.rs
@@ -16,12 +16,12 @@ use starknet_api::transaction::{
AccountDeploymentData,
Calldata,
ContractAddressSalt,
+ DeprecatedResourceBoundsMapping,
Event,
Fee,
L1ToL2Payload,
L2ToL1Payload,
PaymasterData,
- ResourceBoundsMapping,
Tip,
TransactionHash,
TransactionOffsetInBlock,
@@ -60,7 +60,7 @@ auto_impl_get_test_instance! {
Reserved = 0,
}
pub struct IntermediateDeclareTransaction {
- pub resource_bounds: Option,
+ pub resource_bounds: Option,
pub tip: Option,
pub signature: TransactionSignature,
pub nonce: Nonce,
@@ -76,7 +76,7 @@ auto_impl_get_test_instance! {
pub transaction_hash: TransactionHash,
}
pub struct IntermediateDeployAccountTransaction {
- pub resource_bounds: Option,
+ pub resource_bounds: Option,
pub tip: Option,
pub signature: TransactionSignature,
pub nonce: Nonce,
@@ -100,7 +100,7 @@ auto_impl_get_test_instance! {
pub version: TransactionVersion,
}
pub struct IntermediateInvokeTransaction {
- pub resource_bounds: Option,
+ pub resource_bounds: Option,
pub tip: Option,
pub calldata: Calldata,
pub sender_address: ContractAddress,
diff --git a/crates/starknet_client/src/reader/objects/transaction.rs b/crates/starknet_client/src/reader/objects/transaction.rs
index be699ba19e..839ce41a74 100644
--- a/crates/starknet_client/src/reader/objects/transaction.rs
+++ b/crates/starknet_client/src/reader/objects/transaction.rs
@@ -23,6 +23,7 @@ use starknet_api::transaction::{
DeclareTransactionOutput,
DeployAccountTransactionOutput,
DeployTransactionOutput,
+ DeprecatedResourceBoundsMapping,
Event,
Fee,
InvokeTransactionOutput,
@@ -31,7 +32,6 @@ use starknet_api::transaction::{
L2ToL1Payload,
MessageToL1,
PaymasterData,
- ResourceBoundsMapping,
RevertedTransactionExecutionStatus as SnApiRevertedTransactionExecutionStatus,
Tip,
TransactionExecutionStatus as SnApiTransactionExecutionStatus,
@@ -178,7 +178,7 @@ impl From for starknet_api::data_availability::Dat
#[serde(deny_unknown_fields)]
pub struct IntermediateDeclareTransaction {
#[serde(skip_serializing_if = "Option::is_none")]
- pub resource_bounds: Option,
+ pub resource_bounds: Option,
#[serde(skip_serializing_if = "Option::is_none")]
pub tip: Option,
pub signature: TransactionSignature,
@@ -347,7 +347,7 @@ impl From for starknet_api::transaction::DeployTransaction {
#[serde(deny_unknown_fields)]
pub struct IntermediateDeployAccountTransaction {
#[serde(skip_serializing_if = "Option::is_none")]
- pub resource_bounds: Option,
+ pub resource_bounds: Option,
#[serde(skip_serializing_if = "Option::is_none")]
pub tip: Option,
pub signature: TransactionSignature,
@@ -470,7 +470,7 @@ impl TryFrom
#[serde(deny_unknown_fields)]
pub struct IntermediateInvokeTransaction {
#[serde(skip_serializing_if = "Option::is_none")]
- pub resource_bounds: Option,
+ pub resource_bounds: Option,
#[serde(skip_serializing_if = "Option::is_none")]
pub tip: Option,
pub calldata: Calldata,
diff --git a/crates/starknet_client/src/writer/objects/transaction.rs b/crates/starknet_client/src/writer/objects/transaction.rs
index 94b47ab274..50adae8afd 100644
--- a/crates/starknet_client/src/writer/objects/transaction.rs
+++ b/crates/starknet_client/src/writer/objects/transaction.rs
@@ -31,9 +31,9 @@ use starknet_api::transaction::{
AccountDeploymentData,
Calldata,
ContractAddressSalt,
+ DeprecatedResourceBoundsMapping,
Fee,
PaymasterData,
- ResourceBoundsMapping,
Tip,
TransactionSignature,
TransactionVersion,
@@ -104,7 +104,7 @@ pub struct DeployAccountV1Transaction {
#[derive(Debug, Deserialize, Serialize, Clone, Eq, PartialEq)]
#[serde(deny_unknown_fields)]
pub struct DeployAccountV3Transaction {
- pub resource_bounds: ResourceBoundsMapping,
+ pub resource_bounds: DeprecatedResourceBoundsMapping,
pub tip: Tip,
pub contract_address_salt: ContractAddressSalt,
pub class_hash: ClassHash,
@@ -169,7 +169,7 @@ pub struct InvokeV1Transaction {
#[derive(Debug, Deserialize, Serialize, Clone, Eq, PartialEq)]
#[serde(deny_unknown_fields)]
pub struct InvokeV3Transaction {
- pub resource_bounds: ResourceBoundsMapping,
+ pub resource_bounds: DeprecatedResourceBoundsMapping,
pub tip: Tip,
pub calldata: Calldata,
pub sender_address: ContractAddress,
@@ -235,7 +235,7 @@ pub struct DeclareV2Transaction {
#[serde(deny_unknown_fields)]
pub struct DeclareV3Transaction {
pub contract_class: ContractClass,
- pub resource_bounds: ResourceBoundsMapping,
+ pub resource_bounds: DeprecatedResourceBoundsMapping,
pub tip: Tip,
pub signature: TransactionSignature,
pub nonce: Nonce,