refactor(testutil): drop dead helpers; use cosmos/evm's fork-neutral test fns#312
Merged
Conversation
bb657dc to
f5adfe7
Compare
…test fns Delete testutil files with zero importers (contract.go, integration.go, statedb.go — evmos leftovers orphaned by the x/erc20 and rpc/ removals) and the dead CreateEthTx helper, and use cosmos/evm/testutil's NoOpNextFn and NewHeader instead of the in-tree copies — the only upstream test helpers with no key, codec, denom, or app surface (verified identical). Everything else stays in-tree deliberately: tx/signer.go is byte-identical to upstream except the import that decides which ethsecp256k1 type tests exercise (moca's SDK fork registers only its own); fund.go's upstream counterpart mints via the mint module (no mint perms in moca's maccPerms — runtime panic); tx/cosmos.go's upstream hardcodes example-chain fees; testutil/network is a production dependency of 'mocad testnet' and wires BLS validator creation. Verified: go build; go test -race over app/ante/..., the storageprovider precompile, and tests/integration/...; go vet -tags norace ./testutil/network/ (nothing in CI compiles that file); all repeated on an amd64 box. Signed-off-by: puneetmahajan <59960662+puneet2019@users.noreply.github.com>
f5adfe7 to
16825e8
Compare
phenix3443
approved these changes
Jul 6, 2026
phenix3443
reviewed
Jul 6, 2026
phenix3443
left a comment
Contributor
There was a problem hiding this comment.
I reviewed the incremental diff on top of #310 and did not find any blocking issues.
The deleted helpers appear to have no remaining in-repo importers, and the swaps to cosmos/evm/testutil.NoOpNextFn / NewHeader are behaviorally equivalent for the current call sites. I also verified the touched packages still build/test cleanly.
Residual risk: testutil is still a public Go package path, so removing exported helpers can be a downstream API break for external consumers that are not part of this repo or CI.
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.
Part of the shrink-to-upstream campaign (#309, #310, #311).
Summary
Slims
testutil/along the line a feasibility audit drew: delete what's dead, adopt upstream only where it is provably fork-neutral, and keep everything the moca-cosmos-sdk fork actually couples to.Change (net ≈ −300 LOC)
testutil/contract.go,testutil/integration.go,testutil/statedb.go— evmos leftovers orphaned by thex/erc20(chore(erc20): delete x/erc20 module and related files #221) andrpc/(refactor(rpc)!: replace in-tree JSON-RPC with cosmos/evm/rpc #309) removals — plus the unreferencedCreateEthTxintestutil/tx/eth.go.cosmos/evm/testutilfor two pure functions (firstcosmos/evm/testutilimport in moca):NoOpNextFn(== deletedtestutil.NextFn) andNewHeader(byte-identical) — the only upstream helpers with no key/codec/denom/app surface. 4 call sites updated.Deliberately KEPT in-tree (the fork traps)
testutil/tx/signer.go— byte-identical to upstream except one import line that decides whichethsecp256k1type every signing test exercises (fork vs cosmos/evm; moca's codecs register only the fork's — the refactor(rpc)!: replace in-tree JSON-RPC with cosmos/evm/rpc #309personal_*bug class).testutil/fund.go— upstream's mints via the mint module; moca'smaccPermshas no mint entry → runtime panic.testutil/tx/cosmos.go— upstream hardcodes example-chain (aatom) fees.testutil/network/— production dependency ofmocad testnet(client/testnet.go,cmd/mocad/cmd/testnet.go) and wires moca's BLS validator creation.testutil/codec,sample,nullify,storage,abci.go,staking-rewards.go,app.go— fork/app/greenfield-coupled.Verification
go build ./...;go test -raceover./app/ante/..., the storageprovider precompile,./tests/integration/...— green.go vet -tags norace ./testutil/network/— green (CI never compiles that norace-tagged file; checked here so the deletion set can't silently break it).🤖 Generated with Claude Code