Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort_ecdsa_and_mod_builtins_private_inputs_by_idx #1851

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
pefontana marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

#### Upcoming Changes

* fix: [#1851](https://github.com/lambdaclass/cairo-vm/pull/1851):
* Fix unsorted signature and mod builtin outputs in air_private_input.

* feat(BREAKING): [#1824](https://github.com/lambdaclass/cairo-vm/pull/1824)[#1838](https://github.com/lambdaclass/cairo-vm/pull/1838):
* Add support for dynamic layout
* CLI change(BREAKING): The flag `cairo_layout_params_file` must be specified when using dynamic layout.
Expand Down
2 changes: 2 additions & 0 deletions vm/src/vm/runners/builtin_runner/modulo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ impl ModBuiltinRunner {
});
}

instances.sort_by_key(|input| input.index);

vec![PrivateInput::Mod(ModInput {
instances,
zero_value_address: relocation_table
Expand Down
4 changes: 4 additions & 0 deletions vm/src/vm/runners/builtin_runner/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@
}))
}
}
private_inputs.sort_by_key(|input| match input {
PrivateInput::Signature(sig) => sig.index,
_ => unreachable!(),

Check warning on line 243 in vm/src/vm/runners/builtin_runner/signature.rs

View check run for this annotation

Codecov / codecov/patch

vm/src/vm/runners/builtin_runner/signature.rs#L242-L243

Added lines #L242 - L243 were not covered by tests
Copy link
Collaborator

@pefontana pefontana Nov 6, 2024

Choose a reason for hiding this comment

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

How much work is to add an error handling here?
If it is not possible at least add an error message to the user and a line documenting why it is not possible to get into the unreachable

Copy link
Collaborator Author

@YairVaknin-starkware YairVaknin-starkware Nov 6, 2024

Choose a reason for hiding this comment

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

Added a msg here and also added a test for the signature's air_public_input fn.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How much work is to add an error handling here?

If it is not possible at least add an error message to the user and a line documenting why it is not possible to get into the unreachable

I can add error handling, but I'm not sure how elegant it will be. Lmk if it's important, or if it's okay the way it is now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also, currently air_private_input doesn't return a Result type for any builtin variant. Do we want to panic or refactor the code that uses it? Because this case can never happen, I think if we do add an error panic is probably okay(?).

});
private_inputs
}
}
Expand Down
Loading