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

feat(batcher): add validate flow to proposal manager #1951

Merged

Conversation

Yael-Starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@Yael-Starkware Yael-Starkware marked this pull request as ready for review November 11, 2024 15:24
Copy link

codecov bot commented Nov 11, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 5.02%. Comparing base (e3165c4) to head (53eeb10).
Report is 382 commits behind head on main.

Files with missing lines Patch % Lines
crates/starknet_batcher/src/proposal_manager.rs 75.00% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #1951       +/-   ##
==========================================
- Coverage   40.10%   5.02%   -35.09%     
==========================================
  Files          26     140      +114     
  Lines        1895   16808    +14913     
  Branches     1895   16808    +14913     
==========================================
+ Hits          760     844       +84     
- Misses       1100   15896    +14796     
- Partials       35      68       +33     

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

@Yael-Starkware Yael-Starkware force-pushed the 11-10-feat_batcher_add_validate_flow_to_proposal_manager branch 2 times, most recently from 3dacb2e to f9fdf7c Compare November 12, 2024 08:27
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 1 of 3 files at r1, all commit messages.
Reviewable status: 1 of 3 files reviewed, 3 unresolved discussions (waiting on @Yael-Starkware and @yair-starkware)


crates/batcher/src/proposal_manager.rs line 88 at r2 (raw file):

    ) -> Result<(), BuildProposalError>;

    // TODO delete allow dead code once the batcher uses this code.

Suggestion:

// TODO: delete allow dead code once the batcher uses this code.

crates/batcher/src/proposal_manager.rs line 96 at r2 (raw file):

        deadline: tokio::time::Instant,
        tx_receiver: tokio::sync::mpsc::Receiver<Transaction>,
    ) -> Result<(), BuildProposalError>;

If we want to use the same error we should change it's name.

Suggestion:

ProposalError

crates/batcher/src/proposal_manager.rs line 200 at r2 (raw file):

        )?;

        self.spawn_build_block_task(proposal_id, block_builder).await?;

Extracting into a function would be a great preliminary PR :)

@Yael-Starkware Yael-Starkware force-pushed the 11-10-feat_batcher_add_validate_flow_to_proposal_manager branch from f9fdf7c to 687d0d4 Compare November 12, 2024 12:46
@Yael-Starkware Yael-Starkware changed the base branch from main to 11-12-refactor_batcher_change_buildproposalerror_to_generateproposalerror_to_fit_it_to_the_validate_flow November 12, 2024 12:47
Copy link
Contributor Author

@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: 0 of 3 files reviewed, 2 unresolved discussions (waiting on @alonh5 and @yair-starkware)


crates/batcher/src/proposal_manager.rs line 96 at r2 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

If we want to use the same error we should change it's name.

I think ProposalError is too general since we have GetProposalResultError and StartHeightError.

changed to GenerateProposalError, which is not perfect because it is similar to Build.

I think the the problem with the terminology comes from the api, we have build or validate proposal, while it should have been propose and validate. And then we could have used the word build as describing both.
wdyt?

btw , opened a separate PR for this name change.


crates/batcher/src/proposal_manager.rs line 200 at r2 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Extracting into a function would be a great preliminary PR :)

Done.


crates/batcher/src/proposal_manager.rs line 88 at r2 (raw file):

    ) -> Result<(), BuildProposalError>;

    // TODO delete allow dead code once the batcher uses this code.

done

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 3 of 3 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Yael-Starkware and @yair-starkware)


crates/batcher/src/proposal_manager_test.rs line 233 at r3 (raw file):

    // Build and validate multiple proposal consecutively (awaiting on them to
    // make sure they finished successfully).
    build_proposal_and_await_completion(&mut proposal_manager, ProposalId(0)).await;

Maybe interleave them?

@Yael-Starkware Yael-Starkware force-pushed the 11-12-refactor_batcher_change_buildproposalerror_to_generateproposalerror_to_fit_it_to_the_validate_flow branch from dd63481 to 1ff2b0f Compare November 12, 2024 16:20
@Yael-Starkware Yael-Starkware force-pushed the 11-10-feat_batcher_add_validate_flow_to_proposal_manager branch from 687d0d4 to 00b5e9b Compare November 12, 2024 16:22
@Yael-Starkware Yael-Starkware changed the base branch from 11-12-refactor_batcher_change_buildproposalerror_to_generateproposalerror_to_fit_it_to_the_validate_flow to 11-12-refactor_batcher_add_propose_tx_provider_fixture November 12, 2024 16:22
Copy link
Contributor Author

@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: 0 of 3 files reviewed, all discussions resolved (waiting on @alonh5 and @yair-starkware)


crates/batcher/src/proposal_manager_test.rs line 233 at r3 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Maybe interleave them?

done, unfortunately lines are too long now to see it aligned nicely together.
Do you think it's worth shortening names for this?

Copy link
Contributor

@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.

Reviewed 1 of 3 files at r3, 3 of 3 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Yael-Starkware)


crates/batcher/src/proposal_manager_test.rs line 202 at r4 (raw file):

#[rstest]
#[tokio::test]
async fn validate_proposal_fails_without_start_height(

Consider using a test case in a single test


crates/batcher/src/proposal_manager_test.rs line 230 at r4 (raw file):

#[rstest]
#[tokio::test]
async fn validate_proposal_success(

same

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 3 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Yael-Starkware)


crates/batcher/src/proposal_manager_test.rs line 233 at r3 (raw file):

Previously, Yael-Starkware (YaelD) wrote…

done, unfortunately lines are too long now to see it aligned nicely together.
Do you think it's worth shortening names for this?

Maybe remove the _and_await_completion suffix to the function names. I don't think it's important to the test reader in this case.

@Yael-Starkware Yael-Starkware force-pushed the 11-12-refactor_batcher_add_propose_tx_provider_fixture branch 2 times, most recently from 2733f1b to b065f32 Compare November 13, 2024 11:07
@Yael-Starkware Yael-Starkware force-pushed the 11-10-feat_batcher_add_validate_flow_to_proposal_manager branch from 00b5e9b to 233986f Compare November 13, 2024 11:07
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 6 of 6 files at r5, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @Yael-Starkware)


crates/starknet_batcher/src/proposal_manager_test.rs line 119 at r5 (raw file):

}

async fn build_proposal_and_await_completion(

Remove these?

Code quote:

_and_await_completion

crates/starknet_batcher/src/proposal_manager_test.rs line 39 at r5 (raw file):

    tokio::sync::mpsc::unbounded_channel()
}

Restore blank line.

@Yael-Starkware Yael-Starkware force-pushed the 11-12-refactor_batcher_add_propose_tx_provider_fixture branch 2 times, most recently from 39c2415 to 4d57d5f Compare November 14, 2024 06:19
@Yael-Starkware Yael-Starkware force-pushed the 11-10-feat_batcher_add_validate_flow_to_proposal_manager branch from 233986f to d50b9fe Compare November 14, 2024 08:46
@Yael-Starkware Yael-Starkware force-pushed the 11-12-refactor_batcher_add_propose_tx_provider_fixture branch from 4d57d5f to 8637ec6 Compare November 14, 2024 08:50
@Yael-Starkware Yael-Starkware force-pushed the 11-10-feat_batcher_add_validate_flow_to_proposal_manager branch from d50b9fe to d5644b1 Compare November 14, 2024 08:58
@Yael-Starkware Yael-Starkware changed the base branch from 11-12-refactor_batcher_add_propose_tx_provider_fixture to graphite-base/1951 November 14, 2024 09:31
@Yael-Starkware Yael-Starkware force-pushed the 11-10-feat_batcher_add_validate_flow_to_proposal_manager branch from d5644b1 to f59caff Compare November 14, 2024 09:31
@Yael-Starkware Yael-Starkware changed the base branch from graphite-base/1951 to main November 14, 2024 09:32
@Yael-Starkware Yael-Starkware force-pushed the 11-10-feat_batcher_add_validate_flow_to_proposal_manager branch 2 times, most recently from 48fbbdf to 1707470 Compare November 14, 2024 09:52
Copy link
Contributor Author

@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 6 files reviewed, all discussions resolved (waiting on @alonh5 and @yair-starkware)


crates/starknet_batcher/src/proposal_manager_test.rs line 39 at r5 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Restore blank line.

done.


crates/starknet_batcher/src/proposal_manager_test.rs line 119 at r5 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Remove these?

done.


crates/batcher/src/proposal_manager_test.rs line 233 at r3 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Maybe remove the _and_await_completion suffix to the function names. I don't think it's important to the test reader in this case.

done.


crates/batcher/src/proposal_manager_test.rs line 202 at r4 (raw file):

Previously, yair-starkware (Yair) wrote…

Consider using a test case in a single test

couldn't find a simple solution


crates/batcher/src/proposal_manager_test.rs line 230 at r4 (raw file):

Previously, yair-starkware (Yair) wrote…

same

same

@Yael-Starkware Yael-Starkware force-pushed the 11-10-feat_batcher_add_validate_flow_to_proposal_manager branch from 1707470 to 53eeb10 Compare November 14, 2024 10: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 2 of 3 files at r8, 1 of 1 files at r9, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Yael-Starkware)

@Yael-Starkware Yael-Starkware merged commit d6b5026 into main Nov 14, 2024
10 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 16, 2024
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.

4 participants