fix(l1): statetest CLI follow-ups (optional _info, Osaka, BLOCKHASH convention)#6721
fix(l1): statetest CLI follow-ups (optional _info, Osaka, BLOCKHASH convention)#6721ElFantasma wants to merge 5 commits into
Conversation
|
🤖 Kimi Code ReviewThe PR correctly makes the Files reviewed: Observations1.
2.
3.
4. Test coverage
Minor suggestions
// Current (acceptable):
info.description.clone().or_else(|| info.comment.clone())
// Alternative avoiding double clone when description exists:
info.description.as_ref().or(info.comment.as_ref()).cloned()
Verdict: LGTM. The changes properly handle the EF test Automated review by Kimi (Moonshot AI) · kimi-k2.5 · custom prompt |
🤖 Claude Code ReviewHere is my code review for PR #6721: PR #6721 — statetest CLI follow-ups (optional
|
🤖 Codex Code ReviewFindings:
The optional I couldn’t run Automated review by OpenAI Codex · gpt-5.4 · custom prompt |
Greptile SummaryThree focused follow-ups to the statetest CLI landing:
Confidence Score: 4/5Safe to merge for the statetest CLI use-case; the two observations are about edge cases that only activate when Osaka fixtures include blob gas fields or when goevmlab Osaka fixtures flow through the EF runner path. The StatetestDatabase and optional-_info changes are well-tested and correct. Adding Osaka to DEFAULT_FORKS without updating the blob-gas target formula in genesis_from_test_and_fork leaves an incorrect else-0 path for Osaka fixtures that carry currentExcessBlobGas. Similarly, the Osaka skip logic in run_tests will silently drop any fixture with _info=None and osaka in its path. types.rs — the genesis excess-blob-gas target branch does not cover Osaka; runner.rs — the Osaka filter behaves incorrectly when _info is absent.
|
| Filename | Overview |
|---|---|
| tooling/ef_tests/state_v2/src/modules/utils.rs | Adds StatetestDatabase shim that overrides get_block_hash to return keccak256(decimal_string(n)), matching geth's vmTestBlockHash convention; well-tested with 3 unit tests including the n=10 decimal-vs-hex pin. |
| tooling/ef_tests/state_v2/src/modules/types.rs | Makes Test._info optional, adds Osaka to DEFAULT_FORKS, and adds two unit tests; genesis_from_test_and_fork blob-gas target calculation does not handle Osaka (falls to the else-0 branch), which may be incorrect if Osaka uses a non-zero blob target. |
| tooling/ef_tests/state_v2/src/modules/runner.rs | Correctly updates reference_spec extraction to handle Option; Osaka skip logic still works for EF fixtures (which always have _info). |
| tooling/ef_tests/state_v2/src/modules/report.rs | Clean adaptation of description/reference_spec extraction to Option with sensible fallback strings. |
Comments Outside Diff (2)
-
tooling/ef_tests/state_v2/src/modules/types.rs, line 294-300 (link)Osaka blob target missing from genesis excess-blob-gas calculation. Now that Osaka is in
DEFAULT_FORKS, any Osaka fixture that setscurrentExcessBlobGaswill land in theelse { 0 }branch, makinggenesis_excess_blob_gas = current_excess_blob_gas + 0. If Osaka uses a non-zero blob target (like Prague does), the genesis block will carry the wrong excess blob gas, causing the base fee calculation on block 1 to diverge from the expected value and silently misfiring Osaka blob-gas tests.Prompt To Fix With AI
This is a comment left during a code review. Path: tooling/ef_tests/state_v2/src/modules/types.rs Line: 294-300 Comment: Osaka blob target missing from genesis excess-blob-gas calculation. Now that Osaka is in `DEFAULT_FORKS`, any Osaka fixture that sets `currentExcessBlobGas` will land in the `else { 0 }` branch, making `genesis_excess_blob_gas = current_excess_blob_gas + 0`. If Osaka uses a non-zero blob target (like Prague does), the genesis block will carry the wrong excess blob gas, causing the base fee calculation on block 1 to diverge from the expected value and silently misfiring Osaka blob-gas tests. How can I resolve this? If you propose a fix, please make it concise.
-
tooling/ef_tests/state_v2/src/modules/runner.rs, line 40-50 (link)Osaka filter silently skips goevmlab fixtures
When
_infoisNone,test_eipbecomes"". Any fixture whose file path contains"osaka"will satisfy!fusaka_eips_to_test.iter().any(|eip| test_eip.contains(eip))(no EIP can be found in an empty string) and be silently dropped viacontinue. Ifrun_testsis ever invoked for goevmlab-generated Osaka fixtures, they will be skipped without notice. The workaround is to treatNoneas "no EIP filter applies" rather than as "no matching EIP found".Prompt To Fix With AI
This is a comment left during a code review. Path: tooling/ef_tests/state_v2/src/modules/runner.rs Line: 40-50 Comment: **Osaka filter silently skips goevmlab fixtures** When `_info` is `None`, `test_eip` becomes `""`. Any fixture whose file path contains `"osaka"` will satisfy `!fusaka_eips_to_test.iter().any(|eip| test_eip.contains(eip))` (no EIP can be found in an empty string) and be silently dropped via `continue`. If `run_tests` is ever invoked for goevmlab-generated Osaka fixtures, they will be skipped without notice. The workaround is to treat `None` as "no EIP filter applies" rather than as "no matching EIP found". How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
tooling/ef_tests/state_v2/src/modules/types.rs:294-300
Osaka blob target missing from genesis excess-blob-gas calculation. Now that Osaka is in `DEFAULT_FORKS`, any Osaka fixture that sets `currentExcessBlobGas` will land in the `else { 0 }` branch, making `genesis_excess_blob_gas = current_excess_blob_gas + 0`. If Osaka uses a non-zero blob target (like Prague does), the genesis block will carry the wrong excess blob gas, causing the base fee calculation on block 1 to diverge from the expected value and silently misfiring Osaka blob-gas tests.
```suggestion
let target = if *fork == Fork::Cancun {
schedule.cancun.target
} else if *fork >= Fork::Prague {
// Osaka (and future forks) inherit the Prague blob schedule until
// a dedicated schedule entry is added.
schedule.prague.target
} else {
0
};
```
### Issue 2 of 2
tooling/ef_tests/state_v2/src/modules/runner.rs:40-50
**Osaka filter silently skips goevmlab fixtures**
When `_info` is `None`, `test_eip` becomes `""`. Any fixture whose file path contains `"osaka"` will satisfy `!fusaka_eips_to_test.iter().any(|eip| test_eip.contains(eip))` (no EIP can be found in an empty string) and be silently dropped via `continue`. If `run_tests` is ever invoked for goevmlab-generated Osaka fixtures, they will be skipped without notice. The workaround is to treat `None` as "no EIP filter applies" rather than as "no matching EIP found".
Reviews (1): Last reviewed commit: "fix(l1): apply EF state-test BLOCKHASH c..." | Re-trigger Greptile
|
Re Codex finding 3 (parse The hardcoded
So: not parsing |
Motivation
Follow-ups to #6663 (statetest CLI for goevmlab fuzzing), addressing three issues raised in Slack feedback after the PR landed:
_infois required in the statetest fixture deserializer, but goevmlab-generated fixtures don't necessarily include it.default_forks(the allow-list of forks the runner will execute) is missing Osaka, so any fixture with an Osaka post-state was silently skipped or surfaced as an error.BLOCKHASH(0)returns ethrex's synthesized genesis hash rather than the EF state-test conventionkeccak256(decimal_string(n))that geth uses. This trips the goevmlab fuzzer on the very first block-hash lookup.Description
Two commits, reviewable independently:
Commit 1 —
fix(l1): make statetest _info optional and add Osaka to runnable forksTest._infobecomesOption<Info>;build_testno longer errors when_infois absent.runner::run_testsfor EIP filtering andreport::generate_reportfor the description/reference lines) are updated to handleNonewith sensible defaults — emptyreference_spec, "No description or comment" for the report.DEFAULT_FORKSgets"Osaka"inserted between Prague and Amsterdam, matching the fork ordering used elsewhere._infoparses, fixture-with-_infostill parses.Commit 2 —
fix(l1): apply EF state-test BLOCKHASH convention in statetest harnessThe bug: at block N=1, the test contract
0x60004060005500(PUSH1 0 / BLOCKHASH / PUSH1 0 / SSTORE / STOP) callsBLOCKHASH(0). ethrex returned the genesis hash it derived from the test's pre-state (0x86a0…); geth (and the EF spec) returnskeccak256("0")=0x0448…116d. The state root differs from the very first SSTORE, which kills any differential fuzzing.Fix: in
load_initial_state(shared by the statetest CLI andrunner.rs's EF state-test runner), wrap the levmDatabasein a thinStatetestDatabaseshim that delegates everything exceptget_block_hash, which returnskeccak256(decimal_string(n)). Matches geth'svmTestBlockHashintests/state_test_util.go. Three unit tests pin the contract (n=0, n=1, n=10 to distinguish decimal vs hex encoding).block_runner.rshas a separate pre-existing problem: its phase-3 real-block re-execution path uses the actual genesis hash because it goes throughadd_block_pipeline, notload_initial_state. Out of scope here — orthogonal code path, separate fix.Checklist
STORE_SCHEMA_VERSION(crates/storage/lib.rs) if the PR includes breaking changes to theStorerequiring a re-sync.