testgen: fix duplicate test names and regenerate fixtures - #858
Merged
lightclient merged 2 commits intoAug 11, 2026
Merged
Conversation
Fixtures are written to tests/<method>/<test>.io, so two tests of the same method sharing a name silently overwrite each other. Three collisions existed: - eth_simulateV1 "ethSimulate-simple-state-diff" named two distinct tests, one using a stateDiff override and one a full state override. The committed fixture held only the latter, so the stateDiff case was never recorded. Rename the full-override case to "ethSimulate-simple-state". - eth_getLogs "filter-with-blockHash" and eth_simulateV1 "ethSimulate-simple-more-params-validate" were each duplicated with no behavioural difference. Drop the copies; their fixtures are unchanged. Co-authored-by: Weixie Cui <cuiweixie@gmail.com>
Nothing ran the tools test suite in CI, so add a step for it alongside the existing lint job.
1 task
4 tasks
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
Supersedes #850, which found the bug. That PR renames one colliding
eth_simulateV1test but does not regenerate the fixtures, so CI fails at "Fail if any files are
untracked or have changes". This PR fixes all three collisions in the repo,
regenerates the fixtures, and adds a guard so the class cannot recur silently.
rpctestgenwrites each fixture totests/<method>/<test>.ioand never checks for arepeated name (
tools/cmd/rpctestgen/generate.go), so two tests of the same methodsharing a name silently overwrite each other — last one wins.
The three collisions
eth_simulateV1ethSimulate-simple-state-diffeth_simulateV1ethSimulate-simple-more-params-validateeth_getLogsfilter-with-blockHashethSimulate-simple-state-diff— real coverage was lostThe two tests exercise different things: one uses a
stateDiffoverride (patchesindividual slots), the other a full
stateoverride (replaces all storage). Becausethe second won the write, the committed fixture held only the full-
statecase — thestateDiffcase had never been recorded.Renaming the full-override case to
ethSimulate-simple-staterestores both. Readingstorage slot 1 in the second block now shows the distinction:
ethSimulate-simple-state-diff.io0x…02ethSimulate-simple-state.io0x…00Also drops a stale copy-paste comment that labelled the
Statefield a "state diffoverride".
The other two — pure duplicates
Both duplicates produce an identical request/response exchange, so deleting them
loses no coverage. Proof: after deletion the first case of each pair writes the
fixture instead of the second, and
tests/eth_getLogs/filter-with-blockHash.ioandtests/eth_simulateV1/ethSimulate-simple-more-params-validate.iocome outbyte-unchanged.
If a distinct second case was ever intended in either spot, it was never actually
written.
The guard
TestUniqueTestNameswalksAllMethodsand fails on a repeated name within amethod. Verified load-bearing: it reports all three collisions against
mainandpasses here.
Nothing invoked the tools test suite in CI —
lint-toolsrunsmake lintand theroot
make testis speccheck only — so this adds amake teststep next to theexisting lint step. That also starts running the pre-existing
internal/specgentests.
Test plan
make build+make test(speccheck):all passing.make lint(openrpc-linter): no new warningscd tools && make lint(gofmt, vet, staticcheck): cleancd tools && make test: passes, including the new guardmake fillis idempotent — the gate testgen: fix duplicate name for eth_simulateV1 state override test #850 fails is clean hereTestUniqueTestNamesfails onmainwith all three collisions, passes hererpc-compat/eth_simulateV1across go-ethereum, nethermind, erigon, besu,reth, ethrex — both renamed fixtures pass on geth, nethermind, erigon and reth
hive notes: besu and ethrex fail these two fixtures, both pre-existing and unrelated.
ethrex returns
-32601 Method not foundforeth_simulateV1(92 of 93 tests). besudiverges only on synthetic transaction hashes, across 54 of 93 tests including
fixtures this PR does not touch; its
returnData,gasUsedand block fields match.