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

feat(hints): Implement NewHint#62 and NewHint#54 #1035

Merged
merged 14 commits into from
Apr 25, 2023
Merged

feat(hints): Implement NewHint#62 and NewHint#54 #1035

merged 14 commits into from
Apr 25, 2023

Conversation

pefontana
Copy link
Member

@pefontana pefontana commented Apr 21, 2023

Implement Hints #62 and #54

Hint54

                "from starkware.cairo.common.cairo_secp.secp_utils import pack",
                "SECP_P = 2**255-19",
                "to_assert = pack(ids.val, PRIME)",
                "q, r = divmod(pack(ids.val, PRIME), SECP_P)",
                "assert r == 0, f\"verify_zero: Invalid input {ids.val.d0, ids.val.d1, ids.val.d2}.\"",
                "ids.q = q % PRIME"

Hint62

                "from starkware.python.math_utils import line_slope",
                "from starkware.cairo.common.cairo_secp.secp_utils import pack",
                "SECP_P = 2**255-19",
                "# Compute the slope.",
                "x0 = pack(ids.point0.x, PRIME)",
                "y0 = pack(ids.point0.y, PRIME)",
                "x1 = pack(ids.point1.x, PRIME)",
                "y1 = pack(ids.point1.y, PRIME)",
                "value = slope = line_slope(point1=(x0, y0), point2=(x1, y1), p=SECP_P)"

Issue: #979

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.

@pefontana pefontana added the whitelisted-hint Implementation of hint on whitelist directory label Apr 24, 2023
@pefontana pefontana changed the title Hint #62 Implement Hints #62 and #54 Apr 24, 2023
@pefontana pefontana marked this pull request as ready for review April 24, 2023 20:16
@github-actions
Copy link

github-actions bot commented Apr 24, 2023

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 2.980 ± 0.028 2.951 3.030 1.01 ± 0.01
head blake2s_integration_benchmark 2.959 ± 0.027 2.935 3.014 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 3.639 ± 0.026 3.606 3.688 1.02 ± 0.01
head compare_arrays_200000 3.573 ± 0.023 3.551 3.623 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 2.690 ± 0.015 2.669 2.721 1.02 ± 0.01
head dict_integration_benchmark 2.642 ± 0.012 2.629 2.673 1.00
Command Mean [s] Min [s] Max [s] Relative
base factorial_multirun 4.345 ± 0.017 4.326 4.381 1.02 ± 0.01
head factorial_multirun 4.268 ± 0.015 4.247 4.290 1.00
Command Mean [s] Min [s] Max [s] Relative
base fibonacci_1000_multirun 3.557 ± 0.023 3.528 3.597 1.01 ± 0.01
head fibonacci_1000_multirun 3.512 ± 0.015 3.494 3.540 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base field_arithmetic_get_square_benchmark 136.9 ± 0.5 135.8 137.7 1.01 ± 0.01
head field_arithmetic_get_square_benchmark 135.4 ± 0.5 134.5 136.2 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 3.480 ± 0.028 3.460 3.553 1.02 ± 0.01
head integration_builtins 3.420 ± 0.015 3.393 3.443 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 3.268 ± 0.013 3.246 3.290 1.01 ± 0.00
head keccak_integration_benchmark 3.229 ± 0.008 3.214 3.246 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 3.773 ± 0.025 3.748 3.833 1.02 ± 0.01
head linear_search 3.697 ± 0.045 3.672 3.822 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 3.139 ± 0.056 3.102 3.286 1.02 ± 0.02
head math_cmp_and_pow_integration_benchmark 3.084 ± 0.044 3.063 3.206 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 2.793 ± 0.011 2.780 2.821 1.02 ± 0.01
head math_integration_benchmark 2.739 ± 0.010 2.722 2.753 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 2.473 ± 0.033 2.445 2.553 1.02 ± 0.02
head memory_integration_benchmark 2.425 ± 0.027 2.403 2.497 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 2.475 ± 0.012 2.458 2.494 1.01 ± 0.01
head operations_with_data_structures_benchmarks 2.446 ± 0.028 2.428 2.521 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 819.1 ± 2.1 816.2 822.4 1.01 ± 0.01
head pedersen 814.2 ± 8.7 808.9 838.8 1.00
Command Mean [s] Min [s] Max [s] Relative
base poseidon_integration_benchmark 1.543 ± 0.007 1.533 1.553 1.01 ± 0.01
head poseidon_integration_benchmark 1.534 ± 0.007 1.523 1.546 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 2.737 ± 0.010 2.723 2.760 1.01 ± 0.00
head secp_integration_benchmark 2.720 ± 0.008 2.709 2.731 1.00
Command Mean [s] Min [s] Max [s] Relative
base set_integration_benchmark 1.945 ± 0.006 1.934 1.956 1.00 ± 0.00
head set_integration_benchmark 1.942 ± 0.006 1.935 1.952 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.345 ± 0.011 4.330 4.371 1.01 ± 0.00
head uint256_integration_benchmark 4.295 ± 0.012 4.269 4.308 1.00

@pefontana pefontana changed the title Implement Hints #62 and #54 feat(hints): Implement NewHint#62 and NewHint#54 Apr 24, 2023
@codecov
Copy link

codecov bot commented Apr 24, 2023

Codecov Report

Merging #1035 (a2fe1ab) into main (ce36cf7) will increase coverage by 0.00%.
The diff coverage is 98.91%.

@@           Coverage Diff           @@
##             main    #1035   +/-   ##
=======================================
  Coverage   98.08%   98.08%           
=======================================
  Files          84       84           
  Lines       33375    33459   +84     
=======================================
+ Hits        32735    32818   +83     
- Misses        640      641    +1     
Impacted Files Coverage Δ
...rocessor/builtin_hint_processor/secp/secp_utils.rs 100.00% <ø> (ø)
..._processor/builtin_hint_processor/secp/ec_utils.rs 99.45% <97.77%> (-0.12%) ⬇️
...int_processor/builtin_hint_processor_definition.rs 98.91% <100.00%> (+0.03%) ⬆️
...ocessor/builtin_hint_processor/secp/field_utils.rs 99.70% <100.00%> (+0.01%) ⬆️

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

@fmoletta fmoletta mentioned this pull request Apr 25, 2023
6 tasks
@pefontana pefontana added this pull request to the merge queue Apr 25, 2023
Merged via the queue into main with commit 4842bf1 Apr 25, 2023
15 checks passed
@pefontana pefontana deleted the hint-62 branch April 25, 2023 20:27
MegaRedHand pushed a commit that referenced this pull request Apr 25, 2023
* Add hint code

* Add cairo_programs/compute_slope_v2.cairo

* add hints code

* implement compute_slope_v2

* Implement VERIFY_ZERO_V3

* Add verify_zero_v3 unit tests

* Add COMPUTE_SLOPE_V2 unit test

* Update CHANGELOG.md

* cargo clippy

* Add integration test

* cargo clippy
kariy pushed a commit to dojoengine/cairo-rs that referenced this pull request Jun 23, 2023
* Add hint code

* Add cairo_programs/compute_slope_v2.cairo

* add hints code

* implement compute_slope_v2

* Implement VERIFY_ZERO_V3

* Add verify_zero_v3 unit tests

* Add COMPUTE_SLOPE_V2 unit test

* Update CHANGELOG.md

* cargo clippy

* Add integration test

* cargo clippy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
whitelisted-hint Implementation of hint on whitelist directory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants