diff --git a/client/keys/root.go b/client/keys/root.go index 92c78c3abeab..938a0d53a14c 100644 --- a/client/keys/root.go +++ b/client/keys/root.go @@ -44,7 +44,6 @@ The pass backend requires GnuPG: https://gnupg.org/ ImportKeyCommand(), ListKeysCmd(), ShowKeysCmd(), - flags.LineBreak, DeleteKeyCommand(), ParseKeyStringCommand(), MigrateCommand(), diff --git a/client/keys/root_test.go b/client/keys/root_test.go index f66ae9265de6..b6c2f5f88f48 100644 --- a/client/keys/root_test.go +++ b/client/keys/root_test.go @@ -11,5 +11,5 @@ func TestCommands(t *testing.T) { assert.NotNil(t, rootCommands) // Commands are registered - assert.Equal(t, 10, len(rootCommands.Commands())) + assert.Equal(t, 9, len(rootCommands.Commands())) } diff --git a/docs/building-modules/upgrade.md b/docs/building-modules/upgrade.md index 53864fa58b96..2f9eaa98f339 100644 --- a/docs/building-modules/upgrade.md +++ b/docs/building-modules/upgrade.md @@ -8,7 +8,7 @@ In-place store migrations allow your modules to upgrade to new versions that inc ## Prerequisite Readings -- [In-Place Store Migration](../core-concepts/upgrade.md) {prereq} +- [In-Place Store Migration](../core/upgrade.md) {prereq} ## Consensus Version diff --git a/docs/core/upgrade.md b/docs/core/upgrade.md index 4e48e10b9d7e..c37d813871c7 100644 --- a/docs/core/upgrade.md +++ b/docs/core/upgrade.md @@ -82,6 +82,29 @@ To learn more about configuring migration scripts for your modules, see the [Mig You can introduce entirely new modules to the application during an upgrade. New modules are recognized because they have not yet been registered in `x/upgrade`'s `VersionMap` store. In this case, `RunMigrations` calls the `InitGenesis` function from the corresponding module to set up its initial state. +### Add StoreUpgrades for New Modules + +All chains preparing to run in-place store migrations will need to manually add store upgrades for new modules and then configure the store loader to apply those upgrades. This ensures that the new module's stores are added to the multistore before the migrations begin. + +```golang +upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() +if err != nil { + panic(err) +} + +if upgradeInfo.Name == "my-plan" && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + storeUpgrades := storetypes.StoreUpgrades{ + // add store upgrades for new modules + // Example: + // Added: []string{"foo", "bar"}, + // ... + } + + // configure store loader that checks if version == upgradeHeight and applies store upgrades + app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) +} +``` + ## Overwriting Genesis Functions The Cosmos SDK offers modules that the application developer can import in their app. These modules often have an `InitGenesis` function already defined. diff --git a/server/util.go b/server/util.go index 68f1c4828166..e39bb712c87c 100644 --- a/server/util.go +++ b/server/util.go @@ -264,10 +264,8 @@ func AddCommands(rootCmd *cobra.Command, defaultNodeHome string, appCreator type rootCmd.AddCommand( startCmd, UnsafeResetAllCmd(), - flags.LineBreak, tendermintCmd, ExportCmd(appExport, defaultNodeHome), - flags.LineBreak, version.NewVersionCommand(), ) } diff --git a/simapp/simd/cmd/root.go b/simapp/simd/cmd/root.go index e37944f09d55..bb736b61d622 100644 --- a/simapp/simd/cmd/root.go +++ b/simapp/simd/cmd/root.go @@ -28,7 +28,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/x/auth/types" - vestingcli "github.com/cosmos/cosmos-sdk/x/auth/vesting/client/cli" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/crisis" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" @@ -151,12 +150,9 @@ func txCommand() *cobra.Command { authcmd.GetMultiSignCommand(), authcmd.GetMultiSignBatchCmd(), authcmd.GetValidateSignaturesCommand(), - flags.LineBreak, authcmd.GetBroadcastCommand(), authcmd.GetEncodeCommand(), authcmd.GetDecodeCommand(), - flags.LineBreak, - vestingcli.GetTxCmd(), ) simapp.ModuleBasics.AddTxCommands(cmd) diff --git a/types/tx_msg.go b/types/tx_msg.go index d7f15e83f078..42d01fdc55ee 100644 --- a/types/tx_msg.go +++ b/types/tx_msg.go @@ -1,8 +1,6 @@ package types import ( - fmt "fmt" - "github.com/gogo/protobuf/proto" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -79,5 +77,5 @@ type TxEncoder func(tx Tx) ([]byte, error) // MsgTypeURL returns the TypeURL of a `sdk.Msg`. func MsgTypeURL(msg Msg) string { - return fmt.Sprintf("/%s", proto.MessageName(msg)) + return "/" + proto.MessageName(msg) } diff --git a/types/tx_msg_test.go b/types/tx_msg_test.go index 7a55c7d63e64..bf7763b02913 100644 --- a/types/tx_msg_test.go +++ b/types/tx_msg_test.go @@ -29,3 +29,7 @@ func (s *testMsgSuite) TestMsg() { s.Require().Nil(msg.ValidateBasic()) s.Require().NotPanics(func() { msg.GetSignBytes() }) } + +func (s *testMsgSuite) TestMsgTypeURL() { + s.Require().Equal("/testdata.TestMsg", sdk.MsgTypeURL(new(testdata.TestMsg))) +} diff --git a/x/auth/client/cli/decode.go b/x/auth/client/cli/decode.go index e1807efb099e..6af5bb5c38ac 100644 --- a/x/auth/client/cli/decode.go +++ b/x/auth/client/cli/decode.go @@ -17,7 +17,7 @@ const flagHex = "hex" func GetDecodeCommand() *cobra.Command { cmd := &cobra.Command{ Use: "decode [amino-byte-string]", - Short: "Decode an binary encoded transaction string.", + Short: "Decode a binary encoded transaction string", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx := client.GetClientContextFromCmd(cmd)