-
Notifications
You must be signed in to change notification settings - Fork 37
tests: refactoring #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: refactoring #198
Conversation
evmd as separate package - we can make sure more clean dependency: only evmd -> evmd allows. not vice versa. test re-structuring - tests using network + evmd moved into evm/tests/integration - test file names are changed from *_test.go to test_*.go, so any client chains can leverage cosmos/evm's test suites with their own application refactoring - all integration tests in evm uses EvmApp interface. so it allows other client application can leverage cosmos/evm's test suites. - evmd implements methods of EvmApp - separate Erc20Keeper interface to avoid cyclic import between erc20/keeper and precompiles/erc20 - change backend member variables to public. this is for making testing refactoring easier. if there are some security concern, we should consider introducing getters. removed un-used files
# Conflicts: # cmd/evmd/cmd/root.go # tests/integration/rpc/backend/test_backend_suite.go # tests/integration/rpc/backend/test_chain_info.go
removed already migrated test also
dcf74a9
to
1d4201c
Compare
pb files should not be touched
evmd/go.mod
Outdated
@@ -0,0 +1,280 @@ | |||
module cosmosevm.io/evmd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to maintain the github based url.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Eric-Warehime
How about using github.com/cosmos/evm/evmd
instead?
Happy to hear any other suggestions as well if you have something else in mind!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's fine. I think we just don't like the confusion that the github.com/cosmos/cosmos-sdk
and cosmossdk.io
naming has caused, so it's best to stick with the github prefixes here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Eric-Warehime
Applied in e7377b4
interfaces.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we can just declare the interface wherever we need to use it. Are you doing it here because it's just used everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Eric-Warehime
That’s a fair point.
Currently, EvmApp
is used across quite a few directories. While it’s technically possible to define the interface locally wherever it's needed, I thought it made sense to keep it in evm/interfaces.go
since it serves as a kind of reference interface for chains that want to integrate with cosmos/evm
, especially when running the tests under tests/integration
.
Putting it directly under cosmos/evm
felt like a clear signal that it’s the standard interface contract for client chains implementing EvmApp
.
That said, I’m not strongly opinionated here — if you still feel it’s better to colocate the interface with each usage site, I’m happy to revisit that direction.
go.mod
Outdated
@@ -3,8 +3,8 @@ module github.com/cosmos/evm | |||
go 1.23.8 | |||
|
|||
require ( | |||
cosmosevm.io/evmd v0.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the idea was to remove this?
evmd is now a standalone package that imports from evm, but never the other way around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Eric-Warehime
You're right — the ultimate goal is to remove evmd from evm entirely.
However, there are a few more changes needed before we can fully eliminate it.
For example, we'll need to:
- Move
evm/cmd
toevm/evmd/cmd
/ - Relocate shared data structures currently under
evmd
into a more appropriate place withinevm
.
I considered including these changes in the testing refactoring PR, but it felt like too much to bundle into a single PR. That's why I thought it would be cleaner to address the removal of evmd
in a follow-up PR.
Would you prefer we fully remove the evmd
dependency as part of this PR?
Or does it make more sense to merge the testing refactoring first, and then handle the cleanup/removal in a separate one?
Happy to align either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, happy to do things in separate PRs since this is already large in terms of lines of code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created separate issue for following up this: #211
# Conflicts: # .golangci.yml # evmd/tests/ibc/helper.go # evmd/tests/ibc/ibc_middleware_test.go # evmd/testutil/abci.go # go.mod # precompiles/distribution/integration_test.go # precompiles/erc20/integration_test.go # precompiles/gov/integration_test.go # precompiles/p256/integration_test.go # precompiles/staking/integration_test.go # tests/integration/precompiles/erc20/test_events.go # tests/integration/rpc/backend/test_blocks.go # tests/integration/x/erc20/test_genesis.go # tests/integration/x/erc20/test_ibc_callback.go # tests/integration/x/vm/test_call_evm.go # testutil/integration/evm/network/abci.go # testutil/integration/evm/network/network.go
Refactor Integration Tests and Modularize evmd Package
This PR introduces a major restructuring of the Cosmos EVM testing infrastructure to improve modularity, reusability, and maintainability.
Summary
evmd
into a standalone package (github.com/cosmos/evm/evmd
)EvmApp
interfaceKey Changes
evmd
Modularizationevmd
is now a standalone package that imports fromevm
, but never the other way around.evm
.Interface-Based Testing
EvmApp
interface to represent the application under test.evmd
.EvmApp
.Test Structure Restructuring
network
andevmd
were moved toevm/tests/integration
.*_test.go
totest_*.go
to allow proper compilation and import from other packages.*_test.go
files when importing, so this rename enables downstream reuse.Internal Refactoring
backend
fields to public for easier access during tests.Outcome
evm
andevmd
Closes: #33
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
main
branchReviewers Checklist
All items are required.
Please add a note if the item is not applicable
and please add your handle next to the items reviewed
if you only reviewed selected items.
I have...
Unreleased
section inCHANGELOG.md