Skip to content

Ohadn/verify program builtin without extra component#1724

Open
ohad-nir-starkware wants to merge 1 commit intoohadn/verify_program_builtin-deployment-paddedfrom
ohadn/verify_program_builtin-without-extra-component
Open

Ohadn/verify program builtin without extra component#1724
ohad-nir-starkware wants to merge 1 commit intoohadn/verify_program_builtin-deployment-paddedfrom
ohadn/verify_program_builtin-without-extra-component

Conversation

@ohad-nir-starkware
Copy link
Copy Markdown
Collaborator

@ohad-nir-starkware ohad-nir-starkware commented Apr 1, 2026

Note

Medium Risk
Medium risk because it changes AIR/witness generation and lookup composition for verify_program, which can affect proof correctness and compatibility with existing traces.

Overview
Removes the separate program_component and rewires verify_program to read program limbs directly from preprocessed ProgramColumns, shrinking its trace width and interaction trace shape.

Updates prover/witness plumbing and CASM registry metadata accordingly (component lists, claimed sums, lookups, regression expectations), and changes program padding from a fixed MAX_PROGRAM_LOG_LEN size to dynamic next power-of-two padding in both the adapter program segment and the global preprocessed program table.

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


This change is Reviewable

@ohad-nir-starkware ohad-nir-starkware self-assigned this Apr 1, 2026
@ohad-nir-starkware ohad-nir-starkware changed the base branch from main to ohadn/verify_program_builtin-deployment-padded April 1, 2026 13:21
@ohad-nir-starkware ohad-nir-starkware force-pushed the ohadn/verify_program_builtin-without-extra-component branch from e9ef36b to fb85506 Compare April 1, 2026 13:29
@ohad-nir-starkware ohad-nir-starkware force-pushed the ohadn/verify_program_builtin-without-extra-component branch from fb85506 to 2e34cfc Compare April 1, 2026 14:42
@ohad-nir-starkware ohad-nir-starkware force-pushed the ohadn/verify_program_builtin-without-extra-component branch from 2e34cfc to 34a0c28 Compare April 1, 2026 14:52
let curr_program_24 = eval.get_preprocessed_column(ProgramColumn::new(24).id());
let curr_program_25 = eval.get_preprocessed_column(ProgramColumn::new(25).id());
let curr_program_26 = eval.get_preprocessed_column(ProgramColumn::new(26).id());
let curr_program_27 = eval.get_preprocessed_column(ProgramColumn::new(27).id());
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ProgramColumn log_size may mismatch verify_program log_size

High Severity

ProgramColumn is always log_size 12 (MAX_PROGRAM_LOG_LEN), but verify_program's log_size is variable (derived from program segment length). When pad_program_segment is false, the component's domain can differ from the preprocessed column's domain, causing the polynomial evaluations to return incorrect values at the verifier's OODS point. The old design avoided this via a logup cross-component lookup between the variable-size verify_program and the fixed-size program_component.

Fix in Cursor Fix in Web

@ohad-nir-starkware ohad-nir-starkware force-pushed the ohadn/verify_program_builtin-without-extra-component branch 5 times, most recently from 83f894b to 48615a5 Compare April 3, 2026 19:44
Copy link
Copy Markdown

@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.

There are 2 total unresolved issues (including 1 from previous review).

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.

let program_length = relocatable_memory[0].len();
let padded_program_length = 1 << MAX_PROGRAM_LOG_LEN;
// Pad the program segment (segment 0) to constant size.
let padded_program_length = program_length.next_power_of_two();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Small programs panic due to insufficient SIMD padding

Medium Severity

Changing padded_program_length from the fixed 1 << MAX_PROGRAM_LOG_LEN (4096, log_size=12) to program_length.next_power_of_two() means small programs can produce a log_size smaller than LOG_N_LANES (typically 4). For example, a program with 8 entries yields log_size=3, which fails the assert!(log_size >= LOG_N_LANES) in verify_program::ClaimGenerator::new. The old fixed padding always guaranteed log_size=12, safely above the SIMD minimum.

Additional Locations (1)
Fix in Cursor Fix in Web

@ohad-nir-starkware ohad-nir-starkware force-pushed the ohadn/verify_program_builtin-without-extra-component branch from 48615a5 to c955424 Compare April 5, 2026 16:55
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.

1 participant