Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
fix(transaction): change declare default version to be V3 (#2065)
Browse files Browse the repository at this point in the history
  • Loading branch information
meship-starkware authored Jul 10, 2024
1 parent f8dec81 commit b2e9f28
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
3 changes: 1 addition & 2 deletions crates/blockifier/src/concurrency/fee_utils_test.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use num_bigint::BigUint;
use rstest::rstest;
use starknet_api::felt;
use starknet_api::transaction::{Fee, ResourceBoundsMapping, TransactionVersion};
use starknet_api::transaction::{Fee, ResourceBoundsMapping};
use starknet_types_core::felt::Felt;

use crate::concurrency::fee_utils::{add_fee_to_sequencer_balance, fill_sequencer_balance_reads};
Expand All @@ -27,7 +27,6 @@ pub fn test_fill_sequencer_balance_reads(
sender_address: account.get_instance_address(0),
calldata: create_trivial_calldata(account.get_instance_address(0)),
resource_bounds: max_resource_bounds,
version: TransactionVersion::THREE
});
let chain_info = &block_context.chain_info;
let state = &mut test_state_inner(chain_info, BALANCE, &[(account, 1)], erc20_version);
Expand Down
3 changes: 1 addition & 2 deletions crates/blockifier/src/concurrency/worker_logic_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::sync::Mutex;

use rstest::rstest;
use starknet_api::core::{ContractAddress, Nonce, PatriciaKey};
use starknet_api::transaction::{ContractAddressSalt, ResourceBoundsMapping, TransactionVersion};
use starknet_api::transaction::{ContractAddressSalt, ResourceBoundsMapping};
use starknet_api::{contract_address, felt, patricia_key};
use starknet_types_core::felt::Felt;

Expand Down Expand Up @@ -546,7 +546,6 @@ fn test_deploy_before_declare(max_resource_bounds: ResourceBoundsMapping) {
resource_bounds: max_resource_bounds.clone(),
class_hash: test_class_hash,
compiled_class_hash: test_compiled_class_hash,
version: TransactionVersion::THREE,
nonce: nonce!(0_u8),
},
test_class_info.clone(),
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/test_utils/declare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Default for DeclareTxArgs {
max_fee: Fee::default(),
signature: TransactionSignature::default(),
sender_address: ContractAddress::default(),
version: TransactionVersion::ONE,
version: TransactionVersion::THREE,
resource_bounds: default_testing_resource_bounds(),
tip: Tip::default(),
nonce_data_availability_mode: DataAvailabilityMode::L1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ fn test_circuit(block_context: BlockContext, max_resource_bounds: ResourceBounds
"test_circuit",
&[]
),
version: TransactionVersion::THREE,
nonce: nonce_manager.next(account_address)
};
let tx_execution_info = run_invoke_tx(
Expand Down Expand Up @@ -278,8 +277,8 @@ fn test_max_fee_limit_validate(
) {
let chain_info = &block_context.chain_info;
let TestInitData { mut state, account_address, contract_address, mut nonce_manager } =
create_test_init_data(chain_info, CairoVersion::Cairo0);
let grindy_validate_account = FeatureContract::AccountWithLongValidate(CairoVersion::Cairo0);
create_test_init_data(chain_info, CairoVersion::Cairo1);
let grindy_validate_account = FeatureContract::AccountWithLongValidate(CairoVersion::Cairo1);
let grindy_class_hash = grindy_validate_account.get_class_hash();
let block_info = &block_context.block_info;
let class_info = calculate_class_info_for_testing(grindy_validate_account.get_class());
Expand All @@ -289,7 +288,7 @@ fn test_max_fee_limit_validate(
declare_tx_args! {
class_hash: grindy_class_hash,
sender_address: account_address,
max_fee: Fee(MAX_FEE),
resource_bounds: max_resource_bounds.clone(),
nonce: nonce_manager.next(account_address),
},
class_info,
Expand Down
7 changes: 3 additions & 4 deletions crates/blockifier/src/transaction/transactions_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -803,8 +803,7 @@ fn test_max_fee_exceeds_balance(

// V3 invoke.
let invalid_tx = account_invoke_tx(invoke_tx_args! {
resource_bounds: invalid_resource_bounds,
version: TransactionVersion::THREE,
resource_bounds: invalid_resource_bounds.clone(),
..default_args
});
assert_failure_if_resource_bounds_exceed_balance(state, block_context, invalid_tx);
Expand All @@ -820,14 +819,14 @@ fn test_max_fee_exceeds_balance(
assert_failure_if_resource_bounds_exceed_balance(state, block_context, invalid_tx);

// Declare.
let contract_to_declare = FeatureContract::Empty(CairoVersion::Cairo0);
let contract_to_declare = FeatureContract::Empty(CairoVersion::Cairo1);
let class_info = calculate_class_info_for_testing(contract_to_declare.get_class());
let invalid_tx = declare_tx(
declare_tx_args! {
class_hash: contract_to_declare.get_class_hash(),
compiled_class_hash: contract_to_declare.get_compiled_class_hash(),
sender_address: account_contract_address,
max_fee: invalid_max_fee,
resource_bounds: invalid_resource_bounds,
},
class_info,
);
Expand Down

0 comments on commit b2e9f28

Please sign in to comment.