Skip to content

Commit

Permalink
Fix markdown formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippGackstatter committed Dec 6, 2023
1 parent d277435 commit 80b37c9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tips/TIP-0040/tip-0040.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<m`.
Calculate the `Undecayed Rewards(n)` for each epoch `n` in the validation period. If `Pool Rewards(n)-Fixed Cost≥0`,
it will be given by:
- `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.
- `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
Expand Down

0 comments on commit 80b37c9

Please sign in to comment.