@@ -153,24 +153,22 @@ async fn test_poc_with_boosted_hexes(pool: PgPool) -> anyhow::Result<()> {
153153 assert_eq ! ( poc_rewards. len( ) , 3 ) ;
154154
155155 // Calculating expected rewards
156- let ( regular_poc, boosted_poc ) = get_poc_allocation_buckets ( reward_info. epoch_emissions ) ;
156+ let regular_poc = get_poc_allocation_buckets ( reward_info. epoch_emissions ) ;
157157
158158 // With regular poc now 50% of total emissions, that will be split
159159 // between the 3 radios equally. 900 comes from IndoorWifi 400 *
160160 // 0.75 speedtest multiplier * 3 radios
161- let regular_share = regular_poc / dec ! ( 900 ) ;
162161
163162 // Boosted hexes are 10x and 20x.
164163 // (300 * 19) + (300 * 9) = 8400;
165164 // To get points _only_ from boosting.
166- let boosted_share = boosted_poc / dec ! ( 8400 ) ;
167165
168- let exp_reward_1 =
169- rounded ( regular_share * dec ! ( 300 ) ) + rounded ( boosted_share * dec ! ( 300 ) * dec ! ( 19 ) ) ;
170- let exp_reward_2 =
171- rounded ( regular_share * dec ! ( 300 ) ) + rounded ( boosted_share * dec ! ( 300 ) * dec ! ( 9 ) ) ;
172- let exp_reward_3 =
173- rounded ( regular_share * dec ! ( 300 ) ) + rounded ( boosted_share * dec ! ( 300 ) * dec ! ( 0 ) ) ;
166+ //combined is 9300 points
167+ let share = regular_poc / dec ! ( 9300 ) ;
168+
169+ let exp_reward_1 = rounded ( share * dec ! ( 300 ) ) + rounded ( share * dec ! ( 300 ) * dec ! ( 19 ) ) ;
170+ let exp_reward_2 = rounded ( share * dec ! ( 300 ) ) + rounded ( share * dec ! ( 300 ) * dec ! ( 9 ) ) ;
171+ let exp_reward_3 = rounded ( share * dec ! ( 300 ) ) + rounded ( share * dec ! ( 300 ) * dec ! ( 0 ) ) ;
174172
175173 assert_eq ! ( exp_reward_1, hotspot_2. total_poc_reward( ) ) ; // 20x boost
176174 assert_eq ! ( exp_reward_2, hotspot_1. total_poc_reward( ) ) ; // 10x boost
@@ -439,20 +437,23 @@ async fn test_poc_with_multi_coverage_boosted_hexes(pool: PgPool) -> anyhow::Res
439437 // - 2 covered hexes boosted at 10x
440438 // - 1 covered hex boosted at 20x
441439 // - 1 covered hex no boost
442- let ( regular_poc, boosted_poc ) = get_poc_allocation_buckets ( reward_info. epoch_emissions ) ;
440+ let regular_poc = get_poc_allocation_buckets ( reward_info. epoch_emissions ) ;
443441
444442 // With regular poc now 50% of total emissions, that will be split
445443 // between the 3 radios equally.
446444 // 1200 comes from IndoorWifi 400 * 0.75 speedtest multiplier * 4 hexes
447- let regular_share = regular_poc / dec ! ( 1200 ) ;
445+ // let regular_share = regular_poc / dec!(1200);
448446
449447 // Boosted hexes are 2 at 10x and 1 at 20x.
450448 // (300 * (9 * 2)) + (300 * 19) = 11,100;
451449 // To get points _only_ from boosting.
452- let boosted_share = boosted_poc / dec ! ( 11_100 ) ;
450+ // let boosted_share = boosted_poc / dec!(11_100);
453451
454- let hex_coverage = |hexes : u8 | regular_share * dec ! ( 300 ) * Decimal :: from ( hexes) ;
455- let boost_coverage = |mult : u8 | boosted_share * dec ! ( 300 ) * Decimal :: from ( mult) ;
452+ // combined points is 12,300
453+ let share = regular_poc / dec ! ( 12_300 ) ;
454+
455+ let hex_coverage = |hexes : u8 | share * dec ! ( 300 ) * Decimal :: from ( hexes) ;
456+ let boost_coverage = |mult : u8 | share * dec ! ( 300 ) * Decimal :: from ( mult) ;
456457
457458 let exp_reward_1 = rounded ( hex_coverage ( 2 ) ) + rounded ( boost_coverage ( 18 ) ) ;
458459 let exp_reward_2 = rounded ( hex_coverage ( 1 ) ) + rounded ( boost_coverage ( 19 ) ) ;
@@ -462,13 +463,6 @@ async fn test_poc_with_multi_coverage_boosted_hexes(pool: PgPool) -> anyhow::Res
462463 assert_eq ! ( exp_reward_2, hotspot_2. total_poc_reward( ) ) ; // 1 at 20x boost
463464 assert_eq ! ( exp_reward_3, hotspot_3. total_poc_reward( ) ) ; // 1 at no boost
464465
465- // hotspot 1 and 2 should have the same coverage points, but different poc rewards.
466- assert_eq ! (
467- hotspot_1. total_coverage_points( ) ,
468- hotspot_2. total_coverage_points( )
469- ) ;
470- assert_ne ! ( hotspot_1. total_poc_reward( ) , hotspot_2. total_poc_reward( ) ) ;
471-
472466 // assert the number of boosted hexes for each radio
473467 assert_eq ! ( 1 , hotspot_2. boosted_hexes_len( ) ) ;
474468 assert_eq ! ( 2 , hotspot_1. boosted_hexes_len( ) ) ;
@@ -679,7 +673,7 @@ async fn test_reduced_location_score_with_boosted_hexes(pool: PgPool) -> anyhow:
679673 assert_eq ! ( poc_rewards. len( ) , 3 ) ;
680674
681675 // Calculating expected rewards
682- let ( regular_poc, boosted_poc ) = get_poc_allocation_buckets ( reward_info. epoch_emissions ) ;
676+ let regular_poc = get_poc_allocation_buckets ( reward_info. epoch_emissions ) ;
683677
684678 // Here's how we get the regular shares per coverage points
685679 // | base coverage point | speedtest | location | total |
@@ -689,19 +683,17 @@ async fn test_reduced_location_score_with_boosted_hexes(pool: PgPool) -> anyhow:
689683 // | 400 | 0.75 | 0.25 | 75 |
690684 // |---------------------|-----------|----------|-------|
691685 // | 675 |
692- let regular_share = regular_poc / dec ! ( 675 ) ;
693686
694687 // Boosted hexes are 2x, only one radio qualifies based on the location trust
695688 // 300 * 1 == 300
696689 // To get points _only_ from boosting.
697- let boosted_share = boosted_poc / dec ! ( 300 ) ;
698690
699- let exp_reward_1 =
700- rounded ( regular_share * dec ! ( 300 ) ) + rounded ( boosted_share * dec ! ( 300 ) * dec ! ( 1 ) ) ;
701- let exp_reward_2 =
702- rounded ( regular_share * dec ! ( 300 ) ) + rounded ( boosted_share * dec ! ( 300 ) * dec ! ( 0 ) ) ;
703- let exp_reward_3 =
704- rounded ( regular_share * dec ! ( 75 ) ) + rounded ( boosted_share * dec ! ( 75 ) * dec ! ( 0 ) ) ;
691+ // combined points is 975
692+ let share = regular_poc / dec ! ( 975 ) ;
693+
694+ let exp_reward_1 = rounded ( share * dec ! ( 300 ) ) + rounded ( share * dec ! ( 300 ) * dec ! ( 1 ) ) ;
695+ let exp_reward_2 = rounded ( share * dec ! ( 300 ) ) + rounded ( share * dec ! ( 300 ) * dec ! ( 0 ) ) ;
696+ let exp_reward_3 = rounded ( share * dec ! ( 75 ) ) + rounded ( share * dec ! ( 75 ) * dec ! ( 0 ) ) ;
705697
706698 assert_eq ! ( exp_reward_1, hotspot_1. total_poc_reward( ) ) ;
707699 assert_eq ! ( exp_reward_2, hotspot_2. total_poc_reward( ) ) ;
@@ -818,7 +810,7 @@ async fn test_distance_from_asserted_removes_boosting_but_not_location_trust(
818810 assert_eq ! ( poc_rewards. len( ) , 3 ) ;
819811
820812 // Calculating expected rewards
821- let ( regular_poc, boosted_poc ) = get_poc_allocation_buckets ( reward_info. epoch_emissions ) ;
813+ let regular_poc = get_poc_allocation_buckets ( reward_info. epoch_emissions ) ;
822814
823815 // Here's how we get the regular shares per coverage points
824816 // | base coverage point | speedtest | location | total |
@@ -828,19 +820,20 @@ async fn test_distance_from_asserted_removes_boosting_but_not_location_trust(
828820 // | 400 | 0.75 | 1.00 | 300 |
829821 // |---------------------|-----------|----------|-------|
830822 // | 900 |
831- let regular_share = regular_poc / dec ! ( 900 ) ;
832823
833824 // Boosted hexes are 2x, only one radio qualifies based on the location trust
834825 // 300 * 1 == 300
835826 // To get points _only_ from boosting.
836- let boosted_share = boosted_poc / dec ! ( 300 ) ;
827+
828+ // combined base poc points and boosted poc points is 1200
829+ let regular_share = regular_poc / dec ! ( 1200 ) ;
837830
838831 let exp_reward_1 =
839- rounded ( regular_share * dec ! ( 300 ) ) + rounded ( boosted_share * dec ! ( 300 ) * dec ! ( 1 ) ) ;
832+ rounded ( regular_share * dec ! ( 300 ) ) + rounded ( regular_share * dec ! ( 300 ) * dec ! ( 1 ) ) ;
840833 let exp_reward_2 =
841- rounded ( regular_share * dec ! ( 300 ) ) + rounded ( boosted_share * dec ! ( 300 ) * dec ! ( 0 ) ) ;
834+ rounded ( regular_share * dec ! ( 300 ) ) + rounded ( regular_share * dec ! ( 300 ) * dec ! ( 0 ) ) ;
842835 let exp_reward_3 =
843- rounded ( regular_share * dec ! ( 300 ) ) + rounded ( boosted_share * dec ! ( 300 ) * dec ! ( 0 ) ) ;
836+ rounded ( regular_share * dec ! ( 300 ) ) + rounded ( regular_share * dec ! ( 300 ) * dec ! ( 0 ) ) ;
844837
845838 assert_eq ! ( exp_reward_1, hotspot_1. total_poc_reward( ) ) ;
846839 assert_eq ! ( exp_reward_2, hotspot_2. total_poc_reward( ) ) ;
@@ -980,7 +973,7 @@ async fn test_poc_with_wifi_and_multi_coverage_boosted_hexes(pool: PgPool) -> an
980973 assert_eq ! ( poc_rewards. len( ) , 3 ) ;
981974
982975 // Calculating expected rewards
983- let ( regular_poc, boosted_poc ) = get_poc_allocation_buckets ( reward_info. epoch_emissions ) ;
976+ let regular_poc = get_poc_allocation_buckets ( reward_info. epoch_emissions ) ;
984977
985978 // Here's how we get the regular shares per coverage points
986979 // | base coverage point | speedtest | location | total |
@@ -990,20 +983,19 @@ async fn test_poc_with_wifi_and_multi_coverage_boosted_hexes(pool: PgPool) -> an
990983 // | 400 | 0.75 | 1.00 | 300 |
991984 // |---------------------|-----------|----------|-------|
992985 // | 624 |
993- let regular_share = regular_poc / dec ! ( 624 ) ;
994986
995987 // Boosted hexes are 1 at 10x and 1 at 20x.
996988 // Only wifi is targeted with Boosts.
997989 // (24 * 9) + (300 * 19) == 5916
998990 // To get points _only_ from boosting.
999- let boosted_share = boosted_poc / dec ! ( 5916 ) ;
1000991
1001- let exp_reward_1 = rounded ( regular_share * ( dec ! ( 24 ) * dec ! ( 1 ) ) )
1002- + rounded ( boosted_share * ( dec ! ( 24 ) * dec ! ( 9 ) ) ) ;
1003- let exp_reward_2 = rounded ( regular_share * dec ! ( 300 ) * dec ! ( 1 ) )
1004- + rounded ( boosted_share * dec ! ( 300 ) * dec ! ( 19 ) ) ;
1005- let exp_reward_3 =
1006- rounded ( regular_share * dec ! ( 300 ) * dec ! ( 1 ) ) + rounded ( boosted_share * dec ! ( 300 ) * dec ! ( 0 ) ) ;
992+ // combined points are 6540
993+ let share = regular_poc / dec ! ( 6540 ) ;
994+
995+ let exp_reward_1 =
996+ rounded ( share * ( dec ! ( 24 ) * dec ! ( 1 ) ) ) + rounded ( share * ( dec ! ( 24 ) * dec ! ( 9 ) ) ) ;
997+ let exp_reward_2 = rounded ( share * dec ! ( 300 ) * dec ! ( 1 ) ) + rounded ( share * dec ! ( 300 ) * dec ! ( 19 ) ) ;
998+ let exp_reward_3 = rounded ( share * dec ! ( 300 ) * dec ! ( 1 ) ) + rounded ( share * dec ! ( 300 ) * dec ! ( 0 ) ) ;
1007999
10081000 assert_eq ! ( exp_reward_1, hotspot_1. total_poc_reward( ) ) ;
10091001 assert_eq ! ( exp_reward_2, hotspot_2. total_poc_reward( ) ) ;
@@ -1533,19 +1525,16 @@ async fn save_seniority_object(
15331525 Ok ( ( ) )
15341526}
15351527
1536- fn get_poc_allocation_buckets ( total_emissions : Decimal ) -> ( Decimal , Decimal ) {
1528+ fn get_poc_allocation_buckets ( total_emissions : Decimal ) -> Decimal {
15371529 // To not deal with percentages of percentages, let's start with the
15381530 // total emissions and work from there.
1539- let data_transfer = total_emissions * dec ! ( 0.4 ) ;
1540- let regular_poc = total_emissions * dec ! ( 0.1 ) ;
1541- let boosted_poc = total_emissions * dec ! ( 0.1 ) ;
1531+ let data_transfer = total_emissions * dec ! ( 0.6 ) ;
1532+ let regular_poc = total_emissions * dec ! ( 0.0 ) ;
15421533
15431534 // There is no data transfer in this test to be rewarded, so we know
15441535 // the entirety of the unallocated amount will be put in the poc
15451536 // pool.
1546- let regular_poc = regular_poc + data_transfer;
1547-
1548- ( regular_poc, boosted_poc)
1537+ regular_poc + data_transfer
15491538}
15501539
15511540fn assert_total_matches_emissions ( total : u64 , reward_info : & EpochRewardInfo ) {
0 commit comments