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

fix(batcher): treat deadline as error in validate flow #2148

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 18, 2024 15:43
@Yael-Starkware Yael-Starkware force-pushed the yael/fix_return_status_and_tests branch from 834e59b to ede1319 Compare November 18, 2024 15:47
@Yael-Starkware Yael-Starkware force-pushed the 11-18-fix_batcher_treat_deadline_as_error_in_the_validate_flow branch from 39d387a to 13bf505 Compare November 18, 2024 15:48
@Yael-Starkware Yael-Starkware force-pushed the yael/fix_return_status_and_tests branch from ede1319 to cbb54e6 Compare November 19, 2024 06:48
@Yael-Starkware Yael-Starkware force-pushed the 11-18-fix_batcher_treat_deadline_as_error_in_the_validate_flow branch from 13bf505 to ba48389 Compare November 19, 2024 06:48
@Yael-Starkware Yael-Starkware changed the title fix(batcher): treat deadline as error in the validate flow fix(batcher): treat deadline as error in validate flow Nov 19, 2024
Copy link

codecov bot commented Nov 19, 2024

Codecov Report

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

Project coverage is 5.26%. Comparing base (e3165c4) to head (fa0b49a).
Report is 511 commits behind head on main.

Files with missing lines Patch % Lines
crates/starknet_batcher/src/block_builder.rs 71.42% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #2148       +/-   ##
==========================================
- Coverage   40.10%   5.26%   -34.85%     
==========================================
  Files          26     145      +119     
  Lines        1895   17068    +15173     
  Branches     1895   17068    +15173     
==========================================
+ Hits          760     898      +138     
- Misses       1100   16094    +14994     
- Partials       35      76       +41     

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


🚨 Try these New Features:

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, 1 unresolved discussion (waiting on @alonh5 and @yair-starkware)


crates/starknet_batcher/src/block_builder.rs line 52 at r1 (raw file):

    StreamTransactionsError(#[from] tokio::sync::mpsc::error::SendError<Transaction>),
    #[error("Build block with fail_on_err mode, failed on error {}.", _0)]
    FailOnError(String),

do you think an enum would be better than a string here?

#[derive(Debug)]
pub enum FailCause {
DeadlineReached,
BlockFull,
TransactionError(err),
}

Code quote:

FailOnError(String)

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


crates/starknet_batcher/src/block_builder.rs line 52 at r1 (raw file):

Previously, Yael-Starkware (YaelD) wrote…

do you think an enum would be better than a string here?

#[derive(Debug)]
pub enum FailCause {
DeadlineReached,
BlockFull,
TransactionError(err),
}

Both are fine, but I think an enum would be better.

@Yael-Starkware Yael-Starkware changed the base branch from yael/fix_return_status_and_tests to graphite-base/2148 November 19, 2024 08:52
@Yael-Starkware Yael-Starkware force-pushed the 11-18-fix_batcher_treat_deadline_as_error_in_the_validate_flow branch from ba48389 to 0ef64e6 Compare November 19, 2024 09:04
@Yael-Starkware Yael-Starkware changed the base branch from graphite-base/2148 to main November 19, 2024 09:05
@Yael-Starkware Yael-Starkware force-pushed the 11-18-fix_batcher_treat_deadline_as_error_in_the_validate_flow branch 2 times, most recently from afc5b93 to e3e8aac Compare November 19, 2024 09:21
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, 1 unresolved discussion (waiting on @alonh5 and @yair-starkware)


crates/starknet_batcher/src/block_builder.rs line 52 at r1 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Both are fine, but I think an enum would be better.

Done.

@Yael-Starkware Yael-Starkware force-pushed the 11-18-fix_batcher_treat_deadline_as_error_in_the_validate_flow branch from e3e8aac to d3224ef Compare November 19, 2024 09:30
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 2 of 3 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Yael-Starkware and @yair-starkware)


crates/starknet_batcher/src/block_builder.rs line 71 at r3 (raw file):

        match self {
            FailOnErrorCause::BlockFull => write!(f, "Block is full"),
            FailOnErrorCause::DeadlineReached => write!(f, "Deadline was reached"),

Suggestion:

has been reached

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


a discussion (no related file):
Can we use test cases in the tests that check fail_on_error


crates/starknet_batcher/src/block_builder_test.rs line 154 at r3 (raw file):

fn mock_transaction_executor_with_delay(
    input_txs: Vec<Transaction>,

Not blocking, but IIUC this change is not necessary (and it is advised to use slices in arguments)

Code quote:

Vec<T

crates/starknet_batcher/src/block_builder.rs line 52 at r3 (raw file):

    #[error(transparent)]
    StreamTransactionsError(#[from] tokio::sync::mpsc::error::SendError<Transaction>),
    #[error("Build block with fail_on_err mode, failed on error {0}.")]

activated

Code quote:

 mode

crates/starknet_batcher/src/block_builder.rs line 61 at r3 (raw file):

#[derive(Debug)]
pub enum FailOnErrorCause {

You can derive Error and use error(transaparent) in BlockBuilderError

Code quote:

pub enum FailOnErrorCause {

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 r2, 1 of 1 files at r3.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @Yael-Starkware)

@Yael-Starkware Yael-Starkware force-pushed the 11-18-fix_batcher_treat_deadline_as_error_in_the_validate_flow branch from d3224ef to fa0b49a Compare November 19, 2024 13:15
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: 1 of 3 files reviewed, 1 unresolved discussion (waiting on @alonh5 and @yair-starkware)


a discussion (no related file):

Previously, yair-starkware (Yair) wrote…

Can we use test cases in the tests that check fail_on_error

done.


crates/starknet_batcher/src/block_builder.rs line 52 at r3 (raw file):

Previously, yair-starkware (Yair) wrote…

activated

done


crates/starknet_batcher/src/block_builder.rs line 61 at r3 (raw file):

Previously, yair-starkware (Yair) wrote…

You can derive Error and use error(transaparent) in BlockBuilderError

Done.


crates/starknet_batcher/src/block_builder_test.rs line 154 at r3 (raw file):

Previously, yair-starkware (Yair) wrote…

Not blocking, but IIUC this change is not necessary (and it is advised to use slices in arguments)

done.


crates/starknet_batcher/src/block_builder.rs line 71 at r3 (raw file):

        match self {
            FailOnErrorCause::BlockFull => write!(f, "Block is full"),
            FailOnErrorCause::DeadlineReached => write!(f, "Deadline was reached"),

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.

Reviewed 2 of 2 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @yair-starkware)

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.

:lgtm:

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

@Yael-Starkware Yael-Starkware merged commit 4e76762 into main Nov 20, 2024
10 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 21, 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