Skip to content

Conversation

@cdiielsi
Copy link
Contributor

@cdiielsi cdiielsi commented Nov 4, 2025

Motivation

The ef test for Osaka that's run in the Hive integration testing site named osaka/eip7825_transaction_gas_limit_cap/test_tx_gas_limit.py::test_tx_gas_larger_than_block_gas_limit[fork_Osaka-blockchain_test_engine-exceed_block_gas_limit_False] is failing due to an error message mismatch. See here.
Besides we don't have any logic implemented when processing a block to stop computing transactions once the block's gas limit was surpassed.

Description

This pr adds a conditional to check if the block's gas limit can be potentially surpassed, and in that case stop computing any other transactions. So if tx.gas_limit > gas_available the block's execution must stop with an exception, as the spec says here.

To test it I run:

make build-image
cd hive
./hive --sim ethereum/eels/consume-engine --client ethrex --results-root results --client-file=../fixtures/hive/clients.yaml --sim.buildarg fixtures=https://github.com/ethereum/execution-spec-tests/releases/download/v5.3.0/fixtures_develop.tar.gz --sim.buildarg branch=forks/osaka --sim.loglevel=3 --sim.limit=".*test_tx_gas_larger_than_block_gas_limit.*"

This tx.gas_limit > gas_available check was already implemented for block building, as we can see here in ethrex/crates/blockchain/payload.rs The main difference is that instead of throwing an exception when the condition is false we keep searching for a transaction with a smaller gas_limit so it can be included in the block that's being built.

@github-actions github-actions bot added the L1 Ethereum client label Nov 4, 2025
@github-actions
Copy link

github-actions bot commented Nov 4, 2025

Lines of code report

Total lines added: 14
Total lines removed: 0
Total lines changed: 14

Detailed view
+---------------------------------------+-------+------+
| File                                  | Lines | Diff |
+---------------------------------------+-------+------+
| ethrex/crates/vm/backends/levm/mod.rs | 626   | +14  |
+---------------------------------------+-------+------+

@cdiielsi cdiielsi marked this pull request as ready for review November 4, 2025 19:47
@cdiielsi cdiielsi requested a review from a team as a code owner November 4, 2025 19:47
@ethrex-project-sync ethrex-project-sync bot moved this to In Review in ethrex_l1 Nov 4, 2025
Copy link
Collaborator

@MegaRedHand MegaRedHand left a comment

Choose a reason for hiding this comment

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

LGTM. We should add this check to block building.

@fmoletta fmoletta added this pull request to the merge queue Nov 5, 2025
Merged via the queue into main with commit 11fe1c1 Nov 5, 2025
46 checks passed
@fmoletta fmoletta deleted the fix_execute_block_when_surpassed_gas_limit branch November 5, 2025 15:32
@github-project-automation github-project-automation bot moved this from In Review to Done in ethrex_l1 Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L1 Ethereum client

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants