Increase SMALL_VALUE_BITS to 29 and rename builtin-specific bound.#431
Increase SMALL_VALUE_BITS to 29 and rename builtin-specific bound.#431ilyalesokhin-starkware wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
1c275ea to
d20a814
Compare
SMALL_VALUE_BITS increases from 27 to 29 for general small values. The builtin n_uses range check keeps the tighter 27-bit bound under the new name BUILTIN_USAGE_BITS, since builtin_start + n_uses * instance_size must not overflow M31_P. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
d20a814 to
bf0b3a8
Compare
PR SummaryMedium Risk Overview This renames and refactors the limb-splitting helper to Builtin usage range checks are decoupled from the new 29-bit bound via a new Reviewed by Cursor Bugbot for commit bf0b3a8. Bugbot is set up for automated code reviews on this repo. Configure here. |

SMALL_VALUE_BITS increases from 27 to 29 for general small values. The builtin n_uses range check keeps the tighter 27-bit bound under the new name BUILTIN_USAGE_BITS, since builtin_start + n_uses * instance_size must not overflow M31_P.
Note
Medium Risk
Touches constraint bit-decomposition and range-check bounds used in proof verification; incorrect bounds could allow invalid public data or break compatibility with existing traces.
Overview
Updates Cairo AIR statement constraints to treat general “small” public values as 29-bit instead of 27-bit, including updating the value-to-limb splitter to output 4×9-bit limbs and using it for public memory and safe-call initialization logup terms.
Keeps builtin
n_usesrange checks at a tighter 27-bit bound under the newBUILTIN_USAGE_BITSconstant, and adjusts the associated overflow assertion and extraction calls to match the new split between 29-bit addresses/values and 27-bit builtin usage counts.Reviewed by Cursor Bugbot for commit d20a814. Bugbot is set up for automated code reviews on this repo. Configure here.