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

Remove assert on downcast, fixing a panic #822

Merged
merged 3 commits into from
Oct 1, 2024
Merged

Conversation

edg-l
Copy link
Collaborator

@edg-l edg-l commented Sep 30, 2024

Fixes #821

Apparently in cairo you can downcast a smaller type into a bigger type (even both being non bounded ints), the code was already in place to handle this conversion (only needed to remove a unreachable and handle that path, i added a comment there).

Checklist

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

@edg-l edg-l added the review-ready A PR that is ready for review label Sep 30, 2024
@codecov-commenter
Copy link

codecov-commenter commented Sep 30, 2024

Codecov Report

Attention: Patch coverage is 38.82353% with 52 lines in your changes missing coverage. Please review.

Project coverage is 87.98%. Comparing base (ae17dd3) to head (374734f).

Files with missing lines Patch % Lines
src/libfuncs/cast.rs 38.82% 52 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #822      +/-   ##
==========================================
- Coverage   88.03%   87.98%   -0.06%     
==========================================
  Files         122      122              
  Lines       34270    34289      +19     
==========================================
- Hits        30171    30169       -2     
- Misses       4099     4120      +21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Sep 30, 2024

Benchmark results Main vs HEAD

Command Mean [s] Min [s] Max [s] Relative
head factorial_2M.cairo (JIT) 3.185 ± 0.024 3.130 3.214 1.01 ± 0.02
base factorial_2M.cairo (JIT) 3.167 ± 0.056 3.088 3.272 1.00
head factorial_2M.cairo (AOT) 3.200 ± 0.038 3.144 3.251 1.01 ± 0.02
base factorial_2M.cairo (AOT) 3.185 ± 0.031 3.145 3.223 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
head fib_2M.cairo (JIT) 2.730 ± 0.021 2.692 2.768 1.01 ± 0.02
base fib_2M.cairo (JIT) 2.730 ± 0.025 2.699 2.771 1.01 ± 0.02
head fib_2M.cairo (AOT) 2.715 ± 0.038 2.652 2.754 1.00
base fib_2M.cairo (AOT) 2.733 ± 0.025 2.688 2.773 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
head logistic_map.cairo (JIT) 3.162 ± 0.033 3.122 3.215 1.05 ± 0.02
base logistic_map.cairo (JIT) 3.254 ± 0.041 3.203 3.325 1.08 ± 0.02
head logistic_map.cairo (AOT) 3.023 ± 0.045 2.946 3.080 1.00
base logistic_map.cairo (AOT) 3.044 ± 0.037 2.990 3.110 1.01 ± 0.02

src/libfuncs/cast.rs Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Oct 1, 2024

Benchmark results Main vs HEAD

Command Mean [s] Min [s] Max [s] Relative
head factorial_2M.cairo (JIT) 3.073 ± 0.014 3.047 3.097 1.00 ± 0.01
base factorial_2M.cairo (JIT) 3.090 ± 0.021 3.057 3.117 1.01 ± 0.01
head factorial_2M.cairo (AOT) 3.080 ± 0.017 3.060 3.118 1.00 ± 0.01
base factorial_2M.cairo (AOT) 3.066 ± 0.012 3.041 3.083 1.00
Command Mean [s] Min [s] Max [s] Relative
head fib_2M.cairo (JIT) 2.620 ± 0.024 2.580 2.672 1.00
base fib_2M.cairo (JIT) 2.646 ± 0.013 2.627 2.663 1.01 ± 0.01
head fib_2M.cairo (AOT) 2.628 ± 0.018 2.599 2.653 1.00 ± 0.01
base fib_2M.cairo (AOT) 2.632 ± 0.015 2.598 2.654 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
head logistic_map.cairo (JIT) 3.032 ± 0.010 3.014 3.046 1.05 ± 0.01
base logistic_map.cairo (JIT) 3.045 ± 0.010 3.026 3.062 1.05 ± 0.01
head logistic_map.cairo (AOT) 2.893 ± 0.011 2.870 2.904 1.00
base logistic_map.cairo (AOT) 2.896 ± 0.016 2.876 2.928 1.00 ± 0.01

Copy link

github-actions bot commented Oct 1, 2024

Benchmark results Main vs HEAD

Command Mean [s] Min [s] Max [s] Relative
head factorial_2M.cairo (JIT) 3.157 ± 0.022 3.123 3.184 1.01 ± 0.01
base factorial_2M.cairo (JIT) 3.134 ± 0.026 3.091 3.164 1.00
head factorial_2M.cairo (AOT) 3.142 ± 0.026 3.092 3.182 1.00 ± 0.01
base factorial_2M.cairo (AOT) 3.152 ± 0.021 3.105 3.176 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
head fib_2M.cairo (JIT) 2.748 ± 0.025 2.707 2.789 1.02 ± 0.01
base fib_2M.cairo (JIT) 2.727 ± 0.030 2.672 2.757 1.01 ± 0.01
head fib_2M.cairo (AOT) 2.747 ± 0.031 2.700 2.791 1.02 ± 0.01
base fib_2M.cairo (AOT) 2.700 ± 0.021 2.666 2.731 1.00
Command Mean [s] Min [s] Max [s] Relative
head logistic_map.cairo (JIT) 3.122 ± 0.018 3.087 3.147 1.06 ± 0.01
base logistic_map.cairo (JIT) 3.100 ± 0.030 3.046 3.149 1.05 ± 0.01
head logistic_map.cairo (AOT) 2.958 ± 0.020 2.929 3.003 1.00 ± 0.01
base logistic_map.cairo (AOT) 2.947 ± 0.009 2.933 2.958 1.00

@pefontana pefontana added this pull request to the merge queue Oct 1, 2024
Merged via the queue into main with commit c866fbf Oct 1, 2024
15 checks passed
@pefontana pefontana deleted the fix_downcast_panic branch October 1, 2024 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review-ready A PR that is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Downcast panic in tx 0x7dc9fa07e754386498c5fe7b942da1d3a0a8f1de53c98b14aafc8aa411fe658
5 participants