Skip to content

Block execution - #25

Merged
sbillig merged 12 commits into
mainfrom
feat/block-execution
Nov 16, 2026
Merged

sbillig merged 12 commits into
mainfrom
feat/block-execution

Conversation

@sbillig

@sbillig sbillig commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Adds block execution.

  • Evm holds the world and Config across transactions, with the allocations they reuse. transact, simulate and validate take a request and its block; world(), world_mut(), set_world, set_config and into_world work between them. fevm serve, the conformance driver and the soak driver use it.
  • Block holds an Evm from begin to finish. begin records the parent hash for BLOCKHASH and makes the EIP-4788 and EIP-2935 system calls. transact checks a transaction against the block's remaining gas and blob gas and adds its cumulative gas, logs bloom and EIP-6110 deposits. finish credits withdrawals (EIP-4895), calls the EIP-7002 and EIP-7251 request contracts (from Amsterdam also EIP-8282's builder request contracts), and returns the Evm with a BlockOutput: gas used, blob gas used, logs bloom, requests and requests hash, and from Amsterdam the EIP-7928 block access list with its hash. A missing or failing request contract, a malformed deposit or an oversized access list gives a BlockError.
  • rlp::Encoder for the access list.
  • fevm_tools conformance runs a release's blockchain_tests through Block in native/conformance/driver, and CI runs them for Osaka and Amsterdam.

Left to the host: header validation against the parent, transaction decoding and sender recovery, Merkle roots, and undoing an invalid block (keep a try_clone of the world). The blockchain test runner skips invalid blocks that only these checks would reject and counts them in blocks_not_judged.

Notes for review:

  • The old transact/simulate API that took the world by value and returned Applied is removed, with no compatibility layer.
  • CALL, CALLCODE, DELEGATECALL, STATICCALL and SELFDESTRUCT now pay for an account access before reading it, and SSTORE warms its slot before its charge, matching the specification's order. An access that runs out of gas is not listed as a read.
  • The first commit trusts the precompiles ingot in the soak driver. It fixes a soak driver build failure that predates this branch.

The soak driver builds on its own, outside the workspace, and its
transactions reach the precompiles' unsafe code, which Fe now rejects
unless the driver trusts that ingot too.
`transact` and `simulate` took the world and buffers by value and
returned them in `Applied`, so each transaction copied both in and out
of its `Transaction`. `Evm` holds them across transactions:
`Evm::new(world, config)`, then `transact`, `simulate` and `validate`
with a request and its block, and `world()`, `world_mut()`,
`set_world`, `set_config` and `into_world` between them. `fevm serve`,
the conformance driver and the soak driver use it. A plain transfer
runs 168 fewer instructions (3,438 to 3,270).
A `Block` holds an `Evm` from `begin` to `finish`. `begin` records
the parent hash for BLOCKHASH and makes the EIP-4788 and EIP-2935 system
calls. `transact` checks a transaction against the gas and blob gas the
block has left, which validation takes as a `Capacity`, and adds its
cumulative gas, logs bloom and deposits (EIP-6110). `finish` credits
the withdrawals and calls the EIP-7002 and EIP-7251 request contracts,
and returns the `Evm` with the block's gas used, blob gas used, bloom,
requests and requests hash, or the reason the block is invalid.

`Config` gains the block's blob limit and the deposit contract.
`fevm_tools conformance` runs a release's `blockchain_tests` as well:
each test's blocks through `Block`, in one driver process. The driver
judges a block by its transactions' validity, its system calls and what
its header says of its execution (gas used, blob gas used, logs bloom,
requests hash), and undoes an invalid block from a copy of the world. The
runner compares each block's validity, a valid block's receipts and the
post-state. It leaves out invalid blocks that only a header check, a
Merkle root or transaction decoding would reject.

All 17,441 Osaka tests of tests@v21.0.2 pass; CI runs them.
From Amsterdam a block ends with the system calls to EIP-8282's builder
deposit and exit request contracts, whose requests are types 3 and 4.
`rlp::Encoder` appends integers, strings and nested lists to a buffer,
and reports a failed allocation at the end.
From Amsterdam a block's header commits to the accounts and storage its
execution read and changed (EIP-7928). `Block` records them and
`finish` returns the list's RLP, hash and item count, or an error if
it is too large for the gas limit.

A read is noted where an account or slot is warmed, which is after its
gas is paid, and stays through reverts; an access-list slot is warm but
unread until its first access. Changes are taken from the journal when
a transaction, system call or the withdrawals end: the first surviving
entry for a balance, nonce, code or slot holds what it was at the
start. Changes at one index, as of the withdrawals and the request
calls after them, are merged.

CALL, CALLCODE, DELEGATECALL, STATICCALL and SELFDESTRUCT now pay for
each account before reading it, and SSTORE warms its slot before its
charge, as the specification orders them, so an access that runs out of
gas is listed exactly when the specification lists it. A set-code
transaction reads its target only once its authorizations are paid for.

All 26,349 Amsterdam blockchain tests of tests@v21.0.2 pass with the
access list hash checked; CI runs them.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T23:30:44.535962Z 5ef3b51 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dc4468bb5a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ingots/evm/src/block.fe Resolved
Comment thread native/conformance/driver/src/blocks.fe Resolved
Comment thread ingots/evm/src/processor.fe Resolved
Block::begin skipped the parent hash for block 0 but still made the
EIP-4788 and EIP-2935 system calls, which EIP-4788 rules out at genesis.
Make them only for a block with a parent.
The blockchain driver printed a host failure (BlockError::Host, or a
transaction whose receipt has a host status) as an invalid block, which
`check` accepts for a block expected to be invalid. Print it as the
driver's top-level host_error instead, as for a failed snapshot clone,
including a host failure before an invalid transaction, which
`Block::failure` exposes.
A system call began like a transaction, with the system address, the
target and the precompiles warm and SYSTEM_ADDRESS as the coinbase. EELS
starts an Osaka system call with nothing warm, and from Amsterdam warms a
transaction's set with the block's coinbase. Add Rules::WARM_SYSTEM_CALLS
and Transaction::begin_cold, which begins a run as `begin` does and then
drops the implicit warm set; Osaka system calls and the withdrawals use it.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ee1b38be2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ingots/evm/src/processor.fe Resolved
`extend_from_word` stores 32 bytes wherever it writes and grows the buffer
with an infallible `reserve` when they do not fit, so the encoder's header
and word writes could abort on a failed allocation instead of failing the
encoder. The encoder now reserves those 32 bytes on top of what an item
appends.
system_call had its own copy of the top-level dispatch: it ran a
delegated target's delegate without charging for or warming it, and ran
a precompile target's empty code. EELS runs a system call as a
transaction's message. Build the system call's request and run it
through prepare_message and execute_message, so that from Amsterdam the
delegate is charged, warmed and listed, before Amsterdam it is warmed
for free, a precompile delegate runs nothing and a precompile target
runs the precompile.
@sbillig
sbillig added this pull request to stack #29 November 14, 2026 06:23
@sbillig
sbillig merged commit 3df19a3 into main Nov 16, 2026
2 checks passed
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