Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 3065378

Browse files
fguthmannfannyguthmannmatias-gonzSantiagoPittellajuanbono
committed
Add comments to origin/Document-transactionl1_handler module (#888)
* added comments to origin/Document-transactionl1_handler-module * modified comments * Test multi syscall (#687) * create multy syscall * remove the replace syscall, it failed because the contract adress didn't match * added library call_syscall * wip * wip * wip * wip * work in progress * remove .sjon files from starknet_programs * finished implemented all the syscalls * reorder code, create one call to syscall * fix pull bug * Update tests/multi_syscall_test.rs Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> * Update starknet_programs/cairo1/multi_syscall_test.cairo Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> * Update starknet_programs/cairo1/contract_a.cairo Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> * Update tests/multi_syscall_test.rs Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> * added test syscall for deploy * make format changes * corrected make clippy error * get_caller_address and get_contract_address return a adress * failed of get_contract_address * failed of get_contract_address * wip * modify the selector entrypoint_selector to be function specific * wip * wip * wip * add input to cairo functions * coorect format problem * wip * wip * wip * remove format problem * Fix sierra class hash calculation (#886) * reproduce bug * use pythonic formatter * rename test * fix test * cargo fmt * Fail with an Err transactions whose calculated fee exceed `max_fee` (#892) * Make tx fail when actual_fee exceeds max_fee * Changed test * Formatting * Fix logic * Leave fail only without charging * Change test * Fix test broken by better fee calc * Fixed test fee * Update fee on test_deploy_account * Remove comment --------- Co-authored-by: Juan Bono <juanbono94@gmail.com> * Fix test_get_nonce_at (#910) * Fix test_get_nonce_at * Rely on another contract * fix get_sorted_events bug (#912) * fix get_sorted_events bug * fmt * fix clippy --------- Co-authored-by: Estéfano Bargas <estefano.bargas@fing.edu.uy> * Added documentations to syscalls/deprecated_syscall_handler module (#883) * added comments to file syscalls/deprecated_syscall_handler-module' * Update src/syscalls/deprecated_syscall_handler.rs Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> * Update src/syscalls/deprecated_syscall_handler.rs Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> --------- Co-authored-by: fannyguthmann <fanny.guthmann@post.idc.ac.il> Co-authored-by: Juan Bono <juanbono94@gmail.com> Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> * wip * Modify the tests * fixed clippy errors --------- Co-authored-by: fannyguthmann <fanny.guthmann@post.idc.ac.il> Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> Co-authored-by: SantiagoPittella <pittellasantiago@gmail.com> Co-authored-by: Juan Bono <juanbono94@gmail.com> Co-authored-by: Estéfano Bargas <estefano.bargas@fing.edu.uy> * Parse internal calls (#915) * Added comments to core/contract_address module (#900) Co-authored-by: fannyguthmann <fanny.guthmann@post.idc.ac.il> * Add more transaction tests and fee investigation (#914) * add function for getting tx and refactor tests * improve imports * separe tests into 2 groups * fix test * add comments * format * cargo clippy * add details to every test * add fee discrepancy to test doc * cargo fmt * improve imports * added safety element --------- Co-authored-by: fannyguthmann <fanny.guthmann@post.idc.ac.il> Co-authored-by: Matías Ignacio González <maigonzalez@fi.uba.ar> Co-authored-by: SantiagoPittella <pittellasantiago@gmail.com> Co-authored-by: Juan Bono <juanbono94@gmail.com> Co-authored-by: Estéfano Bargas <estefano.bargas@fing.edu.uy> Co-authored-by: Santiago Pittella <87827390+SantiagoPittella@users.noreply.github.com>
1 parent b825aec commit 3065378

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/transaction/l1_handler.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use num_traits::Zero;
2424

2525
#[allow(dead_code)]
2626
#[derive(Debug, Getters, Clone)]
27+
/// Represents an L1Handler transaction in the StarkNet network.
2728
pub struct L1Handler {
2829
#[getset(get = "pub")]
2930
hash_value: Felt252,
@@ -38,6 +39,7 @@ pub struct L1Handler {
3839
}
3940

4041
impl L1Handler {
42+
/// Constructor creates a new [L1Handler] instance.
4143
pub fn new(
4244
contract_address: Address,
4345
entry_point_selector: Felt252,
@@ -66,7 +68,12 @@ impl L1Handler {
6668
hash_value,
6769
)
6870
}
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.
7077
pub fn new_with_tx_hash(
7178
contract_address: Address,
7279
entry_point_selector: Felt252,
@@ -191,6 +198,8 @@ impl L1Handler {
191198
L1_HANDLER_VERSION.into(),
192199
))
193200
}
201+
202+
/// Creates a L1Handler for simulation purposes.
194203
pub(crate) fn create_for_simulation(
195204
&self,
196205
skip_validate: bool,
@@ -234,6 +243,7 @@ mod test {
234243
utils::Address,
235244
};
236245

246+
/// Test the correct execution of the L1Handler.
237247
#[test]
238248
fn test_execute_l1_handler() {
239249
let l1_handler = L1Handler::new(
@@ -293,6 +303,8 @@ mod test {
293303
assert_eq!(tx_exec, expected_tx_exec)
294304
}
295305

306+
/// Helper function to construct the expected transaction execution info.
307+
/// Expected output of the L1Handler's execution.
296308
fn expected_tx_exec_info() -> TransactionExecutionInfo {
297309
TransactionExecutionInfo {
298310
validate_info: None,

0 commit comments

Comments
 (0)