diff --git a/UPGRADING.md b/UPGRADING.md index b95b9f159c..0f956a82df 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -6,9 +6,9 @@ This guide provides instructions for upgrading to specific versions of Cosmos SD ### Database configuration -Cleveldb, Boltdb and BadgerDB are not supported anymore. To migrate from a unsupported database to a supported database please use the database migration tool +ClevelDB, BoltDB and BadgerDB are not supported anymore. To migrate from a unsupported database to a supported database please use the database migration tool. - + ### Protobuf @@ -19,6 +19,13 @@ The SDK is in the process of removing all `gogoproto` annotations. The `gogoproto.goproto_stringer = false` annotation has been removed from most proto files. This means that the `String()` method is being generated for types that previously had this annotation. The generated `String()` method uses `proto.CompactTextString` for _stringifying_ structs. [Verify](https://github.com/cosmos/cosmos-sdk/pull/13850#issuecomment-1328889651) the usage of the modified `String()` methods and double-check that they are not used in state-machine code. +### SimApp + +#### Module Assertions + +Previously, all modules were required to be set in `OrderBeginBlockers`, `OrderEndBlockers` and `OrderInitGenesis / OrderExportGenesis` in `app.go` / `app_config.go`. +This is no longer the case, the assertion has been loosened to only require modules implementing, respectively, the `module.BeginBlockAppModule`, `module.EndBlockAppModule` and `module.HasGenesis` interfaces. + ## [v0.47.x](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.0) ### Simulation diff --git a/client/v2/autocli/query_test.go b/client/v2/autocli/query_test.go index 889a35f858..2507ea1d09 100644 --- a/client/v2/autocli/query_test.go +++ b/client/v2/autocli/query_test.go @@ -245,7 +245,7 @@ func TestNotFoundErrors(t *testing.T) { Service: testpb.Query_ServiceDesc.ServiceName, RpcCommandOptions: []*autocliv1.RpcCommandOptions{{RpcMethod: "bar"}}, }) - assert.ErrorContains(t, err, "rpc method bar not found") + assert.ErrorContains(t, err, "rpc method \"bar\" not found") // bad positional field _, err = b.BuildModuleQueryCommand("test", &autocliv1.ServiceCommandDescriptor{ diff --git a/simapp/app_config.go b/simapp/app_config.go index 2fde9c7b3e..8fc1bf2692 100644 --- a/simapp/app_config.go +++ b/simapp/app_config.go @@ -51,21 +51,6 @@ import ( ) var ( - - // NOTE: The genutils module must occur after staking so that pools are - // properly initialized with tokens from genesis accounts. - // NOTE: The genutils module must also occur after auth so that it can access the params from auth. - // NOTE: Capability module must occur first so that it can initialize any capabilities - // so that other modules that want to create or claim capabilities afterwards in InitChain - // can do so safely. - genesisModuleOrder = []string{ - capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, - distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, - minttypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, - feegrant.ModuleName, nft.ModuleName, group.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, - vestingtypes.ModuleName, consensustypes.ModuleName, runtime.ModuleName, - } - // module account permissions moduleAccPerms = []*authmodulev1.ModuleAccountPermission{ {Account: authtypes.FeeCollectorName}, @@ -126,12 +111,38 @@ var ( KvStoreKey: "acc", }, }, - InitGenesis: genesisModuleOrder, + // NOTE: The genutils module must occur after staking so that pools are + // properly initialized with tokens from genesis accounts. + // NOTE: The genutils module must also occur after auth so that it can access the params from auth. + // NOTE: Capability module must occur first so that it can initialize any capabilities + // so that other modules that want to create or claim capabilities afterwards in InitChain + // can do so safely. + InitGenesis: []string{ + capabilitytypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + stakingtypes.ModuleName, + slashingtypes.ModuleName, + govtypes.ModuleName, + minttypes.ModuleName, + crisistypes.ModuleName, + genutiltypes.ModuleName, + evidencetypes.ModuleName, + authz.ModuleName, + feegrant.ModuleName, + nft.ModuleName, + group.ModuleName, + paramstypes.ModuleName, + upgradetypes.ModuleName, + vestingtypes.ModuleName, + consensustypes.ModuleName, + }, // When ExportGenesis is not specified, the export genesis module order // is equal to the init genesis order - // ExportGenesis: genesisModuleOrder, + // ExportGenesis: []string{}, // Uncomment if you want to set a custom migration order here. - // OrderMigrations: nil, + // OrderMigrations: []string{}, }), }, { diff --git a/testutil/configurator/configurator.go b/testutil/configurator/configurator.go index 7024c13e53..90b04e7c16 100644 --- a/testutil/configurator/configurator.go +++ b/testutil/configurator/configurator.go @@ -241,10 +241,9 @@ func NewAppConfig(opts ...ModuleOption) depinject.Config { opt(cfg) } - // always add runtime module beginBlockers := make([]string, 0) endBlockers := make([]string, 0) - initGenesis := []string{"runtime"} + initGenesis := make([]string, 0) overrides := make([]*runtimev1alpha1.StoreKeyConfig, 0) for _, s := range beginBlockOrder { diff --git a/types/module/module.go b/types/module/module.go index 8d27f3dbdf..d22a20e755 100644 --- a/types/module/module.go +++ b/types/module/module.go @@ -293,13 +293,21 @@ func NewManagerFromMap(moduleMap map[string]appmodule.AppModule) *Manager { // SetOrderInitGenesis sets the order of init genesis calls func (m *Manager) SetOrderInitGenesis(moduleNames ...string) { - m.assertNoForgottenModules("SetOrderInitGenesis", moduleNames, nil) + m.assertNoForgottenModules("SetOrderInitGenesis", moduleNames, func(moduleName string) bool { + module := m.Modules[moduleName] + _, hasGenesis := module.(HasGenesis) + return !hasGenesis + }) m.OrderInitGenesis = moduleNames } // SetOrderExportGenesis sets the order of export genesis calls func (m *Manager) SetOrderExportGenesis(moduleNames ...string) { - m.assertNoForgottenModules("SetOrderExportGenesis", moduleNames, nil) + m.assertNoForgottenModules("SetOrderExportGenesis", moduleNames, func(moduleName string) bool { + module := m.Modules[moduleName] + _, hasGenesis := module.(HasGenesis) + return !hasGenesis + }) m.OrderExportGenesis = moduleNames } diff --git a/x/auth/testutil/app_config.go b/x/auth/testutil/app_config.go index 8f1f422e4e..44453a8f61 100644 --- a/x/auth/testutil/app_config.go +++ b/x/auth/testutil/app_config.go @@ -1,7 +1,6 @@ package testutil import ( - "github.com/cosmos/cosmos-sdk/runtime" _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import as blank for app wiring @@ -61,7 +60,6 @@ var AppConfig = appconfig.Compose(&appv1alpha1.Config{ paramstypes.ModuleName, consensustypes.ModuleName, vestingtypes.ModuleName, - runtime.ModuleName, }, }), }, diff --git a/x/authz/testutil/app_config.go b/x/authz/testutil/app_config.go index e741b573c9..3753eaa588 100644 --- a/x/authz/testutil/app_config.go +++ b/x/authz/testutil/app_config.go @@ -1,7 +1,6 @@ package testutil import ( - "github.com/cosmos/cosmos-sdk/runtime" _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/authz/module" // import as blank for app wiring @@ -62,7 +61,6 @@ var AppConfig = appconfig.Compose(&appv1alpha1.Config{ authz.ModuleName, paramstypes.ModuleName, consensustypes.ModuleName, - runtime.ModuleName, }, }), }, diff --git a/x/capability/testutil/app_config.go b/x/capability/testutil/app_config.go index e75bb58f24..c94037b9d1 100644 --- a/x/capability/testutil/app_config.go +++ b/x/capability/testutil/app_config.go @@ -1,7 +1,6 @@ package testutil import ( - "github.com/cosmos/cosmos-sdk/runtime" _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/bank" // import as blank for app wiring @@ -55,7 +54,6 @@ var AppConfig = appconfig.Compose(&appv1alpha1.Config{ genutiltypes.ModuleName, paramstypes.ModuleName, consensustypes.ModuleName, - runtime.ModuleName, }, }), }, diff --git a/x/distribution/testutil/app_config.go b/x/distribution/testutil/app_config.go index 2c242a0273..8bf2a0b286 100644 --- a/x/distribution/testutil/app_config.go +++ b/x/distribution/testutil/app_config.go @@ -1,7 +1,6 @@ package testutil import ( - "github.com/cosmos/cosmos-sdk/runtime" _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/bank" // import as blank for app wiring @@ -60,7 +59,6 @@ var AppConfig = appconfig.Compose(&appv1alpha1.Config{ genutiltypes.ModuleName, paramstypes.ModuleName, consensustypes.ModuleName, - runtime.ModuleName, }, }), }, diff --git a/x/evidence/testutil/app_config.go b/x/evidence/testutil/app_config.go index 6344b98767..566ce383e6 100644 --- a/x/evidence/testutil/app_config.go +++ b/x/evidence/testutil/app_config.go @@ -1,7 +1,6 @@ package testutil import ( - "github.com/cosmos/cosmos-sdk/runtime" _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/bank" // import as blank for app wiring @@ -61,7 +60,6 @@ var AppConfig = appconfig.Compose(&appv1alpha1.Config{ evidencetypes.ModuleName, paramstypes.ModuleName, consensustypes.ModuleName, - runtime.ModuleName, }, }), }, diff --git a/x/feegrant/testutil/app_config.go b/x/feegrant/testutil/app_config.go index 925583ac77..d2c846be56 100644 --- a/x/feegrant/testutil/app_config.go +++ b/x/feegrant/testutil/app_config.go @@ -1,7 +1,6 @@ package testutil import ( - "github.com/cosmos/cosmos-sdk/runtime" _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import as blank for app wiring @@ -62,7 +61,6 @@ var AppConfig = appconfig.Compose(&appv1alpha1.Config{ paramstypes.ModuleName, vestingtypes.ModuleName, consensustypes.ModuleName, - runtime.ModuleName, }, }), }, diff --git a/x/group/testutil/app_config.go b/x/group/testutil/app_config.go index 7112386ec7..a778d3a573 100644 --- a/x/group/testutil/app_config.go +++ b/x/group/testutil/app_config.go @@ -5,7 +5,6 @@ import ( "google.golang.org/protobuf/types/known/durationpb" - "github.com/cosmos/cosmos-sdk/runtime" _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/authz" // import as blank for app wiring @@ -64,7 +63,6 @@ var AppConfig = appconfig.Compose(&appv1alpha1.Config{ group.ModuleName, paramstypes.ModuleName, consensustypes.ModuleName, - runtime.ModuleName, }, }), }, diff --git a/x/mint/testutil/app_config.go b/x/mint/testutil/app_config.go index 5cebc5cafe..e1d0254d3c 100644 --- a/x/mint/testutil/app_config.go +++ b/x/mint/testutil/app_config.go @@ -2,7 +2,6 @@ package testutil import ( "cosmossdk.io/core/appconfig" - "github.com/cosmos/cosmos-sdk/runtime" _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/bank" // import as blank for app wiring @@ -55,7 +54,6 @@ var AppConfig = appconfig.Compose(&appv1alpha1.Config{ genutiltypes.ModuleName, paramstypes.ModuleName, consensustypes.ModuleName, - runtime.ModuleName, }, }), }, diff --git a/x/nft/testutil/app_config.go b/x/nft/testutil/app_config.go index 9d7573f48e..2eb0644b0f 100644 --- a/x/nft/testutil/app_config.go +++ b/x/nft/testutil/app_config.go @@ -2,7 +2,6 @@ package testutil import ( "cosmossdk.io/core/appconfig" - "github.com/cosmos/cosmos-sdk/runtime" _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/bank" // import as blank for app wiring @@ -59,7 +58,6 @@ var AppConfig = appconfig.Compose(&appv1alpha1.Config{ nft.ModuleName, paramstypes.ModuleName, consensustypes.ModuleName, - runtime.ModuleName, }, }), }, diff --git a/x/params/testutil/app_config.go b/x/params/testutil/app_config.go index a21623a6dd..83f72994dd 100644 --- a/x/params/testutil/app_config.go +++ b/x/params/testutil/app_config.go @@ -1,7 +1,6 @@ package testutil import ( - "github.com/cosmos/cosmos-sdk/runtime" _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/bank" // import as blank for app wiring @@ -50,7 +49,6 @@ var AppConfig = appconfig.Compose(&appv1alpha1.Config{ genutiltypes.ModuleName, paramstypes.ModuleName, consensustypes.ModuleName, - runtime.ModuleName, }, }), }, diff --git a/x/slashing/testutil/app_config.go b/x/slashing/testutil/app_config.go index 95afa8bcb4..e34ec8f582 100644 --- a/x/slashing/testutil/app_config.go +++ b/x/slashing/testutil/app_config.go @@ -1,7 +1,6 @@ package testutil import ( - "github.com/cosmos/cosmos-sdk/runtime" _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/bank" // import as blank for app wiring @@ -65,7 +64,6 @@ var AppConfig = appconfig.Compose(&appv1alpha1.Config{ genutiltypes.ModuleName, paramstypes.ModuleName, consensustypes.ModuleName, - runtime.ModuleName, }, }), }, diff --git a/x/staking/testutil/app_config.go b/x/staking/testutil/app_config.go index f6c361ce7f..daf044465f 100644 --- a/x/staking/testutil/app_config.go +++ b/x/staking/testutil/app_config.go @@ -1,7 +1,6 @@ package testutil import ( - "github.com/cosmos/cosmos-sdk/runtime" _ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/bank" // import as blank for app wiring @@ -65,7 +64,6 @@ var AppConfig = appconfig.Compose(&appv1alpha1.Config{ genutiltypes.ModuleName, paramstypes.ModuleName, consensustypes.ModuleName, - runtime.ModuleName, }, }), },