helium / oracles

Oracles for Helium subDAOs
Apache License 2.0
17 stars 18 forks source link

HIP-122 restrict boosting from poc bucket #836

Open michaeldjeffrey opened 1 week ago

michaeldjeffrey commented 1 week ago

Reference: HIP-122

DataTransferAndPocAllocatedRewardBuckets and CalculatedPocRewardShares

Data Transfer rewards used to be calculated to fit within the MAX_DATA_TRANSFER_REWARDS_PERCENT from the total scheduled tokens for an epoch. This has been moved to the construction of DataTransferAndPocAllocatedRewardBuckets so boosted poc rewards can be carved out of the poc allocation as soon as possible.

After Data Transfer has been rewarded, the unallocated amount is rolled into the normal POC bucket with reward_shares.handle_unallocated_data_transfer(dc_unallocated_amount);.

Unallocated Data Transfer rewards are allowed to increase the POC rewards, but not service provider boosted rewards. (In the case where boosted rewards do not exceed 10%, nothing extra needs to be done.)

CoveragePoints and HexPoints

To ensure we can do reward calculations with regard to the boosted poc pool, we store the points received from service provider boosting per hex separate from the points received by covering a hex.

Any time boosted points are used in code or comment they do not include base points from covering a hex.

Example:

An IndoorWifi radio with good SignalLevel receives 400 coverage points from a hex. If that hex is boosted 10x, the radio receives 4,000 coverage points. But they are stored { base: 400, boosted: 3,600 }, because the radio receives 3,600 additional points thanks to Service Provider Boosting.

hex_boosting.rs test file

Tests where boosting did not exceed 10% of rewards were untouched.

For the rest, I attempted to recreate the math that derives the expected rewards for radios. For a sense of how expected rewards changed with few radios and few hexes, some examples. (These tests include the 40% data transfer bucket as well)

test_poc_with_boosted_hexes

Old Expected Reward New Expected Reward
20x boosted 31,729,243,786,356 19,223,263,075,722
10x boosted 15,864,621,893,178 16,295,862,607,338
No boost 1,586,462,189,317 13,661,202,185,792

The boosts contributed significantly less than before.

test_poc_with_multi_coverage_boosted_hexes

Old Expected Reward New Expected Reward
1 at 20x boosted 23,990,403,838,464 14,455,028,799,291
2 at 10x boosted 23,990,403,838,464 24,479,397,430,217
No boost 1,199,520,191,923 10,245,901,639,344

Covering more hexes is much more valuable than a strong boosted hex.