Conversation
Introduce `EEVM.Block.Processor` plus the supporting `Header`, `Receipt`,
and `BlockResult` value structs. The processor runs a block end-to-end:
1. Reject the block when `sum(tx.gas_limit) > header.gas_limit`.
2. Apply any `:system_calls` hooks against the pre-state DB (this is
where EIP-4788 / EIP-2935 plug in once their PRs land).
3. Fold transactions through an injected `:tx_executor`, accumulating
receipts whose `cumulative_gas_used` is the running total. First
`{:error, _}` halts and reports the failing index.
4. Compute `state_root`, `receipts_root`, `transactions_root`,
`logs_bloom`, and total `gas_used` into a `BlockResult`.
The transaction executor and system-call hooks are dependency-injected
rather than aliased so this PR can ship independently of #81 / #82 / #83;
once those land a follow-up will wire in real defaults.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EEVM.Block.Processor.process_block/4, which runs a block end-to-end: pre-flight gas-limit check → system-call hooks → transaction fold with cumulative-gas tracking → root/bloom commitments.EEVM.Block.Header,EEVM.Block.Receipt, andEEVM.BlockResultfor the inputs and outputs.state_root,receipts_root,transactions_root,logs_bloom, and totalgas_usedto match what an external verifier would check against the advertised header.Notes
:tx_executor(3-arity fn) and an optional:system_callslist. A follow-up will wire in real defaults once those PRs land.{:error, reason}from the executor halts the fold and surfaces{:error, {:tx_failed, index, reason}}— no optimistic rollback.[status, cumulativeGasUsed, bloom, logs].Closes #86.
Test plan
mix format --check-formattedmix compile --warnings-as-errorsmix credo --strictmix test(571 tests, 0 failures; 14 new intest/block/processor_test.exs):tx_executorand system-call hooks once Implement transaction execution pipeline #83 / Implement historical block hashes contract (EIP-2935) #81 / Implement beacon block root contract (EIP-4788) #82 merge🤖 Generated with Claude Code