Skip to content

Commit

Permalink
chore: finalise v1.3 upgrade handler (#113)
Browse files Browse the repository at this point in the history
Co-authored-by: Troy Kessler <troy.kessler99@gmail.com>
(cherry picked from commit 3c2ca41)
  • Loading branch information
mbreithecker authored and mergify[bot] committed Jul 14, 2023
1 parent c4591ba commit bed8c6d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You can find the `kyved` binary in the `./build` directory.
If you need binaries for alternative architectures than your host:

```shell
make release
make release ENV=mainnet
```

The different binaries can be found in the `./release` directory.
Expand Down
19 changes: 11 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,37 @@

# CHANGELOG

An '!' indicates a state machine breaking change.

## [Unreleased]

### Features

- (ibc) [#30](https://github.com/KYVENetwork/chain/pull/30) Integrate [Packet Forward Middleware](https://github.com/strangelove-ventures/packet-forward-middleware).
- (`x/bundles`) [#99](https://github.com/KYVENetwork/chain/pull/99) Use weighted round-robin approach for uploader selection.
- (`x/bundles`) [#108](https://github.com/KYVENetwork/chain/pull/108) Store stake security for finalized bundles.
- ! (ibc) [#30](https://github.com/KYVENetwork/chain/pull/30) Integrate [Packet Forward Middleware](https://github.com/strangelove-ventures/packet-forward-middleware).
- ! (`x/bundles`) [#98](https://github.com/KYVENetwork/chain/pull/98) Split inflation rewards between chain and protocol layer.
- ! (`x/bundles`) [#99](https://github.com/KYVENetwork/chain/pull/99) Use weighted round-robin approach for uploader selection.
- ! (`x/bundles`) [#108](https://github.com/KYVENetwork/chain/pull/108) Store stake security for finalized bundles.

### Improvements

- (`x/bundles`) [#62](https://github.com/KYVENetwork/chain/pull/62) Payout storage cost directly to the bundle uploader.
- (`x/pool`) [#74](https://github.com/KYVENetwork/chain/pull/74) Improve parameter validation in pool proposals.
- (`x/stakers`) [#46](https://github.com/KYVENetwork/chain/pull/46) Allow protocol validator commission rewards to be claimed.
- ! (`x/bundles`) [#62](https://github.com/KYVENetwork/chain/pull/62) Payout storage cost directly to the bundle uploader.
- ! (`x/pool`) [#74](https://github.com/KYVENetwork/chain/pull/74) Improve parameter validation in pool proposals.
- ! (`x/stakers`) [#46](https://github.com/KYVENetwork/chain/pull/46) Allow protocol validator commission rewards to be claimed.

### Bug Fixes

- [#96](https://github.com/KYVENetwork/chain/pull/96) Track investor delegation inside auth module.

### Client Breaking

- (`x/stakers`) [#46](https://github.com/KYVENetwork/chain/pull/46) Include `MsgClaimCommissionRewards` for claiming commission rewards.
- (`x/bundles`) [#104](https://github.com/KYVENetwork/chain/pull/104) Improve schema for finalized bundles query.
- ! (`x/stakers`) [#46](https://github.com/KYVENetwork/chain/pull/46) Include `MsgClaimCommissionRewards` for claiming commission rewards.

### API Breaking

- (`x/query`) [#87](https://github.com/KYVENetwork/chain/pull/87) Correctly return pools that an account has funded.
<!-- TODO: Switch this link to the release tag. -->
- (`x/stakers`) [#46](https://github.com/KYVENetwork/chain/pull/46) Emit an [event](https://github.com/KYVENetwork/chain/blob/main/x/stakers/spec/05_events.md#eventclaimcommissionrewards) when claiming protocol validator commission rewards.
- (`x/bundles`) [#104](https://github.com/KYVENetwork/chain/pull/104) Improve schema for finalized bundles query.

## [v1.2.2](https://github.com/KYVENetwork/chain/releases/tag/v1.2.2) - 2023-06-08

Expand Down
26 changes: 25 additions & 1 deletion app/upgrades/v1_3/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,15 @@ func CreateUpgradeHandler(
return func(ctx sdk.Context, _ upgradeTypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
logger := ctx.Logger().With("upgrade", UpgradeName)

CheckPoolAccounts(ctx, logger, poolKeeper)
// 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)
Expand Down Expand Up @@ -108,3 +114,21 @@ func UpdateBundlesVersionMap(keeper bundlesKeeper.Keeper, ctx sdk.Context) {
},
})
}

// 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
}

0 comments on commit bed8c6d

Please sign in to comment.