Skip to content

Commit

Permalink
Merge branch 'master' into marko/version_info
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle authored Jun 18, 2021
2 parents aad7ca0 + 0ae07fe commit 9311221
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 13 deletions.
1 change: 0 additions & 1 deletion client/keys/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ The pass backend requires GnuPG: https://gnupg.org/
ImportKeyCommand(),
ListKeysCmd(),
ShowKeysCmd(),
flags.LineBreak,
DeleteKeyCommand(),
ParseKeyStringCommand(),
MigrateCommand(),
Expand Down
2 changes: 1 addition & 1 deletion client/keys/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
}
2 changes: 1 addition & 1 deletion docs/building-modules/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
23 changes: 23 additions & 0 deletions docs/core/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions server/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
}
Expand Down
4 changes: 0 additions & 4 deletions simapp/simd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions types/tx_msg.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package types

import (
fmt "fmt"

"github.com/gogo/protobuf/proto"

cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
Expand Down Expand Up @@ -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)
}
4 changes: 4 additions & 0 deletions types/tx_msg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}
2 changes: 1 addition & 1 deletion x/auth/client/cli/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9311221

Please sign in to comment.