Combining poc and service provider unallocated rewards #1112
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With the current rewarding, depending on the total epoch emissions there may be a bone unaccounted for due to rounding. Currently, we write an unallocated reward for unaccounted for bones during poc rewarding. We do not write unallocated rewards for service providers because the full amount is rewarded. In total, this accounts for 94% of the total epoch emissions.
If the poc unallocated amount is less than 1, it will not be written. The problem is that when we calculate the reward amount for service providers, we round to 0, which could dismiss 0.8 of a bone. If we are dismissing 0.6 of a bone during poc rewarding, and dismissing 0.8 of a bone during service provider rewarding, we then have 1.4 bones that are unaccounted for.
Example:
Total epoch emissions 82191780821915
poc and dc rewards: 57534246575340
sp: 19726027397259
poc unallocated: 0.5
sp unallocated: 0.6 (both less than 0 so no unallocated reward written)
result: 77260273972599
94%: 77260273972600.1
Missing 1.1 bones
In this PR, I have moved the writing of unallocated rewards out of poc. Now we reward poc and service providers and calculate the total unallocated amount and write a combined (poc and service provider) unallocated reward.