Skip to content

Comments

feat(evm): split gas tracking into execution vs storage creation gas (TIP-1016)#2734

Open
fgimenez wants to merge 4 commits intotip1016from
fgimenez/chain-791
Open

feat(evm): split gas tracking into execution vs storage creation gas (TIP-1016)#2734
fgimenez wants to merge 4 commits intotip1016from
fgimenez/chain-791

Conversation

@fgimenez
Copy link
Member

Closes CHAIN-791

Adds block-level plumbing to track execution gas and storage creation gas separately in TempoBlockExecutor.

  • Added cumulative_full_gas_used and cumulative_storage_creation_gas fields to TempoBlockExecutor
  • commit_transaction now computes execution_gas = full_gas - storage_creation_gas and only execution gas counts toward block gas limits (non_shared_gas_left, non_payment_gas_left)
  • Receipts and cumulative_full_gas_used continue to track full gas (execution + storage creation)
  • finish() returns execution gas (not full gas) for the block header gas field
  • storage_creation_gas is hardcoded to 0 with a TODO — it will be populated once handler-level tracking lands (CHAIN-789 / PR feat!(evm): split intrinsic gas between regular and state gas for T2+ (TIP-1016) #2714)

Note: hardfork gating is not required. With storage_creation_gas = 0, all gas accounting is identical to the current behavior. The hardfork gate (T2) lives in the handler layer, not here. This is pure plumbing that becomes active only when upstream EVM tracking is enabled.

@fgimenez fgimenez requested a review from rakita February 17, 2026 11:17
@fgimenez fgimenez added C-enhancement New feature or request A-evm Related to the EVM labels Feb 17, 2026
@github-actions
Copy link

github-actions bot commented Feb 17, 2026

⚠️ Changelog not found.

A changelog entry is required before merging. We've generated a suggested changelog based on your changes:

Preview
---
tempo-consensus: patch
tempo-evm: minor
---

Fixed TIP-1016 consensus validation to allow block header `gas_used` to be less than or equal to the last receipt's `cumulative_gas_used`, accommodating the split between execution gas and storage creation gas. Added gas tracking fields to `TempoBlockExecutor` to separately accumulate total and storage creation gas, ensuring block headers report execution-only gas while receipts retain total cumulative gas.

Add changelog to commit this to your branch.


/// Tracks full cumulative gas used (execution + storage creation) for receipts.
/// This differs from block gas limit accounting which only counts execution gas.
cumulative_full_gas_used: u64,
Copy link
Contributor

Choose a reason for hiding this comment

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

cumulative_total_gas_used total naming is used in tip1016

Copy link
Member Author

Choose a reason for hiding this comment

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

ok changed total_gas -> full_gas

// the EVM-level tracking is implemented.
let storage_creation_gas: u64 = 0;

let full_gas_used = self.inner.commit_transaction(inner)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

I see, we need to change alloy/evm traits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-evm Related to the EVM C-enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants