diff --git a/tips/TIP-0040/tip-0040.md b/tips/TIP-0040/tip-0040.md index bed1000ca..3e78007cf 100644 --- a/tips/TIP-0040/tip-0040.md +++ b/tips/TIP-0040/tip-0040.md @@ -616,14 +616,14 @@ the amount of Mana Rewards that can be claimed is defined as follows. - Let the total claimable rewards at epoch `m` be the sum of `Rewards(n)` for a certain set of epoch indexes `n> ProfitMarginExponent` - - `Residual Validator Factor = ((Profit Margin Complement * (Pool Rewards(n)-Fixed Cost)) >> ProfitMarginExponent) * Staked Amount/Pool Stake(n)`. - Note that `((Profit Margin Complement * Pool Rewards(n)) >> ProfitMarginExponent) * Staked Amount` uses up to 94 - bits and `Pool Stake(n)` up to 53, so to prevent overflowing the first factor should be either stored as a 128 bits - integer or it should be stored as 2 uint64 variables (and the proper 128 by 64 division algorithm must be used). - Otherwise (i.e., if `Pool Rewards(n)-Fixed Cost<0`), `Undecayed Rewards(n)` must be set to zero. + - `Undecayed Rewards(n)` = `Fixed Cost + Profit Margin Factor + Residual Validator Factor` where + - `Profit Margin Complement = (1 << ProfitMarginExponent) - Profit Margin(n)` + - `Profit Margin Factor = (Profit Margin(n) * (Pool Rewards(n)-Fixed Cost)) >> ProfitMarginExponent` + - `Residual Validator Factor = ((Profit Margin Complement * (Pool Rewards(n)-Fixed Cost)) >> ProfitMarginExponent) * Staked Amount/Pool Stake(n)` + - Note that `((Profit Margin Complement * Pool Rewards(n)) >> ProfitMarginExponent) * Staked Amount` uses up to 94 + bits and `Pool Stake(n)` up to 53, so to prevent overflowing the first factor should be either stored as a 128 + bits integer or it should be stored as 2 uint64 variables (and the proper 128 by 64 division algorithm must be + used). Otherwise (i.e., if `Pool Rewards(n)-Fixed Cost<0`), `Undecayed Rewards(n)` must be set to zero. - Finally, decay the rewards according to [Mana Decay](../TIP-0039/tip-0039.md#mana-decay), meaning that `Rewards(n)=decay(Undecayed Rewards(n),m-n)`, where the function `decay` is defined in [TIP-39](../TIP-0039/tip-0039.md). The total claimable decayed reward for validator `i` will be, then, the sum of