Skip to content

Add ecop builtin#1705

Open
anatgstarkware wants to merge 1 commit intomainfrom
anatg/ecop
Open

Add ecop builtin#1705
anatgstarkware wants to merge 1 commit intomainfrom
anatg/ecop

Conversation

@anatgstarkware
Copy link
Contributor

@anatgstarkware anatgstarkware commented Mar 22, 2026

Note

Medium Risk
Adds a new Cairo builtin (ec_op) into the proving pipeline and updates VM layout handling, which can affect trace generation, constraint evaluation, and proof compatibility. While changes are mostly additive, they touch core prover/claim wiring and builtins relocation/padding logic.

Overview
Adds full prover support for the Cairo ec_op builtin. The adapter now relocates/records an ec_op segment, builtins padding/counting includes it, and the prover wires new ec_op_builtin and partial_ec_mul_generic claims/components through claim generation, interaction-claim aggregation, component lists, and debug tooling.

Updates execution/config plumbing. run_and_adapt now accepts a LayoutName and callers default to LayoutName::all_cairo_stwo (with tests adjusted), the preprocessed-trace PreProcessedTraceVariant type is moved to stwo_cairo_common and carried on PreProcessedTrace, and test data is updated to exercise ec_op usage. Separately removes unused mix_into/is_empty helpers and tweaks PackedPartialEcMulGeneric::deduce_output to return a boxed packed result.

Written by Cursor Bugbot for commit dd833a6. This will update automatically on new commits. Configure here.


This change is Reviewable

@anatgstarkware anatgstarkware self-assigned this Mar 22, 2026
@anatgstarkware anatgstarkware force-pushed the anatg/ecop branch 2 times, most recently from 4649712 to 0300067 Compare March 22, 2026 16:28
Copy link
Collaborator

@az-starkware az-starkware left a comment

Choose a reason for hiding this comment

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

@az-starkware reviewed 40 files and all commit messages, and made 2 comments.
Reviewable status: 40 of 96 files reviewed, 2 unresolved discussions (waiting on anatgstarkware and gilbens-starkware).


stwo_cairo_prover/crates/dev_utils/src/vm_utils.rs line 30 at r2 (raw file):

    program_path: &PathBuf,
    program_type: ProgramType,
    no_ecop: bool,

Suggestion:

layout: LayoutName,

stwo_cairo_prover/crates/prover/src/witness/builtins.rs line 135 at r2 (raw file):

            id: "pedersen_points_small_0".to_owned(),
        }) {
            panic!("Not supporting ec_op_builtin with canonical_small preprocessed trace.")

Why? What is missing to support it?

Copy link
Contributor Author

@anatgstarkware anatgstarkware left a comment

Choose a reason for hiding this comment

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

@anatgstarkware made 2 comments.
Reviewable status: 33 of 104 files reviewed, 2 unresolved discussions (waiting on az-starkware and gilbens-starkware).


stwo_cairo_prover/crates/prover/src/witness/builtins.rs line 135 at r2 (raw file):

Previously, az-starkware wrote…

Why? What is missing to support it?

Fixed as we said f2f


stwo_cairo_prover/crates/dev_utils/src/vm_utils.rs line 30 at r2 (raw file):

    program_path: &PathBuf,
    program_type: ProgramType,
    no_ecop: bool,

Done.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Copy link
Collaborator

@az-starkware az-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:

@az-starkware reviewed 71 files and all commit messages, made 1 comment, and resolved 2 discussions.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on anatgstarkware and gilbens-starkware).

@anatgstarkware anatgstarkware force-pushed the anatg/ecop branch 2 times, most recently from b6532f1 to d0dd16f Compare March 23, 2026 20:00
@ilyalesokhin-starkware
Copy link
Collaborator

stwo_cairo_prover/crates/common/src/preprocessed_columns/preprocessed_trace.rs line 72 at r4 (raw file):

    fn from_columns(
        columns: Vec<Box<dyn PreProcessedColumn>>,
        variant: PreProcessedTraceVariant,

Don't you have two sources of truth here?

Code quote:

        columns: Vec<Box<dyn PreProcessedColumn>>,
        variant: PreProcessedTraceVariant,

@ilyalesokhin-starkware
Copy link
Collaborator

stwo_cairo_prover/crates/common/src/preprocessed_columns/preprocessed_trace.rs line 72 at r4 (raw file):

Previously, ilyalesokhin-starkware wrote…

Don't you have two sources of truth here?

can you remove the columns argument.

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