Skip to content

Commit 40423e0

Browse files
chore(blockifier): create a file dedicated to l1 handler txs (#6380)
1 parent 2153366 commit 40423e0

3 files changed

Lines changed: 40 additions & 40 deletions

File tree

crates/blockifier/src/transaction.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ pub mod account_transaction;
22
#[cfg(test)]
33
pub mod error_format_test;
44
pub mod errors;
5+
pub mod l1_handler_transaction;
56
pub mod objects;
67
#[cfg(any(feature = "testing", test))]
78
pub mod test_utils;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
use starknet_api::executable_transaction::L1HandlerTransaction;
2+
use starknet_api::transaction::fields::{Fee, TransactionSignature};
3+
use starknet_api::transaction::TransactionVersion;
4+
5+
use crate::transaction::objects::{
6+
CommonAccountFields,
7+
DeprecatedTransactionInfo,
8+
HasRelatedFeeType,
9+
TransactionInfo,
10+
TransactionInfoCreator,
11+
};
12+
13+
impl HasRelatedFeeType for L1HandlerTransaction {
14+
fn version(&self) -> TransactionVersion {
15+
self.tx.version
16+
}
17+
18+
fn is_l1_handler(&self) -> bool {
19+
true
20+
}
21+
}
22+
23+
impl TransactionInfoCreator for L1HandlerTransaction {
24+
fn create_tx_info(&self) -> TransactionInfo {
25+
TransactionInfo::Deprecated(DeprecatedTransactionInfo {
26+
common_fields: CommonAccountFields {
27+
transaction_hash: self.tx_hash,
28+
version: self.tx.version,
29+
signature: TransactionSignature::default(),
30+
nonce: self.tx.nonce,
31+
sender_address: self.tx.contract_address,
32+
only_query: false,
33+
},
34+
max_fee: Fee::default(),
35+
})
36+
}
37+
}

crates/blockifier/src/transaction/transactions.rs

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,8 @@ use starknet_api::executable_transaction::{
1010
InvokeTransaction,
1111
L1HandlerTransaction,
1212
};
13-
use starknet_api::transaction::fields::{
14-
AccountDeploymentData,
15-
Calldata,
16-
Fee,
17-
TransactionSignature,
18-
};
19-
use starknet_api::transaction::{
20-
constants,
21-
DeclareTransactionV2,
22-
DeclareTransactionV3,
23-
TransactionVersion,
24-
};
13+
use starknet_api::transaction::fields::{AccountDeploymentData, Calldata};
14+
use starknet_api::transaction::{constants, DeclareTransactionV2, DeclareTransactionV3};
2515

2616
use crate::context::{BlockContext, GasCounter, TransactionContext};
2717
use crate::execution::call_info::CallInfo;
@@ -40,11 +30,9 @@ use crate::transaction::objects::{
4030
CommonAccountFields,
4131
CurrentTransactionInfo,
4232
DeprecatedTransactionInfo,
43-
HasRelatedFeeType,
4433
TransactionExecutionInfo,
4534
TransactionExecutionResult,
4635
TransactionInfo,
47-
TransactionInfoCreator,
4836
TransactionInfoCreatorInner,
4937
};
5038
#[cfg(test)]
@@ -115,16 +103,6 @@ pub trait ValidatableTransaction {
115103
) -> TransactionExecutionResult<Option<CallInfo>>;
116104
}
117105

118-
impl HasRelatedFeeType for L1HandlerTransaction {
119-
fn version(&self) -> TransactionVersion {
120-
self.tx.version
121-
}
122-
123-
fn is_l1_handler(&self) -> bool {
124-
true
125-
}
126-
}
127-
128106
impl<S: State> Executable<S> for L1HandlerTransaction {
129107
fn run_execute(
130108
&self,
@@ -159,22 +137,6 @@ impl<S: State> Executable<S> for L1HandlerTransaction {
159137
}
160138
}
161139

162-
impl TransactionInfoCreator for L1HandlerTransaction {
163-
fn create_tx_info(&self) -> TransactionInfo {
164-
TransactionInfo::Deprecated(DeprecatedTransactionInfo {
165-
common_fields: CommonAccountFields {
166-
transaction_hash: self.tx_hash,
167-
version: self.tx.version,
168-
signature: TransactionSignature::default(),
169-
nonce: self.tx.nonce,
170-
sender_address: self.tx.contract_address,
171-
only_query: false,
172-
},
173-
max_fee: Fee::default(),
174-
})
175-
}
176-
}
177-
178140
impl TransactionInfoCreatorInner for AccountTransaction {
179141
fn create_tx_info(&self, only_query: bool) -> TransactionInfo {
180142
match self {

0 commit comments

Comments
 (0)