@@ -24,6 +24,7 @@ use num_traits::Zero;
24
24
25
25
#[ allow( dead_code) ]
26
26
#[ derive( Debug , Getters , Clone ) ]
27
+ /// Represents an L1Handler transaction in the StarkNet network.
27
28
pub struct L1Handler {
28
29
#[ getset( get = "pub" ) ]
29
30
hash_value : Felt252 ,
@@ -38,6 +39,7 @@ pub struct L1Handler {
38
39
}
39
40
40
41
impl L1Handler {
42
+ /// Constructor creates a new [L1Handler] instance.
41
43
pub fn new (
42
44
contract_address : Address ,
43
45
entry_point_selector : Felt252 ,
@@ -66,7 +68,12 @@ impl L1Handler {
66
68
hash_value,
67
69
)
68
70
}
69
-
71
+ /// Creates a new [L1Handler] instance with a specified transaction hash.
72
+ ///
73
+ /// # Safety
74
+ ///
75
+ /// `tx_hash` will be assumed to be the same as would result from calling
76
+ /// `calculate_transaction_hash_common`. Non-compliance will result in silent misbehavior.
70
77
pub fn new_with_tx_hash (
71
78
contract_address : Address ,
72
79
entry_point_selector : Felt252 ,
@@ -191,6 +198,8 @@ impl L1Handler {
191
198
L1_HANDLER_VERSION . into ( ) ,
192
199
) )
193
200
}
201
+
202
+ /// Creates a L1Handler for simulation purposes.
194
203
pub ( crate ) fn create_for_simulation (
195
204
& self ,
196
205
skip_validate : bool ,
@@ -234,6 +243,7 @@ mod test {
234
243
utils:: Address ,
235
244
} ;
236
245
246
+ /// Test the correct execution of the L1Handler.
237
247
#[ test]
238
248
fn test_execute_l1_handler ( ) {
239
249
let l1_handler = L1Handler :: new (
@@ -293,6 +303,8 @@ mod test {
293
303
assert_eq ! ( tx_exec, expected_tx_exec)
294
304
}
295
305
306
+ /// Helper function to construct the expected transaction execution info.
307
+ /// Expected output of the L1Handler's execution.
296
308
fn expected_tx_exec_info ( ) -> TransactionExecutionInfo {
297
309
TransactionExecutionInfo {
298
310
validate_info : None ,
0 commit comments