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

builtin cost rework with fixes and entry point info #875

Merged
merged 39 commits into from
Nov 11, 2024
Merged

Conversation

edg-l
Copy link
Collaborator

@edg-l edg-l commented Oct 22, 2024

This reverts commit 355c250.

We should test this change with a block range we know works with current main, to assert it adds no regressions.

Also adds entry point info, fixes #885

Checklist

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

@codecov-commenter
Copy link

codecov-commenter commented Oct 22, 2024

Codecov Report

Attention: Patch coverage is 85.27132% with 76 lines in your changes missing coverage. Please review.

Project coverage is 83.01%. Comparing base (9791075) to head (cdb84b2).

Files with missing lines Patch % Lines
src/executor/contract.rs 80.79% 29 Missing ⚠️
src/libfuncs/gas.rs 85.56% 14 Missing ⚠️
src/executor/aot.rs 82.97% 8 Missing ⚠️
src/executor/jit.rs 63.15% 7 Missing ⚠️
src/metadata/gas.rs 76.66% 7 Missing ⚠️
src/executor.rs 86.48% 5 Missing ⚠️
src/types.rs 0.00% 3 Missing ⚠️
runtime/src/lib.rs 83.33% 2 Missing ⚠️
src/utils.rs 98.68% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #875      +/-   ##
==========================================
+ Coverage   82.99%   83.01%   +0.01%     
==========================================
  Files         120      120              
  Lines       33866    34313     +447     
==========================================
+ Hits        28108    28485     +377     
- Misses       5758     5828      +70     

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

Copy link

github-actions bot commented Oct 22, 2024

Benchmarking results

Benchmark for program factorial_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 11.296 ± 0.093 11.163 11.438 8.33 ± 0.07
cairo-native (embedded AOT) 3.502 ± 0.025 3.477 3.544 2.58 ± 0.02
cairo-native (embedded JIT using LLVM's ORC Engine) 3.310 ± 0.031 3.267 3.356 2.44 ± 0.02
cairo-native (standalone AOT with -march=native) 1.356 ± 0.002 1.354 1.360 1.00

Benchmark for program fib_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 11.683 ± 0.040 11.605 11.734 143.71 ± 0.60
cairo-native (embedded AOT) 3.041 ± 0.028 3.013 3.102 37.40 ± 0.35
cairo-native (embedded JIT using LLVM's ORC Engine) 2.854 ± 0.022 2.822 2.896 35.11 ± 0.29
cairo-native (standalone AOT with -march=native) 0.081 ± 0.000 0.081 0.082 1.00

Benchmark for program logistic_map

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 4.422 ± 0.036 4.358 4.464 18.15 ± 0.15
cairo-native (embedded AOT) 3.219 ± 0.029 3.174 3.273 13.21 ± 0.12
cairo-native (embedded JIT using LLVM's ORC Engine) 3.105 ± 0.022 3.056 3.133 12.74 ± 0.09
cairo-native (standalone AOT with -march=native) 0.244 ± 0.001 0.243 0.245 1.00

Copy link

github-actions bot commented Oct 22, 2024

Benchmark results Main vs HEAD.

Command Mean [s] Min [s] Max [s] Relative
head factorial_2M.cairo (JIT) 3.203 ± 0.048 3.149 3.326 1.01 ± 0.02
base factorial_2M.cairo (JIT) 3.186 ± 0.034 3.148 3.252 1.00 ± 0.01
head factorial_2M.cairo (AOT) 3.376 ± 0.025 3.334 3.405 1.06 ± 0.01
base factorial_2M.cairo (AOT) 3.175 ± 0.016 3.144 3.192 1.00
Command Mean [s] Min [s] Max [s] Relative
head fib_2M.cairo (JIT) 2.743 ± 0.018 2.713 2.765 1.00
base fib_2M.cairo (JIT) 2.748 ± 0.049 2.707 2.844 1.00 ± 0.02
head fib_2M.cairo (AOT) 3.012 ± 0.042 2.943 3.069 1.10 ± 0.02
base fib_2M.cairo (AOT) 2.758 ± 0.034 2.696 2.802 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
head logistic_map.cairo (JIT) 3.138 ± 0.043 3.073 3.217 1.09 ± 0.02
base logistic_map.cairo (JIT) 3.051 ± 0.035 3.013 3.136 1.06 ± 0.02
head logistic_map.cairo (AOT) 3.128 ± 0.039 3.063 3.188 1.09 ± 0.02
base logistic_map.cairo (AOT) 2.880 ± 0.024 2.840 2.918 1.00

Copy link

github-actions bot commented Oct 22, 2024

✅ Code is now correctly formatted.

@edg-l edg-l changed the title builtin cost rework builtin cost rework with fixes Oct 22, 2024
@edg-l edg-l marked this pull request as ready for review October 22, 2024 12:39
azteca1998
azteca1998 previously approved these changes Oct 24, 2024
@edg-l edg-l mentioned this pull request Oct 25, 2024
5 tasks
* store entry point info, optimize abi storage

* use felt

* update hash
@edg-l edg-l changed the title builtin cost rework with fixes builtin cost rework with fixes and entry point info Oct 28, 2024
@edg-l
Copy link
Collaborator Author

edg-l commented Nov 6, 2024

There is currently a bug when using replay with this branch, i'm looking into it

to reproduce with replay:

rm -rf compiled_programs/ ; cargo run --release -- tx 0x57c072b3774f8e5c4776efabaefa4b029216058beab53d4b1a54f3d9fbf671d mainnet 742001
vs
rm -rf compiled_programs/ ; cargo run -- tx 0x57c072b3774f8e5c4776efabaefa4b029216058beab53d4b1a54f3d9fbf671d mainnet 742001 

@edg-l
Copy link
Collaborator Author

edg-l commented Nov 6, 2024

There is currently a bug when using replay with this branch, i'm looking into it

to reproduce with replay:

rm -rf compiled_programs/ ; cargo run --release -- tx 0x57c072b3774f8e5c4776efabaefa4b029216058beab53d4b1a54f3d9fbf671d mainnet 742001
vs
rm -rf compiled_programs/ ; cargo run -- tx 0x57c072b3774f8e5c4776efabaefa4b029216058beab53d4b1a54f3d9fbf671d mainnet 742001 

Fixed, was a problem with using a stack value on recursive contract calls

@pefontana pefontana marked this pull request as ready for review November 8, 2024 21:23
Copy link
Collaborator

@pefontana pefontana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one @edg-l !

@edg-l edg-l added this pull request to the merge queue Nov 11, 2024
@edg-l edg-l mentioned this pull request Nov 11, 2024
5 tasks
Merged via the queue into main with commit 4d24686 Nov 11, 2024
41 checks passed
@edg-l edg-l deleted the revert_revert branch November 11, 2024 10:23
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.

Add entry_point_by_type mapping to the contract executor
6 participants