Skip to content

Commit 8d68d5e

Browse files
authored
chore: prepare v11.14.0 (#339)
* prepare v11.14.0 * lint * interchain-test
1 parent ee7ad6f commit 8d68d5e

File tree

5 files changed

+107
-4
lines changed

5 files changed

+107
-4
lines changed

app/app.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ import (
5656

5757
"github.com/persistenceOne/persistenceCore/v11/app/keepers"
5858
"github.com/persistenceOne/persistenceCore/v11/app/upgrades"
59-
v11_13_0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/v11.13.0"
59+
v11_14_0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/v11.14.0"
6060
"github.com/persistenceOne/persistenceCore/v11/client/docs"
6161
)
6262

6363
var (
6464
DefaultNodeHome string
65-
Upgrades = []upgrades.Upgrade{v11_13_0.Upgrade}
65+
Upgrades = []upgrades.Upgrade{v11_14_0.Upgrade}
6666
ModuleBasics = module.NewBasicManager(keepers.AppModuleBasics...)
6767
)
6868

app/upgrades/v11.14.0/constants.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package v11_14_0
2+
3+
import (
4+
store "github.com/cosmos/cosmos-sdk/store/types"
5+
6+
"github.com/persistenceOne/persistenceCore/v11/app/upgrades"
7+
)
8+
9+
const (
10+
// UpgradeName defines the on-chain upgrade name.
11+
UpgradeName = "v11.14.0"
12+
)
13+
14+
var Upgrade = upgrades.Upgrade{
15+
UpgradeName: UpgradeName,
16+
CreateUpgradeHandler: CreateUpgradeHandler,
17+
StoreUpgrades: store.StoreUpgrades{},
18+
}

app/upgrades/v11.14.0/upgrades.go

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package v11_14_0
2+
3+
import (
4+
sdk "github.com/cosmos/cosmos-sdk/types"
5+
"github.com/cosmos/cosmos-sdk/types/module"
6+
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
7+
"github.com/persistenceOne/pstake-native/v2/x/liquidstakeibc/keeper"
8+
liquidstakeibctypes "github.com/persistenceOne/pstake-native/v2/x/liquidstakeibc/types"
9+
10+
"github.com/persistenceOne/persistenceCore/v11/app/upgrades"
11+
)
12+
13+
func CreateUpgradeHandler(args upgrades.UpgradeHandlerArgs) upgradetypes.UpgradeHandler {
14+
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
15+
ctx.Logger().Info("running module migrations...")
16+
17+
RemoveStargazeUnbondedBalance(ctx, args.Keepers.LiquidStakeIBCKeeper)
18+
19+
return args.ModuleManager.RunMigrations(ctx, args.Configurator, vm)
20+
}
21+
}
22+
23+
func RemoveStargazeUnbondedBalance(ctx sdk.Context, liquidStakeIBCKeeper *keeper.Keeper) {
24+
ctx.Logger().Info("starting to move tokens...")
25+
26+
// as per https://github.com/persistenceOne/pstake-native/issues/853
27+
chainID := "stargaze-1"
28+
epoch := int64(582)
29+
stkAmt := sdk.NewCoin("stk/ustars", sdk.NewInt(60621412694))
30+
unbondAmt := sdk.NewCoin("ustars", sdk.NewInt(62810179898))
31+
refillerAddr := "persistence1fp6qhht94pmfdq9h94dvw0tnmnlf2vutnlu7pt"
32+
33+
ctx.Logger().Info("set user unbonding...")
34+
liquidStakeIBCKeeper.SetUserUnbonding(ctx, &liquidstakeibctypes.UserUnbonding{
35+
ChainId: chainID,
36+
EpochNumber: epoch,
37+
Address: refillerAddr,
38+
StkAmount: stkAmt,
39+
UnbondAmount: unbondAmt,
40+
})
41+
42+
ctx.Logger().Info("set epoch unbonding...")
43+
liquidStakeIBCKeeper.SetUnbonding(ctx, &liquidstakeibctypes.Unbonding{
44+
ChainId: chainID,
45+
EpochNumber: epoch,
46+
MatureTime: ctx.BlockTime(),
47+
BurnAmount: stkAmt,
48+
UnbondAmount: unbondAmt,
49+
IbcSequenceId: "",
50+
State: 2,
51+
})
52+
53+
ctx.Logger().Info("done remove stargaze unbonded balance...")
54+
55+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package v11_14_0_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/CosmWasm/wasmd/x/wasm"
7+
dbm "github.com/cometbft/cometbft-db"
8+
"github.com/cometbft/cometbft/libs/log"
9+
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
10+
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
11+
"github.com/cosmos/cosmos-sdk/types"
12+
"github.com/stretchr/testify/require"
13+
14+
"github.com/persistenceOne/persistenceCore/v11/app"
15+
v11_14_0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/v11.14.0"
16+
)
17+
18+
func TestRemoveStargazeUnbondedBalance(t *testing.T) {
19+
testApp := app.NewApplication(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(""), []wasm.Option{})
20+
ctx := testApp.NewContext(true, tmproto.Header{})
21+
v11_14_0.RemoveStargazeUnbondedBalance(ctx, testApp.LiquidStakeIBCKeeper)
22+
23+
unbonding, ok := testApp.LiquidStakeIBCKeeper.GetUnbonding(ctx, "stargaze-1", 582)
24+
require.True(t, ok)
25+
require.Equal(t, types.NewInt(62810179898), unbonding.UnbondAmount.Amount)
26+
27+
userUnbonding, ok := testApp.LiquidStakeIBCKeeper.GetUserUnbonding(ctx, "stargaze-1", "persistence1fp6qhht94pmfdq9h94dvw0tnmnlf2vutnlu7pt", 582)
28+
require.True(t, ok)
29+
require.Equal(t, types.NewInt(62810179898), userUnbonding.UnbondAmount.Amount)
30+
}

interchaintest/chain_upgrade_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ const (
2929
func TestPersistenceUpgradeBasic(t *testing.T) {
3030
var (
3131
chainName = "persistence"
32-
initialVersion = "v11.12.0"
33-
upgradeName = "v11.13.0"
32+
initialVersion = "v11.13.0"
33+
upgradeName = "v11.14.0"
3434
upgradeRepo = PersistenceCoreImage.Repository
3535
upgradeBranchVersion = PersistenceCoreImage.Version
3636
)

0 commit comments

Comments
 (0)