Skip to content
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

refactor(batcher): refactor proposal manager #790

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

yair-starkware
Copy link
Contributor

@yair-starkware yair-starkware commented Sep 15, 2024

This change is Reviewable

Copy link

codecov bot commented Sep 15, 2024

Codecov Report

Attention: Patch coverage is 10.93750% with 57 lines in your changes missing coverage. Please review.

Project coverage is 2.57%. Comparing base (79f4c46) to head (64cfda8).
Report is 112 commits behind head on main.

Files with missing lines Patch % Lines
crates/batcher/src/proposals_manager.rs 10.93% 55 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #790       +/-   ##
==========================================
- Coverage   76.03%   2.57%   -73.46%     
==========================================
  Files         359      48      -311     
  Lines       38300    3181    -35119     
  Branches    38300    3181    -35119     
==========================================
- Hits        29120      82    -29038     
+ Misses       6845    3089     -3756     
+ Partials     2335      10     -2325     
Flag Coverage Δ
2.57% <10.93%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yair-starkware yair-starkware force-pushed the yair/refactor_proposal_manager branch 2 times, most recently from 8209bef to 2c78b23 Compare September 15, 2024 13:40
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.

Reviewed 1 of 4 files at r1.
Reviewable status: 1 of 4 files reviewed, 2 unresolved discussions (waiting on @ArniStarkware, @dafnamatsry, and @yair-starkware)


crates/batcher/src/proposals_manager.rs line 203 at r2 (raw file):

                        self.max_txs_per_mempool_request,
                        &mempool_tx_sender,
                    ) => {

wdyt about defining a streaming_future in advance?
same as you did for the building_future.
I think it will be more readable

Code quote:

                    fetch_result = Self::feed_more_mempool_txs(
                        &self.mempool_client,
                        self.max_txs_per_mempool_request,
                        &mempool_tx_sender,
                    ) => {

crates/batcher/src/proposals_manager.rs line 232 at r2 (raw file):

        for tx in mempool_txs {
            mempool_tx_sender.send(tx).await.map_err(|err| {
                // TODO: should we return the rest of the txs to the mempool?

yes, but I think it should be one flow together with cleaning up aborted proposals.
I wonder if this is the batcher responsibility or the orchestrator's. In this case the orchestrator may not have gotten all the transactions yet. we should probably discuss this in the broader context of how to return txs to the mempool.

Code quote:

// TODO: should we return the rest of the txs to the mempool?

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: 1 of 4 files reviewed, 3 unresolved discussions (waiting on @ArniStarkware, @dafnamatsry, and @yair-starkware)


crates/batcher/src/proposals_manager.rs line 196 at r2 (raw file):

            );
            pin!(building_future);
            loop {

I think the loop should be inside feed_more_mempool_txs.

Code quote:

loop {

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 4 files reviewed, 3 unresolved discussions (waiting on @ArniStarkware, @dafnamatsry, and @Yael-Starkware)


crates/batcher/src/proposals_manager.rs line 196 at r2 (raw file):

Previously, Yael-Starkware (YaelD) wrote…

I think the loop should be inside feed_more_mempool_txs.

Done.


crates/batcher/src/proposals_manager.rs line 203 at r2 (raw file):

Previously, Yael-Starkware (YaelD) wrote…

wdyt about defining a streaming_future in advance?
same as you did for the building_future.
I think it will be more readable

Done.

@yair-starkware yair-starkware force-pushed the yair/refactor_proposal_manager branch 2 times, most recently from b0f0c05 to 5ef19f8 Compare September 22, 2024 09:40
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.

Reviewed 3 of 4 files at r8, all commit messages.
Reviewable status: 3 of 4 files reviewed, 2 unresolved discussions (waiting on @ArniStarkware, @dafnamatsry, and @yair-starkware)


crates/batcher/src/proposals_manager.rs line 210 at r8 (raw file):

            },
            builder_done = building_future => {
                info!("Block builder finished.");

The building future can also return with an error.

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: 3 of 4 files reviewed, 2 unresolved discussions (waiting on @ArniStarkware, @dafnamatsry, and @Yael-Starkware)


crates/batcher/src/proposals_manager.rs line 232 at r2 (raw file):

Previously, Yael-Starkware (YaelD) wrote…

yes, but I think it should be one flow together with cleaning up aborted proposals.
I wonder if this is the batcher responsibility or the orchestrator's. In this case the orchestrator may not have gotten all the transactions yet. we should probably discuss this in the broader context of how to return txs to the mempool.

For now I think the todo is ok.


crates/batcher/src/proposals_manager.rs line 210 at r8 (raw file):

Previously, Yael-Starkware (YaelD) wrote…

The building future can also return with an error.

I will handle it in another PR after we have more final API for the block builder

@yair-starkware
Copy link
Contributor Author

crates/batcher/src/proposals_manager.rs line 232 at r2 (raw file):

Previously, yair-starkware (Yair) wrote…

For now I think the todo is ok.

Resolved in #541

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: 3 of 4 files reviewed, all discussions resolved (waiting on @ArniStarkware and @dafnamatsry)

Copy link
Collaborator

@dafnamatsry dafnamatsry 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 3 of 4 files at r8, all commit messages.
Reviewable status: 3 of 4 files reviewed, all discussions resolved (waiting on @ArniStarkware)


crates/batcher/src/proposals_manager.rs line 181 at r8 (raw file):

impl BuildProposalTask {
    async fn run(mut self) -> ProposalsManagerResult<()> {
        // TODO: Should we use a different config for the stream buffer size?

Note:
You defined a different config in https://reviewable.io/reviews/starkware-libs/sequencer/541#-

Code quote:

// TODO: Should we use a different config for the stream buffer size?

crates/batcher/src/proposals_manager.rs line 227 at r8 (raw file):

        loop {
            // TODO: Get L1 transactions.
            let mempool_txs = match mempool_client.get_txs(max_txs_per_mempool_request).await {

Note:
handle the case of empty mempool_txs.

Copy link
Collaborator

@dafnamatsry dafnamatsry left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 4 files at r1.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ArniStarkware)

@yair-starkware yair-starkware merged commit d7c8257 into main Sep 23, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants