Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
c12a37d to
43f2917
Compare
|
It depends on the range because of maybe_tempvar, right? Code quote: vec![ApChange::Known(1)] |
ilyalesokhin-starkware
left a comment
There was a problem hiding this comment.
@ilyalesokhin-starkware reviewed 5 files and all commit messages.
Reviewable status: 5 of 9 files reviewed, 2 unresolved discussions (waiting on orizi).
43f2917 to
8b488ea
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi made 1 comment and resolved 1 discussion.
Reviewable status: 5 of 9 files reviewed, 1 unresolved discussion (waiting on ilyalesokhin-starkware).
crates/cairo-lang-sierra-ap-change/src/core_libfunc_ap_change.rs line 437 at r1 (raw file):
Previously, ilyalesokhin-starkware wrote…
It depends on the range because of maybe_tempvar, right?
Done
8b488ea to
3814e9a
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi resolved 1 discussion.
Reviewable status: 3 of 9 files reviewed, 1 unresolved discussion (waiting on ilyalesokhin-starkware).
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.
SIERRA_UPDATE_MINOR_CHANGE_TAG=Added new libfunc and type.
3814e9a to
b519f15
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi resolved 1 discussion.
Reviewable status: 2 of 9 files reviewed, 1 unresolved discussion (waiting on ilyalesokhin-starkware).
ilyalesokhin-starkware
left a comment
There was a problem hiding this comment.
@ilyalesokhin-starkware reviewed 6 files and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: 8 of 9 files reviewed, all discussions resolved.
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 1 file.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on orizi).


Summary
Adds support for
BoundedIntGuaranteetype andbounded_int_guarantee_verifylibfunc to the Cairo Sierra language. This introduces a non-duplicatable, non-droppable guarantee type that must be verified through range checks to be consumed, currently supporting u32 bounds (0 to 2^32-1).Type of change
Please check one:
Why is this change needed?
This change introduces a new type system feature that allows for compile-time guarantees about integer bounds that must be verified at runtime. The
BoundedIntGuaranteetype provides a way to represent values that are guaranteed to be within specific bounds, but unlike regularBoundedInttypes, these guarantees must be explicitly verified through thebounded_int_guarantee_verifylibfunc before the value can be used.What was the behavior or documentation before?
Before this change, only
BoundedInttypes existed, which were duplicatable and droppable. There was no mechanism for creating non-duplicatable guarantees that required explicit verification.What is the behavior or documentation after?
After this change:
BoundedIntGuarantee<MIN, MAX>type is available that is non-duplicatable and non-droppablebounded_int_guarantee_verifylibfunc can be used to verify these guarantees, consuming the guarantee and performing range checksRelated issue or discussion (if any)
Additional context
The implementation includes:
validate_geandvalidate_ltNote
Medium Risk
Introduces a new core type and libfunc that affect Sierra type specialization, CASM generation, and cost/AP accounting; mistakes could lead to incorrect verification or mispriced execution. Scope is limited (currently u32-only) and covered by an e2e test.
Overview
Adds a new core Sierra type
BoundedIntGuarantee<MIN, MAX>(non-drop/non-dup) and wires it into the core type hierarchy and type sizing.Introduces
bounded_int_guarantee_verifyunder the bounded-int module, with signature/specialization restricted to the u32 bounds case, and adds CASM lowering that enforces the bounds viavalidate_ge/validate_ltrange checks.Updates AP-change and gas-cost models for the new libfunc, exposes the shared cast-range-check helpers (
validate_ge/validate_lt), allows the libfunc in Starknet’sall.json, and adds an e2e test fixture for the new verification path.Written by Cursor Bugbot for commit b519f15. This will update automatically on new commits. Configure here.