Open code423n4 opened 3 years ago
Agree with finding, as per the yellowpaper the actual cost should be: 2900, as per EIP2200 the actual cost (since the value is the same) should be 800 https://ethereum.stackexchange.com/questions/90318/does-an-sstore-where-the-new-value-is-the-same-as-the-existing-value-cost-gas
Handle
kenzo
Vulnerability details
When declared, variables are already initialized to 0, so there is no need to do so explicitly.
Impact
Around 2000 gas for each variable.
Proof of Concept
ownerSplit in Factory: https://github.com/code-423n4/2021-09-defiProtocol/blob/52b74824c42acbcd64248f68c40128fe3a82caf6/contracts/contracts/Factory.sol#L21
Tools Used
Manual analysis
Recommended Mitigation Steps
Remove the redundant line.