Skip to content

fix(apollo_batcher): batcher returns error when l1_provider fail while commiting a block #6359

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

Conversation

itamar-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@itamar-starkware itamar-starkware self-assigned this May 7, 2025
@itamar-starkware itamar-starkware marked this pull request as ready for review May 7, 2025 10:17
@itamar-starkware itamar-starkware force-pushed the 05-07-fix_apollo_batcher_batcher_returns_error_when_l1_provider_fail_while_commiting_a_block branch from eea0104 to 630f43a Compare May 7, 2025 10:25
@itamar-starkware itamar-starkware requested a review from alonh5 May 7, 2025 10:26
@itamar-starkware itamar-starkware force-pushed the 05-07-fix_apollo_batcher_batcher_returns_error_when_l1_provider_fail_while_commiting_a_block branch from 630f43a to 0463ebd Compare May 7, 2025 10:43
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 r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @itamar-starkware)


crates/apollo_batcher/src/batcher.rs line 611 at r1 (raw file):

            // Rollback the state diff in the storage.
            self.storage_writer.revert_block(height);
            STORAGE_HEIGHT.decrement(1);

Instead of incrementing an decrementing you can only increment at the end of the function once you can't fail anymore.

Code quote:

STORAGE_HEIGHT.decrement(1);

crates/apollo_batcher/src/batcher.rs line 612 at r1 (raw file):

            self.storage_writer.revert_block(height);
            STORAGE_HEIGHT.decrement(1);
            REVERTED_BLOCKS.increment(1);

No need to increment this, it's only for when blocks were reverted in Starknet. Here we a re just reverting in this node because of an error.

Code quote:

REVERTED_BLOCKS.increment(1);

crates/apollo_batcher/src/batcher_test.rs line 1132 at r1 (raw file):

    mock_dependencies.storage_writer.expect_revert_block().returning(|_| ());

    // let expected_artifacts = BlockExecutionArtifacts::create_for_testing();

Remove?

Code quote:

// let expected_artifacts = BlockExecutionArtifacts::create_for_testing();

@itamar-starkware itamar-starkware force-pushed the 05-07-fix_apollo_batcher_batcher_returns_error_when_l1_provider_fail_while_commiting_a_block branch from 0463ebd to 954be8f Compare May 7, 2025 12:41
@itamar-starkware
Copy link
Contributor Author

crates/apollo_batcher/src/batcher_test.rs line 1132 at r1 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Remove?

Yes, I was considering using this variable like that:

Code snippet:

    mock_create_builder_for_propose_block(
        &mut mock_dependencies.block_builder_factory,
        vec![],
        Ok(expected_artifacts),
    );
What do you think?

Copy link
Contributor Author

@itamar-starkware itamar-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 2 files reviewed, 3 unresolved discussions (waiting on @alonh5)


crates/apollo_batcher/src/batcher.rs line 611 at r1 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Instead of incrementing an decrementing you can only increment at the end of the function once you can't fail anymore.

Done.


crates/apollo_batcher/src/batcher.rs line 612 at r1 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

No need to increment this, it's only for when blocks were reverted in Starknet. Here we a re just reverting in this node because of an error.

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 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @itamar-starkware)


crates/apollo_batcher/src/batcher_test.rs line 1132 at r1 (raw file):

Previously, itamar-starkware wrote…

Yes, I was considering using this variable like that:

It's okay like this

@itamar-starkware itamar-starkware added this pull request to the merge queue May 7, 2025
Merged via the queue into main with commit 71d904b May 7, 2025
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