Skip to content

fix(test): replace fork type checks with spec flag checks in test harness#10896

Merged
LukaszRozmej merged 1 commit into
masterfrom
fix/test-harness-fork-type-checks
Mar 20, 2026
Merged

fix(test): replace fork type checks with spec flag checks in test harness#10896
LukaszRozmej merged 1 commit into
masterfrom
fix/test-harness-fork-type-checks

Conversation

@LukaszRozmej
Copy link
Copy Markdown
Member

@LukaszRozmej LukaszRozmej commented Mar 20, 2026

Summary

  • Replace test.Fork is Cancun / test.Network is Cancun exact type checks with IsEip4844Enabled spec flag checks in the Ethereum test harness
  • Fixes BLOBBASEFEE (0x4A) returning BadInstruction on post-Cancun state and blockchain tests (Prague, Osaka, …) that won't specify CurrentExcessBlobGas explicitly (fuzz testing in practive)
  • Fixes KZG polynomial commitments not being initialized for post-Cancun blockchain tests

Root cause

The named fork classes (Cancun, Prague, Osaka, …) are sibling classes inheriting from NamedReleaseSpec<T>, not a class hierarchy. The fork chain is expressed via Parent composition. So test.Fork is Cancun only matches the exact Cancun class — it returns false for Prague, Osaka, and any future fork.

This caused two issues:

  1. GeneralTestBase.cs: ExcessBlobGas defaulted to null instead of 0 for post-Cancun forks. At runtime, InstructionBlobBaseFee checks Header.ExcessBlobGas.HasValue and returns BadInstruction when null — even though the opcode is correctly registered in the lookup table.
  2. BlockchainTestBase.cs: KZG commitments were not initialized for post-Cancun forks, which would cause blob verification failures.

Introduced in #10825 which replaced the previous fork ordering comparison with the type check.

No other is <NamedFork> patterns exist in the codebase.

Changes

  • Bug fix (non-breaking change which fixes an issue)

Testing

Verified with two Osaka state tests that previously failed with BadInstruction at the BLOBBASEFEE opcode — both now execute correctly past the opcode.

🤖 Generated with Claude Code

…ness

The test harness used `test.Fork is Cancun` (exact type match) to
decide whether to default `ExcessBlobGas` to 0 and whether to
initialize KZG. Since the named fork classes (Cancun, Prague, Osaka…)
are siblings—not a class hierarchy—the check was false for every
post-Cancun fork, leaving `ExcessBlobGas` null and KZG uninitialized.

This caused BLOBBASEFEE (0x4A) to return BadInstruction on Osaka state
tests: the opcode *was* registered in the lookup table, but
`InstructionBlobBaseFee` checks `Header.ExcessBlobGas.HasValue` at
runtime and bails out when it is null.

Replace the type checks with `IsEip4844Enabled` spec flag checks,
consistent with every other default in the same code block.

No other `is <NamedFork>` patterns exist in the codebase.

Ref #10825

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@LukaszRozmej LukaszRozmej requested a review from alexb5dh March 20, 2026 10:13
@LukaszRozmej LukaszRozmej merged commit 15a59c7 into master Mar 20, 2026
422 checks passed
@LukaszRozmej LukaszRozmej deleted the fix/test-harness-fork-type-checks branch March 20, 2026 10:25
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