code-423n4 / 2021-12-defiprotocol-findings

0 stars 0 forks source link

A more efficient for loop index proceeding #125

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

Jujic

Vulnerability details

Impact

Here you could use unchecked{++i} to save gas since it is more efficient then i++.

Proof of Concept

https://github.com/code-423n4/2021-12-defiprotocol/blob/205d3766044171e325df6a8bf2e79b37856eece1/contracts/contracts/Basket.sol#L289

https://github.com/code-423n4/2021-12-defiprotocol/blob/205d3766044171e325df6a8bf2e79b37856eece1/contracts/contracts/Basket.sol#L282

https://github.com/code-423n4/2021-12-defiprotocol/blob/205d3766044171e325df6a8bf2e79b37856eece1/contracts/contracts/Basket.sol#L275

Tools Used

Recommended Mitigation Steps

0xleastwood commented 2 years ago

Duplicate of #120