-
Notifications
You must be signed in to change notification settings - Fork 148
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
feat: enable the skip_instruction_exectution for hints #645
feat: enable the skip_instruction_exectution for hints #645
Conversation
55b95c8
to
044f871
Compare
Hey:), what is the |
The builtin hint processor has a few hardcoded supported hints. Whenever you pass a hint that isn't natively implemented, it will return that error. This allows catching this special case if you want to extend the supported hints with an extra processor while still using the optimized version for the supported hints. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just remove the print and it's good to go.
There's one more thing I missed (which is the reason the tests fail): you'll need to implement that setting as a new hint in the builtin runner. You can avoid making the new function public as well when you do that. |
Thanks a lot for your reply! I'm on it |
I proposed an updated version with what I understood from your review:)! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two very minor changes and it's good to go!
src/hint_processor/builtin_hint_processor/skip_next_instruction.rs
Outdated
Show resolved
Hide resolved
Thanks a lot for your time! |
2bbda52
to
2e0ff56
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent!
2e0ff56
to
e2a44e9
Compare
Just for the record. Our common practice is squash and merge, so force pushing isn't strictly necessary. If you can push fixes individually it helps GitHub separate them to see what changed since the last review (I often do partial reviews with that feature to check requested changes before making a final one with everything together). |
Thanks for the explanation! Will push partial chances from now on! Could you retrigger workflows? |
Hi, thanks for the contribution!
I looked into it a bit and while I haven't found a solution, I did find some things that might be useful for fixing this. Would you mind taking a look and correcting this? |
Hey, thanks a lot for your time:)! What do you mean to say My understanding of how hints work rn in the VM is:
this means that the hint processor will understand the text
Meaning that when the runner encounters my hint in |
Oh, sorry, I didn't explain myself properly. I meant that the function doesn't exist in the original python implementation. The part that is failing to run is not cairo_rs, but cairo-lang from strakware |
Ohh thanks for the explanation, what are some steps I could take to fix this? |
It's only added for testing proposes | ||
*/ | ||
|
||
pub fn skip_next_instruction(vm: &mut VirtualMachine) -> Result<(), VirtualMachineError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be pub(crate)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm thinking this could be exposed for maximum composability with other test-oriented hints
Hello! we merged a PR recently that changed how the hint_processor is used, we now receive a mutable reference to it instead of a normal reference. The CI uses |
d688ceb
to
c256690
Compare
c256690
to
31fc4e7
Compare
Hi:)! I'll resolve the conflicts,
|
a058880
to
afa08f3
Compare
…ow for new features
afa08f3
to
b66b80b
Compare
What is the status on this PR:)? |
Hi @Eikix, sorry for the delays. I think the procedure in your last comment is sensible and the way to go. |
Hmmm, it doesn't build. It must have been broken by the toolchain updates. |
Thanks! Tried to rebase and fix issues due to rebase |
* DO NOT PUSH this commit * Add and AddAssign tests * Proptest for felt bitwise operations (#716) * DO NOT PUSH this commit * this works but a lot of the variables are 0 * add tests for the or and xor operations * fixed another test, where the prop_assume was in the wrong place to avoid dividing by zero * Update felt/src/lib.rs Co-authored-by: Mario Rugiero <mario.rugiero@lambdaclass.com> Co-authored-by: Martina <martina@martina> Co-authored-by: Mario Rugiero <mario.rugiero@lambdaclass.com> * Add proptest for felt subtraction (#722) * add test for subtraction * minor fix Co-authored-by: Martina <martina@martina> * Parse from string radix (#692) Co-authored-by: Juanma <juanma@Juanmas-MacBook-Air.local> * Neg prop test for felts (#721) * found a bug, when x is 0 the code breaks when applying the Neg operation * minor change * fixed bug for Neg operator Co-authored-by: Martina <martina@martina> * derive default for execution resources (#727) * Add Serialize trait to Felt (#724) Co-authored-by: Pedro Fontana <pedro.fontana@lamdaclass.com> * feat: enable the skip_instruction_exectution for hints (#645) * feat: enable the skip_instruction_exectution for hints * feat: add skip_next_instruction() as whitelisted hint * feat: update hint string to match python vm skip_instruction hint * feat: update hint text * feat: refactor skip_next_instruction into crate feature * fix: fix make compare command to ignore .noretrocompat.* files to allow for new features * feat: add mut to hintprocessor after main rebase * fix: fix clippy error -> reference instead of variable * fix: fix erros due to rebase * Whitespace Co-authored-by: Timothée Delabrouille <timothee.delabrouille@gmail.com> Co-authored-by: Mario Rugiero <mario.rugiero@nextroll.com> * Fix builtin security check. (#714) * verify signature hint (#702) * Add common signature test * Add hint to hint code * Add signature hint * Add signature test * Add test to signature-hint * Happy path test Co-authored-by: Juanma <juanma@Juanmas-MacBook-Air.local> * Mul assign felt proptest (#717) * DO NOT PUSH this commit * test for multiplication with assignment * minor fix Co-authored-by: Martina <martina@martina> Co-authored-by: Juan-M-V <102986292+Juan-M-V@users.noreply.github.com> * Fix: typos (#733) * Fix: typo Fix: typo * Fix: typos Fix: typos * Fix: typos Fix: typos * Fix: typos Fix: typos * Use CairoArg enum instead of Any in CairoRunner::run_from_entrypoint (#686) * Start get_traceback_entries + add convenience methos * Add fn is_call_instruction * add code * Refactor code * Clippy * Add get_traceback method * Fix get_error_attr_value * Add traceback to VmException * Make traceback non-optional * Add tests for is_call_instruction * Add traceback to error display * Add test + fix logic for get_traceback_entries * Code refactor * Add one more test for get_traceback_entries * Fix string format + add test for get_traceback * Improve fn * Add reference to is_call_instruction signature * Add reference to immediate in decode_instruction + remove clone * Fix hint_processor mutability in tests * Add Location::get_location_marks * Fix method to_string_with_contents * Fix string format * Fix string format * Update traceback tests * Add tests for Location::to_string_with_contents() * Fix intermediate string format * Fix test * Add tests for Location::get_location_marks() * Update VmException display * Fix string format * Fix string format * Remove debug print * Fix Display * Implement Display for MaybeRelocatable * Add real-case test for VmException Display * Remove debug format from erros containing MaybeRelocatable and Relocatable * Add tests for display implementation * Update Changelog * Clippy * Remove unnecessary & * Add hint location to InstructionLocation * Use InstructionLocation instead of Location in insruction_locations field of Program * Add hint location logic to get_location * Add rought version of VirtualMachineError::Hint * Add test for error display on HintError * Add test for get_location with hint_index * Start refactor * Update changelog * Finnish changing hint fns to HintError * Update custom hint example * Fix changelog format * Add changelog entry for this PR * Use CairoArg enum instead of Any in CairoRunner::run_from_entrypoint * Fix tests * Add tests + remove unused func * use slice instead of vec * Update changelog * Add non-typed helpers for ids variables * Swap BigInt for MaybeRelocatable in Dictionary * Update dict_hint_utils + dict macros in test_utils * Fix tests * Clippy * Add test for dict_write with relocatable * Add tests on hint_utils.rs * Add tetss on hint_processor_utils.rs * Add integration test for bug case * Update changelog * Fix eof * Remove debug print * Update readme (#729) * DO NOT PUSH this commit * Improve the About section * more changes * improve step by step instructions to use the repo * more changes * made requested changes in the hints section * removed (optional) as it was unnecessary Co-authored-by: Martina <martina@martina> * subtraction tests * delete unnecessary print Co-authored-by: Martina <martina@martina> Co-authored-by: Mario Rugiero <mario.rugiero@lambdaclass.com> Co-authored-by: Juan-M-V <102986292+Juan-M-V@users.noreply.github.com> Co-authored-by: Juanma <juanma@Juanmas-MacBook-Air.local> Co-authored-by: Juan Bono <juanbono94@gmail.com> Co-authored-by: Pedro Fontana <pedro.fontana@lambdaclass.com> Co-authored-by: Pedro Fontana <pedro.fontana@lamdaclass.com> Co-authored-by: Elias Tazartes <66871571+Eikix@users.noreply.github.com> Co-authored-by: Timothée Delabrouille <timothee.delabrouille@gmail.com> Co-authored-by: Mario Rugiero <mario.rugiero@nextroll.com> Co-authored-by: Alon Haramati <91828241+alonh5@users.noreply.github.com> Co-authored-by: omahs <73983677+omahs@users.noreply.github.com> Co-authored-by: fmoletta <99273364+fmoletta@users.noreply.github.com>
feat: enable the skip_instruction_execution for hints
the feature making hints able to disable next instruction executions was disabled
Description
New implementation for #518
#518
Adds an integration test for skip_instruction
Description of the pull request changes and motivation.
Checklist