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(levm): change gas consumption order and some logic #1414

Merged
merged 6 commits into from
Dec 5, 2024

Conversation

JereSalo
Copy link
Contributor

@JereSalo JereSalo commented Dec 5, 2024

Motivation

  • Gas consumption order is wrong, we are substracting balance from the user at the end of the transaction and that's not how it should be.
  • There are some things to fix and organize related to gas usage so this PR can address that.

Description

  • Contemplates gas refunds for coinbase fee
  • Substracts up-front cost from user pre-execution and returns unused gas contemplating gas refunds post-execution.
  • Changes behavior when reverting create post execution -> If revert reason is the RevertOpcode don't consume remaining gas.
  • validate_transaction is now named prepare_execution because it both validates and makes pre-execution changes (that are very related with validations). Is has added functionalities like adding the value to the receiver's balance.
  • It creates method post_execution_changes() for organizing transact() method

Tests Passing: 1734 total, with last main changes.

@JereSalo JereSalo added the levm Lambda EVM implementation label Dec 5, 2024
@JereSalo JereSalo self-assigned this Dec 5, 2024
@JereSalo JereSalo marked this pull request as ready for review December 5, 2024 18:38
@JereSalo JereSalo requested a review from a team as a code owner December 5, 2024 18:38
Copy link
Contributor

@ilitteri ilitteri left a comment

Choose a reason for hiding this comment

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

LGTM. Great work!

Copy link
Contributor

@maximopalopoli maximopalopoli left a comment

Choose a reason for hiding this comment

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

LGTM

@JereSalo JereSalo added this pull request to the merge queue Dec 5, 2024
Merged via the queue into main with commit ab7d6bc Dec 5, 2024
5 checks passed
@JereSalo JereSalo deleted the levm/change_gas_consumption_order branch December 5, 2024 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
levm Lambda EVM implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants