code-423n4 / 2021-11-badgerzaps-findings

0 stars 0 forks source link

Gas optimization: Unreachable code in Zap.sol #77

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

gzeon

Vulnerability details

Impact

Detailed description of the impact of this finding.

Proof of Concept

https://github.com/Badger-Finance/ibbtc/blob/d8b95e8d145eb196ba20033267a9ba43a17be02c/contracts/Zap.sol

L111 and L234 are unreachable because pools is a Pool[4], any poolId > 3 would have been reverted in L102 and L225 respectively. We can even replace else if (poolId == 3) to else to save a little bit more gas.

GalloDaSballo commented 2 years ago

Agree with the finding but probably nofix as in the future we may add more pools