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:

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:

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:

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:

4. Reduce ROE

ROE could be divided by a large number to reduce risk of overflow, e.g. 1,000,0000.

Downside:

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.