mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-25 07:45:18 +00:00
fix: only set config in migration if unsealed (#1142)
This commit is contained in:
parent
2e99b716e2
commit
691a483675
@ -38,7 +38,6 @@ import (
|
|||||||
ibchost "github.com/cosmos/ibc-go/modules/core/24-host"
|
ibchost "github.com/cosmos/ibc-go/modules/core/24-host"
|
||||||
ibctypes "github.com/cosmos/ibc-go/modules/core/types"
|
ibctypes "github.com/cosmos/ibc-go/modules/core/types"
|
||||||
|
|
||||||
"github.com/kava-labs/kava/app"
|
|
||||||
v015kavadist "github.com/kava-labs/kava/x/kavadist/legacy/v0_15"
|
v015kavadist "github.com/kava-labs/kava/x/kavadist/legacy/v0_15"
|
||||||
v015validatorvesting "github.com/kava-labs/kava/x/validator-vesting/legacy/v0_15"
|
v015validatorvesting "github.com/kava-labs/kava/x/validator-vesting/legacy/v0_15"
|
||||||
)
|
)
|
||||||
@ -71,7 +70,7 @@ func migrateV043(appState genutiltypes.AppMap, clientCtx client.Context) genutil
|
|||||||
// migrateV040 migrates cosmos modules from v0.39 to a v0.40 genesis state.
|
// migrateV040 migrates cosmos modules from v0.39 to a v0.40 genesis state.
|
||||||
// This is based on the genutil/legacy/v40 migration logic but adapted to handle custom types from the kava module.
|
// This is based on the genutil/legacy/v40 migration logic but adapted to handle custom types from the kava module.
|
||||||
func migrateV040(appState genutiltypes.AppMap, clientCtx client.Context, genesisTime time.Time) genutiltypes.AppMap {
|
func migrateV040(appState genutiltypes.AppMap, clientCtx client.Context, genesisTime time.Time) genutiltypes.AppMap {
|
||||||
app.SetSDKConfig()
|
setConfigIfUnsealed()
|
||||||
v039Codec := codec.NewLegacyAmino()
|
v039Codec := codec.NewLegacyAmino()
|
||||||
v039auth.RegisterLegacyAminoCodec(v039Codec)
|
v039auth.RegisterLegacyAminoCodec(v039Codec)
|
||||||
v036gov.RegisterLegacyAminoCodec(v039Codec)
|
v036gov.RegisterLegacyAminoCodec(v039Codec)
|
||||||
|
@ -6,10 +6,10 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/client"
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
|
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
|
||||||
tmtypes "github.com/tendermint/tendermint/types"
|
|
||||||
|
|
||||||
"github.com/kava-labs/kava/app"
|
"github.com/kava-labs/kava/app"
|
||||||
|
tmtypes "github.com/tendermint/tendermint/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -17,9 +17,17 @@ var (
|
|||||||
ChainID = "kava-9"
|
ChainID = "kava-9"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func setConfigIfUnsealed() {
|
||||||
|
config := sdk.GetConfig()
|
||||||
|
if config.GetBech32AccountAddrPrefix() == "kava" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
app.SetSDKConfig()
|
||||||
|
}
|
||||||
|
|
||||||
// Migrate converts v15 genesis doc to v16 genesis doc
|
// Migrate converts v15 genesis doc to v16 genesis doc
|
||||||
func Migrate(genDoc *tmtypes.GenesisDoc, ctx client.Context) (*tmtypes.GenesisDoc, error) {
|
func Migrate(genDoc *tmtypes.GenesisDoc, ctx client.Context) (*tmtypes.GenesisDoc, error) {
|
||||||
app.SetSDKConfig()
|
setConfigIfUnsealed()
|
||||||
|
|
||||||
var appState genutiltypes.AppMap
|
var appState genutiltypes.AppMap
|
||||||
var err error
|
var err error
|
||||||
|
@ -63,7 +63,7 @@ func TestMigrateFull(t *testing.T) {
|
|||||||
|
|
||||||
func TestAccountBalances(t *testing.T) {
|
func TestAccountBalances(t *testing.T) {
|
||||||
t.Skip() // avoid committing test data
|
t.Skip() // avoid committing test data
|
||||||
app.SetSDKConfig()
|
setConfigIfUnsealed()
|
||||||
|
|
||||||
// load auth state from kava-8 with empty accounts removed (keeps size down)
|
// load auth state from kava-8 with empty accounts removed (keeps size down)
|
||||||
authbz, err := ioutil.ReadFile(filepath.Join("testdata", "kava-8-test-auth-state.json"))
|
authbz, err := ioutil.ReadFile(filepath.Join("testdata", "kava-8-test-auth-state.json"))
|
||||||
|
Loading…
Reference in New Issue
Block a user