From d6767b014dee92ec2f96c63f196a253c05c3cad5 Mon Sep 17 00:00:00 2001 From: Marc Puig Date: Wed, 1 May 2024 12:12:22 +0200 Subject: [PATCH 1/7] chore: prepare v11.11.0-rc0 (#330) * add upgrade migration * update migration test * udpate mod. --------- Co-authored-by: puneetmahajan --- app/app.go | 4 ++-- .../testnet/v11.11.0-rc0/constants.go | 18 +++++++++++++++ app/upgrades/testnet/v11.11.0-rc0/upgrades.go | 22 +++++++++++++++++++ go.mod | 4 ++-- go.sum | 8 +++---- interchaintest/chain_upgrade_test.go | 4 ++-- 6 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 app/upgrades/testnet/v11.11.0-rc0/constants.go create mode 100644 app/upgrades/testnet/v11.11.0-rc0/upgrades.go diff --git a/app/app.go b/app/app.go index 3de5c739..8be9857f 100644 --- a/app/app.go +++ b/app/app.go @@ -56,13 +56,13 @@ import ( "github.com/persistenceOne/persistenceCore/v11/app/keepers" "github.com/persistenceOne/persistenceCore/v11/app/upgrades" - v11_10_0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/v11.10.0" + v11_11_0_rc0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/testnet/v11.11.0-rc0" "github.com/persistenceOne/persistenceCore/v11/client/docs" ) var ( DefaultNodeHome string - Upgrades = []upgrades.Upgrade{v11_10_0.Upgrade} + Upgrades = []upgrades.Upgrade{v11_11_0_rc0.Upgrade} ModuleBasics = module.NewBasicManager(keepers.AppModuleBasics...) ) diff --git a/app/upgrades/testnet/v11.11.0-rc0/constants.go b/app/upgrades/testnet/v11.11.0-rc0/constants.go new file mode 100644 index 00000000..86e87f8b --- /dev/null +++ b/app/upgrades/testnet/v11.11.0-rc0/constants.go @@ -0,0 +1,18 @@ +package v11_11_0_rc0 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + + "github.com/persistenceOne/persistenceCore/v11/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name. + UpgradeName = "v11.11.0-rc0" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{}, +} diff --git a/app/upgrades/testnet/v11.11.0-rc0/upgrades.go b/app/upgrades/testnet/v11.11.0-rc0/upgrades.go new file mode 100644 index 00000000..67aa0f56 --- /dev/null +++ b/app/upgrades/testnet/v11.11.0-rc0/upgrades.go @@ -0,0 +1,22 @@ +package v11_11_0_rc0 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/persistenceOne/persistenceCore/v11/app/upgrades" +) + +func CreateUpgradeHandler(args upgrades.UpgradeHandlerArgs) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + ctx.Logger().Info("running module migrations...") + + err := args.Keepers.StakingKeeper.RefreshTotalLiquidStaked(ctx) + if err != nil { + ctx.Logger().Error("LSM failed to refresh total liquid staked", "error", err) + } + + return args.ModuleManager.RunMigrations(ctx, args.Configurator, vm) + } +} diff --git a/go.mod b/go.mod index a000c74b..f751ee63 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/cosmos/ibc-go/v7 v7.4.0 github.com/gorilla/mux v1.8.1 github.com/persistenceOne/persistence-sdk/v2 v2.2.0 - github.com/persistenceOne/pstake-native/v2 v2.12.0 + github.com/persistenceOne/pstake-native/v2 v2.13.0-rc0 github.com/prometheus/client_golang v1.16.0 github.com/skip-mev/pob v1.0.5 github.com/spf13/cast v1.6.0 @@ -61,7 +61,7 @@ require ( github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.4 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/gogoproto v1.4.10 // indirect diff --git a/go.sum b/go.sum index 57b2efa8..4cc6d3d1 100644 --- a/go.sum +++ b/go.sum @@ -403,8 +403,8 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= -github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= +github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= +github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= @@ -1034,8 +1034,8 @@ github.com/persistenceOne/cosmos-sdk v0.47.10-lsm-rc0 h1:lbSQZUdaaKIpoSAznVESl0v github.com/persistenceOne/cosmos-sdk v0.47.10-lsm-rc0/go.mod h1:Q/eHvXB0Awenk3NCh77NvjpeKGPigawFHIXlz2ayfos= github.com/persistenceOne/persistence-sdk/v2 v2.2.0 h1:ZsBsy/HElkwjPXoASI7CptMFY9C3C/d27G+8bxFDzQw= github.com/persistenceOne/persistence-sdk/v2 v2.2.0/go.mod h1:8VgozZWTPLMdlzsyiuGI0+vLo2fvGYSj/YKM9kiJwrI= -github.com/persistenceOne/pstake-native/v2 v2.12.0 h1:uuqZufMArylhtJvsLNVRWDhZRYUOz4xRmU+NVEryu6c= -github.com/persistenceOne/pstake-native/v2 v2.12.0/go.mod h1:mSAByOyYAXomcALxlwyVGKdFPwUkkyLOFs9OeTHKcuw= +github.com/persistenceOne/pstake-native/v2 v2.13.0-rc0 h1:JE6oYeNz1b00cqn8RT7pI4TKQB0CvpFmP3yGl9RCw/M= +github.com/persistenceOne/pstake-native/v2 v2.13.0-rc0/go.mod h1:FcLbnTasZfKKKQJ6nzgzdkDqb3dUlIyraqcsj7DMTfE= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= diff --git a/interchaintest/chain_upgrade_test.go b/interchaintest/chain_upgrade_test.go index e3ad0ba5..a2c4722e 100644 --- a/interchaintest/chain_upgrade_test.go +++ b/interchaintest/chain_upgrade_test.go @@ -29,8 +29,8 @@ const ( func TestPersistenceUpgradeBasic(t *testing.T) { var ( chainName = "persistence" - initialVersion = "v11.9.0" - upgradeName = "v11.10.0" + initialVersion = "v11.10.0" + upgradeName = "v11.11.0-rc0" upgradeRepo = PersistenceCoreImage.Repository upgradeBranchVersion = PersistenceCoreImage.Version ) From 0d36ac48d7d382a9f83cf3c7651f0637a2b879c3 Mon Sep 17 00:00:00 2001 From: kruspy Date: Thu, 2 May 2024 15:35:21 +0200 Subject: [PATCH 2/7] bump pstake --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index f751ee63..09d83653 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/cosmos/ibc-go/v7 v7.4.0 github.com/gorilla/mux v1.8.1 github.com/persistenceOne/persistence-sdk/v2 v2.2.0 - github.com/persistenceOne/pstake-native/v2 v2.13.0-rc0 + github.com/persistenceOne/pstake-native/v2 v2.13.0 github.com/prometheus/client_golang v1.16.0 github.com/skip-mev/pob v1.0.5 github.com/spf13/cast v1.6.0 diff --git a/go.sum b/go.sum index 4cc6d3d1..4ef8b8cc 100644 --- a/go.sum +++ b/go.sum @@ -1034,8 +1034,8 @@ github.com/persistenceOne/cosmos-sdk v0.47.10-lsm-rc0 h1:lbSQZUdaaKIpoSAznVESl0v github.com/persistenceOne/cosmos-sdk v0.47.10-lsm-rc0/go.mod h1:Q/eHvXB0Awenk3NCh77NvjpeKGPigawFHIXlz2ayfos= github.com/persistenceOne/persistence-sdk/v2 v2.2.0 h1:ZsBsy/HElkwjPXoASI7CptMFY9C3C/d27G+8bxFDzQw= github.com/persistenceOne/persistence-sdk/v2 v2.2.0/go.mod h1:8VgozZWTPLMdlzsyiuGI0+vLo2fvGYSj/YKM9kiJwrI= -github.com/persistenceOne/pstake-native/v2 v2.13.0-rc0 h1:JE6oYeNz1b00cqn8RT7pI4TKQB0CvpFmP3yGl9RCw/M= -github.com/persistenceOne/pstake-native/v2 v2.13.0-rc0/go.mod h1:FcLbnTasZfKKKQJ6nzgzdkDqb3dUlIyraqcsj7DMTfE= +github.com/persistenceOne/pstake-native/v2 v2.13.0 h1:XUYvVwkjjWGQeL+cpcgLUdRtO47+e3YffayGrUNGcvM= +github.com/persistenceOne/pstake-native/v2 v2.13.0/go.mod h1:FcLbnTasZfKKKQJ6nzgzdkDqb3dUlIyraqcsj7DMTfE= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= From a5b619c12fb2e0e807c2774560adb1ce2530ab4c Mon Sep 17 00:00:00 2001 From: kruspy Date: Thu, 2 May 2024 15:35:29 +0200 Subject: [PATCH 3/7] upgrade handlers --- app/app.go | 4 ++-- app/upgrades/v11.11.0/constants.go | 18 ++++++++++++++++++ app/upgrades/v11.11.0/upgrades.go | 22 ++++++++++++++++++++++ interchaintest/chain_upgrade_test.go | 2 +- 4 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 app/upgrades/v11.11.0/constants.go create mode 100644 app/upgrades/v11.11.0/upgrades.go diff --git a/app/app.go b/app/app.go index 8be9857f..25a21d6f 100644 --- a/app/app.go +++ b/app/app.go @@ -56,13 +56,13 @@ import ( "github.com/persistenceOne/persistenceCore/v11/app/keepers" "github.com/persistenceOne/persistenceCore/v11/app/upgrades" - v11_11_0_rc0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/testnet/v11.11.0-rc0" + v11_11_0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/v11.11.0" "github.com/persistenceOne/persistenceCore/v11/client/docs" ) var ( DefaultNodeHome string - Upgrades = []upgrades.Upgrade{v11_11_0_rc0.Upgrade} + Upgrades = []upgrades.Upgrade{v11_11_0.Upgrade} ModuleBasics = module.NewBasicManager(keepers.AppModuleBasics...) ) diff --git a/app/upgrades/v11.11.0/constants.go b/app/upgrades/v11.11.0/constants.go new file mode 100644 index 00000000..1f40b6a3 --- /dev/null +++ b/app/upgrades/v11.11.0/constants.go @@ -0,0 +1,18 @@ +package v11_11_0 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + + "github.com/persistenceOne/persistenceCore/v11/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name. + UpgradeName = "v11.11.0" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{}, +} diff --git a/app/upgrades/v11.11.0/upgrades.go b/app/upgrades/v11.11.0/upgrades.go new file mode 100644 index 00000000..0ee88957 --- /dev/null +++ b/app/upgrades/v11.11.0/upgrades.go @@ -0,0 +1,22 @@ +package v11_11_0 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/persistenceOne/persistenceCore/v11/app/upgrades" +) + +func CreateUpgradeHandler(args upgrades.UpgradeHandlerArgs) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + ctx.Logger().Info("running module migrations...") + + err := args.Keepers.StakingKeeper.RefreshTotalLiquidStaked(ctx) + if err != nil { + ctx.Logger().Error("LSM failed to refresh total liquid staked", "error", err) + } + + return args.ModuleManager.RunMigrations(ctx, args.Configurator, vm) + } +} diff --git a/interchaintest/chain_upgrade_test.go b/interchaintest/chain_upgrade_test.go index a2c4722e..0cc5b419 100644 --- a/interchaintest/chain_upgrade_test.go +++ b/interchaintest/chain_upgrade_test.go @@ -30,7 +30,7 @@ func TestPersistenceUpgradeBasic(t *testing.T) { var ( chainName = "persistence" initialVersion = "v11.10.0" - upgradeName = "v11.11.0-rc0" + upgradeName = "v11.11.0" upgradeRepo = PersistenceCoreImage.Repository upgradeBranchVersion = PersistenceCoreImage.Version ) From 5c02b48c1171575cc4798a8119b06be016134775 Mon Sep 17 00:00:00 2001 From: Ajeet Goyal Date: Fri, 17 May 2024 12:20:02 +0530 Subject: [PATCH 4/7] fix: register epoch hook + delegate pending rewards (#334) * register x/liquidstake epoch hooks * upgrade handler to delegate pending rewards * update upgrade test * register upgrade handler * update pstake version --- app/app.go | 4 +- app/keepers/keepers.go | 4 +- .../testnet/v11.12.0-rc0/constants.go | 18 +++++++ app/upgrades/testnet/v11.12.0-rc0/upgrades.go | 53 +++++++++++++++++++ go.mod | 2 +- go.sum | 4 +- interchaintest/chain_upgrade_test.go | 4 +- 7 files changed, 81 insertions(+), 8 deletions(-) create mode 100644 app/upgrades/testnet/v11.12.0-rc0/constants.go create mode 100644 app/upgrades/testnet/v11.12.0-rc0/upgrades.go diff --git a/app/app.go b/app/app.go index 25a21d6f..7bda634d 100644 --- a/app/app.go +++ b/app/app.go @@ -56,13 +56,13 @@ import ( "github.com/persistenceOne/persistenceCore/v11/app/keepers" "github.com/persistenceOne/persistenceCore/v11/app/upgrades" - v11_11_0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/v11.11.0" + v11_12_0_rc0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/testnet/v11.12.0-rc0" "github.com/persistenceOne/persistenceCore/v11/client/docs" ) var ( DefaultNodeHome string - Upgrades = []upgrades.Upgrade{v11_11_0.Upgrade} + Upgrades = []upgrades.Upgrade{v11_12_0_rc0.Upgrade} ModuleBasics = module.NewBasicManager(keepers.AppModuleBasics...) ) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 9cb9922f..fba3c96f 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -473,7 +473,9 @@ func NewAppKeeper( ) appKeepers.EpochsKeeper.SetHooks( epochstypes.NewMultiEpochHooks( - appKeepers.LiquidStakeIBCKeeper.NewEpochHooks(), appKeepers.RateSyncKeeper.EpochHooks(), + appKeepers.LiquidStakeIBCKeeper.NewEpochHooks(), + appKeepers.LiquidStakeKeeper.EpochHooks(), + appKeepers.RateSyncKeeper.EpochHooks(), ), ) diff --git a/app/upgrades/testnet/v11.12.0-rc0/constants.go b/app/upgrades/testnet/v11.12.0-rc0/constants.go new file mode 100644 index 00000000..fe538e8d --- /dev/null +++ b/app/upgrades/testnet/v11.12.0-rc0/constants.go @@ -0,0 +1,18 @@ +package v11_12_0_rc0 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + + "github.com/persistenceOne/persistenceCore/v11/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name. + UpgradeName = "v11.12.0-rc0" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{}, +} diff --git a/app/upgrades/testnet/v11.12.0-rc0/upgrades.go b/app/upgrades/testnet/v11.12.0-rc0/upgrades.go new file mode 100644 index 00000000..8ea9a10c --- /dev/null +++ b/app/upgrades/testnet/v11.12.0-rc0/upgrades.go @@ -0,0 +1,53 @@ +package v11_12_0_rc0 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + liquidstaketypes "github.com/persistenceOne/pstake-native/v2/x/liquidstake/types" + + "github.com/persistenceOne/persistenceCore/v11/app/keepers" + "github.com/persistenceOne/persistenceCore/v11/app/upgrades" +) + +func CreateUpgradeHandler(args upgrades.UpgradeHandlerArgs) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + ctx.Logger().Info("running module migrations...") + + DelegateLiquidStakeRewards(ctx, args.Keepers) + + return args.ModuleManager.RunMigrations(ctx, args.Configurator, vm) + } +} + +func DelegateLiquidStakeRewards(ctx sdk.Context, k *keepers.AppKeepers) { + proxyAccBalance := k.LiquidStakeKeeper.GetProxyAccBalance(ctx, liquidstaketypes.LiquidStakeProxyAcc) + amountToDelegate := proxyAccBalance.Amount + + whitelistedValidators := k.LiquidStakeKeeper.GetParams(ctx).WhitelistedValidators + whitelistedValsMap := liquidstaketypes.GetWhitelistedValsMap(whitelistedValidators) + activeLiquidVals := k.LiquidStakeKeeper.GetActiveLiquidValidators(ctx, whitelistedValsMap) + + // currently auto compounding fee rate is zero, therefore fee logic is added here. + + err := k.LiquidStakeKeeper.LiquidDelegate(ctx, liquidstaketypes.LiquidStakeProxyAcc, activeLiquidVals, amountToDelegate, whitelistedValsMap) + + // if liquid delegate fails then try to delegate to any one active validator + if err != nil { + ctx.Logger().Info("failed to liquid delegate, trying to delegate to any one validator...", "error", err.Error()) + + for _, lv := range activeLiquidVals { + val, _ := k.StakingKeeper.GetValidator(ctx, lv.GetOperator()) + err2 := k.LiquidStakeKeeper.DelegateWithCap(ctx, liquidstaketypes.LiquidStakeProxyAcc, val, amountToDelegate) + if err2 != nil { + ctx.Logger().Info("failed to delegate", "validator", val.GetOperator(), "error", err2.Error()) + // continue with next val + } else { + // successfully delegated, exit + return + } + } + + ctx.Logger().Error("failed to delegate to any of active val set") + } +} diff --git a/go.mod b/go.mod index 09d83653..93a659b4 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/cosmos/ibc-go/v7 v7.4.0 github.com/gorilla/mux v1.8.1 github.com/persistenceOne/persistence-sdk/v2 v2.2.0 - github.com/persistenceOne/pstake-native/v2 v2.13.0 + github.com/persistenceOne/pstake-native/v2 v2.14.0-rc0 github.com/prometheus/client_golang v1.16.0 github.com/skip-mev/pob v1.0.5 github.com/spf13/cast v1.6.0 diff --git a/go.sum b/go.sum index 4ef8b8cc..7937a243 100644 --- a/go.sum +++ b/go.sum @@ -1034,8 +1034,8 @@ github.com/persistenceOne/cosmos-sdk v0.47.10-lsm-rc0 h1:lbSQZUdaaKIpoSAznVESl0v github.com/persistenceOne/cosmos-sdk v0.47.10-lsm-rc0/go.mod h1:Q/eHvXB0Awenk3NCh77NvjpeKGPigawFHIXlz2ayfos= github.com/persistenceOne/persistence-sdk/v2 v2.2.0 h1:ZsBsy/HElkwjPXoASI7CptMFY9C3C/d27G+8bxFDzQw= github.com/persistenceOne/persistence-sdk/v2 v2.2.0/go.mod h1:8VgozZWTPLMdlzsyiuGI0+vLo2fvGYSj/YKM9kiJwrI= -github.com/persistenceOne/pstake-native/v2 v2.13.0 h1:XUYvVwkjjWGQeL+cpcgLUdRtO47+e3YffayGrUNGcvM= -github.com/persistenceOne/pstake-native/v2 v2.13.0/go.mod h1:FcLbnTasZfKKKQJ6nzgzdkDqb3dUlIyraqcsj7DMTfE= +github.com/persistenceOne/pstake-native/v2 v2.14.0-rc0 h1:4vHEFSM6aZ14GzhtT+nsO6jLiB2as/dy5aQT8w8zUfQ= +github.com/persistenceOne/pstake-native/v2 v2.14.0-rc0/go.mod h1:FcLbnTasZfKKKQJ6nzgzdkDqb3dUlIyraqcsj7DMTfE= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= diff --git a/interchaintest/chain_upgrade_test.go b/interchaintest/chain_upgrade_test.go index 0cc5b419..c493d894 100644 --- a/interchaintest/chain_upgrade_test.go +++ b/interchaintest/chain_upgrade_test.go @@ -29,8 +29,8 @@ const ( func TestPersistenceUpgradeBasic(t *testing.T) { var ( chainName = "persistence" - initialVersion = "v11.10.0" - upgradeName = "v11.11.0" + initialVersion = "v11.11.0" + upgradeName = "v11.12.0-rc0" upgradeRepo = PersistenceCoreImage.Repository upgradeBranchVersion = PersistenceCoreImage.Version ) From de4841e7ff6b891e0a49d8cc78a249f02645e3e1 Mon Sep 17 00:00:00 2001 From: Ajeet Goyal Date: Fri, 17 May 2024 19:31:20 +0530 Subject: [PATCH 5/7] prepare v11.12.0 upgrade (#335) --- app/app.go | 4 +- app/upgrades/testnet/v11.12.0-rc0/upgrades.go | 2 +- app/upgrades/v11.12.0/constants.go | 18 +++++++ app/upgrades/v11.12.0/upgrades.go | 53 +++++++++++++++++++ go.mod | 2 +- go.sum | 4 +- interchaintest/chain_upgrade_test.go | 2 +- 7 files changed, 78 insertions(+), 7 deletions(-) create mode 100644 app/upgrades/v11.12.0/constants.go create mode 100644 app/upgrades/v11.12.0/upgrades.go diff --git a/app/app.go b/app/app.go index 7bda634d..dbe84504 100644 --- a/app/app.go +++ b/app/app.go @@ -56,13 +56,13 @@ import ( "github.com/persistenceOne/persistenceCore/v11/app/keepers" "github.com/persistenceOne/persistenceCore/v11/app/upgrades" - v11_12_0_rc0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/testnet/v11.12.0-rc0" + v11_12_0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/v11.12.0" "github.com/persistenceOne/persistenceCore/v11/client/docs" ) var ( DefaultNodeHome string - Upgrades = []upgrades.Upgrade{v11_12_0_rc0.Upgrade} + Upgrades = []upgrades.Upgrade{v11_12_0.Upgrade} ModuleBasics = module.NewBasicManager(keepers.AppModuleBasics...) ) diff --git a/app/upgrades/testnet/v11.12.0-rc0/upgrades.go b/app/upgrades/testnet/v11.12.0-rc0/upgrades.go index 8ea9a10c..dbe3cd8b 100644 --- a/app/upgrades/testnet/v11.12.0-rc0/upgrades.go +++ b/app/upgrades/testnet/v11.12.0-rc0/upgrades.go @@ -28,7 +28,7 @@ func DelegateLiquidStakeRewards(ctx sdk.Context, k *keepers.AppKeepers) { whitelistedValsMap := liquidstaketypes.GetWhitelistedValsMap(whitelistedValidators) activeLiquidVals := k.LiquidStakeKeeper.GetActiveLiquidValidators(ctx, whitelistedValsMap) - // currently auto compounding fee rate is zero, therefore fee logic is added here. + // currently auto compounding fee rate is zero, therefore fee logic is not added here. err := k.LiquidStakeKeeper.LiquidDelegate(ctx, liquidstaketypes.LiquidStakeProxyAcc, activeLiquidVals, amountToDelegate, whitelistedValsMap) diff --git a/app/upgrades/v11.12.0/constants.go b/app/upgrades/v11.12.0/constants.go new file mode 100644 index 00000000..ef2e1034 --- /dev/null +++ b/app/upgrades/v11.12.0/constants.go @@ -0,0 +1,18 @@ +package v11_12_0 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + + "github.com/persistenceOne/persistenceCore/v11/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name. + UpgradeName = "v11.12.0" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{}, +} diff --git a/app/upgrades/v11.12.0/upgrades.go b/app/upgrades/v11.12.0/upgrades.go new file mode 100644 index 00000000..74090f34 --- /dev/null +++ b/app/upgrades/v11.12.0/upgrades.go @@ -0,0 +1,53 @@ +package v11_12_0 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + liquidstaketypes "github.com/persistenceOne/pstake-native/v2/x/liquidstake/types" + + "github.com/persistenceOne/persistenceCore/v11/app/keepers" + "github.com/persistenceOne/persistenceCore/v11/app/upgrades" +) + +func CreateUpgradeHandler(args upgrades.UpgradeHandlerArgs) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + ctx.Logger().Info("running module migrations...") + + DelegateLiquidStakeRewards(ctx, args.Keepers) + + return args.ModuleManager.RunMigrations(ctx, args.Configurator, vm) + } +} + +func DelegateLiquidStakeRewards(ctx sdk.Context, k *keepers.AppKeepers) { + proxyAccBalance := k.LiquidStakeKeeper.GetProxyAccBalance(ctx, liquidstaketypes.LiquidStakeProxyAcc) + amountToDelegate := proxyAccBalance.Amount + + whitelistedValidators := k.LiquidStakeKeeper.GetParams(ctx).WhitelistedValidators + whitelistedValsMap := liquidstaketypes.GetWhitelistedValsMap(whitelistedValidators) + activeLiquidVals := k.LiquidStakeKeeper.GetActiveLiquidValidators(ctx, whitelistedValsMap) + + // currently auto compounding fee rate is zero, therefore fee logic is not added here. + + err := k.LiquidStakeKeeper.LiquidDelegate(ctx, liquidstaketypes.LiquidStakeProxyAcc, activeLiquidVals, amountToDelegate, whitelistedValsMap) + + // if liquid delegate fails then try to delegate to any one active validator + if err != nil { + ctx.Logger().Info("failed to liquid delegate, trying to delegate to any one validator...", "error", err.Error()) + + for _, lv := range activeLiquidVals { + val, _ := k.StakingKeeper.GetValidator(ctx, lv.GetOperator()) + err2 := k.LiquidStakeKeeper.DelegateWithCap(ctx, liquidstaketypes.LiquidStakeProxyAcc, val, amountToDelegate) + if err2 != nil { + ctx.Logger().Info("failed to delegate", "validator", val.GetOperator(), "error", err2.Error()) + // continue with next val + } else { + // successfully delegated, exit + return + } + } + + ctx.Logger().Error("failed to delegate to any of active val set") + } +} diff --git a/go.mod b/go.mod index 93a659b4..65a8ffdb 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/cosmos/ibc-go/v7 v7.4.0 github.com/gorilla/mux v1.8.1 github.com/persistenceOne/persistence-sdk/v2 v2.2.0 - github.com/persistenceOne/pstake-native/v2 v2.14.0-rc0 + github.com/persistenceOne/pstake-native/v2 v2.14.0 github.com/prometheus/client_golang v1.16.0 github.com/skip-mev/pob v1.0.5 github.com/spf13/cast v1.6.0 diff --git a/go.sum b/go.sum index 7937a243..d275f5f0 100644 --- a/go.sum +++ b/go.sum @@ -1034,8 +1034,8 @@ github.com/persistenceOne/cosmos-sdk v0.47.10-lsm-rc0 h1:lbSQZUdaaKIpoSAznVESl0v github.com/persistenceOne/cosmos-sdk v0.47.10-lsm-rc0/go.mod h1:Q/eHvXB0Awenk3NCh77NvjpeKGPigawFHIXlz2ayfos= github.com/persistenceOne/persistence-sdk/v2 v2.2.0 h1:ZsBsy/HElkwjPXoASI7CptMFY9C3C/d27G+8bxFDzQw= github.com/persistenceOne/persistence-sdk/v2 v2.2.0/go.mod h1:8VgozZWTPLMdlzsyiuGI0+vLo2fvGYSj/YKM9kiJwrI= -github.com/persistenceOne/pstake-native/v2 v2.14.0-rc0 h1:4vHEFSM6aZ14GzhtT+nsO6jLiB2as/dy5aQT8w8zUfQ= -github.com/persistenceOne/pstake-native/v2 v2.14.0-rc0/go.mod h1:FcLbnTasZfKKKQJ6nzgzdkDqb3dUlIyraqcsj7DMTfE= +github.com/persistenceOne/pstake-native/v2 v2.14.0 h1:3FghzZZFA1UX/UrZNiVh5kPX2CSQUxZihZ5l80VWhms= +github.com/persistenceOne/pstake-native/v2 v2.14.0/go.mod h1:FcLbnTasZfKKKQJ6nzgzdkDqb3dUlIyraqcsj7DMTfE= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= diff --git a/interchaintest/chain_upgrade_test.go b/interchaintest/chain_upgrade_test.go index c493d894..dd0cf5a3 100644 --- a/interchaintest/chain_upgrade_test.go +++ b/interchaintest/chain_upgrade_test.go @@ -30,7 +30,7 @@ func TestPersistenceUpgradeBasic(t *testing.T) { var ( chainName = "persistence" initialVersion = "v11.11.0" - upgradeName = "v11.12.0-rc0" + upgradeName = "v11.12.0" upgradeRepo = PersistenceCoreImage.Repository upgradeBranchVersion = PersistenceCoreImage.Version ) From 8d68ae238ea23312a4ff4f9da059dfa44a98ef5f Mon Sep 17 00:00:00 2001 From: Puneet <59960662+puneet2019@users.noreply.github.com> Date: Thu, 30 May 2024 17:45:20 +0400 Subject: [PATCH 6/7] chore: prepare v11.13.0-rc0 for testnet (#336) * prepare v11.13.0-rc0 for testnet * update tests, by reducing rebalancing epoch * add sleep before staking * update go.mod * refix interchain test. --- app/app.go | 4 ++-- app/upgrades/testnet/v11.13.0-rc0/constants.go | 18 ++++++++++++++++++ app/upgrades/testnet/v11.13.0-rc0/upgrades.go | 15 +++++++++++++++ go.mod | 2 +- go.sum | 4 ++-- interchaintest/chain_upgrade_test.go | 4 ++-- .../liquidstake_stkxprt_globalcap_test.go | 5 ++--- interchaintest/liquidstake_stkxprt_test.go | 9 +++------ 8 files changed, 45 insertions(+), 16 deletions(-) create mode 100644 app/upgrades/testnet/v11.13.0-rc0/constants.go create mode 100644 app/upgrades/testnet/v11.13.0-rc0/upgrades.go diff --git a/app/app.go b/app/app.go index dbe84504..869fea06 100644 --- a/app/app.go +++ b/app/app.go @@ -56,13 +56,13 @@ import ( "github.com/persistenceOne/persistenceCore/v11/app/keepers" "github.com/persistenceOne/persistenceCore/v11/app/upgrades" - v11_12_0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/v11.12.0" + v11_13_0_rc0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/testnet/v11.13.0-rc0" "github.com/persistenceOne/persistenceCore/v11/client/docs" ) var ( DefaultNodeHome string - Upgrades = []upgrades.Upgrade{v11_12_0.Upgrade} + Upgrades = []upgrades.Upgrade{v11_13_0_rc0.Upgrade} ModuleBasics = module.NewBasicManager(keepers.AppModuleBasics...) ) diff --git a/app/upgrades/testnet/v11.13.0-rc0/constants.go b/app/upgrades/testnet/v11.13.0-rc0/constants.go new file mode 100644 index 00000000..0566cc18 --- /dev/null +++ b/app/upgrades/testnet/v11.13.0-rc0/constants.go @@ -0,0 +1,18 @@ +package v11_13_0_rc0 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + + "github.com/persistenceOne/persistenceCore/v11/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name. + UpgradeName = "v11.13.0-rc0" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{}, +} diff --git a/app/upgrades/testnet/v11.13.0-rc0/upgrades.go b/app/upgrades/testnet/v11.13.0-rc0/upgrades.go new file mode 100644 index 00000000..ba50820b --- /dev/null +++ b/app/upgrades/testnet/v11.13.0-rc0/upgrades.go @@ -0,0 +1,15 @@ +package v11_13_0_rc0 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + "github.com/persistenceOne/persistenceCore/v11/app/upgrades" +) + +func CreateUpgradeHandler(args upgrades.UpgradeHandlerArgs) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + ctx.Logger().Info("running module migrations...") + return args.ModuleManager.RunMigrations(ctx, args.Configurator, vm) + } +} diff --git a/go.mod b/go.mod index 65a8ffdb..1a5c2aec 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/cosmos/ibc-go/v7 v7.4.0 github.com/gorilla/mux v1.8.1 github.com/persistenceOne/persistence-sdk/v2 v2.2.0 - github.com/persistenceOne/pstake-native/v2 v2.14.0 + github.com/persistenceOne/pstake-native/v2 v2.15.0-rc1 github.com/prometheus/client_golang v1.16.0 github.com/skip-mev/pob v1.0.5 github.com/spf13/cast v1.6.0 diff --git a/go.sum b/go.sum index d275f5f0..04bc0b87 100644 --- a/go.sum +++ b/go.sum @@ -1034,8 +1034,8 @@ github.com/persistenceOne/cosmos-sdk v0.47.10-lsm-rc0 h1:lbSQZUdaaKIpoSAznVESl0v github.com/persistenceOne/cosmos-sdk v0.47.10-lsm-rc0/go.mod h1:Q/eHvXB0Awenk3NCh77NvjpeKGPigawFHIXlz2ayfos= github.com/persistenceOne/persistence-sdk/v2 v2.2.0 h1:ZsBsy/HElkwjPXoASI7CptMFY9C3C/d27G+8bxFDzQw= github.com/persistenceOne/persistence-sdk/v2 v2.2.0/go.mod h1:8VgozZWTPLMdlzsyiuGI0+vLo2fvGYSj/YKM9kiJwrI= -github.com/persistenceOne/pstake-native/v2 v2.14.0 h1:3FghzZZFA1UX/UrZNiVh5kPX2CSQUxZihZ5l80VWhms= -github.com/persistenceOne/pstake-native/v2 v2.14.0/go.mod h1:FcLbnTasZfKKKQJ6nzgzdkDqb3dUlIyraqcsj7DMTfE= +github.com/persistenceOne/pstake-native/v2 v2.15.0-rc1 h1:kOJ8E/N9QPFbH2JaoDrhlnwP88o9NZ7Mp44KAiBdNN8= +github.com/persistenceOne/pstake-native/v2 v2.15.0-rc1/go.mod h1:FcLbnTasZfKKKQJ6nzgzdkDqb3dUlIyraqcsj7DMTfE= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= diff --git a/interchaintest/chain_upgrade_test.go b/interchaintest/chain_upgrade_test.go index dd0cf5a3..c2ce32c7 100644 --- a/interchaintest/chain_upgrade_test.go +++ b/interchaintest/chain_upgrade_test.go @@ -29,8 +29,8 @@ const ( func TestPersistenceUpgradeBasic(t *testing.T) { var ( chainName = "persistence" - initialVersion = "v11.11.0" - upgradeName = "v11.12.0" + initialVersion = "v11.12.0" + upgradeName = "v11.13.0-rc0" upgradeRepo = PersistenceCoreImage.Repository upgradeBranchVersion = PersistenceCoreImage.Version ) diff --git a/interchaintest/liquidstake_stkxprt_globalcap_test.go b/interchaintest/liquidstake_stkxprt_globalcap_test.go index 5c4adead..967a950f 100644 --- a/interchaintest/liquidstake_stkxprt_globalcap_test.go +++ b/interchaintest/liquidstake_stkxprt_globalcap_test.go @@ -2,10 +2,8 @@ package interchaintest import ( "context" - "encoding/json" - "testing" - "cosmossdk.io/math" + "encoding/json" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -15,6 +13,7 @@ import ( "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" + "testing" "github.com/persistenceOne/persistenceCore/v11/interchaintest/helpers" ) diff --git a/interchaintest/liquidstake_stkxprt_test.go b/interchaintest/liquidstake_stkxprt_test.go index 58e0c4d1..0cd77b2c 100644 --- a/interchaintest/liquidstake_stkxprt_test.go +++ b/interchaintest/liquidstake_stkxprt_test.go @@ -2,22 +2,20 @@ package interchaintest import ( "context" - "encoding/json" - "testing" - "cosmossdk.io/math" + "encoding/json" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + "github.com/persistenceOne/persistenceCore/v11/interchaintest/helpers" liquidstaketypes "github.com/persistenceOne/pstake-native/v2/x/liquidstake/types" "github.com/strangelove-ventures/interchaintest/v7" "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" "github.com/strangelove-ventures/interchaintest/v7/ibc" "github.com/strangelove-ventures/interchaintest/v7/testutil" "github.com/stretchr/testify/require" - - "github.com/persistenceOne/persistenceCore/v11/interchaintest/helpers" + "testing" ) // TestLiquidStakeStkXPRT runs the flow of liquid XPRT staking using @@ -155,7 +153,6 @@ func TestLiquidStakeStkXPRT(t *testing.T) { ) require.NoError(t, err, "error submitting liquidstake validators whitelist update tx") require.Equal(t, uint32(0), txResp.Code, txResp.RawLog) - // Liquid stake XPRT from the first user (5 XPRT) firstUserLiquidStakeAmount := sdk.NewInt(5_000_000) From e3704ab387237012055fb5986a2465d88d97e246 Mon Sep 17 00:00:00 2001 From: Puneet <59960662+puneet2019@users.noreply.github.com> Date: Fri, 31 May 2024 13:14:53 +0530 Subject: [PATCH 7/7] chore: prepare mainnet v11.13.0 (#337) * prepare mainnet v11.13.0 * update mod --- app/app.go | 4 ++-- app/upgrades/v11.13.0/constants.go | 18 ++++++++++++++++++ app/upgrades/v11.13.0/upgrades.go | 16 ++++++++++++++++ go.mod | 2 +- go.sum | 4 ++-- interchaintest/chain_upgrade_test.go | 2 +- 6 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 app/upgrades/v11.13.0/constants.go create mode 100644 app/upgrades/v11.13.0/upgrades.go diff --git a/app/app.go b/app/app.go index 869fea06..d4665a7b 100644 --- a/app/app.go +++ b/app/app.go @@ -56,13 +56,13 @@ import ( "github.com/persistenceOne/persistenceCore/v11/app/keepers" "github.com/persistenceOne/persistenceCore/v11/app/upgrades" - v11_13_0_rc0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/testnet/v11.13.0-rc0" + v11_13_0 "github.com/persistenceOne/persistenceCore/v11/app/upgrades/v11.13.0" "github.com/persistenceOne/persistenceCore/v11/client/docs" ) var ( DefaultNodeHome string - Upgrades = []upgrades.Upgrade{v11_13_0_rc0.Upgrade} + Upgrades = []upgrades.Upgrade{v11_13_0.Upgrade} ModuleBasics = module.NewBasicManager(keepers.AppModuleBasics...) ) diff --git a/app/upgrades/v11.13.0/constants.go b/app/upgrades/v11.13.0/constants.go new file mode 100644 index 00000000..b226549d --- /dev/null +++ b/app/upgrades/v11.13.0/constants.go @@ -0,0 +1,18 @@ +package v11_13_0 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + + "github.com/persistenceOne/persistenceCore/v11/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name. + UpgradeName = "v11.13.0" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{}, +} diff --git a/app/upgrades/v11.13.0/upgrades.go b/app/upgrades/v11.13.0/upgrades.go new file mode 100644 index 00000000..9f9f6329 --- /dev/null +++ b/app/upgrades/v11.13.0/upgrades.go @@ -0,0 +1,16 @@ +package v11_13_0 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + + "github.com/persistenceOne/persistenceCore/v11/app/upgrades" +) + +func CreateUpgradeHandler(args upgrades.UpgradeHandlerArgs) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + ctx.Logger().Info("running module migrations...") + return args.ModuleManager.RunMigrations(ctx, args.Configurator, vm) + } +} diff --git a/go.mod b/go.mod index 1a5c2aec..57b991e3 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/cosmos/ibc-go/v7 v7.4.0 github.com/gorilla/mux v1.8.1 github.com/persistenceOne/persistence-sdk/v2 v2.2.0 - github.com/persistenceOne/pstake-native/v2 v2.15.0-rc1 + github.com/persistenceOne/pstake-native/v2 v2.15.0 github.com/prometheus/client_golang v1.16.0 github.com/skip-mev/pob v1.0.5 github.com/spf13/cast v1.6.0 diff --git a/go.sum b/go.sum index 04bc0b87..b7c704bc 100644 --- a/go.sum +++ b/go.sum @@ -1034,8 +1034,8 @@ github.com/persistenceOne/cosmos-sdk v0.47.10-lsm-rc0 h1:lbSQZUdaaKIpoSAznVESl0v github.com/persistenceOne/cosmos-sdk v0.47.10-lsm-rc0/go.mod h1:Q/eHvXB0Awenk3NCh77NvjpeKGPigawFHIXlz2ayfos= github.com/persistenceOne/persistence-sdk/v2 v2.2.0 h1:ZsBsy/HElkwjPXoASI7CptMFY9C3C/d27G+8bxFDzQw= github.com/persistenceOne/persistence-sdk/v2 v2.2.0/go.mod h1:8VgozZWTPLMdlzsyiuGI0+vLo2fvGYSj/YKM9kiJwrI= -github.com/persistenceOne/pstake-native/v2 v2.15.0-rc1 h1:kOJ8E/N9QPFbH2JaoDrhlnwP88o9NZ7Mp44KAiBdNN8= -github.com/persistenceOne/pstake-native/v2 v2.15.0-rc1/go.mod h1:FcLbnTasZfKKKQJ6nzgzdkDqb3dUlIyraqcsj7DMTfE= +github.com/persistenceOne/pstake-native/v2 v2.15.0 h1:GmsLLcAhkk71FqV2hwWH555MSLRsdFaR2kEnscUrKOE= +github.com/persistenceOne/pstake-native/v2 v2.15.0/go.mod h1:FcLbnTasZfKKKQJ6nzgzdkDqb3dUlIyraqcsj7DMTfE= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= diff --git a/interchaintest/chain_upgrade_test.go b/interchaintest/chain_upgrade_test.go index c2ce32c7..cb6d5ba2 100644 --- a/interchaintest/chain_upgrade_test.go +++ b/interchaintest/chain_upgrade_test.go @@ -30,7 +30,7 @@ func TestPersistenceUpgradeBasic(t *testing.T) { var ( chainName = "persistence" initialVersion = "v11.12.0" - upgradeName = "v11.13.0-rc0" + upgradeName = "v11.13.0" upgradeRepo = PersistenceCoreImage.Repository upgradeBranchVersion = PersistenceCoreImage.Version )