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 79cac9ee12..9a85630108 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..8107c3ad78 100644 --- a/crates/blockifier/src/concurrency/worker_logic_test.rs +++ b/crates/blockifier/src/concurrency/worker_logic_test.rs @@ -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}; @@ -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 6aa7523507..faf2303568 100644 --- a/crates/blockifier/src/execution/stack_trace_test.rs +++ b/crates/blockifier/src/execution/stack_trace_test.rs @@ -6,7 +6,7 @@ use starknet_api::transaction::{ Calldata, ContractAddressSalt, Fee, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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..33b2932e0d 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 @@ -12,7 +12,7 @@ use starknet_api::transaction::{ PaymasterData, Resource, ResourceBounds, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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..bb9b513322 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::{L2ToL1Payload, DeprecatedResourceBoundsMapping}; 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..beb25ae789 100644 --- a/crates/blockifier/src/test_utils.rs +++ b/crates/blockifier/src/test_utils.rs @@ -20,7 +20,7 @@ use starknet_api::transaction::{ ContractAddressSalt, Resource, ResourceBounds, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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..5a70d80884 100644 --- a/crates/blockifier/src/test_utils/declare.rs +++ b/crates/blockifier/src/test_utils/declare.rs @@ -7,7 +7,7 @@ use starknet_api::transaction::{ DeclareTransactionV3, Fee, PaymasterData, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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..b24e0c9d3d 100644 --- a/crates/blockifier/src/test_utils/deploy_account.rs +++ b/crates/blockifier/src/test_utils/deploy_account.rs @@ -7,7 +7,7 @@ use starknet_api::transaction::{ DeployAccountTransactionV3, Fee, PaymasterData, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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..a62ef0597b 100644 --- a/crates/blockifier/src/test_utils/invoke.rs +++ b/crates/blockifier/src/test_utils/invoke.rs @@ -9,7 +9,7 @@ use starknet_api::transaction::{ InvokeTransactionV1, InvokeTransactionV3, PaymasterData, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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 3f48297d15..a3e3f1df58 100644 --- a/crates/blockifier/src/transaction/account_transactions_test.rs +++ b/crates/blockifier/src/transaction/account_transactions_test.rs @@ -13,7 +13,7 @@ use starknet_api::transaction::{ ContractAddressSalt, DeclareTransactionV2, Fee, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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,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; @@ -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, @@ -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 } = @@ -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; @@ -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 } = @@ -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); @@ -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, @@ -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 } = @@ -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 } = @@ -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, ) { @@ -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, @@ -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 @@ -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(); diff --git a/crates/blockifier/src/transaction/execution_flavors_test.rs b/crates/blockifier/src/transaction/execution_flavors_test.rs index a7537b49fe..0ca7773148 100644 --- a/crates/blockifier/src/transaction/execution_flavors_test.rs +++ b/crates/blockifier/src/transaction/execution_flavors_test.rs @@ -6,7 +6,7 @@ use starknet_api::felt; use starknet_api::transaction::{ Calldata, Fee, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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..2c3d6a8087 100644 --- a/crates/blockifier/src/transaction/objects.rs +++ b/crates/blockifier/src/transaction/objects.rs @@ -12,7 +12,7 @@ use starknet_api::transaction::{ PaymasterData, Resource, ResourceBounds, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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..2996ce8621 100644 --- a/crates/blockifier/src/transaction/post_execution_test.rs +++ b/crates/blockifier/src/transaction/post_execution_test.rs @@ -2,7 +2,7 @@ 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, Fee, DeprecatedResourceBoundsMapping, TransactionVersion}; use starknet_api::{felt, patricia_key}; use starknet_types_core::felt::Felt; @@ -67,7 +67,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 +212,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 d6b1724e3a..637cf1235c 100644 --- a/crates/blockifier/src/transaction/test_utils.rs +++ b/crates/blockifier/src/transaction/test_utils.rs @@ -9,7 +9,7 @@ use starknet_api::transaction::{ InvokeTransactionV3, Resource, ResourceBounds, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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 a8198cfa9b..098857f708 100644 --- a/crates/blockifier/src/transaction/transactions_test.rs +++ b/crates/blockifier/src/transaction/transactions_test.rs @@ -19,7 +19,7 @@ use starknet_api::transaction::{ EventKey, Fee, L2ToL1Payload, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, TransactionSignature, TransactionVersion, }; @@ -383,7 +383,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, @@ -576,7 +576,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; @@ -818,7 +818,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; @@ -974,7 +974,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; @@ -1014,7 +1014,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); @@ -1134,7 +1134,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, @@ -1287,7 +1287,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; @@ -1454,7 +1454,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; @@ -1685,7 +1685,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, ) { @@ -1713,7 +1713,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; @@ -1955,7 +1955,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); @@ -2028,7 +2028,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/native_blockifier/src/py_declare.rs b/crates/native_blockifier/src/py_declare.rs index eb0988a3c8..bfbd2894a6 100644 --- a/crates/native_blockifier/src/py_declare.rs +++ b/crates/native_blockifier/src/py_declare.rs @@ -12,7 +12,7 @@ use starknet_api::transaction::{ DeclareTransactionV3, Fee, PaymasterData, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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..749f19586a 100644 --- a/crates/native_blockifier/src/py_deploy_account.rs +++ b/crates/native_blockifier/src/py_deploy_account.rs @@ -12,7 +12,7 @@ use starknet_api::transaction::{ DeployAccountTransactionV3, Fee, PaymasterData, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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..111d53b0f1 100644 --- a/crates/native_blockifier/src/py_invoke_function.rs +++ b/crates/native_blockifier/src/py_invoke_function.rs @@ -14,7 +14,7 @@ use starknet_api::transaction::{ InvokeTransactionV1, InvokeTransactionV3, PaymasterData, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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..15254e1181 100644 --- a/crates/native_blockifier/src/py_transaction.rs +++ b/crates/native_blockifier/src/py_transaction.rs @@ -68,7 +68,7 @@ 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..c788b00b1a 100644 --- a/crates/papyrus_common/src/transaction_hash.rs +++ b/crates/papyrus_common/src/transaction_hash.rs @@ -23,7 +23,7 @@ use starknet_api::transaction::{ L1HandlerTransaction, Resource, ResourceBounds, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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 c42fdb43a7..7bc2135baa 100644 --- a/crates/papyrus_protobuf/src/converters/transaction.rs +++ b/crates/papyrus_protobuf/src/converters/transaction.rs @@ -26,7 +26,7 @@ use starknet_api::transaction::{ PaymasterData, Resource, ResourceBounds, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, Tip, Transaction, TransactionOutput, @@ -305,7 +305,7 @@ 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( + let resource_bounds = DeprecatedResourceBoundsMapping::try_from(value.resource_bounds.ok_or( ProtobufConversionError::MissingField { field_description: "DeployAccountV3::resource_bounds", }, @@ -415,10 +415,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", @@ -466,8 +466,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(); @@ -621,7 +621,7 @@ 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( + let resource_bounds = DeprecatedResourceBoundsMapping::try_from(value.resource_bounds.ok_or( ProtobufConversionError::MissingField { field_description: "InvokeV3::resource_bounds", }, @@ -939,7 +939,7 @@ 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( + let resource_bounds = DeprecatedResourceBoundsMapping::try_from(value.resource_bounds.ok_or( ProtobufConversionError::MissingField { field_description: "DeclareV3::resource_bounds", }, diff --git a/crates/papyrus_protobuf/src/converters/transaction_test.rs b/crates/papyrus_protobuf/src/converters/transaction_test.rs index 9f7bc6edf9..1041d9fd18 100644 --- a/crates/papyrus_protobuf/src/converters/transaction_test.rs +++ b/crates/papyrus_protobuf/src/converters/transaction_test.rs @@ -12,7 +12,7 @@ use starknet_api::transaction::{ L1HandlerTransactionOutput, Resource, ResourceBounds, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, Transaction as StarknetApiTransaction, TransactionOutput, }; @@ -189,7 +189,7 @@ lazy_static! { da_gas_consumed: GasVector::default(), gas_consumed: GasVector::default(), }; - static ref RESOURCE_BOUNDS_MAPPING: ResourceBoundsMapping = ResourceBoundsMapping( + 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 }), 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..508976c97e 100644 --- a/crates/papyrus_storage/src/serialization/serializers.rs +++ b/crates/papyrus_storage/src/serialization/serializers.rs @@ -109,7 +109,7 @@ use starknet_api::transaction::{ PaymasterData, Resource, ResourceBounds, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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..c0864aa6a7 100644 --- a/crates/papyrus_test_utils/src/lib.rs +++ b/crates/papyrus_test_utils/src/lib.rs @@ -132,7 +132,7 @@ use starknet_api::transaction::{ PaymasterData, Resource, ResourceBounds, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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/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 644bf951fa..2f0e00507e 100644 --- a/crates/starknet_api/src/transaction.rs +++ b/crates/starknet_api/src/transaction.rs @@ -209,7 +209,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, @@ -318,7 +318,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, @@ -455,7 +455,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, @@ -924,9 +924,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)>, diff --git a/crates/starknet_api/src/transaction_hash.rs b/crates/starknet_api/src/transaction_hash.rs index b7daf1fd97..55cdc33caa 100644 --- a/crates/starknet_api/src/transaction_hash.rs +++ b/crates/starknet_api/src/transaction_hash.rs @@ -14,6 +14,7 @@ use crate::transaction::{ DeployAccountTransactionV1, DeployAccountTransactionV3, DeployTransaction, + DeprecatedResourceBoundsMapping, InvokeTransaction, InvokeTransactionV0, InvokeTransactionV1, @@ -21,7 +22,6 @@ use crate::transaction::{ L1HandlerTransaction, Resource, ResourceBounds, - ResourceBoundsMapping, Tip, Transaction, TransactionHash, @@ -175,7 +175,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..100695878c 100644 --- a/crates/starknet_client/src/reader/objects/test_utils.rs +++ b/crates/starknet_client/src/reader/objects/test_utils.rs @@ -21,7 +21,7 @@ use starknet_api::transaction::{ L1ToL2Payload, L2ToL1Payload, PaymasterData, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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..16c62b5f62 100644 --- a/crates/starknet_client/src/reader/objects/transaction.rs +++ b/crates/starknet_client/src/reader/objects/transaction.rs @@ -31,7 +31,7 @@ use starknet_api::transaction::{ L2ToL1Payload, MessageToL1, PaymasterData, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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..97def90f38 100644 --- a/crates/starknet_client/src/writer/objects/transaction.rs +++ b/crates/starknet_client/src/writer/objects/transaction.rs @@ -33,7 +33,7 @@ use starknet_api::transaction::{ ContractAddressSalt, Fee, PaymasterData, - ResourceBoundsMapping, + DeprecatedResourceBoundsMapping, 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,