Skip to content

feat(starknet_batcher): metric for blocks closed on capacity #5223

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 30, 2025

Conversation

yair-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link

graphite-app bot commented Mar 24, 2025

Graphite Automations

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

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

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


crates/starknet_batcher/src/block_builder_test.rs line 448 at r1 (raw file):

        crate::metrics::FULL_BLOCKS.parse_numeric_metric::<u64>(metrics),
        Some(expected_full_blocks_metric)
    );

Suggestion:

crate::metrics::FULL_BLOCKS.asssert_eq<u64>(metrics, expected_full_blocks_metric);

crates/starknet_batcher/src/block_builder_test.rs line 492 at r1 (raw file):

    crate::metrics::FULL_BLOCKS.register();
    let metrics = recorder.handle().render();
    assert_eq!(crate::metrics::FULL_BLOCKS.parse_numeric_metric::<u64>(&metrics), Some(0));

Suggestion:

crate::metrics::FULL_BLOCKS.assert_eq<u64>(&metrics, 0);

crates/starknet_batcher/src/block_builder_test.rs line 515 at r1 (raw file):

        test_expectations.expected_full_blocks_metric,
        &recorder.handle().render(),
    )

better to pass a reference to the entire test_expectations than 3 of it's sub-fields.

Code quote:

    verify_build_block_output(
        test_expectations.expected_txs_output,
        test_expectations.expected_block_artifacts,
        result_block_artifacts,
        output_tx_receiver,
        test_expectations.expected_full_blocks_metric,
        &recorder.handle().render(),
    )

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


crates/starknet_batcher/src/block_builder_test.rs line 515 at r1 (raw file):

Previously, Yael-Starkware (YaelD) wrote…

better to pass a reference to the entire test_expectations than 3 of it's sub-fields.

Added todo


crates/starknet_batcher/src/block_builder_test.rs line 448 at r1 (raw file):

        crate::metrics::FULL_BLOCKS.parse_numeric_metric::<u64>(metrics),
        Some(expected_full_blocks_metric)
    );

Done.


crates/starknet_batcher/src/block_builder_test.rs line 492 at r1 (raw file):

    crate::metrics::FULL_BLOCKS.register();
    let metrics = recorder.handle().render();
    assert_eq!(crate::metrics::FULL_BLOCKS.parse_numeric_metric::<u64>(&metrics), Some(0));

Done.

@yair-starkware yair-starkware force-pushed the yair/full_block_metric branch from 1543682 to 8708926 Compare March 26, 2025 09:58
@yair-starkware yair-starkware changed the base branch from yair/refactor_e2e to graphite-base/5223 March 27, 2025 13:29
@yair-starkware yair-starkware force-pushed the yair/full_block_metric branch from 8708926 to e891dde Compare March 27, 2025 13:29
@yair-starkware yair-starkware changed the base branch from graphite-base/5223 to main March 27, 2025 13: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 1 of 2 files at r3, all commit messages.
Reviewable status: 2 of 4 files reviewed, 4 unresolved discussions (waiting on @Yael-Starkware)


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

            return Err(BlockBuilderError::FailOnError(FailOnErrorCause::BlockFull));
        } else {
            FULL_BLOCKS.increment(1);

How do we know this block was accepted? If it counts full proposed blocks that weren't accepted this metric won't mean much

@yair-starkware yair-starkware force-pushed the yair/full_block_metric branch from e891dde to 250bc63 Compare March 27, 2025 14:36
@yair-starkware
Copy link
Contributor Author

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

Previously, alonh5 (Alon Haramati) wrote…

How do we know this block was accepted? If it counts full proposed blocks that weren't accepted this metric won't mean much

I guess we don't.
Why won't it mean much?

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


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

Previously, yair-starkware (Yair) wrote…

I guess we don't.
Why won't it mean much?

Well I guess it's better than nothing, and for now it's not worth the effort checking if the block was accepted.


crates/starknet_batcher/src/metrics.rs line 40 at r4 (raw file):

    BATCHED_TRANSACTIONS.register();
    REJECTED_TRANSACTIONS.register();
<<<<<<< HEAD

resolve.


crates/starknet_batcher/src/block_builder_test.rs line 446 at r4 (raw file):

    assert_eq!(result_block_artifacts, expected_block_artifacts);

    crate::metrics::FULL_BLOCKS.assert_eq::<u64>(metrics, expected_full_blocks_metric)

import

Code quote:

crate::metrics::FULL_BLOCKS

crates/starknet_batcher/src/block_builder_test.rs line 485 at r4 (raw file):

#[tokio::test]
async fn test_build_block(#[case] test_expectations: TestExpectations) {
    let recorder: metrics_exporter_prometheus::PrometheusRecorder =

is this needed?

Code quote:

: metrics_exporter_prometheus::PrometheusRecorder

@yair-starkware yair-starkware force-pushed the yair/full_block_metric branch from 250bc63 to 976b6c6 Compare March 30, 2025 07:27
@yair-starkware yair-starkware requested a review from alonh5 March 30, 2025 07:57
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, 6 unresolved discussions (waiting on @alonh5 and @Yael-Starkware)


crates/starknet_batcher/src/block_builder_test.rs line 446 at r4 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

import

Done.


crates/starknet_batcher/src/block_builder_test.rs line 485 at r4 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

is this needed?

Done.


crates/starknet_batcher/src/metrics.rs line 40 at r4 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

resolve.

Done.

@yair-starkware yair-starkware force-pushed the yair/full_block_metric branch from 976b6c6 to 14c10ac Compare March 30, 2025 07:58
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 1 files at r5, 1 of 1 files at r6, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @Yael-Starkware)


crates/starknet_batcher/src/block_builder_test.rs line 488 at r6 (raw file):

    let recorder = PrometheusBuilder::new().build_recorder();
    let _recorder_guard = metrics::set_default_local_recorder(&recorder);
    crate::metrics::FULL_BLOCKS.register();

remove all over file

Code quote:

crate::metrics::

@yair-starkware yair-starkware force-pushed the yair/full_block_metric branch from 14c10ac to 9f37c2b Compare March 30, 2025 08:18
@yair-starkware yair-starkware requested a review from alonh5 March 30, 2025 08:18
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, 4 unresolved discussions (waiting on @alonh5 and @Yael-Starkware)


crates/starknet_batcher/src/block_builder_test.rs line 488 at r6 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

remove all over file

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

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


crates/starknet_batcher/src/block_builder_test.rs line 515 at r1 (raw file):

Previously, yair-starkware (Yair) wrote…

Added todo

I don't see it.

@yair-starkware
Copy link
Contributor Author

crates/starknet_batcher/src/block_builder_test.rs line 515 at r1 (raw file):

Previously, Yael-Starkware (YaelD) wrote…

I don't see it.

line 430:

// TODO(yair): refactor to be a method of TestExpectations.
async fn verify_build_block_output(

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.

:lgtm:

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


crates/starknet_batcher/src/block_builder_test.rs line 515 at r1 (raw file):

Previously, yair-starkware (Yair) wrote…

line 430:

// TODO(yair): refactor to be a method of TestExpectations.
async fn verify_build_block_output(

oh sorry. ack

@yair-starkware yair-starkware added this pull request to the merge queue Mar 30, 2025
Merged via the queue into main with commit 98911ab Mar 30, 2025
9 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 1, 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.

4 participants