Skip to content

Commit

Permalink
test(starknet_api): set l1 handler tx version to default zero
Browse files Browse the repository at this point in the history
  • Loading branch information
ArniStarkware committed Dec 18, 2024
1 parent 8fbc491 commit 39026c3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion crates/papyrus_rpc/src/v0_8/execution_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ use starknet_api::deprecated_contract_class::ContractClass as SN_API_DeprecatedC
use starknet_api::hash::StarkHash;
use starknet_api::state::{StorageKey, ThinStateDiff as StarknetApiStateDiff};
use starknet_api::test_utils::{path_in_resources, read_json_file};
use starknet_api::transaction::constants::L1_HANDLER_VERSION;
use starknet_api::transaction::fields::{Calldata, Fee};
use starknet_api::transaction::{
L1HandlerTransaction,
Expand Down Expand Up @@ -1204,7 +1205,7 @@ async fn pending_trace_block_transactions_and_trace_transaction_execution_contex
#[test]
fn message_from_l1_to_l1_handler_tx() {
let l1_handler_tx = L1HandlerTransaction::from(MESSAGE_FROM_L1.clone());
assert_eq!(l1_handler_tx.version, TransactionVersion::ONE);
assert_eq!(l1_handler_tx.version, L1_HANDLER_VERSION);
assert_eq!(l1_handler_tx.contract_address, *CONTRACT_ADDRESS);
assert_eq!(l1_handler_tx.entry_point_selector, selector_from_name("l1_handle"));
// The first item of calldata is the from_address.
Expand Down
3 changes: 2 additions & 1 deletion crates/papyrus_rpc/src/v0_8/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use starknet_api::core::{
use starknet_api::data_availability::DataAvailabilityMode;
use starknet_api::execution_resources::GasAmount;
use starknet_api::serde_utils::bytes_from_hex_str;
use starknet_api::transaction::constants::L1_HANDLER_VERSION;
use starknet_api::transaction::fields::{
AccountDeploymentData,
AllResourceBounds,
Expand Down Expand Up @@ -1281,7 +1282,7 @@ impl From<MessageFromL1> for L1HandlerTransaction {
calldata.extend_from_slice(&message.payload.0);
let calldata = Calldata(Arc::new(calldata));
Self {
version: TransactionVersion::ONE,
version: L1_HANDLER_VERSION,
contract_address: message.to_address,
entry_point_selector: message.entry_point_selector,
calldata,
Expand Down
3 changes: 2 additions & 1 deletion crates/starknet_api/src/test_utils/l1_handler.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::core::{ContractAddress, EntryPointSelector, Nonce};
use crate::executable_transaction::L1HandlerTransaction as ExecutableL1HandlerTransaction;
use crate::transaction::constants::L1_HANDLER_VERSION;
use crate::transaction::fields::{Calldata, Fee};
use crate::transaction::{L1HandlerTransaction, TransactionHash, TransactionVersion};

Expand All @@ -17,7 +18,7 @@ pub struct L1HandlerTxArgs {
impl Default for L1HandlerTxArgs {
fn default() -> Self {
L1HandlerTxArgs {
version: TransactionVersion::THREE,
version: L1_HANDLER_VERSION,
nonce: Nonce::default(),
contract_address: ContractAddress::default(),
entry_point_selector: EntryPointSelector::default(),
Expand Down

0 comments on commit 39026c3

Please sign in to comment.