Rapidly growing ROE issue
Issue background
Once Staking is activated and most tokens are unstaked with no new tokens being staked, Global SRPs will keep going towards 0. If at the same time Combined Token Pool remains high, the ROE can get very high. Example:
Combined token pool: 10,000,000,000,000,000 SUFs
Global SRP: 1 (all tokens unstaked)
ROE: 10,000,000,000,000,000
If this occurred it will not impact staking fundamentals, but a large enough ROE can lead to overflow and/or precision truncation.
This is extremely unlikely to happen in reality as it would require a very large portion of staked tokens to be unstaked and a large number of tokens come in from fees without any new tokens being staked. Yet as Global SRPs get low, meaning fewer are staking, the APR goes up creating an incentive to stake.
Solutions
No matter the solution selected, Combined Token Pool and Global SRPs have to be initialized to a non-zero value to avoid unexpected behavior.
1. Leave as-is
This approach assumes market forces would prevent ROE from going extreme.
Downside:
In extreme cases may lead to overflow and loss of precision.
2. Freeze ROE
With this approach if Global SRPs get too low, e.g. 1M, the ROE would be “frozen” (kept at last value). Once Global SRPs go back above the minimum, ROE would be unfrozen.
Downside:
As ROE is frozen, users do not earn rewards.
As ROE goes up and stakers “recycle” (stake/unstake) their tokens, the required minimum of staked tokens to not freeze ROE goes up.
See https://docs.google.com/spreadsheets/d/1xLXMF4mluumrt3ZgZVolzsxYhh4Qf_1MCoP8t5SBFMc/edit?usp=sharing
3. Initialize at high number
Initialize Combined Token Pool and Global SRPs high enough that it never becomes an issue, e.g. 1M each.
Downside:
The 1M would effectively be “staked the system” and would continue to earn rewards meaning a growing number of fees would not go to users.
4. Reduce ROE
ROE could be divided by a large number to reduce risk of overflow, e.g. 1,000,0000.
Downside:
It would likely lead to loss of precision.
Will proportionally increase SRPs being issued, which may cause overflow.
5. Integrate math library that can handle very large numbers
This approach allows for a large growth in ROE and in Global SRPs in this edge case by integrating a math library that can handle integer math for large numbers.
Tracked in: https://fioprotocol.atlassian.net/browse/BD-2836
Next Step
Perform additional modeling.