From 14538d6617425b7f2bd91086b588413e9a1ae635 Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Thu, 27 Jul 2023 16:54:42 +0200 Subject: [PATCH 1/2] chore: prepare `v1.4` --- .github/mergify.yml | 8 ++ app/app.go | 15 +-- app/upgrades/v1_3/constants.go | 49 ---------- app/upgrades/v1_3/upgrade.go | 134 --------------------------- app/upgrades/v1_4/constants.go | 10 ++ app/upgrades/{v1_3 => v1_4}/store.go | 8 +- app/upgrades/v1_4/upgrade.go | 21 +++++ 7 files changed, 46 insertions(+), 199 deletions(-) delete mode 100644 app/upgrades/v1_3/constants.go delete mode 100644 app/upgrades/v1_3/upgrade.go create mode 100644 app/upgrades/v1_4/constants.go rename app/upgrades/{v1_3 => v1_4}/store.go (70%) create mode 100644 app/upgrades/v1_4/upgrade.go diff --git a/.github/mergify.yml b/.github/mergify.yml index 8d0dd702..807ba194 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -38,3 +38,11 @@ pull_request_rules: backport: branches: - release/v1.3.x + - name: backport patches to v1.4.x branch + conditions: + - base=main + - label=backport/v1.4.x + actions: + backport: + branches: + - release/v1.4.x diff --git a/app/app.go b/app/app.go index 5a7b9adc..5b6a32f9 100644 --- a/app/app.go +++ b/app/app.go @@ -7,7 +7,7 @@ import ( "os" "path/filepath" - v1p3 "github.com/KYVENetwork/chain/app/upgrades/v1_3" + v1p4 "github.com/KYVENetwork/chain/app/upgrades/v1_4" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" @@ -802,15 +802,10 @@ func NewKYVEApp( app.SetEndBlocker(app.EndBlocker) app.UpgradeKeeper.SetUpgradeHandler( - v1p3.UpgradeName, - v1p3.CreateUpgradeHandler( + v1p4.UpgradeName, + v1p4.CreateUpgradeHandler( app.mm, app.configurator, - app.PoolKeeper, - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - app.BundlesKeeper, ), ) @@ -819,8 +814,8 @@ func NewKYVEApp( panic(err) } - if upgradeInfo.Name == v1p3.UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - app.SetStoreLoader(v1p3.CreateStoreLoader(upgradeInfo.Height)) + if upgradeInfo.Name == v1p4.UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + app.SetStoreLoader(v1p4.CreateStoreLoader(upgradeInfo.Height)) } if loadLatest { diff --git a/app/upgrades/v1_3/constants.go b/app/upgrades/v1_3/constants.go deleted file mode 100644 index 0f2ec299..00000000 --- a/app/upgrades/v1_3/constants.go +++ /dev/null @@ -1,49 +0,0 @@ -package v1_3 - -// UpgradeName is the name of this specific software upgrade used on-chain. -const UpgradeName = "v1.3.0" - -// TestnetChainID is the Chain ID of the KYVE testnet (Kaon). -const TestnetChainID = "kaon-1" - -// MainnetChainID is the Chain ID of the KYVE mainnet. -const MainnetChainID = "kyve-1" - -// InvestorAccounts is a list of accounts from our second funding round. -var InvestorAccounts = []string{ - "kyve1lmmvd34rn05uuxyzyajyht5eykksvas9gpz9ln", - "kyve10ucfmct7epngs7k3y77qrfpvjlsgfv2qqjytm4", - "kyve10we97qv6nujhx4eyzskw9p23s0qfnr5rq6uadp", - "kyve1z2d4fvcv8gf72zvdp23x6ryswywh0ptrjrkdhp", - "kyve1hae0u8jqfedpm7u5ng6k464xsxx32tvluqus8t", - "kyve1gcz2tjuel4w6q3v4ec92eu4nvey6fkgnyfcavm", - "kyve1matxpxlw4cna4xr77jaqqmst74j35puy0nf87f", - "kyve1946pdjdg6dqxfd5et4g3k6glkkvt8l9r5zqmp9", - "kyve1ag2mctnvgwqea7au0lh92xd4ncfysw8gs94r6v", - "kyve1e7rmpdrrnjeuypn733c9lt2vg2cvkj788pvtvr", - "kyve1ewy2yfxr8aw3v9jv2kjgt4z6tj9ved3a9qyjh2", - "kyve1u26sz6kydnmpr5zq6nureav4xhasak8nu5q8d8", - "kyve194rvm2rjxhe0gfnv2095z6k5tnyszxh9sdyzhy", - "kyve1j7p7jg4cuw9ww6zyjf2gvpjxgseffjuhaj4qcq", - "kyve1kcmdhddxnwvmnekrsejnr4n87xqyxq9tlqlyqn", - "kyve13agpsm0r2sr3wl0yqqfxdncl7mxla0nh6jteum", - "kyve1jp7tv4g2ks855spj4cppmdnx4jtx26h5u5y3x2", - "kyve1hlsaz3fegeze2mk6a9f7mh93y72edfmxuq2as7", - "kyve1a9zlytywun0sq8gxjkqhsc4knzm8zw3tprq4x8", - "kyve1uqm9n8a769nvwagz7gmpx5x52nmqn3z05gdrqe", - "kyve1tmjvtgv6a447dewwhd4j2ehqsm8x4d2ttm053n", - "kyve1xlg7pgptqujg72csewpx7rytr4f0sgngqrj3gu", - "kyve1th6v7yygmxsfm2x2uwsp582eagnrcrjywwaf7f", - "kyve159ufwz58rzkcvjk94wkxv5uyz877pwpf6h7xy2", - "kyve1z73v6kqhutr5fq5eem2256l5a45empuk0xkxxm", - "kyve17rdl2fadf82qx4r0wd2ehtqyy3qsazeqyun9dd", - "kyve1tp5uz49gvvl5kys795re80e3mf9w9up0yzhzq7", - "kyve18d8t7nj9jqyyrzr76wea38u7er3ljzzqqys5nl", - "kyve14l2zxt75ylgnumjevxxans20uapctnke698vq2", - "kyve17zfy84an63jqdmm632th7sp2tj2tmh82hrysn9", - "kyve1m297tfaystezangz7wrm9j5s55a3j8xz7g5nkp", - "kyve1yxt5u93an2as4csf2xqv8sw96rgm2y3rrzmj2g", - "kyve1eddmugm8k5eyaa96v7e3rwrw97040q8awmkwdy", - "kyve1uxarsjawzcu3xjvydnmlgmceq3eldx2yas2djf", - "kyve1rtx3akgca36lrevmzal050ehxpxnwtn9xv7taz", -} diff --git a/app/upgrades/v1_3/upgrade.go b/app/upgrades/v1_3/upgrade.go deleted file mode 100644 index 54939de5..00000000 --- a/app/upgrades/v1_3/upgrade.go +++ /dev/null @@ -1,134 +0,0 @@ -package v1_3 - -import ( - "fmt" - - bundlesKeeper "github.com/KYVENetwork/chain/x/bundles/keeper" - bundlesTypes "github.com/KYVENetwork/chain/x/bundles/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/tendermint/tendermint/libs/log" - - // Pool - poolKeeper "github.com/KYVENetwork/chain/x/pool/keeper" - poolTypes "github.com/KYVENetwork/chain/x/pool/types" - // Upgrade - bankKeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - - // Auth - authKeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - vestingExported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported" - // Staking - stakingKeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - // Upgrade - upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" -) - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - poolKeeper poolKeeper.Keeper, - accountKeeper authKeeper.AccountKeeper, - bankKeeper bankKeeper.Keeper, - stakingKeeper stakingKeeper.Keeper, - bundlesKeeper bundlesKeeper.Keeper, -) upgradeTypes.UpgradeHandler { - return func(ctx sdk.Context, _ upgradeTypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - logger := ctx.Logger().With("upgrade", UpgradeName) - - // Multiple Bundle Versions - UpdateBundlesVersionMap(bundlesKeeper, ctx) - - // Configure Inflation Splitting - CheckPoolAccounts(ctx, logger, poolKeeper) - SetBundleParams(ctx, poolKeeper) - AdjustOperatingCost(ctx, poolKeeper) - - // Vesting Account Delegation Fix - if ctx.ChainID() == MainnetChainID { - for _, address := range InvestorAccounts { - TrackInvestorDelegation(ctx, logger, sdk.MustAccAddressFromBech32(address), accountKeeper, bankKeeper, stakingKeeper) - } - } - - return mm.RunMigrations(ctx, configurator, vm) - } -} - -// TrackInvestorDelegation performs a correction of the delegation tracking inside the vesting account. -// The correction is done by performing a full untracking and then tracking the actual total delegated amount -// (including slashed amounts). -func TrackInvestorDelegation(ctx sdk.Context, logger log.Logger, address sdk.AccAddress, ak authKeeper.AccountKeeper, bk bankKeeper.Keeper, sk stakingKeeper.Keeper) { - denom := sk.BondDenom(ctx) - account, _ := ak.GetAccount(ctx, address).(vestingExported.VestingAccount) - - // Obtain total delegation of address - totalDelegation := sdk.NewInt(0) - for _, delegation := range sk.GetAllDelegatorDelegations(ctx, address) { - // We take the shares as the total delegation as this is the amount which is - // tracked inside the vesting account. (slashes are ignored, which is correct) - totalDelegation = totalDelegation.Add(delegation.GetShares().TruncateInt()) - } - - // Fetch current balance. - balanceCoin := bk.GetBalance(ctx, address, denom) - - // This is the balance a user would have if all tokens are unbonded (even the ones which got slashed). - maxPossibleBalance := balanceCoin.Amount.Add(totalDelegation) - maxPossibleBalanceCoins := sdk.NewCoins().Add(sdk.NewCoin(denom, maxPossibleBalance)) - - if totalDelegation.GT(sdk.ZeroInt()) { - - // Untrack entire vesting delegation using maximum amount. This will set both `delegated_free` - // and `delegated_vesting` back to zero. - account.TrackUndelegation(sdk.NewCoins(sdk.NewCoin("ukyve", maxPossibleBalance))) - - // Track the delegation using the total delegation - account.TrackDelegation(ctx.BlockTime(), maxPossibleBalanceCoins, sdk.NewCoins(sdk.NewCoin("ukyve", totalDelegation))) - - logger.Info(fmt.Sprintf("tracked delegation of %s with %s", address.String(), totalDelegation.String())) - ak.SetAccount(ctx, account) - } -} - -// CheckPoolAccounts ensures that each pool account exists post upgrade. -func CheckPoolAccounts(ctx sdk.Context, logger log.Logger, keeper poolKeeper.Keeper) { - pools := keeper.GetAllPools(ctx) - - for _, pool := range pools { - keeper.EnsurePoolAccount(ctx, pool.Id) - - name := fmt.Sprintf("%s/%d", poolTypes.ModuleName, pool.Id) - logger.Info("successfully initialised pool account", "name", name) - } -} - -func UpdateBundlesVersionMap(keeper bundlesKeeper.Keeper, ctx sdk.Context) { - keeper.SetBundleVersionMap(ctx, bundlesTypes.BundleVersionMap{ - Versions: []*bundlesTypes.BundleVersionEntry{ - { - Height: uint64(ctx.BlockHeight()), - Version: 2, - }, - }, - }) -} - -// SetBundleParams initializes the parameters for inflation splitting. -// The inflation share is 8.45 % resulting in a 40% APY on 10M target stake for the CosmosHub Pool. -// This value needs to be adjusted by the governance in the future. -// The inflation payout rate of 5% turned out to be a good damping factor for the inflation payout. -func SetBundleParams(ctx sdk.Context, keeper poolKeeper.Keeper) { - keeper.SetParams(ctx, poolTypes.Params{ - ProtocolInflationShare: sdk.MustNewDecFromStr("0.0845"), - PoolInflationPayoutRate: sdk.MustNewDecFromStr("0.05"), - }) -} - -// AdjustOperatingCost calculates the new operating. Because of inflation splitting the -// operating cost needs to be adjusted to a lower value to maintain the same pool APY. -func AdjustOperatingCost(ctx sdk.Context, keeper poolKeeper.Keeper) { - cosmosHubPool, _ := keeper.GetPool(ctx, 0) - cosmosHubPool.OperatingCost = 3_100_000 // 3.1 $KYVE -} diff --git a/app/upgrades/v1_4/constants.go b/app/upgrades/v1_4/constants.go new file mode 100644 index 00000000..4f8b6010 --- /dev/null +++ b/app/upgrades/v1_4/constants.go @@ -0,0 +1,10 @@ +package v1_4 + +// UpgradeName is the name of this specific software upgrade used on-chain. +const UpgradeName = "v1.4.0" + +// TestnetChainID is the Chain ID of the KYVE testnet (Kaon). +const TestnetChainID = "kaon-1" + +// MainnetChainID is the Chain ID of the KYVE mainnet. +const MainnetChainID = "kyve-1" diff --git a/app/upgrades/v1_3/store.go b/app/upgrades/v1_4/store.go similarity index 70% rename from app/upgrades/v1_3/store.go rename to app/upgrades/v1_4/store.go index 38e843ed..a52d207f 100644 --- a/app/upgrades/v1_3/store.go +++ b/app/upgrades/v1_4/store.go @@ -1,20 +1,16 @@ -package v1_3 +package v1_4 import ( "github.com/cosmos/cosmos-sdk/baseapp" storeTypes "github.com/cosmos/cosmos-sdk/store/types" - // PFM - pfmTypes "github.com/strangelove-ventures/packet-forward-middleware/v6/router/types" // Upgrade upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) func CreateStoreLoader(upgradeHeight int64) baseapp.StoreLoader { storeUpgrades := storeTypes.StoreUpgrades{ - Added: []string{ - pfmTypes.StoreKey, - }, + Added: []string{}, } return upgradeTypes.UpgradeStoreLoader(upgradeHeight, &storeUpgrades) diff --git a/app/upgrades/v1_4/upgrade.go b/app/upgrades/v1_4/upgrade.go new file mode 100644 index 00000000..193c9393 --- /dev/null +++ b/app/upgrades/v1_4/upgrade.go @@ -0,0 +1,21 @@ +package v1_4 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + + // Upgrade + upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, +) upgradeTypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradeTypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + logger := ctx.Logger().With("upgrade", UpgradeName) + logger.Info("Run v1.4 upgrade") + + return mm.RunMigrations(ctx, configurator, vm) + } +} From 0e720e5ab44066e8bd6ff36cffada592ecc2d588 Mon Sep 17 00:00:00 2001 From: Maximilian Breithecker <72022235+mbreithecker@users.noreply.github.com> Date: Thu, 3 Aug 2023 17:04:08 +0200 Subject: [PATCH 2/2] chore: sync changelog --- .github/README.md | 2 +- CHANGELOG.md | 6 ++++++ Makefile | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/README.md b/.github/README.md index b6197b5b..801e8b28 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,6 +1,6 @@ # The KYVE Network -###### v1.3.0 +###### v1.3.1 The KYVE consensus layer is the backbone of the KYVE ecosystem. This layer is a sovereign Delegated Proof of Stake network built using the diff --git a/CHANGELOG.md b/CHANGELOG.md index 30a13225..87563bfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,12 @@ An '!' indicates a state machine breaking change. +## [v1.3.1](https://github.com/KYVENetwork/chain/releases/tag/v1.3.1) - 2023-08-02 + +### Bug Fixes + +- [#122](https://github.com/KYVENetwork/chain/pull/122) Fix makefile go version parse cmd. + ## [v1.3.0](https://github.com/KYVENetwork/chain/releases/tag/v1.3.0) - 2023-07-15 ### Features diff --git a/Makefile b/Makefile index c0b08608..ad3ee575 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ COMMIT := $(shell git log -1 --format='%H') GO_VERSION := $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1,2) -VERSION := v1.3.0 # $(shell echo $(shell git describe --tags) | sed 's/^v//') +VERSION := v1.3.1 # $(shell echo $(shell git describe --tags) | sed 's/^v//') TEAM_ALLOCATION := 165000000000000 ifeq ($(ENV),kaon)