Skip to content

Implement block-level transaction processing #86

@mw2000

Description

@mw2000

Summary

Process an entire block of transactions: execute each transaction sequentially, accumulate state, generate receipts, compute receipts trie root, and validate the final state root.

Specification

Block processing pipeline:

  1. Execute system calls (beacon root deposit per EIP-4788, block hash storage per EIP-2935)
  2. For each transaction in order:
    a. Execute via transaction pipeline
    b. Accumulate cumulative gas
    c. Generate receipt with cumulative gas
    d. Accumulate state changes
  3. After all transactions:
    a. Compute state root from final state
    b. Compute receipts root from all receipts
    c. Compute transactions root from all txs
    d. Validate against block header

Prerequisites

  • Transaction execution pipeline (issue)
  • Receipt generation (issue)
  • State root computation (issue)

Implementation Guide

  1. Create lib/eevm/block/processor.ex — block processing orchestrator
  2. process_block(block_header, transactions, pre_state_db){:ok, post_state_db, receipts} | {:error, reason}
  3. Validate block gas limit — sum of tx gas must not exceed block gas limit
  4. Execute system calls first if hardfork config enables them
  5. Sequential transaction execution — each tx sees state from previous tx
  6. Compute trie roots — state, receipts, transactions
  7. Tests: single-tx block, multi-tx block, gas limit exceeded, system calls

Acceptance Criteria

  • Processes all transactions in a block sequentially
  • Cumulative gas tracked correctly
  • State root matches expected after block processing
  • Receipts root computed correctly
  • Block gas limit enforced
  • System calls executed at block start (when enabled)
  • Tests pass

Reference

  • Yellow Paper §11 (Block Finalization)
  • execution-specs: process_block function

Metadata

Metadata

Assignees

No one assigned

    Labels

    block-processingBlock-level transaction processingcoreCore EVM functionality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions