Path: blob/main/docs/versioned_docs/version-v29/06-migration/v0.24.0.md
1671 views
------Cosmos SDK v0.46 upgrade notes
Update dependencies
Cosmos SDK v0.46 is compatible with the latest version of IBC Go v5. If you have a chain that is using an older version, update the dependencies in your project.
Throughout the code you might see the following dependencies:
Where v3 is the version of IBC Go and ... are different IBC Go packages.
To upgrade the version to v5, a global find-and-replace should work. Replace cosmos/ibc-go/v3 (or whicherver version you're using) with cosmos/ibc-go/v5 only in *.go files (to exclude unwated changes to files like go,sum).
Module keeper
Add an import:
In the Keeper struct replace sdk.StoreKey with storetypes.StoreKey:
In the argument list of the NewKeeper function definition:
Store type aliases have been removed from the Cosmos SDK types package and now have to be imported from store/types, instead.
In the testutil/keeper/{moduleName}.go replace types.StoreKey with storetypes.StoreKey and types.MemStoreKey with storetypes.MemStoreKey.
Testutil network package
Add the require package for testing and pruningtypes and remove storetypes:
In the DefaultConfig function replace storetypes.NewPruningOptionsFromString with pruningtypes.NewPruningOptionsFromString
The New function in the Cosmos SDK testutil/network package now accepts three arguments instead of two.
In the New function add t.TempDir() as the second argument to network.New() and test that no error is thrown with require.NoError(t, err):
Testutil keeper package
In the {moduleName}Keeper function make the following replacements:
storetypes.StoreKey→types.StoreKeystoretypes.MemStoreKey→types.MemStoreKeysdk.StoreTypeIAVL→storetypes.StoreTypeIAVLsdk.StoreTypeMemory→storetypes.StoreTypeMemory
IBC modules
If you have IBC-enabled modules (for example, added with ignite scaffold module ... --ibc or created manually), make the following changes to the source code.
Cosmos SDK expects IBC modules to implement the IBCModule interface. Create a IBCModule type that embeds the module's keeper and a method that returns a new IBCModule. Methods in this file will be defined on this type.
Replace receivers for all methods in this file from (am AppModule) to (im IBCModule). Replace all instances of am. with im. to fix the errors.
OnChanOpenInit now returns to values: a string and an error:
Ensure that all return statements (five, in the default template) in OnChanOpenInit return two values. For example:
Error acknowledgments returned from Transfer OnRecvPacket now include a deterministic ABCI code and error message. Remove the .Error() call:
After switching to using both AppModule and IBCModule, modifying the following line:
Main
The Execute function in Cosmos SDK server/cmd package now accepts three arguments instead of two.
Handler
Cosmos SDK v0.46 no longer needs a NewHandler function that was used to handle messages and call appropriate keeper methods based on message types. Feel free to remove x/{moduleName}/handler.go file.
Since there is no NewHandler now, modify the deprecated Route function to return sdk.Route{}: