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: dibit shouldn't fail when m is zero #1247

Merged
merged 5 commits into from
Jun 16, 2023
Merged

fix: dibit shouldn't fail when m is zero #1247

merged 5 commits into from
Jun 16, 2023

Conversation

MegaRedHand
Copy link
Contributor

Closes: #1245

Description

This PR fixes a check in the n_pair_bits function called from the dibit hint that was only correct for the quad_bit hint.

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.

It was always checking that `m` wasn't zero, but that was correct only for a `number_of_pairs` equal to 2 (i.e. quad_bit).
@codecov
Copy link

codecov bot commented Jun 16, 2023

Codecov Report

Merging #1247 (2a9626f) into main (8a72ddc) will increase coverage by 0.00%.
The diff coverage is 95.65%.

@@           Coverage Diff           @@
##             main    #1247   +/-   ##
=======================================
  Coverage   97.59%   97.59%           
=======================================
  Files          89       89           
  Lines       36138    36152   +14     
=======================================
+ Hits        35268    35282   +14     
  Misses        870      870           
Impacted Files Coverage Δ
..._processor/builtin_hint_processor/secp/ec_utils.rs 99.54% <95.65%> (+<0.01%) ⬆️

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

@github-actions
Copy link

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 10.947 ± 0.063 10.844 11.038 1.00
head blake2s_integration_benchmark 10.958 ± 0.058 10.893 11.079 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 3.853 ± 0.039 3.811 3.927 1.00
head compare_arrays_200000 3.883 ± 0.073 3.833 4.046 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 2.563 ± 0.034 2.534 2.634 1.01 ± 0.01
head dict_integration_benchmark 2.542 ± 0.011 2.528 2.563 1.00
Command Mean [s] Min [s] Max [s] Relative
base factorial_multirun 4.073 ± 0.030 4.045 4.134 1.00
head factorial_multirun 4.083 ± 0.016 4.057 4.108 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base fibonacci_1000_multirun 3.405 ± 0.015 3.387 3.430 1.00
head fibonacci_1000_multirun 3.416 ± 0.046 3.390 3.543 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.918 ± 0.021 1.901 1.971 1.00 ± 0.01
head field_arithmetic_get_square_benchmark 1.914 ± 0.010 1.902 1.936 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 9.757 ± 0.143 9.588 10.029 1.00 ± 0.04
head integration_builtins 9.737 ± 0.317 9.512 10.621 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 11.137 ± 0.212 10.934 11.532 1.01 ± 0.02
head keccak_integration_benchmark 10.996 ± 0.092 10.884 11.172 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 3.885 ± 0.086 3.834 4.120 1.01 ± 0.02
head linear_search 3.836 ± 0.017 3.813 3.865 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 2.780 ± 0.020 2.759 2.816 1.01 ± 0.01
head math_cmp_and_pow_integration_benchmark 2.763 ± 0.007 2.755 2.782 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 2.531 ± 0.035 2.508 2.628 1.01 ± 0.01
head math_integration_benchmark 2.514 ± 0.008 2.506 2.528 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 2.223 ± 0.010 2.211 2.241 1.00
head memory_integration_benchmark 2.225 ± 0.012 2.212 2.253 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 2.492 ± 0.008 2.476 2.502 1.00
head operations_with_data_structures_benchmarks 2.495 ± 0.020 2.476 2.543 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 871.6 ± 1.7 869.5 874.9 1.00
head pedersen 872.5 ± 2.1 869.8 876.3 1.00 ± 0.00
Command Mean [s] Min [s] Max [s] Relative
base poseidon_integration_benchmark 1.543 ± 0.008 1.533 1.553 1.00 ± 0.01
head poseidon_integration_benchmark 1.540 ± 0.007 1.531 1.555 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 2.965 ± 0.016 2.939 3.003 1.01 ± 0.01
head secp_integration_benchmark 2.941 ± 0.009 2.931 2.960 1.00
Command Mean [s] Min [s] Max [s] Relative
base set_integration_benchmark 1.658 ± 0.025 1.635 1.726 1.00 ± 0.02
head set_integration_benchmark 1.650 ± 0.003 1.647 1.654 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 7.025 ± 0.033 6.995 7.109 1.00 ± 0.01
head uint256_integration_benchmark 7.006 ± 0.011 6.994 7.029 1.00

@juanbono juanbono added this pull request to the merge queue Jun 16, 2023
Merged via the queue into main with commit ad25b63 Jun 16, 2023
30 of 31 checks passed
@juanbono juanbono deleted the fix-dibit-check branch June 16, 2023 21:19
kariy pushed a commit to dojoengine/cairo-rs that referenced this pull request Jun 23, 2023
* Fix test

* Fix n_pair_bits if condition

It was always checking that `m` wasn't zero, but that was correct only for a `number_of_pairs` equal to 2 (i.e. quad_bit).

* Rename error

* Update changelog

* Add test for quad_bit with `m == 0`
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.

dibit hint not equivalent with Python implementation
3 participants