Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bump] sdk version to v0.43.0-rc0 #507

Merged
merged 13 commits into from
Jul 12, 2021
Merged
11 changes: 5 additions & 6 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ import (
customcrisis "github.com/terra-money/core/custom/crisis"
customdistr "github.com/terra-money/core/custom/distribution"
customevidence "github.com/terra-money/core/custom/evidence"
customfeegrant "github.com/terra-money/core/custom/feegrant"
customgov "github.com/terra-money/core/custom/gov"
custommint "github.com/terra-money/core/custom/mint"
customparams "github.com/terra-money/core/custom/params"
Expand Down Expand Up @@ -169,7 +170,7 @@ var (
customparams.AppModuleBasic{},
customcrisis.AppModuleBasic{},
customslashing.AppModuleBasic{},
feegrantmodule.AppModuleBasic{},
customfeegrant.AppModuleBasic{},
ibc.AppModuleBasic{},
customupgrade.AppModuleBasic{},
customevidence.AppModuleBasic{},
Expand Down Expand Up @@ -346,8 +347,9 @@ func NewTerraApp(
app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp)

// clear SoftwareUpgradeProposal
app.UpgradeKeeper.SetUpgradeHandler("v0.5.0", func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
app.UpgradeKeeper.SetUpgradeHandler("v0.5.0-rc0", func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// Just pass current version map, no migration required
return app.mm.RunMigrations(ctx, app.configurator, app.mm.GetVersionMap())
})

// register the staking hooks
Expand Down Expand Up @@ -609,9 +611,6 @@ func (app *TerraApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abc
panic(err)
}

// store initial module version maps to upgrade keeper
app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap())

return app.mm.InitGenesis(ctx, app.appCodec, genesisState)
}

Expand Down
12 changes: 12 additions & 0 deletions app/encoding.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
package app

import (
"github.com/cosmos/cosmos-sdk/codec/legacy"
"github.com/cosmos/cosmos-sdk/std"

"github.com/terra-money/core/app/params"
)

var legacyCodecRegistered = false

// MakeEncodingConfig creates an EncodingConfig for testing
func MakeEncodingConfig() params.EncodingConfig {
encodingConfig := params.MakeEncodingConfig()
std.RegisterLegacyAminoCodec(encodingConfig.Amino)
std.RegisterInterfaces(encodingConfig.InterfaceRegistry)
ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino)
ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry)

if !legacyCodecRegistered {
// authz module use this codec to get signbytes.
// authz MsgExec can execute all message types,
// so legacy.Cdc need to register all amino messages to get proper signature
ModuleBasics.RegisterLegacyAminoCodec(legacy.Cdc)
legacyCodecRegistered = true
}

return encodingConfig
}
18 changes: 9 additions & 9 deletions app/legacy/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ $ terrad migrate /path/to/genesis.json --chain-id=cosmoshub-4 --genesis-time=201

var bankGenesis banktypes.GenesisState

clientCtx.JSONCodec.MustUnmarshalJSON(newGenState[banktypes.ModuleName], &bankGenesis)
clientCtx.Codec.MustUnmarshalJSON(newGenState[banktypes.ModuleName], &bankGenesis)

var oracleGenesis oracletypes.GenesisState
clientCtx.JSONCodec.MustUnmarshalJSON(newGenState[oracletypes.ModuleName], &oracleGenesis)
clientCtx.Codec.MustUnmarshalJSON(newGenState[oracletypes.ModuleName], &oracleGenesis)

// Register whitelist denom list
denomMetadata := make([]banktypes.Metadata, len(oracleGenesis.Params.Whitelist)+1)
Expand Down Expand Up @@ -119,11 +119,11 @@ $ terrad migrate /path/to/genesis.json --chain-id=cosmoshub-4 --genesis-time=201
}

bankGenesis.DenomMetadata = denomMetadata
newGenState[banktypes.ModuleName] = clientCtx.JSONCodec.MustMarshalJSON(&bankGenesis)
newGenState[banktypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(&bankGenesis)

var stakingGenesis staking.GenesisState

clientCtx.JSONCodec.MustUnmarshalJSON(newGenState[staking.ModuleName], &stakingGenesis)
clientCtx.Codec.MustUnmarshalJSON(newGenState[staking.ModuleName], &stakingGenesis)

ibcTransferGenesis := ibcxfertypes.DefaultGenesisState()
ibcCoreGenesis := ibccoretypes.DefaultGenesisState()
Expand All @@ -136,11 +136,11 @@ $ terrad migrate /path/to/genesis.json --chain-id=cosmoshub-4 --genesis-time=201
ibcCoreGenesis.ClientGenesis.Params.AllowedClients = []string{exported.Tendermint}
stakingGenesis.Params.HistoricalEntries = 10000

newGenState[ibcxfertypes.ModuleName] = clientCtx.JSONCodec.MustMarshalJSON(ibcTransferGenesis)
newGenState[host.ModuleName] = clientCtx.JSONCodec.MustMarshalJSON(ibcCoreGenesis)
newGenState[captypes.ModuleName] = clientCtx.JSONCodec.MustMarshalJSON(capGenesis)
newGenState[evtypes.ModuleName] = clientCtx.JSONCodec.MustMarshalJSON(evGenesis)
newGenState[staking.ModuleName] = clientCtx.JSONCodec.MustMarshalJSON(&stakingGenesis)
newGenState[ibcxfertypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(ibcTransferGenesis)
newGenState[host.ModuleName] = clientCtx.Codec.MustMarshalJSON(ibcCoreGenesis)
newGenState[captypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(capGenesis)
newGenState[evtypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(evGenesis)
newGenState[staking.ModuleName] = clientCtx.Codec.MustMarshalJSON(&stakingGenesis)

genDoc.AppState, err = json.Marshal(newGenState)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions app/legacy/pubkey_replacement.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ func loadKeydataFromFile(clientCtx client.Context, replacementrJSON string, genD
var stakingGenesis staking.GenesisState
var slashingGenesis slashing.GenesisState

clientCtx.JSONCodec.MustUnmarshalJSON(state[staking.ModuleName], &stakingGenesis)
clientCtx.JSONCodec.MustUnmarshalJSON(state[slashing.ModuleName], &slashingGenesis)
clientCtx.Codec.MustUnmarshalJSON(state[staking.ModuleName], &stakingGenesis)
clientCtx.Codec.MustUnmarshalJSON(state[slashing.ModuleName], &slashingGenesis)

for i, val := range stakingGenesis.Validators {
idx, replacement := replacementKeys.isReplacedValidator(val.OperatorAddress)
Expand All @@ -71,7 +71,7 @@ func loadKeydataFromFile(clientCtx client.Context, replacementrJSON string, genD
toReplaceValConsAddress, _ := val.GetConsAddr()

var consPubKey cryptotypes.PubKey
if err := clientCtx.JSONCodec.UnmarshalInterfaceJSON([]byte(replacement.ConsensusPubkey), &consPubKey); err != nil {
if err := clientCtx.Codec.UnmarshalInterfaceJSON([]byte(replacement.ConsensusPubkey), &consPubKey); err != nil {
log.Fatal(fmt.Errorf("failed to decode key:%s %w", replacement.ConsensusPubkey, err))
}

Expand Down Expand Up @@ -109,8 +109,8 @@ func loadKeydataFromFile(clientCtx client.Context, replacementrJSON string, genD
}

}
state[staking.ModuleName] = clientCtx.JSONCodec.MustMarshalJSON(&stakingGenesis)
state[slashing.ModuleName] = clientCtx.JSONCodec.MustMarshalJSON(&slashingGenesis)
state[staking.ModuleName] = clientCtx.Codec.MustMarshalJSON(&stakingGenesis)
state[slashing.ModuleName] = clientCtx.Codec.MustMarshalJSON(&slashingGenesis)

genDoc.AppState, err = json.Marshal(state)

Expand Down
5 changes: 2 additions & 3 deletions app/legacy/v05/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
v040slashing "github.com/cosmos/cosmos-sdk/x/slashing/legacy/v040"
v038staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v038"
v040staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v040"
v043staking "github.com/cosmos/cosmos-sdk/x/staking/legacy/v043"

v039authcustom "github.com/terra-money/core/custom/auth/legacy/v039"
v040authcustom "github.com/terra-money/core/custom/auth/legacy/v040"
Expand Down Expand Up @@ -65,7 +64,7 @@ func Migrate(appState types.AppMap, clientCtx client.Context) types.AppMap {
v036paramscustom.RegisterLegacyAminoCodec(v04Codec)
v038upgradecustom.RegisterLegacyAminoCodec(v04Codec)

v05Codec := clientCtx.JSONCodec
v05Codec := clientCtx.Codec

if appState[v038bank.ModuleName] != nil {
// unmarshal relative source genesis application state
Expand Down Expand Up @@ -214,7 +213,7 @@ func Migrate(appState types.AppMap, clientCtx client.Context) types.AppMap {

// Migrate relative source genesis application state and marshal it into
// the respective key.
appState[v040staking.ModuleName] = v05Codec.MustMarshalJSON(v043staking.MigrateJSON(v040staking.Migrate(stakingGenState)))
appState[v040staking.ModuleName] = v05Codec.MustMarshalJSON(v040staking.Migrate(stakingGenState))
}

// Migrate x/genutil
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

Loading