Skip to content

Commit

Permalink
chore: set tx_hash as default in create declare tx for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ArniStarkware committed Sep 15, 2024
1 parent ae4ae2f commit 210e0d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 5 additions & 2 deletions crates/blockifier/src/test_utils/declare.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
use starknet_api::test_utils::declare::DeclareTxArgs;
use starknet_api::transaction::TransactionHash;

use crate::execution::contract_class::ClassInfo;
use crate::transaction::account_transaction::AccountTransaction;
use crate::transaction::transactions::DeclareTransaction;

pub fn declare_tx(declare_tx_args: DeclareTxArgs, class_info: ClassInfo) -> AccountTransaction {
let tx_hash = declare_tx_args.tx_hash;
let default_tx_hash = TransactionHash::default();
let declare_tx = starknet_api::test_utils::declare::declare_tx(declare_tx_args);

AccountTransaction::Declare(DeclareTransaction::new(declare_tx, tx_hash, class_info).unwrap())
AccountTransaction::Declare(
DeclareTransaction::new(declare_tx, default_tx_hash, class_info).unwrap(),
)
}
8 changes: 3 additions & 5 deletions crates/starknet_api/src/test_utils/declare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ pub struct DeclareTxArgs {
pub nonce: Nonce,
pub class_hash: ClassHash,
pub compiled_class_hash: CompiledClassHash,
// TODO(Arni): Consider removing this field.
pub tx_hash: TransactionHash,
}

impl Default for DeclareTxArgs {
Expand All @@ -52,7 +50,6 @@ impl Default for DeclareTxArgs {
nonce: Nonce::default(),
class_hash: ClassHash::default(),
compiled_class_hash: CompiledClassHash::default(),
tx_hash: TransactionHash::default(),
}
}
}
Expand Down Expand Up @@ -124,7 +121,8 @@ pub fn executable_declare_tx(
declare_tx_args: DeclareTxArgs,
class_info: ClassInfo,
) -> ExecutableDeclareTransaction {
let tx_hash = declare_tx_args.tx_hash;
let default_tx_hash = TransactionHash::default();
let tx = declare_tx(declare_tx_args);
ExecutableDeclareTransaction { tx, tx_hash, class_info }

ExecutableDeclareTransaction { tx, tx_hash: default_tx_hash, class_info }
}

0 comments on commit 210e0d6

Please sign in to comment.