Files
evm/core
zeekayandHanzo Dev c435ce5aea core: run the ./core block suite through the cevm shadow verifier and report the honest agreement rate
Wires the existing cevm (C++ EVM) byte-exact shadow verifier so it observes
EVERY block of the real ./core suite, and reports the true tally — without
weakening the gate or ever letting cevm apply state.

- core/main_cevm_test.go (//go:build cevm): a cevm-only TestMain that runs the
  whole ./core suite then prints the aggregate parallel.CevmShadowStats(). Because
  state_processor.go:124 routes every block through
  parallel.DefaultExecutor().ExecuteBlock — which under -tags cevm is the
  cevmShadowExecutor — this is the honest whole-suite count. main_test.go's goleak
  TestMain is gated //go:build !cevm so exactly one TestMain exists per build.

- core/parallel/cevm_shadow_registration_test.go (//go:build cevm): asserts
  DefaultExecutor() is the cevmShadowExecutor (not the no-op fallback) — the
  precondition for the whole claim.

- core/parallel/cevm_shadow_e2e_test.go: scaled the real-StateProcessor agreement
  proof from 3 to 256 genuine InsertChain blocks (768 transfers). cevm's
  independent real-MPT process_block root byte-matched the Go EVM header.Root on
  ALL 256/256 blocks (0 disagree, 0 finalize-gap).

- Four precompile test files (genesis_dexsettle_reproduce, precompile_alwayson,
  precompile_statedb_subbalance, precompile_env_call) gated //go:build !cevm: they
  alone pull precompile/registry -> luxfi/precompile/dex -> luxfi/dex/pkg/dex whose
  cgo file #includes the absent dex_gpu.h, breaking the CGO_ENABLED=1 build the
  bridge needs. They are precompile tests, not block-execution tests, and still run
  in every non-cevm build — an orthogonal blocker isolated, not a cevm regression.

HONEST RESULTS (CGO_ENABLED=1 -tags cevm):
- Whole ./core suite: 78 PASS / 0 FAIL / 32 SKIP. cevm observed all 9794 blocks;
  it declined every one as no-preimage (the production default runs preimages OFF,
  and the shadow needs trie-key preimages to recover the 20-byte addresses that
  seed cevm) — 0 disagree, 0 errored, 0 false roots. The Go EVM applied every
  block; cevm never touched state.
- Real-block agreement (preimages ON, the config the shadow requires), driven
  through core.BlockChain.InsertChain -> StateProcessor.Process -> the shadow:
  256/256 blocks byte-exact agreement (768 transfers).

Default (!cevm) build unchanged: ./core and ./core/parallel green in both CGO
modes; the 10 gated precompile tests present in the default build.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-19 18:14:45 -07:00
..
2025-08-01 01:23:42 +00:00
2025-08-01 01:23:42 +00:00
2025-08-01 01:23:42 +00:00
2025-08-01 01:23:42 +00:00
2025-08-01 01:23:42 +00:00
2025-08-01 01:23:42 +00:00
2025-08-01 01:23:42 +00:00
2025-08-01 01:23:42 +00:00
2025-08-01 01:23:42 +00:00
2023-11-29 11:37:30 -05:00
2023-11-29 11:37:30 -05:00
2023-11-29 11:37:30 -05: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.

EVM 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.