Skip to content

Update EIP-8037: Calldata floor accounting alignment & call-frame refill clarification#11706

Merged
eth-bot merged 8 commits into
ethereum:masterfrom
misilva73:update-eip-8037
Jun 1, 2026
Merged

Update EIP-8037: Calldata floor accounting alignment & call-frame refill clarification#11706
eth-bot merged 8 commits into
ethereum:masterfrom
misilva73:update-eip-8037

Conversation

@misilva73

@misilva73 misilva73 commented May 20, 2026

Copy link
Copy Markdown
Contributor

Updates to EIP-8037 covering four changes:

  1. Calldata floor gas accounting — aligns block- and transaction-level gas accounting by applying the EIP-7623 calldata floor at the transaction level (deriving regular gas from the post-refund value), clarifies floor/refund interaction and receipt accounting, and adds an "Integration with EIP-7778" subsection.
  2. Call refill clarification — extend the state-gas refill rule for CALL*/CREATE/CREATE2 to cover cases where the operation is unsuccessful before entering the call frame (e.g., insufficient balance, stack depth limit), not only revert/exceptional halt inside the frame.
  3. Deterministic deployment factories caveat — adds a caveat that deterministic deployment factories (Nick's method, ERC-2470, CreateX, etc.) won't deploy via their presigned transactions on new networks activating from genesis, since state creation costs exceed the hardcoded gas limits.
  4. CREATE/CREATE2 clarification — clarifies that CREATE/CREATE2 to a balance-only (codeless, zero-nonce) account skips the account-creation charge.
  5. Authors — add Dragan Rakita (@rakita) to the author list.

@github-actions github-actions Bot added c-update Modifies an existing proposal s-draft This EIP is a Draft t-core labels May 20, 2026
@eth-bot

eth-bot commented May 20, 2026

Copy link
Copy Markdown
Collaborator

✅ All reviewers have approved.

Comment thread EIPS/eip-8037.md Outdated
tx_state_gas = intrinsic_state_gas + tx_output.execution_state_gas_used

if calldata_floor_gas_cost >= tx_gas_used_after_refund:
tx_regular_gas = tx_gas_used - tx_state_gas

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks strange to me,

block_output.block_regular_gas_used should not contain floor gas calculation, but tx_gas_used is max(tx_gas_used_after_refund, calldata_floor_gas_cost) so this does not compute for me.

Comment thread EIPS/eip-8037.md
State-gas accounting for `CALL*` and `CREATE`/`CREATE2` operations is performed right before the respective call frame. If the respective call frame reverts or halts exceptionally, the charged state-gas is refilled back to the `state_gas_reservoir` and `execution_state_gas_used` decreases by the same amount.
State-gas accounting for `CALL*` and `CREATE`/`CREATE2` operations is performed right before the respective call frame. If the respective call frame reverts or halts exceptionally or if the operation is unsuccessful before entering the call frame (e.g., due to insufficient balance or due to the stack depth), the charged state-gas is refilled back to the `state_gas_reservoir` and `execution_state_gas_used` decreases by the same amount.

The same applies to top-level contract-creation transactions. If the transaction reverts or halts, the `STATE_BYTES_PER_NEW_ACCOUNT × CPSB` portion of `intrinsic_state_gas` is refilled back to `state_gas_reservoir` and `execution_state_gas_used` decreases by the same amount.

@Helkomine Helkomine May 21, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If the destination account of a valid created transaction is not empty (only if the balance > 0), so we shouldn't charge a fee or have to refill STATE_BYTES_PER_NEW_ACCOUNT × CPSB for it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am not sure what you mean. This covers CALL and CREATE, not eth transfers

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What I mean is that an account that is the target of a create transaction is still valid if only its balance > 0 and everything else is 0 according to eip684. However, the cost of CREATE you provided is (STATE_BYTES_PER_NEW_ACCOUNT + L) × CPSB, in which case the expected cost is L x CPSB.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Got it. It should be clarified now

rakita added a commit to bluealloy/revm that referenced this pull request May 26, 2026
…3719)

* fix(eip-8037): apply EIP-7778 branching to block_regular_gas_used

Replace `max(total_gas_spent - state_gas_spent, floor_gas)` with the
conditional formula from EIP-8037 + EIP-7778 (PR ethereum/EIPs#11706):

- Floor-dominant (floor_gas >= total_gas_spent - refunded):
  block_regular = tx_gas_used - state_gas_spent
- Refund-dominant: block_regular = total_gas_spent - state_gas_spent
  (pre-refund, since refunds are excluded from block accounting)

Floor gas no longer participates as a `max(...)` against the regular
component; it only contributes through `tx_gas_used` when it dominates
the post-refund total.

* fix(eip-8037): exclude floor and refund from block_regular_gas_used

Per EIP-8037 + EIP-7778, block-level regular gas accounting is the
pre-refund regular component of execution. Refund and floor are scalar
adjustments on the combined `state + regular` total and only affect the
receipt's `tx_gas_used`, not the block-level split.

block_regular_gas_used = total_gas_spent - state_gas_spent
@misilva73 misilva73 marked this pull request as ready for review June 1, 2026 08:52
@misilva73 misilva73 requested a review from eth-bot as a code owner June 1, 2026 08:52
@misilva73

Copy link
Copy Markdown
Contributor Author

@eth-bot rerun

@eth-bot eth-bot enabled auto-merge (squash) June 1, 2026 08:54

@eth-bot eth-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All Reviewers Have Approved; Performing Automatic Merge...

@eth-bot eth-bot merged commit 1d65ced into ethereum:master Jun 1, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c-update Modifies an existing proposal s-draft This EIP is a Draft t-core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants