From 3f26bfae2375ba8ce374dfbd2be354279e4bfd9b Mon Sep 17 00:00:00 2001 From: Michael Jeffrey Date: Fri, 27 Sep 2024 13:42:16 -0700 Subject: [PATCH] Found a rounding error truncating to 5 decimal places for a % can result in the summed allocation exceeding 100%. Thanks proptest --- mobile_verifier/src/service_provider/reward.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile_verifier/src/service_provider/reward.rs b/mobile_verifier/src/service_provider/reward.rs index 3c9e7e7cc..4eb08aff9 100644 --- a/mobile_verifier/src/service_provider/reward.rs +++ b/mobile_verifier/src/service_provider/reward.rs @@ -251,7 +251,7 @@ fn distribute_unalloc_over_limit(coll: &mut [RewardInfo], unallocated_perc: Deci continue; } let shares = sp.realized_promo_perc * dec!(100); - sp.matched_promo_perc = ((shares / total) * unallocated_perc).round_dp(5); + sp.matched_promo_perc = (shares / total) * unallocated_perc; } }