Skip to content

Commit

Permalink
chore: align the tx_hash parameter in the account tx creator test util (
Browse files Browse the repository at this point in the history
  • Loading branch information
ArniStarkware authored Oct 27, 2024
1 parent 0024cbe commit 35f5ff7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions crates/blockifier/src/test_utils/deploy_account.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
use starknet_api::core::calculate_contract_address;
use starknet_api::test_utils::deploy_account::DeployAccountTxArgs;
use starknet_api::test_utils::NonceManager;
use starknet_api::transaction::TransactionHash;

use crate::transaction::transactions::DeployAccountTransaction;

pub fn deploy_account_tx(
deploy_tx_args: DeployAccountTxArgs,
nonce_manager: &mut NonceManager,
) -> DeployAccountTransaction {
let default_tx_hash = TransactionHash::default();
let tx_hash = deploy_tx_args.tx_hash;
let contract_address = calculate_contract_address(
deploy_tx_args.contract_address_salt,
deploy_tx_args.class_hash,
Expand All @@ -22,5 +21,5 @@ pub fn deploy_account_tx(
deploy_tx_args,
nonce_manager.next(contract_address),
);
DeployAccountTransaction::new(deploy_account_tx, default_tx_hash, contract_address)
DeployAccountTransaction::new(deploy_account_tx, tx_hash, contract_address)
}
8 changes: 4 additions & 4 deletions crates/blockifier/src/test_utils/invoke.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use starknet_api::test_utils::invoke::InvokeTxArgs;
use starknet_api::transaction::{InvokeTransactionV0, TransactionHash, TransactionVersion};
use starknet_api::transaction::{InvokeTransactionV0, TransactionVersion};

use crate::abi::abi_utils::selector_from_name;
use crate::transaction::constants::EXECUTE_ENTRY_POINT_NAME;
use crate::transaction::transactions::InvokeTransaction;

pub fn invoke_tx(invoke_args: InvokeTxArgs) -> InvokeTransaction {
let default_tx_hash = TransactionHash::default();
let tx_hash = invoke_args.tx_hash;
let only_query = invoke_args.only_query;
// TODO: Make TransactionVersion an enum and use match here.
let invoke_tx = if invoke_args.version == TransactionVersion::ZERO {
Expand All @@ -23,7 +23,7 @@ pub fn invoke_tx(invoke_args: InvokeTxArgs) -> InvokeTransaction {
};

match only_query {
true => InvokeTransaction::new_for_query(invoke_tx, default_tx_hash),
false => InvokeTransaction::new(invoke_tx, default_tx_hash),
true => InvokeTransaction::new_for_query(invoke_tx, tx_hash),
false => InvokeTransaction::new(invoke_tx, tx_hash),
}
}

0 comments on commit 35f5ff7

Please sign in to comment.