Skip to content

refactor(block): fold withdrawals into Block.Processor#135

Merged
mw2000 merged 2 commits intomainfrom
refactor/withdrawals-in-processor
May 2, 2026
Merged

refactor(block): fold withdrawals into Block.Processor#135
mw2000 merged 2 commits intomainfrom
refactor/withdrawals-in-processor

Conversation

@mw2000
Copy link
Copy Markdown
Owner

@mw2000 mw2000 commented May 2, 2026

Summary

  • Withdrawals (EIP-4895) were applied in BlockchainTestRunner after Block.Processor.process_block/4 returned, then the runner recomputed the state root. A real client folds these credits into block processing so the returned state_root already reflects them.
  • New module EEVM.Block.Withdrawal (lib/) plus a :withdrawals option on process_block/4, applied between the transaction fold and the commitments phase.
  • The runner now converts fixture withdrawals to the new struct, passes them through, and asserts on result.state_root directly — the apply_withdrawals / credit_balance / StateRoot helpers in the runner are gone.
  • Closes Refactor: fold withdrawals processing into Block.Processor #126.

Test plan

  • mix compile clean
  • mix credo --strict clean
  • mix test — 4 doctests, 617 tests, 0 failures (4 new tests cover gwei→wei conversion, state root reflects withdrawals, ordering relative to txs, empty list no-op)
  • Existing BlockchainTest harness still green

🤖 Generated with Claude Code

mw2000 and others added 2 commits May 1, 2026 23:27
Withdrawals were applied in BlockchainTestRunner *after* process_block/4
returned, then the runner recomputed the state root. A real client folds
EIP-4895 credits into block processing so the returned state_root already
reflects them.

- Add EEVM.Block.Withdrawal in lib/.
- Add :withdrawals option to Block.Processor.process_block/4, applied
  between the transaction fold and the commitments phase. Defaults to [].
- BlockchainTestRunner converts fixture withdrawals to the new struct,
  passes them via :withdrawals, and verifies result.state_root directly.
  apply_withdrawals/credit_balance/StateRoot helpers in the runner go away.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@mw2000 mw2000 changed the title refactor(block): fold withdrawals into Block.Processor (#126) refactor(block): fold withdrawals into Block.Processor May 2, 2026
@mw2000 mw2000 merged commit c56c519 into main May 2, 2026
3 checks passed
@mw2000 mw2000 deleted the refactor/withdrawals-in-processor branch May 2, 2026 06:41
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.

Refactor: fold withdrawals processing into Block.Processor

1 participant