fix: check values.contains_key before get_type_info#9703
Open
Bashmunta wants to merge 1 commit intostarkware-libs:mainfrom
Open
fix: check values.contains_key before get_type_info#9703Bashmunta wants to merge 1 commit intostarkware-libs:mainfrom
values.contains_key before get_type_info#9703Bashmunta wants to merge 1 commit intostarkware-libs:mainfrom
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
orizi
requested changes
Feb 24, 2026
Collaborator
orizi
left a comment
There was a problem hiding this comment.
@orizi made 1 comment.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on Bashmunta).
crates/cairo-lang-sierra/src/extensions/modules/circuit.rs line 1069 at r1 (raw file):
if values.contains_key(&ty) { // The value was already processed.
why remove the doc?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moved the
values.contains_key()check beforeget_type_info()call to avoid redundant lookups, matching the pattern used inparse_circuit_inputs.Type of change
Please check one:
Why is this change needed?
In
get_circuit_info,context.get_type_info()was called before checking if the value was already processed. Since the same gate can appear multiple times in the stack (shared inputs), this caused unnecessary lookups when the value already existed invalues.