From df835d328e30e387101701b100f55516ac996b05 Mon Sep 17 00:00:00 2001 From: Arni Hod Date: Mon, 16 Dec 2024 15:49:01 +0200 Subject: [PATCH] test(starknet_api): remove the version argument from l1 handler tx args --- .../blockifier/src/test_utils/l1_handler.rs | 2 -- crates/papyrus_rpc/src/v0_8/transaction.rs | 1 + .../starknet_api/src/test_utils/l1_handler.rs | 19 ++----------------- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/crates/blockifier/src/test_utils/l1_handler.rs b/crates/blockifier/src/test_utils/l1_handler.rs index a57d08b8b6..20116839d6 100644 --- a/crates/blockifier/src/test_utils/l1_handler.rs +++ b/crates/blockifier/src/test_utils/l1_handler.rs @@ -4,7 +4,6 @@ use starknet_api::core::ContractAddress; use starknet_api::executable_transaction::L1HandlerTransaction; use starknet_api::test_utils::l1_handler::{executable_l1_handler_tx, L1HandlerTxArgs}; use starknet_api::transaction::fields::Fee; -use starknet_api::transaction::TransactionVersion; use starknet_types_core::felt::Felt; pub fn l1handler_tx(l1_fee: Fee, contract_address: ContractAddress) -> L1HandlerTransaction { @@ -15,7 +14,6 @@ pub fn l1handler_tx(l1_fee: Fee, contract_address: ContractAddress) -> L1Handler ]; executable_l1_handler_tx(L1HandlerTxArgs { - version: TransactionVersion::ZERO, contract_address, entry_point_selector: selector_from_name("l1_handler_set_value"), calldata, diff --git a/crates/papyrus_rpc/src/v0_8/transaction.rs b/crates/papyrus_rpc/src/v0_8/transaction.rs index 1637542041..da7dc9c41e 100644 --- a/crates/papyrus_rpc/src/v0_8/transaction.rs +++ b/crates/papyrus_rpc/src/v0_8/transaction.rs @@ -1281,6 +1281,7 @@ impl From for L1HandlerTransaction { calldata.extend_from_slice(&message.payload.0); let calldata = Calldata(Arc::new(calldata)); Self { + // TODO: This should be of transaction version 0. version: TransactionVersion::ONE, contract_address: message.to_address, entry_point_selector: message.entry_point_selector, diff --git a/crates/starknet_api/src/test_utils/l1_handler.rs b/crates/starknet_api/src/test_utils/l1_handler.rs index a377ae4acd..bc848a6b01 100644 --- a/crates/starknet_api/src/test_utils/l1_handler.rs +++ b/crates/starknet_api/src/test_utils/l1_handler.rs @@ -3,9 +3,8 @@ use crate::executable_transaction::L1HandlerTransaction as ExecutableL1HandlerTr use crate::transaction::fields::{Calldata, Fee}; use crate::transaction::{L1HandlerTransaction, TransactionHash, TransactionVersion}; -#[derive(Clone)] +#[derive(Clone, Default)] pub struct L1HandlerTxArgs { - pub version: TransactionVersion, pub nonce: Nonce, pub contract_address: ContractAddress, pub entry_point_selector: EntryPointSelector, @@ -14,20 +13,6 @@ pub struct L1HandlerTxArgs { pub paid_fee_on_l1: Fee, } -impl Default for L1HandlerTxArgs { - fn default() -> Self { - L1HandlerTxArgs { - version: TransactionVersion::ZERO, - nonce: Nonce::default(), - contract_address: ContractAddress::default(), - entry_point_selector: EntryPointSelector::default(), - calldata: Calldata::default(), - tx_hash: TransactionHash::default(), - paid_fee_on_l1: Fee::default(), - } - } -} - /// Utility macro for creating `L1HandlerTransaction` to reduce boilerplate. #[macro_export] macro_rules! l1_handler_tx_args { @@ -50,7 +35,7 @@ pub fn executable_l1_handler_tx( ) -> ExecutableL1HandlerTransaction { ExecutableL1HandlerTransaction { tx: L1HandlerTransaction { - version: l1_handler_tx_args.version, + version: TransactionVersion::ZERO, // The transaction version of L1 handler is always 0. nonce: l1_handler_tx_args.nonce, contract_address: l1_handler_tx_args.contract_address, entry_point_selector: l1_handler_tx_args.entry_point_selector,