Open code423n4 opened 3 years ago
jvaqa
Duplicated Code In Admin.viewCurrentMaintenanceStaker()
There are four lines of code that are duplicated in viewCurrentMaintenanceStaker
Change this:
if (maintenanceStakePerBlock > currentStake) { // skip staker = nextMaintenanceStaker[staker]; currentStake = getMaintenanceStakerStake(staker); } else { startBlock += currentStake / maintenanceStakePerBlock; staker = nextMaintenanceStaker[staker]; currentStake = getMaintenanceStakerStake(staker); }
To this:
if (maintenanceStakePerBlock <= currentStake) { startBlock += currentStake / maintenanceStakePerBlock; } staker = nextMaintenanceStaker[staker]; currentStake = getMaintenanceStakerStake(staker);
Handle
jvaqa
Vulnerability details
Duplicated Code In Admin.viewCurrentMaintenanceStaker()
Impact
There are four lines of code that are duplicated in viewCurrentMaintenanceStaker
Recommended Mitigation Steps
Change this:
if (maintenanceStakePerBlock > currentStake) { // skip staker = nextMaintenanceStaker[staker]; currentStake = getMaintenanceStakerStake(staker); } else { startBlock += currentStake / maintenanceStakePerBlock; staker = nextMaintenanceStaker[staker]; currentStake = getMaintenanceStakerStake(staker); }
To this:
if (maintenanceStakePerBlock <= currentStake) { startBlock += currentStake / maintenanceStakePerBlock; } staker = nextMaintenanceStaker[staker]; currentStake = getMaintenanceStakerStake(staker);