Files
Antje WorringandHanzo Dev ee95aa65f2 test: migrate EVM tests to all-upgrades-active fee model (LP-176)
coreth now activates all chain upgrades implicitly (modern Ethereum
through Cancun + Avax/Lux dynamic-fee + capacity-based block fees always
on). Stale tests written for a pre-fee world (bare ChainConfig, legacy
nil-gasprice txs, HomesteadSigner) failed with "fee cap less than base
fee", fee-state capacity errors, or stale expected values. Migrated all
to the canonical pattern: params.TestChainConfig, Ether-scale balances,
types.LatestSigner, DynamicFeeTx paying gen.BaseFee()+tip.

- core: shared *Test helpers migrated (fixes all table-driven variants);
  balances now subtract the fee actually paid. The two obsolete
  block-gas-cost rejection tests (block-gas-cost is 0 under LP-176)
  repurposed to positive zero-tip-block-valid guards (GenerateChainZeroTipBlock,
  InsertChainZeroTipBlockAccepted); the surviving fee-cap-below-base-fee
  rejection stays covered by state_processor_test.go ErrFeeCapTooLow.
- eth/tracers: golden gas +2 (EIP-3860 init-code word, now active).
- eth/gasprice: TestSuggestTipCapMaxBlocksLookback tip 3->1 (block-gas-cost
  surcharge gone; oracle clamps to MinGasPrice=1, matching sibling cases).
- internal/ethapi: regenerated block/header/receipt golden for Cancun
  fields (blobGasUsed/excessBlobGas/parentBeaconBlockRoot + derived
  hashes); no semantic field changed.
- ethclient/simulated: fork at the authoritative genesis hash.
- sync/handlers: 5s block spacing so LP-176 capacity refills.

Full suite: 52/52 packages green (CGO_ENABLED=0 -tags=pebble).

Co-authored-by: Hanzo Dev <[email protected]>
2026-06-06 22:23:12 -07:00
..
2025-07-31 21:45:39 +00:00
2025-12-12 22:51:30 -08:00
2025-07-31 21:45:39 +00:00
2025-12-13 00:01:08 -08:00
2025-07-31 21:45:39 +00:00
2025-12-13 00:01:08 -08:00
2025-07-31 21:45:39 +00:00
2025-12-13 00:01:08 -08:00
2025-07-31 21:45:39 +00:00
2025-07-31 21:45:39 +00:00
2025-07-31 21:45:39 +00:00
2025-07-31 21:45:39 +00:00
2025-07-31 21:45:39 +00:00
2025-07-31 21:45:39 +00:00
2025-12-13 00:01:08 -08:00
2025-07-31 21:45:39 +00:00
2025-07-31 21:45:39 +00:00
2025-07-31 21:45:39 +00:00
2025-07-31 21:45:39 +00:00

Core Package

The core package maintains the backend for the blockchain, transaction pool, and maintains the required indexes for blocks, transactions, logs, and transaction receipts.

Blockchain

The BlockChain struct handles the insertion of blocks into the maintained chain. It maintains a "canonical chain", which is essentially the preferred chain (the chain that ends with the block preferred by the Luxd consensus engine).

When the consensus engine verifies blocks as they are ready to be issued into consensus, it calls Verify() on the ChainVM Block interface implemented here. This calls InsertBlockManual on the BlockChain struct implemented in this package, which is the first entrypoint of a block into the blockchain.

InsertBlockManual verifies the block, inserts it into the state manager to track the merkle trie for the block, and adds it to the canonical chain if it extends the currently preferred chain.

Coreth adds functions for Accept and Reject, which take care of marking a block as finalized and performing garbage collection where possible.

The consensus engine can also call SetPreference on a VM to tell the VM that a specific block is preferred by the consensus engine to be accepted. This triggers a call to reorg the blockchain and set the newly preferred block as the preferred chain.

Transaction Pool

The transaction pool maintains the set of transactions that need to be issued into a new block. The VM exposes APIs that allow clients to issue transactions into the transaction pool and also performs gossip across the network in order to send and receive pending transactions that need to be issued into a new block. The transaction pool asynchronously follows the preferred block of the BlockChain struct by subscribing to new head events and updating its state accordingly. When the transaction pool updates, it ensures that any transactions it contains are still valid to be issued on top of the new preferred block.

State Manager

The State Manager manages the TrieDB. The TrieDB tracks a merkle forest of all of the merkle tries for the last accepted block and processing blocks. When a block is processed, the state transition results in a new merkle trie added to the merkle forest. The State Manager can operate in either archival or pruning mode.

Archival Mode

In archival mode, every merkle trie is written to disk so that the node maintains a complete history of all the blocks that it has processed.

Pruning Mode

In pruning mode, the State Manager keeps a reference to merkle tries of processing blocks. When a block gets accepted, it stays in memory. When a block gets rejected, the state manager can dereference and clean up the no longer needed merkle trie. The State Manager does not immediately write the merkle trie to disk of a block when it gets accepted. Instead, at a regular interval (~4096 blocks) it writes the merkle trie to disk, so that it does not add the overhead of storing every accepted block's merkle trie to disk.