diff --git a/iot_verifier/src/reward_share.rs b/iot_verifier/src/reward_share.rs index cfae424bc..1a5fe9e7d 100644 --- a/iot_verifier/src/reward_share.rs +++ b/iot_verifier/src/reward_share.rs @@ -18,7 +18,7 @@ const DEFAULT_PREC: u32 = 15; lazy_static! { // TODO: year 1 emissions allocate 30% of total to PoC with 6% to beacons and 24% to witnesses but subsequent years back // total PoC percentage off 1.5% each year; determine how beacons and witnesses will split the subsequent years' allocations - static ref REWARDS_PER_DAY: Decimal = (Decimal::from(60_000_000_000_u64) / Decimal::from(365)) * Decimal::from(1_000_000); // 16_438_356_164_383_560 + static ref REWARDS_PER_DAY: Decimal = (Decimal::from(65_000_000_000_u64) / Decimal::from(365)) * Decimal::from(1_000_000); // 16_438_356_164_383_560 static ref BEACON_REWARDS_PER_DAY_PERCENT: Decimal = dec!(0.06); static ref WITNESS_REWARDS_PER_DAY_PERCENT: Decimal = dec!(0.24); // Data transfer is allocated 50% of daily rewards @@ -477,7 +477,7 @@ mod test { println!("total_tokens_for_period: {total_tokens_for_period}"); let operation_tokens_for_period = get_scheduled_ops_fund_tokens(epoch_duration); - assert_eq!(479452054794, operation_tokens_for_period); + assert_eq!(519406392694, operation_tokens_for_period); } #[test] @@ -631,16 +631,16 @@ mod test { // the first is the expected beacon or witness poc reward // the second is the additional reward from unallocated dc transfer rewards assert_eq!(rewards.get(&gw4), None); // Validate zero-amount entry filtered out - assert_eq!(gw1_rewards.beacon_amount, 1_505_343_971 + 17_371_519); - assert_eq!(gw1_rewards.witness_amount, 35_735_556_879 + 412_384_756); - assert_eq!(gw2_rewards.beacon_amount, 30_106_879_421 + 347_430_381); - assert_eq!(gw2_rewards.witness_amount, 65_515_187_611 + 756_038_719); - assert_eq!(gw3_rewards.beacon_amount, 11_290_079_783 + 130_286_392); - assert_eq!(gw3_rewards.witness_amount, 47_647_409_172 + 549_846_341); - assert_eq!(gw5_rewards.beacon_amount, 3_010_687_942 + 34_743_038); - assert_eq!(gw5_rewards.witness_amount, 83_382_966_051 + 962_231_097); - assert_eq!(gw6_rewards.beacon_amount, 22_580_159_566 + 260_572_785); - assert_eq!(gw6_rewards.witness_amount, 41_691_483_025 + 481_115_549); + assert_eq!(gw1_rewards.beacon_amount, 1649612734); + assert_eq!(gw1_rewards.witness_amount, 39160371873); + assert_eq!(gw2_rewards.beacon_amount, 32992254691); + assert_eq!(gw2_rewards.witness_amount, 71794015101); + assert_eq!(gw3_rewards.beacon_amount, 12372095509); + assert_eq!(gw3_rewards.witness_amount, 52213829164); + assert_eq!(gw5_rewards.beacon_amount, 3299225469); + assert_eq!(gw5_rewards.witness_amount, 91374201038); + assert_eq!(gw6_rewards.beacon_amount, 24744191018); + assert_eq!(gw6_rewards.witness_amount, 45687100519); // assert the total POC rewards allocated equals TOTAL_POC_REWARDS_FOR_PERIOD // plus the remainder of the total dc transfer rewards for the period @@ -665,7 +665,7 @@ mod test { // but due to rounding whilst going to u64 in compute_rewards, // is permitted to be a few bones less // tolerance here is 4 - assert_eq!(poc_diff, 4); + assert_eq!(poc_diff, 5); } #[test] @@ -797,29 +797,29 @@ mod test { // but due to rounding whilst going to u64 in compute_rewards, // is permitted to be a few bones less // tolerance here is 2 - assert_eq!(data_transfer_diff, 2); + assert_eq!(data_transfer_diff, 3); // assert the expected data transfer rewards amounts per gateway - assert_eq!(gw1_rewards.dc_transfer_amount, 47_564_687_975); // ~8.33% of total rewards - assert_eq!(gw2_rewards.dc_transfer_amount, 47_564_687_975); // ~8.33% of total rewards - assert_eq!(gw3_rewards.dc_transfer_amount, 47_564_687_975); // ~8.33% of total rewards - assert_eq!(gw5_rewards.dc_transfer_amount, 47_564_687_975); // ~8.33% of total rewards - assert_eq!(gw6_rewards.dc_transfer_amount, 380_517_503_805); // ~66.64% of total rewards, or 8x each of the other gateways + assert_eq!(gw1_rewards.dc_transfer_amount, 51528411973); // ~8.33% of total rewards + assert_eq!(gw2_rewards.dc_transfer_amount, 51528411973); // ~8.33% of total rewards + assert_eq!(gw3_rewards.dc_transfer_amount, 51528411973); // ~8.33% of total rewards + assert_eq!(gw5_rewards.dc_transfer_amount, 51528411973); // ~8.33% of total rewards + assert_eq!(gw6_rewards.dc_transfer_amount, 412227295788); // ~66.64% of total rewards, or 8x each of the other gateways // assert the beacon and witness amount // these will be rewards solely from POC as there are zero unallocated // dc transfer rewards assert_eq!(rewards.get(&gw4), None); // Validate zero-amount entry filtered out - assert_eq!(gw1_rewards.beacon_amount, 1_505_343_971); - assert_eq!(gw1_rewards.witness_amount, 35_735_556_879); - assert_eq!(gw2_rewards.beacon_amount, 30_106_879_421); - assert_eq!(gw2_rewards.witness_amount, 65_515_187_611); - assert_eq!(gw3_rewards.beacon_amount, 11_290_079_783); - assert_eq!(gw3_rewards.witness_amount, 47_647_409_172); - assert_eq!(gw5_rewards.beacon_amount, 3_010_687_942); - assert_eq!(gw5_rewards.witness_amount, 83_382_966_051); - assert_eq!(gw6_rewards.beacon_amount, 22_580_159_566); - assert_eq!(gw6_rewards.witness_amount, 41_691_483_025); + assert_eq!(gw1_rewards.beacon_amount, 1630789302); + assert_eq!(gw1_rewards.witness_amount, 38713519952); + assert_eq!(gw2_rewards.beacon_amount, 32615786040); + assert_eq!(gw2_rewards.witness_amount, 70974786579); + assert_eq!(gw3_rewards.beacon_amount, 12230919765); + assert_eq!(gw3_rewards.witness_amount, 51618026603); + assert_eq!(gw5_rewards.beacon_amount, 3261578604); + assert_eq!(gw5_rewards.witness_amount, 90331546555); + assert_eq!(gw6_rewards.beacon_amount, 24461839530); + assert_eq!(gw6_rewards.witness_amount, 45165773277); // assert the total rewards allocated equals TOTAL_POC_REWARDS_FOR_PERIOD // plus 0% of the total dc transfer rewards for the period @@ -965,11 +965,11 @@ mod test { assert_eq!(expected_data_transfer_percent.round(), dec!(55)); // assert the expected dc amounts per gateway - assert_eq!(gw1_rewards.dc_transfer_amount, 57_077_623_955); // 10% of total + assert_eq!(gw1_rewards.dc_transfer_amount, 61834091922); // 10% of total assert_eq!(gw2_rewards.dc_transfer_amount, 0); // 0% of total - assert_eq!(gw3_rewards.dc_transfer_amount, 114_155_247_910); // 20% of total - assert_eq!(gw5_rewards.dc_transfer_amount, 28_538_811_977); // 5% of total - assert_eq!(gw6_rewards.dc_transfer_amount, 114_155_247_910); // 20% of total + assert_eq!(gw3_rewards.dc_transfer_amount, 123668183844); // 20% of total + assert_eq!(gw5_rewards.dc_transfer_amount, 30917045961); // 5% of total + assert_eq!(gw6_rewards.dc_transfer_amount, 123668183844); // 20% of total // assert the beacon and witness amount, these will now have an allocation // of any unused data transfer rewards @@ -977,16 +977,16 @@ mod test { // the first is the expected beacon/witness poc reward // the second is the additional reward from unallocated dc transfer rewards assert_eq!(rewards.get(&gw4), None); // Validate zero-amount entry filtered out - assert_eq!(gw1_rewards.beacon_amount, 1_505_343_971 + 7_840_333); - assert_eq!(gw1_rewards.witness_amount, 35_735_556_879 + 186_122_698); - assert_eq!(gw2_rewards.beacon_amount, 30_106_879_421 + 156_806_670); - assert_eq!(gw2_rewards.witness_amount, 65_515_187_611 + 341_224_947); - assert_eq!(gw3_rewards.beacon_amount, 11_290_079_783 + 58_802_501); - assert_eq!(gw3_rewards.witness_amount, 47_647_409_172 + 248_163_598); - assert_eq!(gw5_rewards.beacon_amount, 3_010_687_942 + 15_680_667); - assert_eq!(gw5_rewards.witness_amount, 83_382_966_051 + 434_286_296); - assert_eq!(gw6_rewards.beacon_amount, 22_580_159_566 + 117_605_002); - assert_eq!(gw6_rewards.witness_amount, 41_691_483_025 + 217_143_148); + assert_eq!(gw1_rewards.beacon_amount, 1639282996); + assert_eq!(gw1_rewards.witness_amount, 38915152878); + assert_eq!(gw2_rewards.beacon_amount, 32785659934); + assert_eq!(gw2_rewards.witness_amount, 71344446943); + assert_eq!(gw3_rewards.beacon_amount, 12294622475); + assert_eq!(gw3_rewards.witness_amount, 51886870504); + assert_eq!(gw5_rewards.beacon_amount, 3278565993); + assert_eq!(gw5_rewards.witness_amount, 90802023383); + assert_eq!(gw6_rewards.beacon_amount, 24589244950); + assert_eq!(gw6_rewards.witness_amount, 45401011691); // assert the total POC rewards allocated equal TOTAL_POC_REWARDS_FOR_PERIOD // plus 45% of the total dc transfer rewards for the period @@ -1013,7 +1013,7 @@ mod test { // but due to rounding whilst going to u64 in compute_rewards, // is permitted to be a few bones less // tolerance here is 3 - assert_eq!(poc_diff, 4); + assert_eq!(poc_diff, 5); } #[test]