You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that there are additional EVM-specific loggers in the [@ethereumjs/evm](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/evm) package.
- **[`runBlock`](./src/runBlock.ts)**: Processes a single block.
419
+
- Performs initial setup: Validates hardfork compatibility, sets the state root (if provided), applies DAO fork logic if necessary.
420
+
- Manages state checkpoints before and after processing.
421
+
- Iterates through transactions within the block:
422
+
- For each transaction, calls `runTx`.
423
+
- Processes withdrawals (post-Shanghai/EIP-4895).
424
+
- Calculates and assigns block rewards to the miner (and uncles, pre-Merge).
425
+
- Finalizes the block state (state root, receipts root, logs bloom).
426
+
- Commits or reverts state changes based on success.
427
+
- **[`runTx`](./src/runTx.ts)**: Processes a single transaction.
428
+
- Performs pre-execution checks: Sender balance sufficient for gas+value, sender nonce validity, transaction gas limit against block gas limit, EIP activations (e.g., 2930 Access Lists, 1559 Fee Market, 4844 Blobs).
429
+
- Warms up state access based on Access Lists (EIP-2929/2930).
430
+
- Pays intrinsic gas cost.
431
+
- Executes the transaction code using `vm.evm.runCall` (or specific logic for contract creation).
432
+
- Calculates gas used and refunds remaining gas.
433
+
- Transfers gas fees to the fee recipient (recipient receives all pre EIP-1559, base fee is burned post EIP-1559).
434
+
- Generates a transaction receipt.
435
+
- Manages state checkpoints and commits/reverts changes for the transaction.
436
+
- **[`vm.evm.runCall`](../evm/src/evm.ts)** (within `@ethereumjs/evm`): Executes the EVM code for a transaction (message call or contract creation).
437
+
- Steps through EVM opcodes.
438
+
- Manages memory, stack, and storage changes.
439
+
- Handles exceptions and gas consumption during execution.
440
+
441
+
Note: The process of iterating through the blockchain (block by block) is typically managed by components outside the core VM package, such as `@ethereumjs/blockchain` or a full client implementation, which then utilize the VM's `runBlock` method.
0 commit comments