-
Notifications
You must be signed in to change notification settings - Fork 113
refactor: fully decouple evm from evmd #229
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
refactor: fully decouple evm from evmd #229
Conversation
- Make gas limit configurable for testing lower gas limit scenario - Get ibctesting.AppCreator when create coordinator, so other applications can leverage this test suits. - Make GenerateContractCallArgs as separate function. This doens't have to be a member method of TxFactory implementation. un-necessary dependency. - SendEvmTx now supports contract creation.
Previous ibc test suite uses different bond denom ("stake) with EVM denom ("aatom"). Even though it could be different technically, but we need to make sure everything works correctly with default config (bond denom == evm denom).
Wit this commit, we can make sure IBC and ICS20 transfers with default config should work well.
Updated test util for writing test cases more easily.
Currently, Arguments.Copy in geth panics if there are type mismatch. Returning error instead makes more sense
- Moved shared test/data files from evmd to evm to eliminate evm → evmd dependency - Relocated evmd-bound tests that directly depend on App implementation into evmd/ - Refactored remaining evmd-dependent tests to use EvmApp interface instead - Updated Makefile to reflect cmd relocation under evmd/
e8d99b7 to
f7bd682
Compare
…-evmd-and-evm-dependency # Conflicts: # evmd/go.mod # evmd/go.sum # evmd/tests/ibc/helper.go # evmd/tests/integration/create_app.go # go.mod # tests/integration/precompiles/ics20/test_integration.go # tests/integration/precompiles/ics20/test_query.go # tests/integration/precompiles/ics20/test_setup.go # tests/integration/precompiles/ics20/test_tx.go
Variables in evmd_config.go are defined for serving evmd
dc33d3d to
34bfcc3
Compare
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.
Overall, I would prefer to have app-specific configs (and the ante, somewhat) contained within EVMD. If we need to duplicate them for testing, we should do that. I mostly don't feel comfortable having the configs and options as dependencies that people could use within Cosmos EVM. They likely won't be entirely conforming to the specs each chain have.
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 would prefer that we have two copies of these (evm_app_options, constants, config, activators). One in the test files, and one in evmd. The reason is that these are app-specific config options and it should be clear that any chain implementation needs to implement their own. If we include it in EVMD, then evmd-specific configs will be available via the package, which is confusing imo
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.
Totally agree — that's a great point, thanks for highlighting it.
I've placed the test-related configs under testutil/config, and the ones used by evmd under cmd/evmd/config.
This should help prevent any confusion for client chains integrating with evm.
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.
Likewise, an evmd config shouldn't be in the cosmos/evm files
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.
Absolutely — I’ve moved the evmd-specific configs out of cosmos/evm and into cmd/evmd/config, where they belong.
This separation should help maintain a clean boundary between the core evm package and app-specific configurations.
evmd/test_helpers.go
Outdated
| appOptions[server.FlagInvCheckPeriod] = invCheckPeriod | ||
|
|
||
| app := NewExampleApp(log.NewNopLogger(), db, nil, true, appOptions, evmChainID, EvmAppOptions, baseapp.SetChainID(chainID)) | ||
| app := NewExampleApp(log.NewNopLogger(), db, nil, true, appOptions, evmChainID, evmconfig.EvmAppOptions, baseapp.SetChainID(chainID)) |
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.
App options should be within the evmd files
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.
Yes — I’ve moved the app options into cmd/evmd/config as suggested.
Thanks again for pointing this out!
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 think these ante handlers should also remain in evmd - they're custom to every chain and I don't think they should be set as a default
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.
Good point — I’ve moved the ante handlers under evmd/ante since they’re specific to the app and shouldn’t be treated as defaults. Thanks for the suggestion!
…arts Moved evmd-specific app configurations under the evmd/ directory to improve modularity and maintain clearer separation between evmd and other components. Introduced corresponding configuration files under testutil/ to support test applications, since relocating the original files required new equivalents for testing purposes.
af0de7a to
f46992e
Compare
30dd79d to
322afeb
Compare
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.
lgtm, nice work
* tests: add ics20 precompile tests and refactor test utils
- Make gas limit configurable for testing lower gas limit scenario
- Get ibctesting.AppCreator when create coordinator, so other applications can leverage this test suits.
- Make GenerateContractCallArgs as separate function. This doens't have to be a member method of TxFactory implementation. un-necessary dependency.
- SendEvmTx now supports contract creation.
* fix ibc test suite and ics20 tx vulnerability
Previous ibc test suite uses different bond denom ("stake) with EVM denom ("aatom"). Even though it could be different technically, but we need to make sure everything works correctly with default config (bond denom == evm denom).
Wit this commit, we can make sure IBC and ICS20 transfers with default config should work well.
Updated test util for writing test cases more easily.
* add revert test case
* fix lint
* implement safeCopyInputs and add query test case
Currently, Arguments.Copy in geth panics if there are type mismatch. Returning error instead makes more sense
* refactor: decouple evm from evmd and relocate evmd-specific tests
- Moved shared test/data files from evmd to evm to eliminate evm → evmd dependency
- Relocated evmd-bound tests that directly depend on App implementation into evmd/
- Refactored remaining evmd-dependent tests to use EvmApp interface instead
- Updated Makefile to reflect cmd relocation under evmd/
* fix ci and update test-helper's config path
* resolve conflicts after merge upstream
* nit: changed filename
Variables in evmd_config.go are defined for serving evmd
* chore: update importing package name
* Refactor: relocate evmd-specific configurations and add test counterparts
Moved evmd-specific app configurations under the evmd/ directory to improve modularity and maintain clearer separation between evmd and other components.
Introduced corresponding configuration files under testutil/ to support test applications, since relocating the original files required new equivalents for testing purposes.
* Refactor: relocate app specific ante handler
* fix solidity test config path
* chore: update import package name
Description
This PR finalizes the decoupling between the
evmandevmdpackages by ensuring a strict one-way dependency fromevmd → evm, and eliminating all reverse dependencies.Key Changes
evmdinternals and not using Network harness which is used from integraion tests were moved into the evmd package.evmdwere updated to use theEvmAppinterface, allowing them to remain withinevmwhile preserving abstraction.Motivation
evm(library) andevmd(application).evmto be consumed independently by downstream chains.Closes: #211
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...
mainbranchReviewers 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...
Unreleasedsection inCHANGELOG.md