Skip to content

Conversation

@ScottyPoi
Copy link
Contributor

@ScottyPoi ScottyPoi commented Dec 5, 2025

Implements a minimal test runner to run state_tests and blockchain_tests from execution-spec-tests submodule.

Includes:

  • executionSpecTestLoader.ts
    • Loads test fixtures from ethereum-spec-tests or a specified subdirectory
      • use env variable TEST_PATH to specify specific test directory
    • Generates custom common for blockchain tests
      • Custom hardfork schedule with all previous forks set to timestamp: 0, block: null
      • Transition fork set to timestamp
      • Custom BlobSchedule for BPO forks
      • Preserves EIP collection while controlling setHardforkBy behavior
  • executionSpecState.test.ts
    • Setup pre-state
    • Build and run test tx
      • If tx fails
        • Validate error message
    • Validate post-state
  • executionSpecBlockchain.test.ts
    • Setup blockchain from genesis
    • Validate pre-state
    • Build and run test blocks
      • If blocks fails
        • Validate error message
    • Validate chain head via lastBlockhash
    • Validate post-state accounts info

Additional:

  • EIP7819 Fix:
    • We were using parent common to calculate blobFee
      • This produced incorrect blob gas prices at hardfork transitions when parameters change
    • Fix: Use child common (and parent excessBlobGas) to calculate blobFee
  • TX gas < block gas limit fix:
    • When we compare tx gas to block gas limit, we were using this.gasLimit * elasticityMultiplier as the comparison.
    • We should just compare to this.gasLimit
    • This aligns with the rest of our codebase and the test expectations
  • Use getBlobGasSchedule().maxBlobGasPerBlock instead of param('maxBlobGasPerBlock')
    • Works for both pre-BPO and BPO forks
  • Order of blob count validation
    • Tests expect to fail on block blob count BEFORE failing on tx blob count
      • Reversed order in 4844 tx code

Instructions:

From packages/evm:
npx vitest executionSpecState.test.ts
To run all tests in state_test directories in the execution-spec-tests submodule
or
npx vitest executionSpecBlockchain.test.ts
To run all tests in blockchain_test directories in the execution-spec-tests submodule

To run a subset of test, pass in a directory path with env variable TEST_PATH
e.g.
TEST_PATH=../execution-spec-tests/fusaka-devnet-5/blockchain_tests/osaka/eip7918_blob_reserve_price npx vitest test/tester/executionSpecBlockchain.test.ts

@codecov
Copy link

codecov bot commented Dec 5, 2025

Codecov Report

❌ Patch coverage is 17.39130% with 76 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.08%. Comparing base (cf187e9) to head (aa800e4).

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 88.44% <100.00%> (ø)
blockchain 88.85% <ø> (ø)
common 93.38% <ø> (ø)
evm 62.01% <ø> (ø)
mpt 90.44% <ø> (+0.33%) ⬆️
statemanager 78.10% <ø> (ø)
static 91.35% <ø> (ø)
tx ?
util 85.07% <ø> (ø)
vm 62.10% <14.60%> (-2.98%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

📦 Bundle Size Analysis

Package Size (gzip) Δ
binarytree 30.1 KB ⚪ ±0%
block 45.4 KB 🔴 +0.0 KB (+0.06%)
blockchain 52.4 KB ⚪ ±0%
client 181.7 KB ⚪ ±0%
common 44.9 KB 🔴 +0.0 KB (+0.02%)
devp2p 76.4 KB ⚪ ±0%
e2store 30.3 KB ⚪ ±0%
ethash 8.4 KB ⚪ ±0%
evm 201.4 KB ⚪ ±0%
genesis 519.5 KB ⚪ ±0%
mpt 55.1 KB ⚪ ±0%
rlp 7.2 KB ⚪ ±0%
statemanager 57.2 KB ⚪ ±0%
testdata 60.2 KB ⚪ ±0%
tx 87.1 KB 🔴 +0.1 KB (+0.10%)
util 62.1 KB ⚪ ±0%
vm 61.2 KB 🟢 -0.1 KB (-0.17%)
wallet 14.0 KB ⚪ ±0%

Generated by bundle-size workflow

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a comprehensive test runner infrastructure for the execution-spec-tests suite, enabling validation of EthereumJS implementations against the official Ethereum test fixtures. Additionally, it includes critical bug fixes for blob gas calculations and transaction validation.

Key changes:

  • New test infrastructure for running state_tests and blockchain_tests from the execution-spec-tests submodule
  • Bug fix for EIP-7819: Corrected blob gas price calculation at hardfork transitions to use child common instead of parent common
  • Bug fix for transaction gas limit validation: Removed incorrect elasticity multiplier from block gas limit comparison

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/vm/test/tester/executionSpecTestLoader.ts Implements test fixture loader with support for custom hardfork schedules and transition forks
packages/vm/test/tester/executionSpecState.test.ts State test runner that validates pre-state, transaction execution, and post-state root
packages/vm/test/tester/executionSpecBlockchain.test.ts Blockchain test runner with block processing and exception validation
packages/vm/vitest.config.browser.mts Excludes new execution-spec test files from browser tests
packages/block/src/header/header.ts Fixes EIP-7819 blob fee calculation to use child common at transitions
packages/vm/src/runBlock.ts Corrects transaction gas limit validation against block gas limit
packages/block/src/block/block.ts Updates to use getBlobGasSchedule() API for BPO fork compatibility
packages/tx/src/4844/tx.ts Improves error messages and restructures blob limit validation logic
packages/tx/test/eip4844.spec.ts Updates test assertions to match new error message formats
packages/common/src/hardforks.ts Adds EIP-7892 to Osaka hardfork configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
}

// // Check final state after all blocks are processed
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented-out line suggests this was previously uncommented code. If the check for final state after all blocks is important, this should be restored or removed. Leaving commented code can reduce maintainability.

Suggested change
// // Check final state after all blocks are processed

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants