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

opti: charge_gas #1323

Merged
merged 6 commits into from
Aug 7, 2024
Merged

opti: charge_gas #1323

merged 6 commits into from
Aug 7, 2024

Conversation

obatirou
Copy link
Collaborator

@obatirou obatirou commented Aug 2, 2024

Time spent on this PR:

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe): opti

What is the current behavior?

Resolves #1261

What is the new behavior?

Fix async tests

Tests using get_contract were skipped in local and CI due to not being able to run this function as get_solidity_contract was not awaited and get_contract not marked as async. With those changes, they now run in local and CI. They are using a sync version of get_contract.

chage_gas consume less step

A gain of 9.5%

  • Before: 156433
  • After with inlining: 141777

Test run: poetry run pytest tests/src/kakarot -k test_loop_profiling\[10] --profile-cairo

Before: 156433
before

After with inlining: 141777
profile004


This change is Reviewable

src/kakarot/evm.cairo Show resolved Hide resolved
src/kakarot/evm.cairo Outdated Show resolved Hide resolved
@obatirou obatirou marked this pull request as ready for review August 5, 2024 08:47
enitrat
enitrat previously approved these changes Aug 5, 2024
Copy link
Collaborator

@enitrat enitrat left a comment

Choose a reason for hiding this comment

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

lgtm under the assumption that gas_left < RC_BOUND

@obatirou
Copy link
Collaborator Author

obatirou commented Aug 5, 2024

lgtm under the assumption that gas_left < RC_BOUND

Let's wait to close #1329 before merging this one then

Copy link

codecov bot commented Aug 6, 2024

Codecov Report

Attention: Patch coverage is 30.76923% with 18 lines in your changes missing coverage. Please review.

Project coverage is 64.36%. Comparing base (e64ee4a) to head (6d4fbf3).
Report is 1 commits behind head on main.

Files Patch % Lines
src/kakarot/evm.cairo 30.76% 18 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1323      +/-   ##
==========================================
- Coverage   67.82%   64.36%   -3.47%     
==========================================
  Files          46       50       +4     
  Lines        6983     8676    +1693     
==========================================
+ Hits         4736     5584     +848     
- Misses       2247     3092     +845     

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

tests/src/kakarot/test_evm.py Outdated Show resolved Hide resolved
tests/src/kakarot/test_evm.py Outdated Show resolved Hide resolved
@obatirou obatirou merged commit 7112b36 into kkrt-labs:main Aug 7, 2024
6 checks passed
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.

feat: optimize evm.charge_gas
2 participants