Skip to content

Commit 72feea5

Browse files
committed
Merge remote-tracking branch 'namada/brent/update-inflation-spec' (#613)
* namada/brent/update-inflation-spec: formatting changes change `L_{NAM}` -> `L_{PoS}` for clarity and consistency change inflation `I` to have units of tokens per epoch fix term ordering in error calculation Remove other `:=` in favor of `=` distinguish new and old inflation rates with a prime fix md rendering correct the shielded pool error calculation change storing of error to storing of token ratios (same procedure) fix: `I` is percent per annum distinguish between `K` in storage and `K` as intermediate value in inflation calculation Use `I` for inflation rates, as `R` reserved for locked ratios specify some default values, other small edits
2 parents 48b7c7b + cc8f6f7 commit 72feea5

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

documentation/specs/src/economics/inflation-system.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The Namada protocol controls the Namada token NAM (the native staking token), wh
44

55
### Proof-of-stake rewards
66

7-
The security of the proof-of-stake voting power allocation mechanism used by Namada is depenedent in part upon locking (bonding) tokens to validators, where these tokens can be slashed should the validators misbehave. Funds so locked are only able to be withdrawn after an unbonding period. In order to reward validators and delegators for locking their stake and participating in the consensus mechanism, Namada pays a variable amount of inflation to all delegators and validators. The amount of inflation paid is varied on a PD-controller in order to target a particular bonding ratio (fraction of the NAM token being locked in proof-of-stake). Namada targets a bonding ratio of 2/3, paying up to 10% inflation per annum to proof-of-stake rewards. See [reward distribution mechanism](./proof-of-stake/reward-distribution.md) for details.
7+
The security of the proof-of-stake voting power allocation mechanism used by Namada is dependent in part upon locking (bonding) tokens to validators, where these tokens can be slashed should the validators misbehave. Funds so locked are only able to be withdrawn after an unbonding period. In order to reward validators and delegators for locking their stake and participating in the consensus mechanism, Namada pays a variable amount of inflation to all delegators and validators. The amount of inflation paid is varied on a PD-controller in order to target a particular bonding ratio (fraction of the NAM token being locked in proof-of-stake). Namada targets a bonding ratio of 2/3, paying up to 10% inflation per annum to proof-of-stake rewards. See [reward distribution mechanism](./proof-of-stake/reward-distribution.md) for details.
88

99
### Shielded pool rewards
1010

@@ -20,61 +20,61 @@ Inflation is calculated and paid per-epoch as follows.
2020

2121
First, we start with the following fixed (governance-alterable) parameters:
2222

23-
- $Cap_{PoS}$ is the cap of proof-of-stake reward rate, in units of percent per annum
24-
- $Cap_{SP-A}$ is the cap of shielded pool reward rate for each asset $A$, in units of percent per annum
25-
- $R_{PGF}$ is the public goods funding reward rate, in units of percent per annum
26-
- $R_{PoS-Target}$ is the target staking ratio (genesis default 2/3)
27-
- $R_{SP-A-Target}$ is the target amount of asset $A$ locked in the shielded pool (separate value for each asset $A$)
28-
- $EpochsPerYear$ is the number of epochs per year (genesis default 365)
29-
- ${KP}_{PoS}$ is the proportional gain of the proof-of-stake PD controller, as a fraction of the total input range
30-
- ${KD}_{PoS}$ is the derivative gain of the proof-of-stake PD controller, as a fraction of the total input range
31-
- ${KP}_{SP_A}$ is the proportional gain of the shielded pool reward controller for asset $A$, as a fraction of the total input range (separate value for each asset $A$)
32-
- ${KD}_{SP_A}$ is the derivative gain of the shielded pool reward controller for asset $A$, as a fraction of the total input range (separate value for each asset $A$)
23+
- $Cap_{PoS}$ is the cap of proof-of-stake reward rate, in units of percent per annum (genesis default: 10%)
24+
- $Cap_{SP_A}$ is the cap of shielded pool reward rate for each asset $A$, in units of percent per annum
25+
- $\lambda_{PGF}$ is the public goods funding reward rate, in units of percent per annum
26+
- $R_{PoS-target}$ is the target staking ratio (genesis default: 2/3)
27+
- $R_{SP_A-target}$ is the target amount of asset $A$ locked in the shielded pool (separate value for each asset $A$)
28+
- $EpochsPerYear$ is the number of epochs per year (genesis default: 365)
29+
- ${KP}_{PoS-nom}$ is the nominal proportional gain of the proof-of-stake PD controller, as a fraction of the total input range
30+
- ${KD}_{PoS-nom}$ is the nominal derivative gain of the proof-of-stake PD controller, as a fraction of the total input range
31+
- ${KP}_{SP_A-nom}$ is the nominal proportional gain of the shielded pool reward controller for asset $A$, as a fraction of the total input range (separate value for each asset $A$)
32+
- ${KD}_{SP_A-nom}$ is the nominal derivative gain of the shielded pool reward controller for asset $A$, as a fraction of the total input range (separate value for each asset $A$)
3333

3434
Second, we take as input the following state values:
3535

3636
- $S_{NAM}$ is the current supply of NAM
37-
- $L_{NAM}$ is the current amount of NAM locked in proof-of-stake
38-
- $I_{PoS}$ is the current proof-of-stake reward rate, in units of tokens per epoch
39-
- $E_{PoS-last}$ is the error in proof-of-stake lock ratio (stored from the past epoch)
37+
- $L_{PoS}$ is the current amount of NAM locked in proof-of-stake
38+
- $I_{PoS}$ is the current proof-of-stake inflation amount, in units of tokens per epoch
39+
- $R_{PoS-last}$ is the proof-of-stake locked token ratio from the previous epoch
4040
- $L_{SP_A}$ is the current amount of asset $A$ locked in the shielded pool (separate value for each asset $A$)
41-
- $I_{SP_A}$ is the current shielded pool reward rate for asset $A$, in units of tokens per epoch
42-
- $E_{SP_A-last}$ is the error in shielded pool lock amount for asset $A$ (stored from the past epoch) (separate value for each asset $A$)
41+
- $I_{SP_A}$ is the current shielded pool inflation amount for asset $A$, in units of tokens per epoch
42+
- $R_{SP_A-last}$ is the shielded pool locked token ratio for asset $A$ from the previous epoch (separate value for each asset $A$)
4343

44-
Public goods funding inflation can be calculated and paid immediately:
44+
Public goods funding inflation can be calculated and paid immediately (in terms of total tokens per epoch):
4545

46-
- $I_{PGF} := R_{PGF} * S_{NAM} / EpochsPerYear$
46+
- $I_{PGF} = \lambda_{PGF} * S_{NAM} / EpochsPerYear$
4747

4848
These tokens are distributed to the public goods funding validity predicate.
4949

5050
To run the PD-controllers for proof-of-stake and shielded pool rewards, we first calculate some intermediate values:
5151

52-
- Calculate the staking ratio $R_{PoS}$ as $L_{NAM} / S_{NAM}$
53-
- Calculate the per-epoch cap on proof-of-stake and shielded pool reward rates
54-
- $Cap_{PoS-Epoch} := S_{NAM} * Cap_{PoS} / EpochsPerYear$
55-
- $Cap_{SP_A-Epoch} := S_{NAM} * Cap_{SP_A} / EpochsPerYear$ (separate value for each $A$)
56-
- Calculate PD-controller constants
57-
- ${KP}_{PoS} := {KP}_{PoS} * Cap_{PoS-Epoch}$
58-
- ${KD}_{PoS} := {KD}_{PoS} * Cap_{PoS-Epoch}$
59-
- ${KP}_{SP_A} := {KP}_{SP_A} * Cap_{SP_A-Epoch}$
60-
- ${KD}_{SP_A} := {KD}_{SP_A} * Cap_{SP_A-Epoch}$
52+
- Calculate the latest staking ratio $R_{PoS}$ as $L_{PoS} / S_{NAM}$
53+
- Calculate the per-epoch cap on the proof-of-stake and shielded pool token inflation
54+
- $Cap_{PoS-Epoch} = S_{NAM} * Cap_{PoS} / EpochsPerYear$
55+
- $Cap_{SP_A-Epoch} = S_{NAM} * Cap_{SP_A} / EpochsPerYear$ (separate value for each $A$)
56+
- Calculate PD-controller constants to be used for this epoch
57+
- ${KP}_{PoS} = {KP}_{PoS-nom} * Cap_{PoS-Epoch}$
58+
- ${KD}_{PoS} = {KD}_{PoS-nom} * Cap_{PoS-Epoch}$
59+
- ${KP}_{SP_A} = {KP}_{SP_A-nom} * Cap_{SP_A-Epoch}$
60+
- ${KD}_{SP_A} = {KD}_{SP_A-nom} * Cap_{SP_A-Epoch}$
6161

6262
Then, for proof-of-stake first, run the PD-controller:
6363

64-
- Calculate the error $E_{PoS} := R_{PoS-Target} - R_{PoS}$
65-
- Calculate the error derivative $E'_{PoS} := E_{PoS} - E_{PoS-last}$
66-
- Calculate the control value $C_{PoS} := (KP_{PoS} * E_{PoS}) - (KD_{PoS} * E'_{PoS})$
67-
- Calculate the new $I_{PoS} := max(0, min(I_{PoS} + C_{PoS}, Cap_{PoS}))$
64+
- Calculate the error $E_{PoS} = R_{PoS-target} - R_{PoS}$
65+
- Calculate the error derivative $E'_{PoS} = E_{PoS} - E_{PoS-last} = R_{PoS-last} - R_{PoS}$
66+
- Calculate the control value $C_{PoS} = (KP_{PoS} * E_{PoS}) - (KD_{PoS} * E'_{PoS})$
67+
- Calculate the new $I'_{PoS} = max(0, min(I_{PoS} + C_{PoS}, Cap_{PoS-Epoch}))$
6868

6969
These tokens are distributed to the proof-of-stake reward distribution validity predicate.
7070

7171
Similarly, for each asset $A$ for which shielded pool rewards are being paid:
7272

73-
- Calculate the error $E_{SP_A} := L_{SP_A-Target} - L_{SP_A}$
74-
- Calculate the error derivative $E'_{SP_A} := E_{SP-A} - E_{SP_A-last}$
75-
- Calculate the control value $C_{SP_A} := (KP_{SP_A} * E_{SP_A}) - (KD_{SP_A} * E'{SP_A})$
76-
- Calculate the new $I_{SP_A} := max(0, min(I_{SP_A} + C_{SP_A}, Cap_{SP_A-Epoch}))$
73+
- Calculate the error $E_{SP_A} = R_{SP_A-target} - R_{SP_A}$
74+
- Calculate the error derivative $E'_{SP_A} = E_{SP_A} - E_{SP_A-last} = R_{SP_A-last} - R_{SP_A}$
75+
- Calculate the control value $C_{SP_A} = (KP_{SP_A} * E_{SP_A}) - (KD_{SP_A} * E'_{SP_A})$
76+
- Calculate the new $I'_{SP_A} = max(0, min(I_{SP_A} + C_{SP_A}, Cap_{SP_A-Epoch}))$
7777

7878
These tokens are distributed to the shielded pool reward distribution validity predicate.
7979

80-
Finally, we store the current inflation and error values for the next controller round.
80+
Finally, we store the latest inflation and locked token ratio values for the next epoch's controller round.

0 commit comments

Comments
 (0)