0) Prep
- Create a branch:
git switch -c upgrade/evm-v0.6. - Ensure a clean build + tests green pre-upgrade.
- Snapshot your current params/genesis for comparison later.
1) Dependency bumps (go.mod)
- Bump
github.com/cosmos/evmto v0.6.0 and run:
2) App Wiring Changes
IBC Transfer Module
v0.6.0 removes the custom IBC transfer keeper override and now uses the official IBC-Go transfer keeper directly. This means that ERC20 conversions via Cosmos IBC transfer transactions are not possible. These are now only handled in the ICS20 precompile, and any ERC20 transfer must be initiated through there. Changes required inapp.go:
- Update imports - Replace custom transfer imports with official IBC-Go imports:
- Update TransferKeeper initialization - Remove ERC20 keeper parameter:
- Update module registration - Use official transfer module:
- Update ICS20 precompile wiring - Pass ERC20 keeper to ICS20 precompile:
3) Breaking API Changes
StateDB Requirements
v0.6.0 introduces significant changes to event tracking and state management. All EVM execution functions now require an explicitstateDB parameter and a callFromPrecompile flag to properly handle event management and state transitions.
NOTE: The only function calls affected are CallEVM, CallEVMWithData, ApplyMessage, and ApplyMessageWithConfig. These are typically used in common precompiles and logic that calls back into the EVM from the SDK. If your project does not use these functions, then no steps need to be taken for the upgrade.
Advanced Changes
The following functions have updated signatures:CallEVM
Before (v0.5.x):
CallEVMWithData
Before (v0.5.x):
ApplyMessage
Before (v0.5.x):
ApplyMessageWithConfig
Before (v0.5.x):
Migration Steps
For Non-Precompile Contexts
If you’re calling EVM functions from outside a precompile (e.g., from a module keeper, message server, or query handler):- Create a new
stateDBbefore calling EVM functions - Pass
falsefor thecallFromPrecompileparameter
For Precompile Contexts
If you’re calling EVM functions from within a precompile:- Reuse the existing
stateDBfrom your precompile context (do not create a new one) - Pass
truefor thecallFromPrecompileparameter - The existing
stateDBis typically available as a parameter in your precompile function
Important Notes
- Never pass
nilforstateDB: This will returnErrNilStateDBerror - Commit behavior in precompiles: When
commit=trueandcallFromPrecompile=true, the state changes are flushed to the cache context rather than fully committed. This prevents collapsing the cache stack in nested call scenarios.
EVMKeeper Interface Changes
If you implement or mock theEVMKeeper interface, update your implementation:
4) ERC20 Keeper Interface Changes
TheERC20Keeper interface has new methods:
5) Error Handling
A new error type has been added:nil is passed as the stateDB parameter to EVM functions.
6) Build & Tests
Testing Checklist
After migration, verify:- All EVM calls pass a valid
stateDB - Non-precompile calls use
callFromPrecompile=false - Precompile calls reuse existing
stateDBand usecallFromPrecompile=true - Event emission works correctly in both success and revert scenarios
- State changes are properly committed or reverted