Skip to content

refactor(testutil): drop dead helpers; use cosmos/evm's fork-neutral test fns#312

Merged
puneet2019 merged 1 commit into
mainfrom
refactor/slim-testutil
Jul 6, 2026
Merged

refactor(testutil): drop dead helpers; use cosmos/evm's fork-neutral test fns#312
puneet2019 merged 1 commit into
mainfrom
refactor/slim-testutil

Conversation

@puneet2019

Copy link
Copy Markdown
Contributor

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)

Deliberately KEPT in-tree (the fork traps)

  • testutil/tx/signer.go — byte-identical to upstream except one import line that decides which ethsecp256k1 type 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 #309 personal_* bug class).
  • testutil/fund.go — upstream's mints via the mint module; moca's maccPerms has no mint entry → runtime panic.
  • testutil/tx/cosmos.go — upstream hardcodes example-chain (aatom) fees.
  • testutil/network/production dependency of mocad 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 -race over ./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).
  • All repeated on an amd64 box (CI's arch).

🤖 Generated with Claude Code

@puneet2019 puneet2019 requested a review from a team July 6, 2026 06:53
@puneet2019 puneet2019 force-pushed the refactor/slim-testutil branch 2 times, most recently from bb657dc to f5adfe7 Compare July 6, 2026 06:57
@github-actions github-actions Bot added the tests label Jul 6, 2026
@puneet2019 puneet2019 requested a review from phenix3443 July 6, 2026 07:04
…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>

@phenix3443 phenix3443 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@puneet2019 puneet2019 merged commit 0c916f9 into main Jul 6, 2026
27 checks passed
@puneet2019 puneet2019 deleted the refactor/slim-testutil branch July 6, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants