Skip to content

blockifier: add benchmarking and only-native feature flags#13541

Open
avi-starkware wants to merge 1 commit intomain-v0.14.2from
avi/blockifier/benchmarking-instrumentation
Open

blockifier: add benchmarking and only-native feature flags#13541
avi-starkware wants to merge 1 commit intomain-v0.14.2from
avi/blockifier/benchmarking-instrumentation

Conversation

@avi-starkware
Copy link
Copy Markdown
Collaborator

@avi-starkware avi-starkware commented Mar 26, 2026

Adds two new feature flags:

  • `benchmarking`: gates time/call_counter fields on CallInfo and
    EntryPointExecutionContext for execution profiling
  • `only-native`: forces native execution path even when tracked
    resource is CairoSteps

Zero behavior change without flags enabled.


Note

Medium Risk
Low impact by default, but when enabled this changes execution-path selection (forcing native execution) and adds new data fields to CallInfo, which could affect consumers expecting a stable struct layout/serialization behind feature gates.

Overview
Adds two new opt-in feature flags to blockifier: benchmarking and only-native.

With benchmarking enabled, execution populates per-call profiling metadata (time and call_counter) on CallInfo, backed by a counter in EntryPointExecutionContext. With only-native enabled (and cairo_native), the dispatcher no longer falls back to the VM path for TrackedResource::CairoSteps, forcing the native executor.

Updates tests/fixtures to construct CallInfo via ..Default::default() so new optional fields don’t break compilation, and derives serde for CallSummary/ExecutionSummary when transaction_serde is enabled.

Reviewed by Cursor Bugbot for commit 4d74bec. Bugbot is set up for automated code reviews on this repo. Configure here.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
Collaborator Author

avi-starkware commented Mar 26, 2026

@avi-starkware avi-starkware marked this pull request as ready for review March 26, 2026 17:22
@avi-starkware avi-starkware force-pushed the avi/blockifier/benchmarking-instrumentation branch 2 times, most recently from 4a818d0 to 1ea7c66 Compare March 26, 2026 19:16
@avi-starkware avi-starkware force-pushed the avi/blockifier/benchmarking-instrumentation branch 3 times, most recently from b4eeb90 to 4d74bec Compare April 8, 2026 05:04
Copy link
Copy Markdown
Contributor

@TomerStarkware TomerStarkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

@TomerStarkware reviewed 9 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on noaov1 and Yoni-Starkware).

Copy link
Copy Markdown
Collaborator

@Yoni-Starkware Yoni-Starkware left a comment

Choose a reason for hiding this comment

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

@Yoni-Starkware reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on avi-starkware, noaov1, and TomerStarkware).


crates/blockifier/src/execution/entry_point_execution.rs line 526 at r2 (raw file):

        time: Default::default(),
        #[cfg(feature = "benchmarking")]
        call_counter: 0,

@TomerStarkware why do we need this? can't you just count the number of nested calls at the end of the run?

Code quote:

        #[cfg(feature = "benchmarking")]
        call_counter: 0,

@avi-starkware avi-starkware force-pushed the avi/blockifier/benchmarking-instrumentation branch from 4d74bec to 7293ba2 Compare April 14, 2026 10:59
@cursor
Copy link
Copy Markdown

cursor bot commented Apr 14, 2026

PR Summary

Medium Risk
Adds new optional execution behavior and data collection paths: enabling only-native can change which engine executes calls, and benchmarking changes CallInfo shape and how results are produced under that flag.

Overview
Adds two new blockifier feature flags: benchmarking and only-native.

With benchmarking, CallInfo now includes a gated time: Duration field and execute_entry_point_call measures wall-clock duration for each entry-point execution (Cairo0, Cairo1, and native) and records it on the returned CallInfo.

With only-native, when cairo_native is enabled the executor will always take the native path for RunnableCompiledClass::V1Native even when the tracked resource is CairoSteps (previously it fell back to the VM path). Related test fixtures were updated to use ..Default::default() for the new optional field(s), and CallSummary/ExecutionSummary now derive serde when transaction_serde is enabled.

Reviewed by Cursor Bugbot for commit bfe0a84. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown
Collaborator

@Yoni-Starkware Yoni-Starkware left a comment

Choose a reason for hiding this comment

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

@Yoni-Starkware reviewed 7 files and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on avi-starkware and noaov1).


crates/blockifier/src/execution/entry_point.rs line 331 at r3 (raw file):

    // Used to support charging for gas consumed in blockifier revert flow.
    pub sierra_gas_revert_tracker: SierraGasRevertTracker,

Revert the newline

Adds two new feature flags:
- \`benchmarking\`: gates time/call_counter fields on CallInfo and
  EntryPointExecutionContext for execution profiling
- \`only-native\`: forces native execution path even when tracked
  resource is CairoSteps

Zero behavior change without flags enabled.
@avi-starkware avi-starkware force-pushed the avi/blockifier/benchmarking-instrumentation branch from c9f42dd to bfe0a84 Compare April 19, 2026 09:29
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.

4 participants