Inflation bug fixes (#2982)

* PENDING.md; swap BeginBlocker ordering
* Calculate inflation every block
* Update x/mint spec
* Reset distribution info bond height instead
This commit is contained in:
Christopher Goes
2018-12-04 10:17:02 -08:00
committed by Jack Zampolin
parent bcfd93f544
commit dfd00a661a
11 changed files with 93 additions and 72 deletions
+5 -5
View File
@@ -1,12 +1,12 @@
# Begin-Block
Inflation occurs at the beginning of each block, however minting parameters
are only calculated once per hour.
Minting parameters are recalculated and inflation
paid at the beginning of each block.
## NextInflationRate
The target annual inflation rate is recalculated at the first block of each new
hour. The inflation is also subject to a rate change (positive or negative)
The target annual inflation rate is recalculated each block.
The inflation is also subject to a rate change (positive or negative)
depending on the distance from the desired ratio (67%). The maximum rate change
possible is defined to be 13% per year, however the annual inflation is capped
as between 7% and 20%.
@@ -14,7 +14,7 @@ as between 7% and 20%.
```
NextInflationRate(params Params, bondedRatio sdk.Dec) (inflation sdk.Dec) {
inflationRateChangePerYear = (1 - bondedRatio/params.GoalBonded) * params.InflationRateChange
inflationRateChange = inflationRateChangePerYear/hrsPerYr
inflationRateChange = inflationRateChangePerYear/blocksPerYr
// increase the new annual inflation for this next cycle
inflation += inflationRateChange
-2
View File
@@ -8,7 +8,6 @@ The minter is a space for holding current inflation information.
```golang
type Minter struct {
LastUpdate time.Time // time which the last update was made to the minter
Inflation sdk.Dec // current annual inflation rate
AnnualProvisions sdk.Dec // current annual exptected provisions
}
@@ -30,4 +29,3 @@ type Params struct {
BlocksPerYear uint64 // expected blocks per year
}
```