Open code423n4 opened 2 years ago
3 gas
Agree but hard to quantify as it's deployment cost
Will not save any gas
Would have preferred the warden to do the work of showing the savings, but ultimately this finding is very valuable.
It will save 60k as that's the cost of storing the values. Additionally on each call it will save another 2100 * 2 = 4200 per call
_perMille
will cost 2100 less per call
Total Savings 66303
Am changing the math on how I calculate gas savings, will not add the 20k at deployment so the new total gas saved here is: 6303
Handle
wuwe1
Vulnerability details
Cache array length in for loops can save gas
POC
https://github.com/code-423n4/2022-02-concur/blob/main/contracts/ConcurRewardPool.sol#L35
Dead code
Remove dead code in
https://github.com/code-423n4/2022-02-concur/blob/main/contracts/MasterChef.sol#L19
public to external
These function can be external.
https://github.com/code-423n4/2022-02-concur/blob/main/contracts/ConvexStakingWrapper.sol#L93
https://github.com/code-423n4/2022-02-concur/blob/main/contracts/MasterChef.sol#L86
https://github.com/code-423n4/2022-02-concur/blob/main/contracts/MasterChef.sol#L127
state can be constant
These state variables can be constant
https://github.com/code-423n4/2022-02-concur/blob/main/contracts/MasterChef.sol#L50
https://github.com/code-423n4/2022-02-concur/blob/main/contracts/MasterChef.sol#L56
https://github.com/code-423n4/2022-02-concur/blob/main/contracts/MasterChef.sol#L57