Closed code423n4 closed 2 years ago
Funen
Expensive Gas
rewardsLength += 1; the implementation can be saving more gas by using ++rewardsLength.
rewardsLength += 1;
++rewardsLength
Manual Review
if (rewardsLength == 0) { RewardType storage reward = rewards.push(); reward.reward_token = crv; reward.reward_pool = mainPool; rewardsLength += 1; }
change to
if (rewardsLength == 0) { RewardType storage reward = rewards.push(); reward.reward_token = crv; reward.reward_pool = mainPool; ++rewardsLength; }
Duplicate of #14
Handle
Funen
Vulnerability details
Impact
Expensive Gas
Proof of Concept
rewardsLength += 1;
the implementation can be saving more gas by using++rewardsLength
.Tools Used
Manual Review
Recommended Mitigation Steps
change to