Skip to content

Commit ba45dc3

Browse files
committed
Update rewards for HIP-147
1 parent 3f773e3 commit ba45dc3

File tree

1 file changed

+13
-29
lines changed

1 file changed

+13
-29
lines changed

mobile_verifier/src/reward_shares.rs

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,10 @@ mod radio_reward_v2;
3232

3333
/// Maximum amount of the total emissions pool allocated for data transfer
3434
/// rewards
35-
const MAX_DATA_TRANSFER_REWARDS_PERCENT: Decimal = dec!(0.4);
35+
const MAX_DATA_TRANSFER_REWARDS_PERCENT: Decimal = dec!(0.6);
3636

3737
/// Percentage of total emissions pool allocated for proof of coverage
38-
const POC_REWARDS_PERCENT: Decimal = dec!(0.1);
39-
40-
/// Percentage of total emissions pool allocated for boosted proof of coverage
41-
const BOOSTED_POC_REWARDS_PERCENT: Decimal = dec!(0.1);
38+
const POC_REWARDS_PERCENT: Decimal = dec!(0.0);
4239

4340
/// The fixed price of a mobile data credit
4441
const DC_USD_PRICE: Decimal = dec!(0.00001);
@@ -544,20 +541,18 @@ impl CoverageShares {
544541
pub struct DataTransferAndPocAllocatedRewardBuckets {
545542
pub data_transfer: Decimal,
546543
pub poc: Decimal,
547-
pub boosted_poc: Decimal,
548544
}
549545

550546
impl DataTransferAndPocAllocatedRewardBuckets {
551547
pub fn new(total_emission_pool: Decimal) -> Self {
552548
Self {
553549
data_transfer: total_emission_pool * MAX_DATA_TRANSFER_REWARDS_PERCENT,
554550
poc: total_emission_pool * POC_REWARDS_PERCENT,
555-
boosted_poc: total_emission_pool * BOOSTED_POC_REWARDS_PERCENT,
556551
}
557552
}
558553

559554
pub fn total_poc(&self) -> Decimal {
560-
self.poc + self.boosted_poc
555+
self.poc
561556
}
562557

563558
/// Rewards left over from Data Transfer rewards go into the POC pool. They
@@ -586,7 +581,8 @@ impl CalculatedPocRewardShares {
586581
allocated_rewards: DataTransferAndPocAllocatedRewardBuckets,
587582
radios: impl Iterator<Item = &'a coverage_point_calculator::CoveragePoints>,
588583
) -> Option<Self> {
589-
let (total_points, boost_points, poc_points) = radios.fold(
584+
//TODO fix this
585+
let (total_points, _boost_points, _poc_points) = radios.fold(
590586
(dec!(0), dec!(0), dec!(0)),
591587
|(total, boosted, poc), radio| {
592588
(
@@ -602,20 +598,10 @@ impl CalculatedPocRewardShares {
602598
}
603599

604600
let shares_per_point = allocated_rewards.total_poc() / total_points;
605-
let boost_within_limit = allocated_rewards.boosted_poc >= shares_per_point * boost_points;
606-
607-
if boost_within_limit {
608-
Some(CalculatedPocRewardShares {
609-
normal: shares_per_point,
610-
boost: shares_per_point,
611-
})
612-
} else {
613-
// Over boosted reward limit, need to calculate 2 share ratios
614-
let normal = allocated_rewards.poc / poc_points;
615-
let boost = allocated_rewards.boosted_poc / boost_points;
616-
617-
Some(CalculatedPocRewardShares { normal, boost })
618-
}
601+
Some(CalculatedPocRewardShares {
602+
normal: shares_per_point,
603+
boost: shares_per_point,
604+
})
619605
}
620606

621607
fn base_poc_reward(&self, points: &coverage_point_calculator::CoveragePoints) -> u64 {
@@ -636,8 +622,7 @@ impl CalculatedPocRewardShares {
636622
}
637623

638624
pub fn get_scheduled_tokens_for_poc(total_emission_pool: Decimal) -> Decimal {
639-
let poc_percent =
640-
MAX_DATA_TRANSFER_REWARDS_PERCENT + POC_REWARDS_PERCENT + BOOSTED_POC_REWARDS_PERCENT;
625+
let poc_percent = MAX_DATA_TRANSFER_REWARDS_PERCENT + POC_REWARDS_PERCENT;
641626
total_emission_pool * poc_percent
642627
}
643628

@@ -723,7 +708,6 @@ mod test {
723708
DataTransferAndPocAllocatedRewardBuckets {
724709
data_transfer: dec!(0),
725710
poc: poc + data_transfer,
726-
boosted_poc: total_emission_pool * BOOSTED_POC_REWARDS_PERCENT,
727711
}
728712
}
729713

@@ -1007,13 +991,13 @@ mod test {
1007991
// for POC and data transfer (which is 60% of the daily total emissions).
1008992
let available_poc_rewards = get_scheduled_tokens_for_poc(rewards_info.epoch_emissions)
1009993
- data_transfer_rewards.reward_sum;
1010-
assert_eq!(available_poc_rewards.trunc(), dec!(16_438_356_164_383));
994+
assert_eq!(available_poc_rewards.trunc(), Decimal::ZERO);
1011995
assert_eq!(
1012996
// Rewards are automatically scaled
1013997
data_transfer_rewards.reward(&owner).trunc(),
1014-
dec!(32_876_712_328_766)
998+
get_scheduled_tokens_for_poc(rewards_info.epoch_emissions).trunc(),
1015999
);
1016-
assert_eq!(data_transfer_rewards.reward_scale().round_dp(1), dec!(0.5));
1000+
assert_eq!(data_transfer_rewards.reward_scale().round_dp(1), dec!(0.7));
10171001
}
10181002

10191003
fn bytes_per_s(mbps: u64) -> u64 {

0 commit comments

Comments
 (0)