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

fix: return error when hint's PC is invalid #1340

Merged
merged 10 commits into from
Jul 20, 2023
Merged

fix: return error when hint's PC is invalid #1340

merged 10 commits into from
Jul 20, 2023

Conversation

MegaRedHand
Copy link
Contributor

@MegaRedHand MegaRedHand commented Jul 18, 2023

Closes #1338

Description

This PR fixes the panic described in the issue by checking that a hint's PC is valid (lower than the data segment's length).

Also, modifies the jsons cache so that manually compiled programs aren't cached, and unifies path arguments in them.

Checklist

  • Linked to Github Issue
  • Unit tests added
  • Integration tests added.
  • This change requires new documentation.
    • Documentation has been added/updated.
    • CHANGELOG has been updated.

@github-actions
Copy link

github-actions bot commented Jul 18, 2023

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 4.150 ± 0.023 4.123 4.209 1.00
head big_factorial 4.151 ± 0.013 4.136 4.174 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 3.514 ± 0.008 3.502 3.525 1.00
head big_fibonacci 3.523 ± 0.008 3.514 3.537 1.00 ± 0.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 9.661 ± 0.015 9.643 9.683 1.00
head blake2s_integration_benchmark 9.712 ± 0.036 9.685 9.807 1.01 ± 0.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 3.573 ± 0.007 3.562 3.585 1.00
head compare_arrays_200000 3.607 ± 0.057 3.569 3.767 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 2.423 ± 0.007 2.415 2.439 1.01 ± 0.00
head dict_integration_benchmark 2.410 ± 0.005 2.399 2.416 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.764 ± 0.004 1.757 1.772 1.00
head field_arithmetic_get_square_benchmark 1.785 ± 0.039 1.769 1.895 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 9.602 ± 0.078 9.546 9.808 1.00 ± 0.01
head integration_builtins 9.590 ± 0.057 9.562 9.748 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 9.786 ± 0.060 9.759 9.956 1.00
head keccak_integration_benchmark 9.838 ± 0.058 9.787 9.958 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base linear_search 3.583 ± 0.010 3.570 3.605 1.00 ± 0.00
head linear_search 3.576 ± 0.012 3.561 3.594 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 2.624 ± 0.006 2.614 2.634 1.00
head math_cmp_and_pow_integration_benchmark 2.650 ± 0.004 2.642 2.658 1.01 ± 0.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 2.370 ± 0.006 2.363 2.383 1.00
head math_integration_benchmark 2.380 ± 0.014 2.358 2.411 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 2.068 ± 0.007 2.058 2.079 1.00
head memory_integration_benchmark 2.074 ± 0.002 2.071 2.078 1.00 ± 0.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 2.305 ± 0.006 2.295 2.314 1.00
head operations_with_data_structures_benchmarks 2.314 ± 0.006 2.308 2.325 1.00 ± 0.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 842.4 ± 1.3 839.9 844.3 1.00 ± 0.00
head pedersen 841.3 ± 1.3 839.7 843.3 1.00
Command Mean [s] Min [s] Max [s] Relative
base poseidon_integration_benchmark 1.479 ± 0.003 1.472 1.483 1.00 ± 0.00
head poseidon_integration_benchmark 1.474 ± 0.005 1.468 1.484 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 2.794 ± 0.005 2.787 2.801 1.00
head secp_integration_benchmark 2.797 ± 0.006 2.788 2.810 1.00 ± 0.00
Command Mean [s] Min [s] Max [s] Relative
base set_integration_benchmark 1.435 ± 0.008 1.426 1.446 1.01 ± 0.01
head set_integration_benchmark 1.427 ± 0.001 1.425 1.429 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 6.477 ± 0.017 6.460 6.516 1.00
head uint256_integration_benchmark 6.482 ± 0.019 6.466 6.524 1.00 ± 0.00

@MegaRedHand MegaRedHand marked this pull request as ready for review July 19, 2023 14:08
@codecov
Copy link

codecov bot commented Jul 19, 2023

Codecov Report

Merging #1340 (f28bbde) into main (2a1f732) will increase coverage by 0.00%.
The diff coverage is 98.41%.

@@           Coverage Diff           @@
##             main    #1340   +/-   ##
=======================================
  Coverage   97.50%   97.50%           
=======================================
  Files          92       92           
  Lines       37684    37733   +49     
=======================================
+ Hits        36745    36793   +48     
- Misses        939      940    +1     
Impacted Files Coverage Δ
vm/src/serde/deserialize_program.rs 97.33% <97.91%> (+0.01%) ⬆️
vm/src/types/program.rs 99.53% <100.00%> (+<0.01%) ⬆️
vm/src/utils.rs 99.50% <100.00%> (+<0.01%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@pefontana pefontana added this pull request to the merge queue Jul 20, 2023
Merged via the queue into main with commit 7e5378a Jul 20, 2023
36 checks passed
@pefontana pefontana deleted the fix-big-hint-pcs branch July 20, 2023 14:58
kariy pushed a commit to dojoengine/cairo-rs that referenced this pull request Jul 25, 2023
* Add test for failing program

* Return error when some hint's PC isn't valid

* Fix tests (+add test)

* Appease clippy

* Add some docs

* Update changelog

* Ignore manually compiled jsons in workflows cache

* Fix warning in wasm-demo

* Fix hash not hashing wasm-demo program

* Fix mismatching paths
kariy pushed a commit to dojoengine/cairo-rs that referenced this pull request Jul 25, 2023
* Add test for failing program

* Return error when some hint's PC isn't valid

* Fix tests (+add test)

* Appease clippy

* Add some docs

* Update changelog

* Ignore manually compiled jsons in workflows cache

* Fix warning in wasm-demo

* Fix hash not hashing wasm-demo program

* Fix mismatching paths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VM crashes with big hint PCs
3 participants