Skip to content

Commit

Permalink
docs: umee inflation v2 design doc (#2227)
Browse files Browse the repository at this point in the history
* docs: umee inflation v2 design doc

* update release notes

* Apply suggestions from code review

Co-authored-by: Adam Moser <[email protected]>

* typos

* review

* review

---------

Co-authored-by: Adam Moser <[email protected]>
  • Loading branch information
robert-zaremba and toteki authored Sep 5, 2023
1 parent 3020794 commit 7687802
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 42 deletions.
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,24 @@ See [Release procedure](CONTRIBUTING.md#release-procedure) for more information

### Release Compatibility Matrix

| Umee Version | Mainnet | Cosmos SDK | IBC | Peggo | Price Feeder | Gravity Bridge | libwasmvm |
| :----------: | :-----: | :--------: | :----: | :-----: | :----------: | :------------------------: | :-------: |
| v0.8.x || v0.45.x | v2.0.x | v0.2.x | v0.1.x | | |
| v1.x.x || v0.45.x | v2.0.x | v0.2.x | N/A | umee/v1 module/v1.4.x-umee | |
| v2.x.x || v0.45.x | v2.3.x | v0.2.x | v0.2.x | umee/v2 module/v1.4.x | |
| v3.0-1.x || v0.46.x | v5.0.x | v1.3.x+ | v1.0.x | umee/v3 module/v1.5.x-umee | |
| v3.1.0-cw1 || v0.46.x | v5.0.x | v1.3.x+ | v2.0.x | umee/v3 module/v1.5.x-umee | |
| v3.2.x || v0.46.6+ | v5.1.x | v1.3.x+ | v2.0.x | umee/v3 v1.5.3-umee-3 | v1.1.1 |
| v3.3.x || v0.46.6+ | v5.1.x | v1.3.x+ | v2.0.2 | umee/v3 v1.5.3-umee-3 | v1.1.1 |
| v4.0.x || v0.46.6+ | v5.1.x | v1.3.x+ | v2.0.3 | umee/v4 v1.5.3-umee-4 | v1.1.1 |
| v4.1.x || v0.46.7+ | v5.2.x | v1.3.x+ | v2.1.0 | umee/v4 v1.5.3-umee-4 | v1.1.1 |
| v4.2.x || v0.46.10+ | v5.2.x | v1.3.x+ | umee/v2.1.1 | umee/v4 v1.5.3-umee-4 | v1.1.1 |
| v4.3.x || v0.46.11+ | v6.1.x | v1.3.x+ | umee/v2.1.1 | umee/v4 v1.5.3-umee-6 | v1.2.1 |
| v4.4.x || v0.46.11+ | v6.1.x | v1.3.x+ | umee/v2.1.4+ | umee/v4 v1.5.3-umee-6 | v1.2.3 |
| v5.0.x || v0.46.13+ | v6.2.x | v1.3.x+ | umee/v2.1.4+ | umee/v4 v1.5.3-umee-8 | v1.2.4 |
| v5.1.x || v0.46.13+ | v6.2.x | --- | umee/v2.1.6+ | umee/v4 v1.5.3-umee-10 | v1.2.4 |
| v5.2.x || v0.46.13+ | v6.2.x | --- | umee/v2.1.6+ | umee/v4 v1.5.3-umee-10 | v1.2.4 |
| v6.0.x || v0.46.14+ | v6.2.x | --- | umee/v2.1.6+ | --- | v1.3.0 |
| Umee Version | Mainnet | Cosmos SDK | IBC | Peggo | Price Feeder | Gravity Bridge | libwasmvm |
| :----------: | :-----: | :--------: | :----: | :-----: | :------------: | :------------------------: | :-------: |
| v0.8.x || v0.45.x | v2.0.x | v0.2.x | v0.1.x | | |
| v1.x.x || v0.45.x | v2.0.x | v0.2.x | N/A | umee/v1 module/v1.4.x-umee | |
| v2.x.x || v0.45.x | v2.3.x | v0.2.x | v0.2.x | umee/v2 module/v1.4.x | |
| v3.0-1.x || v0.46.x | v5.0.x | v1.3.x+ | v1.0.x | umee/v3 module/v1.5.x-umee | |
| v3.1.0-cw1 || v0.46.x | v5.0.x | v1.3.x+ | v2.0.x | umee/v3 module/v1.5.x-umee | |
| v3.2.x || v0.46.6+ | v5.1.x | v1.3.x+ | v2.0.x | umee/v3 v1.5.3-umee-3 | v1.1.1 |
| v3.3.x || v0.46.6+ | v5.1.x | v1.3.x+ | v2.0.2 | umee/v3 v1.5.3-umee-3 | v1.1.1 |
| v4.0.x || v0.46.6+ | v5.1.x | v1.3.x+ | v2.0.3 | umee/v4 v1.5.3-umee-4 | v1.1.1 |
| v4.1.x || v0.46.7+ | v5.2.x | v1.3.x+ | v2.1.0 | umee/v4 v1.5.3-umee-4 | v1.1.1 |
| v4.2.x || v0.46.10+ | v5.2.x | v1.3.x+ | umee/v2.1.1 | umee/v4 v1.5.3-umee-4 | v1.1.1 |
| v4.3.x || v0.46.11+ | v6.1.x | v1.3.x+ | umee/v2.1.1 | umee/v4 v1.5.3-umee-6 | v1.2.1 |
| v4.4.x || v0.46.11+ | v6.1.x | v1.3.x+ | umee/v2.1.4+ | umee/v4 v1.5.3-umee-6 | v1.2.3 |
| v5.0.x || v0.46.13+ | v6.2.x | v1.3.x+ | umee/v2.1.4+ | umee/v4 v1.5.3-umee-8 | v1.2.4 |
| v5.1.x || v0.46.13+ | v6.2.x | --- | umee/v2.1.6+ | umee/v4 v1.5.3-umee-10 | v1.2.4 |
| v5.2.x || v0.46.13+ | v6.2.x | --- | umee/v2.1.6+ | umee/v4 v1.5.3-umee-10 | v1.2.4 |
| v6.0.x || v0.46.14+ | v6.2.x | --- | umee/v2.1.6-1+ | --- | v1.3.0 |

#### Price Feeder

Expand Down
21 changes: 13 additions & 8 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,25 @@ Release Procedure is defined in the [CONTRIBUTING](CONTRIBUTING.md#release-proce

Highlights:

- TODO
- TODO: special assets, new Gov messages
- New [inflation mechanism](./docs/design_docs/012-umee-inflation-v2.md).

[v6.0.0 CHANGELOG](https://github.com/umee-network/umee/blob/v6.0.0/CHANGELOG.md).
### New Inflation Mechanism

### Validators
The Upgrade Handler sets the following values to the Umee `x/ugov` Inflation Cycle parameters:

- `max_supply = 21e18uumee` (21 billions UMEE)
- `inflation_cycle = time.Hour * 24 * 365 * 2` (2 years)
- `inflation_reduction_rate = 2500 basis points` (25%)

#### libwasmvm update
The new Inflation Cycle will start on 2023-10-15 15:00 UTC. This will mark the first inflation reduction from the current rates:

Our dependencies have been updated. Now the binary requires `libwasmvm v1.3.0`. When you build the binary from source on the server machine you probably don't need any change. However when you download a binary from GitHub, or from other source, make sure you update the `/usr/lib/libwasmvm.<cpu_arch>.so`. For example:
- `inflation_min` 7% → 5.25%
- `inflation_max` 14% → 10.5%

- copy from `$GOPATH/pkg/mod/github.com/!cosm!wasm/[email protected]/internal/api/libwasmvm.$(uname -m).so`
- or download from github `wget https://raw.githubusercontent.com/CosmWasm/wasmvm/v1.3.0/internal/api/libwasmvm.$(uname -m).so -O /lib/libwasmvm.$(uname -m).so`
The x/staking Bonded Goal stays the same: 33.00%.

You don't need to do anything if you are using our Docker image.
### Validators

#### Min Gas Prices

Expand Down
103 changes: 103 additions & 0 deletions docs/design_docs/012-umee-inflation-v2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Design Doc 12: UMEE Inflation v2

## Changelog

- August, 2023: Initial Design (Ming Duan, @robert-zaremba)

## Status

Accepted

## Abstract

Umee v2 Inflation model introduces market cap for the UMEE supply and inflation cycles when the inflation is updated.

## Context

Today, the token issuance follows standard Cosmos SDK mechanism. We want to progressively limit the issuance in an algorithmic way. The UMEE tokenomics needs to be optimized with the following considerations:

- The current network parameters - min inflation 7% max inflation 14% - results in high spending on chain security.
- The adoption of liquid staking will drive more staking with a lower staking yield required.
- Interchain security and chain based revenue streams can become additional source of income for stakers.
- Set the hard cap to influence more the market expectations of the Umee supply.

## Specification

We set the max inflation to 21 billion UMEE (the supply today is around 12.2 billions):

- Block rewards are always adjusted (zeroed or reduced if necessary) so total supply never exceeds 21 billion UMEE.
- Supply is measured based on `bank/QueryTotalSupply`.
- Minting resumes if supply drops below 21B (and stops again once 21B is reached).
- Burn events will reduce the UMEE supply, enabling more staking rewards, according to the inflation rules. Burning events were included in the whitepaper, but the exact specification will be the subject of another design document.

The $UMEE v2 Inflation follows a similar Cosmos dynamic inflation mechanism based on the bonding rate in the `x/staking` module, to allow the Umee chain to naturally adjust inflation rate to drive staking activities to reach the target bonding rate.

On top of that we introduce _inflation cycle_, which is initially set to 2 years and controlled by the UMEE governance. In each inflation cycle, the yearly total amount of newly emitted tokens is a variable as per the `x/staking` Cosmos SDK module.
At the end of each inflation cycle, the `x/mint` module `inflation_min` and `inflation_max` parameters are automatically decreased by the `infaltion_reduction_rate` parameter, which is initially set to 25%.

Finally, we accelerate the `x/mint` [inflation rate change](https://github.com/cosmos/cosmos-sdk/blob/v0.47.2/x/mint/README.md#nextinflationrate) speed from 1 year to **6 months**.

Umee governance at any time can vote and modify the inflation schedule if the external environment changes materially and requires a different plan.

### Technical Implementation

The new inflation mechanism is build on top of the existing `x/mint` module by providing [`InflationCalculationFn`](https://github.com/cosmos/cosmos-sdk/blob/v0.46.14/x/mint/types/genesis.go#L12) to the `x/mint` module constructor. That function will use Umee `x/ugov` module which will control and store the following parameters:

```protobuf
message InflationParams {
// max_supply is the maximum supply. Inflation will not increase the UMEE supply above this value.
cosmos.base.v1beta1.Coin max_supply = 1;
// inflation_cycle duration after which inflation rates are changed.
google.protobuf.Duration inflation_cycle = 2;
// inflation_reduction_rate for every inflation cycle in basis points.
uint32 inflation_reduction_rate = 3;
}
```

The Umee `x/ugov` will be extended by the following Msg Server Message:

```protobuf
message MsgGovUpdateInflationParams {
option (cosmos.msg.v1.signer) = "authority";
// authority must be the address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
InflationParams params = 2;
}
```

The inflation cycle change is handled by the `InflationCalculationFn` function, implemented by the `inflation.Calculator` object (in the `app/inflation` package). The `Calculator` will handle the x/ugov module dependency.

## Alternative Approaches

We were discussing more advanced mechanism, which would define the staking rewards per user based on his usage of the `x/leverage` and `x/metoken` modules (notably amount of supplying assets).

Another possible modification is to set a constant inflation rate during each Inflation Cycle. It would make the calculation simpler, and make the yearly new supply more predictable. However, it will remove the dynamic nature of the traditional `x/staking` which adapts the block rewards based on the UMEE staking target.

## Test Case

- Unit tests to verify the Inflation Cycle changes.
- Unit tests to verify the inflation change speed.
- Integration test to verify the x/staking and x/ugov integration.

## Consequences

- Umee supply is predictable.
- Umee sell pressure is reduced.
- Umee inflation is more dynamic.

### Backwards Compatibility

- The solution is backwards compatible with the existing Cosmos SDK stack. We don't need to fork any Cosmos SDK module implementation, nor overwrite it.
- The implementation adds new method to the UMEE `x/ugov` module and new parameter set, which is additive.

## Further Discussions

We are exploring the burn mechanisms and ways how to better react on the market conditions.

## References

- Cosmos SDK [x/mint documentation](https://github.com/cosmos/cosmos-sdk/blob/v0.47.2/x/mint/README.md)
- Osmosis [Thirdening](https://medium.com/@ne_fertiti/what-is-osmosis-thirdening-how-it-affects-your-lp-staking-returns-c750f89efb14)
6 changes: 3 additions & 3 deletions proto/umee/ugov/v1/ugov.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ option (gogoproto.goproto_getters_all) = false;

// InflationParams params for changing the inflation min rate and max rate of mint module params.
message InflationParams {
// max_supply is the maximum supply for liquidation.
// max_supply is the maximum supply. Inflation will not increase the UMEE supply above this value.
cosmos.base.v1beta1.Coin max_supply = 1 [(gogoproto.nullable) = false];
// inflation_cycle duration after which inflation rates are changed.
google.protobuf.Duration inflation_cycle = 2 [
Expand All @@ -19,9 +19,9 @@ message InflationParams {
(gogoproto.jsontag) = "inflation_cycle,omitempty",
(gogoproto.moretags) = "yaml:\"inflation_cycle\""
];
// inflation_reduction_rate for every inflation cycle.
// inflation_reduction_rate for every inflation cycle in basis points.
uint32 inflation_reduction_rate = 3 [
(gogoproto.customtype) = "github.com/umee-network/umee/v6/util/bpmath.FixedBP",
(gogoproto.nullable) = false
];
}
}
22 changes: 16 additions & 6 deletions swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2417,7 +2417,9 @@ paths:
type: object
properties:
max_supply:
description: max_supply is the maximum supply for liquidation.
description: >-
max_supply is the maximum supply. Inflation will not
increase the UMEE supply above this value.
type: object
properties:
denom:
Expand All @@ -2432,7 +2434,9 @@ paths:
inflation_reduction_rate:
type: integer
format: int64
description: inflation_reduction_rate for every inflation cycle.
description: >-
inflation_reduction_rate for every inflation cycle in
basis points.
description: >-
InflationParams params for changing the inflation min rate and
max rate of mint module params.
Expand Down Expand Up @@ -6143,7 +6147,9 @@ definitions:
type: object
properties:
max_supply:
description: max_supply is the maximum supply for liquidation.
description: >-
max_supply is the maximum supply. Inflation will not increase the UMEE
supply above this value.
type: object
properties:
denom:
Expand All @@ -6156,7 +6162,7 @@ definitions:
inflation_reduction_rate:
type: integer
format: int64
description: inflation_reduction_rate for every inflation cycle.
description: inflation_reduction_rate for every inflation cycle in basis points.
description: >-
InflationParams params for changing the inflation min rate and max rate of
mint module params.
Expand All @@ -6180,7 +6186,9 @@ definitions:
type: object
properties:
max_supply:
description: max_supply is the maximum supply for liquidation.
description: >-
max_supply is the maximum supply. Inflation will not increase the
UMEE supply above this value.
type: object
properties:
denom:
Expand All @@ -6193,7 +6201,9 @@ definitions:
inflation_reduction_rate:
type: integer
format: int64
description: inflation_reduction_rate for every inflation cycle.
description: >-
inflation_reduction_rate for every inflation cycle in basis
points.
description: >-
InflationParams params for changing the inflation min rate and max
rate of mint module params.
Expand Down
8 changes: 4 additions & 4 deletions x/ugov/inflation_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (

func DefaultInflationParams() InflationParams {
return InflationParams{
MaxSupply: coin.New(appparams.BondDenom, 21_000000000_000000), // 21 Billion Maximum
InflationCycle: time.Hour * 24 * 365 * 2, // 2 years for default inflation cycle
InflationReductionRate: bpmath.FixedBP(2500), // 25% reduction rate for inflation cyle
MaxSupply: coin.New(appparams.BondDenom, 21_000_000_000_000000), // 21 Billion Maximum
InflationCycle: time.Hour * 24 * 365 * 2, // 2 years for default inflation cycle
InflationReductionRate: bpmath.FixedBP(2500), // 25% reduction rate for inflation cyle
}
}

Expand All @@ -26,7 +26,7 @@ func (ip InflationParams) Validate() error {
}

if ip.InflationReductionRate > bpmath.One || ip.InflationReductionRate < 100 {
return sdkerrors.ErrInvalidRequest.Wrap("inflation reduction must be between 100bp to 10'000bp")
return sdkerrors.ErrInvalidRequest.Wrap("inflation reduction must be between 100bp and 10'000bp")
}

if ip.InflationCycle.Seconds() <= 0 {
Expand Down
2 changes: 1 addition & 1 deletion x/ugov/msg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func TestMsgGovUpdateInflationParams(t *testing.T) {
msg.Authority = "umee1yesmdu06f7strl67kjvg2w7t5kacc"
assert.ErrorIs(t, msg.ValidateBasic(), govtypes.ErrInvalidSigner, "must fail on a non gov account")
msg.Params.InflationReductionRate = bpmath.FixedBP(10)
assert.ErrorContains(t, msg.Params.Validate(), "inflation reduction must be between 100bp to 10'000bp")
assert.ErrorContains(t, msg.Params.Validate(), "inflation reduction must be between 100bp and 10'000bp")
msg.Params.MaxSupply = coin.Negative1("test")
assert.ErrorContains(t, msg.Params.Validate(), "max_supply must be positive")
}
4 changes: 2 additions & 2 deletions x/ugov/ugov.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7687802

Please sign in to comment.