From 0077580e27d6156bc03279cade8b15e47a6354d0 Mon Sep 17 00:00:00 2001 From: PierreOssun Date: Thu, 16 Nov 2023 16:20:17 +0100 Subject: [PATCH] PR comments --- pallets/block-rewards-hybrid/src/lib.rs | 2 +- pallets/block-rewards-hybrid/src/tests.rs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pallets/block-rewards-hybrid/src/lib.rs b/pallets/block-rewards-hybrid/src/lib.rs index e6695f89c5..7b6d3c7c81 100644 --- a/pallets/block-rewards-hybrid/src/lib.rs +++ b/pallets/block-rewards-hybrid/src/lib.rs @@ -234,7 +234,7 @@ pub mod pallet { Self::tvl_percentage() / distro_params.ideal_dapps_staking_tvl * adjustable_balance }; - let staker_reward = base_staker_balance + adjustable_staker_part; + let staker_reward = base_staker_balance.saturating_add(adjustable_staker_part); Rewards { treasury_reward, diff --git a/pallets/block-rewards-hybrid/src/tests.rs b/pallets/block-rewards-hybrid/src/tests.rs index 5f5e43b4e6..0ba92d500a 100644 --- a/pallets/block-rewards-hybrid/src/tests.rs +++ b/pallets/block-rewards-hybrid/src/tests.rs @@ -120,7 +120,7 @@ fn reward_distribution_config_not_consistent() { } #[test] -pub fn set_configuration_fails() { +fn set_configuration_fails() { ExternalityBuilder::build().execute_with(|| { // 1 assert_noop!( @@ -142,7 +142,7 @@ pub fn set_configuration_fails() { } #[test] -pub fn set_configuration_is_ok() { +fn set_configuration_is_ok() { ExternalityBuilder::build().execute_with(|| { // custom config so it differs from the default one let reward_config = RewardDistributionConfig { @@ -171,7 +171,7 @@ pub fn set_configuration_is_ok() { } #[test] -pub fn inflation_and_total_issuance_as_expected() { +fn inflation_and_total_issuance_as_expected() { ExternalityBuilder::build().execute_with(|| { let init_issuance = ::Currency::total_issuance(); @@ -190,7 +190,7 @@ pub fn inflation_and_total_issuance_as_expected() { } #[test] -pub fn reward_distribution_as_expected() { +fn reward_distribution_as_expected() { ExternalityBuilder::build().execute_with(|| { // Ensure that initially, all beneficiaries have no free balance let init_balance_snapshot = FreeBalanceSnapshot::new(); @@ -236,7 +236,7 @@ pub fn reward_distribution_as_expected() { } #[test] -pub fn non_distributed_reward_amount_is_burned() { +fn non_distributed_reward_amount_is_burned() { ExternalityBuilder::build().execute_with(|| { // Ensure that initially, all beneficiaries have no free balance let init_balance_snapshot = FreeBalanceSnapshot::new(); @@ -278,7 +278,7 @@ pub fn non_distributed_reward_amount_is_burned() { } #[test] -pub fn reward_distribution_no_adjustable_part() { +fn reward_distribution_no_adjustable_part() { ExternalityBuilder::build().execute_with(|| { let reward_config = RewardDistributionConfig { treasury_percent: Perbill::from_percent(10), @@ -312,7 +312,7 @@ pub fn reward_distribution_no_adjustable_part() { } #[test] -pub fn reward_distribution_all_zero_except_one() { +fn reward_distribution_all_zero_except_one() { ExternalityBuilder::build().execute_with(|| { let reward_config = RewardDistributionConfig { treasury_percent: Perbill::zero(),