fix(test): replace fork type checks with spec flag checks in test harness#10896
Merged
Conversation
…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>
wurdum
approved these changes
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test.Fork is Cancun/test.Network is Cancunexact type checks withIsEip4844Enabledspec flag checks in the Ethereum test harnessBadInstructionon post-Cancun state and blockchain tests (Prague, Osaka, …) that won't specifyCurrentExcessBlobGasexplicitly (fuzz testing in practive)Root cause
The named fork classes (
Cancun,Prague,Osaka, …) are sibling classes inheriting fromNamedReleaseSpec<T>, not a class hierarchy. The fork chain is expressed viaParentcomposition. Sotest.Fork is Cancunonly matches the exactCancunclass — it returnsfalsefor Prague, Osaka, and any future fork.This caused two issues:
GeneralTestBase.cs:ExcessBlobGasdefaulted tonullinstead of0for post-Cancun forks. At runtime,InstructionBlobBaseFeechecksHeader.ExcessBlobGas.HasValueand returnsBadInstructionwhen null — even though the opcode is correctly registered in the lookup table.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
Testing
Verified with two Osaka state tests that previously failed with
BadInstructionat the BLOBBASEFEE opcode — both now execute correctly past the opcode.🤖 Generated with Claude Code