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

[EIP-7706] State transition gas handling #13

Open
wants to merge 6 commits into
base: eip/7706
Choose a base branch
from

Conversation

mralj
Copy link
Collaborator

@mralj mralj commented Oct 19, 2024

This is the first PR tackling #12 (EIP-7706)

New transaction type

As per EIP-7706, this PR adds a new transaction type, called tx_vector_fee, named that way to immediately suggest that our fees are now multi-dimensional.
Furthermore, I've updated the core transaction type as well as the "old" transaction types (i.e., tx_dyamic_fee, tx_legacy, etc.) to align them with this EIP.

State transition gas changes

The focus of the PR is "gas handling" changes per EIP-7706 during state transition.
By "gas handling" I mean:

  1. Executing necessary gas validations (e.g., does the address have enough balance to cover gas + value costs)
  2. Purchasing gas
  3. Paying priority fees
  4. Refunding "over-purchased" gas back to address

Changes to state_transition follow this "template," exemplified on the preCheckGas

// ... 
// [rollup-geth]
if preCheckGasErr := st.preCheckGas(); preCheckGasErr != nil {
    return preCheckGasErr
}
// ...

This is to say, when, e.g., doing "gas pre-checks," I have:

  1. Extracted this code to separate function preCheckGas
  2. This function checks if the new EIP-7706 is enabled and, based on this, calls either
  3. "new EIP-7706" (preCheckGasEIP7706) or the "old code," now moved to the function preCheckGasEip4484

As mentioned above, other changes like buying gas or refunding gas follow the same pattern.
Code in the *EIP4484 functions is unchanged from the upstream

What's missing

Well everything not mentioned above 😅
But most importantly, block changes required by EIP-7706 are not in this PR, but they are planned for the next one :)

@mralj mralj marked this pull request as ready for review October 21, 2024 13:25
@mralj mralj self-assigned this Oct 21, 2024
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.

1 participant