Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
fix wrong genesis parameter (#335)
Browse files Browse the repository at this point in the history
* fix wrong genesis parameter

* fix reward pool

* change height and comments
  • Loading branch information
Stumble authored Mar 12, 2019
1 parent e51d991 commit ec5a4e0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions types/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ const (
// BlockchainUpgrade1Update1Height - since this height, donation > 1 will not cost bandwidth.
BlockchainUpgrade1Update1Height = 21610

// BlockchainUpgrade1Update2Height - global growth rate is corrected.
BlockchainUpgrade1Update2Height = 146000

// NoTPSLimitDonationMin - donation >= this value will not cost bandwidth, in coin.
NoTPSLimitDonationMin = 100000
)
18 changes: 17 additions & 1 deletion x/global/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,20 @@ func (gm *GlobalManager) DistributeHourlyInflation(ctx sdk.Context) sdk.Error {
if err != nil {
return err
}

// BlockchainUpgrade1Update2Height
// Growth rate in genesis file for testnet-upgrade1 was wrong.
// For lino-testnet, the growth rate is, and always was, 0.5%, not 5%.
growthRate := globalAllocation.GlobalGrowthRate
if ctx.BlockHeight() >= types.BlockchainUpgrade1Update2Height {
growthRate = types.NewDecFromRat(5, 1000)
}

// get hourly inflation
thisHourInflation :=
types.DecToCoin(
globalMeta.LastYearTotalLinoCoin.ToDec().
Mul(globalAllocation.GlobalGrowthRate).
Mul(growthRate).
Mul(types.NewDecFromRat(1, types.HoursPerYear)))
if err := gm.storage.SetGlobalMeta(ctx, globalMeta); err != nil {
return err
Expand All @@ -359,6 +368,13 @@ func (gm *GlobalManager) DistributeHourlyInflation(ctx sdk.Context) sdk.Error {
developerInflation :=
thisHourInflation.Minus(contentCreatorInflation).Minus(validatorInflation).Minus(infraInflation)
consumptionMeta.ConsumptionRewardPool = consumptionMeta.ConsumptionRewardPool.Plus(contentCreatorInflation)

// one time execution for upgrade1update2
if ctx.BlockHeight() == types.BlockchainUpgrade1Update2Height {
consumptionMeta.ConsumptionRewardPool = types.DecToCoin(
consumptionMeta.ConsumptionRewardPool.ToDec().Quo(sdk.NewDec(6)))
}

if err := gm.storage.SetConsumptionMeta(ctx, consumptionMeta); err != nil {
return err
}
Expand Down

0 comments on commit ec5a4e0

Please sign in to comment.