Repository navigation
Block execution - #25
Conversation
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.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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".
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.
There was a problem hiding this comment.
💡 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".
`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.
Adds block execution.
Evmholds the world andConfigacross transactions, with the allocations they reuse.transact,simulateandvalidatetake a request and its block;world(),world_mut(),set_world,set_configandinto_worldwork between them.fevm serve, the conformance driver and the soak driver use it.Blockholds anEvmfrombegintofinish.beginrecords the parent hash for BLOCKHASH and makes the EIP-4788 and EIP-2935 system calls.transactchecks a transaction against the block's remaining gas and blob gas and adds its cumulative gas, logs bloom and EIP-6110 deposits.finishcredits withdrawals (EIP-4895), calls the EIP-7002 and EIP-7251 request contracts (from Amsterdam also EIP-8282's builder request contracts), and returns theEvmwith aBlockOutput: 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 aBlockError.rlp::Encoderfor the access list.fevm_tools conformanceruns a release'sblockchain_teststhroughBlockinnative/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_cloneof the world). The blockchain test runner skips invalid blocks that only these checks would reject and counts them inblocks_not_judged.Notes for review:
transact/simulateAPI that took the world by value and returnedAppliedis removed, with no compatibility layer.