Skip to content

feat(starknet_integration_tests): refactor e2e flow test #4787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 27, 2025

Conversation

yair-starkware
Copy link
Contributor

Check success on aggregated txs instead of per height

Copy link
Contributor Author

yair-starkware commented Mar 10, 2025

@reviewable-StarkWare
Copy link

This change is Reviewable

@yair-starkware yair-starkware marked this pull request as ready for review March 10, 2025 09:23
Copy link

graphite-app bot commented Mar 10, 2025

Graphite Automations

"Yair - Auto-assign" took an action on this PR • (03/10/25)

1 assignee was added to this PR based on Yair's automation.

Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: 2 of 4 files reviewed, 1 unresolved discussion (waiting on @ArniStarkware and @Yael-Starkware)


crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 100 at r2 (raw file):

        tokio::time::timeout(TEST_SENARIO_TIMOUT, async {
            for tx in expected_batched_tx_hashes {

In the many_txs_scenario we need to check that only the expected txs were batched.

Copy link
Contributor

@Yael-Starkware Yael-Starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 4 files reviewed, 2 unresolved discussions (waiting on @alonh5 and @ArniStarkware)


crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 100 at r2 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

In the many_txs_scenario we need to check that only the expected txs were batched.

what stops the test from producing another block with the remaining txs?


crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 109 at r2 (raw file):

                    }
                    tokio::time::sleep(Duration::from_millis(2000)).await;
                }

Suggestion:

            while !expected_batched_tx_hashes.is_empty() {
                let batched_txs =
                    mock_running_system.aggregated_txs.lock().await.get_all_txs_so_far();

                expected_batched_tx_hashes.retain(|tx| !batched_txs.contains(tx));

                tokio::time::sleep(Duration::from_millis(2000)).await;
            }

Copy link
Contributor

@Yael-Starkware Yael-Starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 4 files reviewed, 3 unresolved discussions (waiting on @alonh5, @ArniStarkware, and @yair-starkware)


crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 59 at r2 (raw file):

    configure_tracing().await;

    const TEST_SENARIO_TIMOUT: std::time::Duration = std::time::Duration::from_secs(50);

Suggestion:

TEST_SCENARIO_TIMOUT

Copy link
Contributor

@Yael-Starkware Yael-Starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 4 files reviewed, 3 unresolved discussions (waiting on @alonh5, @ArniStarkware, and @yair-starkware)


crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 109 at r2 (raw file):

                    }
                    tokio::time::sleep(Duration::from_millis(2000)).await;
                }

Suggestion:

            loop {
                println!(
                    "Waiting for txs {} to be included in a block.",
                    expected_batched_tx_hashes
                );

                let batched_txs =
                    mock_running_system.aggregated_txs.lock().await.get_all_txs_so_far();
                expected_batched_tx_hashes.retain(|tx| !batched_txs.contains(tx));
                if expected_batched_tx_hashes.is_empty() {
                    break;
                }

                tokio::time::sleep(Duration::from_millis(2000)).await;
            }

crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 109 at r2 (raw file):

                    }
                    tokio::time::sleep(Duration::from_millis(2000)).await;
                }

retracting this one and suggesting a refined version in the next comment.

Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 4 files reviewed, 3 unresolved discussions (waiting on @ArniStarkware, @Yael-Starkware, and @yair-starkware)


crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 100 at r2 (raw file):

Previously, Yael-Starkware (YaelD) wrote…

what stops the test from producing another block with the remaining txs?

Nothing, we should test that at some point only the expected txs where batched. Or can you think of another way to verify the block was closed on size and not time?

Copy link
Contributor Author

@yair-starkware yair-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 4 files reviewed, 3 unresolved discussions (waiting on @alonh5, @ArniStarkware, and @Yael-Starkware)


crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 100 at r2 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Nothing, we should test that at some point only the expected txs where batched. Or can you think of another way to verify the block was closed on size and not time?

How does this verify that it was closed on size and not on time?


crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 109 at r2 (raw file):

                    }
                    tokio::time::sleep(Duration::from_millis(2000)).await;
                }

Why is one better than the other?

Copy link

Benchmark movements:
tree_computation_flow performance regressed!
tree_computation_flow time: [35.903 ms 36.371 ms 36.917 ms]
change: [+1.3800% +2.6707% +4.2010%] (p = 0.00 < 0.05)
Performance has regressed.
Found 11 outliers among 100 measurements (11.00%)
1 (1.00%) high mild
10 (10.00%) high severe

Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 4 files reviewed, 3 unresolved discussions (waiting on @ArniStarkware, @Yael-Starkware, and @yair-starkware)


crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 100 at r2 (raw file):

Previously, yair-starkware (Yair) wrote…

How does this verify that it was closed on size and not on time?

Actually nothing, you're right. Maybe we should just decrease the max gas amount even more and send a lot of txs.
Also maybe we should add a metric for batches closed on time/size for the dashboard, and then we could use it here. (in a different PR). WDYT?

@yair-starkware yair-starkware changed the base branch from yair/tx_collector to graphite-base/4787 March 20, 2025 09:21
@yair-starkware yair-starkware changed the base branch from graphite-base/4787 to main March 20, 2025 09:22
Copy link
Contributor Author

@yair-starkware yair-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 5 files reviewed, 4 unresolved discussions (waiting on @alonh5, @ArniStarkware, and @Yael-Starkware)


crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 108 at r4 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

This is cool that this way you can print which txs we're still waiting for. Can you use a new remaining_expected_batched_tx_hashes variable so in the end you can also assert the other direction:

expected_batched_tx_hashes == batched_txs

It's a problem in the too_many_txs test because the additional txs get to the accumulated txs too.


crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 162 at r4 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

This can be removed now.

Done.


crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 163 at r4 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Also these aren't blocks anymore.

Done.


crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 160 at r6 (raw file):

Previously, ArniStarkware (Arnon Hod) wrote…

There is no longer a need to split it into two test cases. (other than the fact that closing a block on size must have more than 15 txs).
This test case can be squashed into the first test case.

Non-blocking, as this may be complicated.

Can't because limiting the block_max_capacity_sierra_gas for the too_many_txs is causing the l1handler tx to fail in the batcher

@yair-starkware yair-starkware force-pushed the yair/refactor_e2e branch 2 times, most recently from 2f87781 to 89f9261 Compare March 20, 2025 09:29
Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 5 files at r7, 2 of 3 files at r8, 1 of 1 files at r9, 1 of 1 files at r10, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ArniStarkware, @Yael-Starkware, and @yair-starkware)


crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 108 at r4 (raw file):

Previously, yair-starkware (Yair) wrote…

It's a problem in the too_many_txs test because the additional txs get to the accumulated txs too.

Like we said we aren't checking those 12 tx are in one block anyways here right?
You can decrease even more the gas amount and send more txs just to be sure the block will close on size, then you can add this assertion.
In a separate PR can we check the logs we're getting a block full log?

Copy link
Contributor

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Yael-Starkware and @yair-starkware)


crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 160 at r6 (raw file):

Previously, yair-starkware (Yair) wrote…

Can't because limiting the block_max_capacity_sierra_gas for the too_many_txs is causing the l1handler tx to fail in the batcher

Can you increase the number of Txs be more than 15?
Also not sure - because that case the block might be closed on time before it is closed on size.
But, as I said - out of scope.

Copy link
Contributor Author

@yair-starkware yair-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 5 files reviewed, 1 unresolved discussion (waiting on @alonh5 and @Yael-Starkware)


crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 108 at r4 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Like we said we aren't checking those 12 tx are in one block anyways here right?
You can decrease even more the gas amount and send more txs just to be sure the block will close on size, then you can add this assertion.
In a separate PR can we check the logs we're getting a block full log?

Added a todo and will try it in a separate PR

@yair-starkware
Copy link
Contributor Author

crates/starknet_integration_tests/tests/end_to_end_flow_test.rs line 108 at r4 (raw file):

Previously, yair-starkware (Yair) wrote…

Added a todo and will try it in a separate PR

Added the check of the other direction

Check success on aggregated txs instead of per height
Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 5 of 5 files at r11, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Yael-Starkware)

@yair-starkware yair-starkware added this pull request to the merge queue Mar 27, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 27, 2025
@yair-starkware yair-starkware added this pull request to the merge queue Mar 27, 2025
Merged via the queue into main with commit 94ae504 Mar 27, 2025
23 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants