Fix validate-genesis for kava 10 by updatine usdx debt limit to be valid (#1257) (#1258)

This commit is contained in:
Nick DeLuca 2022-05-27 16:31:28 -07:00 committed by GitHub
parent eb1cec7d5c
commit 86de5011f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View File

@ -19,6 +19,7 @@ import (
auctiontypes "github.com/kava-labs/kava/x/auction/types"
v017bep3 "github.com/kava-labs/kava/x/bep3/legacy/v0_17"
bep3types "github.com/kava-labs/kava/x/bep3/types"
cdptypes "github.com/kava-labs/kava/x/cdp/types"
committeetypes "github.com/kava-labs/kava/x/committee/types"
incentivetypes "github.com/kava-labs/kava/x/incentive/types"
savingstypes "github.com/kava-labs/kava/x/savings/types"
@ -76,6 +77,17 @@ func migrateAppState(appState genutiltypes.AppMap, clientCtx client.Context) {
authzState := authz.DefaultGenesisState()
appState[authz.ModuleName] = codec.MustMarshalJSON(authzState)
// x/cdp
if appState[cdptypes.ModuleName] != nil {
var genState cdptypes.GenesisState
codec.MustUnmarshalJSON(appState[cdptypes.ModuleName], &genState)
genState.Params.GlobalDebtLimit = sdk.NewCoin("usdx", sdk.NewInt(393000000000000))
encodedState := codec.MustMarshalJSON(&genState)
appState[cdptypes.ModuleName] = encodedState
}
// x/auction
if appState[auctiontypes.ModuleName] != nil {
var v16GenState v016auction.GenesisState

View File

@ -20,6 +20,7 @@ import (
feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types"
auctiontypes "github.com/kava-labs/kava/x/auction/types"
cdptypes "github.com/kava-labs/kava/x/cdp/types"
evmutiltypes "github.com/kava-labs/kava/x/evmutil/types"
incentivetypes "github.com/kava-labs/kava/x/incentive/types"
savingstypes "github.com/kava-labs/kava/x/savings/types"
@ -68,6 +69,14 @@ func TestMigrateEvm(t *testing.T) {
}, genstate.Params)
}
func TestMigrateCDP(t *testing.T) {
appMap, ctx := migrateToV17AndGetAppMap(t)
var genstate cdptypes.GenesisState
err := ctx.Codec.UnmarshalJSON(appMap[cdptypes.ModuleName], &genstate)
assert.NoError(t, err)
assert.Equal(t, genstate.Params.GlobalDebtLimit, sdk.NewCoin("usdx", sdk.NewInt(393000000000000)))
}
func TestMigrateAuction(t *testing.T) {
appMap, ctx := migrateToV17AndGetAppMap(t)
var genstate auctiontypes.GenesisState

View File

@ -639,7 +639,7 @@
"conversion_factor": "6",
"debt_floor": "10000000"
},
"global_debt_limit": { "denom": "usdx", "amount": "43000000000000" },
"global_debt_limit": { "denom": "usdx", "amount": "393000000000000" },
"surplus_auction_threshold": "500000000000",
"surplus_auction_lot": "10000000000",
"debt_auction_threshold": "100000000000",