From c24709f4cf6eadec0d797fef121f1d7637b0132f Mon Sep 17 00:00:00 2001 From: SamAg19 <52957842+SamAg19@users.noreply.github.com> Date: Wed, 20 Oct 2021 15:09:46 +0530 Subject: [PATCH] age Bug fixed (#517) * age Bug fixed * proper datatype defined --- contracts/Core/RewardManager.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/Core/RewardManager.sol b/contracts/Core/RewardManager.sol index d5f0189b..aece4ac6 100644 --- a/contracts/Core/RewardManager.sol +++ b/contracts/Core/RewardManager.sol @@ -122,7 +122,7 @@ contract RewardManager is Initializable, ACL, Constants, IRewardManager { stakeManager.setStakerAge(epoch, thisStaker.id, 0); return; } - uint32 age = thisStaker.age + 10000; + uint64 age = thisStaker.age + 10000; // cap age to maxAge uint32 maxAge = parameters.maxAge(); age = age > maxAge ? maxAge : age; @@ -135,7 +135,7 @@ contract RewardManager is Initializable, ACL, Constants, IRewardManager { uint64 penalty = 0; for (uint8 i = 0; i < mediansLastEpoch.length; i++) { // slither-disable-next-line calls-loop - uint48 voteValueLastEpoch = voteManager.getVoteValue(i, stakerId); + uint64 voteValueLastEpoch = voteManager.getVoteValue(i, stakerId); // uint32 voteWeightLastEpoch = voteManager.getVoteWeight(thisStaker.id, i); uint32 medianLastEpoch = mediansLastEpoch[i]; if (medianLastEpoch == 0) continue; @@ -150,6 +150,6 @@ contract RewardManager is Initializable, ACL, Constants, IRewardManager { age = penalty > age ? 0 : age - uint32(penalty); - stakeManager.setStakerAge(epoch, thisStaker.id, age); + stakeManager.setStakerAge(epoch, thisStaker.id, uint32(age)); } }