Skip to content

Commit

Permalink
Update hip-782.md (#783)
Browse files Browse the repository at this point in the history
Signed-off-by: Leemon Baird <lbaird@users.noreply.github.com>
Signed-off-by: Michael Garber <michael.garber@swirldslabs.com>
Co-authored-by: Michael Garber <michael.garber@swirldslabs.com>
  • Loading branch information
lbaird and mgarbs authored Aug 10, 2023
1 parent 707615c commit f8ab131
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions HIP/hip-782.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ release: v0.40.0
created: 2023-08-01
discussions-to: https://github.com/hashgraph/hedera-improvement-proposal/pull/782
replaces: 406
updated: 2023-08-09
updated: 2023-08-10
---

Note: This hip does not replace all of hip-406 Staking. It replaces only replaces a small part. Otherwise, hip-406 still stands.
Expand All @@ -28,18 +28,17 @@ This HIP describes a change to the staking reward system for proof of stake desc

## Specification

In the original HIP, there is a setting `stakingRewardRate`, and rewards are given at that rate until the unreserved balance of account `0.0.800` is empty, at which point it abruptly drops to simply distributing each day whatever came in to that account the previous day, such as through transaction fees. And there was originally a setting for the max reward emission per day.
In the original HIP, there is a setting `stakingRewardRate`, and rewards are given at that rate until the unreserved balance of account `0.0.800` is empty, at which point it abruptly drops to simply distributing each day whatever came in to that account the previous day, such as through transaction fees.

The change is to remove both of those settings, and have `stakingRewardRate` automatically change each day, based on the balance of `0.0.800` and three settings: `maxRewardRate`, `rewardBalanceThreshold`, and `maxStakeRewarded`. The `maxRewardRate` (in tinybars earned per hbar staked per day) is the rate to pay normally (i.e., when `0.0.800` has a large balance, and not too many hbars are staked for reward). When the balance of `0.0.800` drops below `rewardBalanceThreshold` (in tinybars), then the `stakingRewardRate` drops smoothly as the balance drops. If the hbars staked for reward exceed `maxStakeRewarded` (in tinybars), then there is a further decrease (which replaces the original absolute limit on hbars emitted per day).
The change is to remove this settings, and have `stakingRewardRate` automatically change each day, based on the balance of `0.0.800` and three settings: `maxRewardRate`, `rewardBalanceThreshold`, and `maxStakeRewarded`. The `maxRewardRate` (in tinybars earned per hbar staked per day) is the rate to pay normally (i.e., when `0.0.800` has a large balance, and not too many hbars are staked for reward). When the balance of `0.0.800` drops below `rewardBalanceThreshold` (in tinybars), then the `stakingRewardRate` drops smoothly as the balance drops. If the hbars staked for reward exceed `maxStakeRewarded` (in tinybars), then there is a further decrease (which replaces the original absolute limit on hbars emitted per day).


Let `unreservedBalance` (in tinybars) be the balance of account `0.0.800` minus the amount of rewards that have been earned but not yet distributed. Let `stakedForReward` (in tinybars) be the total number of hbars on Hedera that have been staked for reward (so it ignores accounts that stake but decline a reward). Then each day, just before the HIP-406 reward calculations are performed using `stakingRewardRate`, recalculate `stakingRewardRate` as follows (implemented with equivalent results, but using integer calculations, rather than the real-number calculations shown):

```
//A real number proportional to the unreserved balance, from 0 for empty, up to 1 at the threshold.
balanceRatio = min(unreservedBalance, rewardBalanceThreshold) / rewardBalanceThreshold;
stakingRewardRate = maxRewardRate
stakingRewardRate = maxRewardRate * stakedForReward
* balanceRatio * (2 – balanceRatio)
* min(1, maxStakeRewarded / stakedForReward)
Expand Down

0 comments on commit f8ab131

Please sign in to comment.