code-423n4 / 2022-08-foundation-findings

0 stars 0 forks source link

Gas Optimizations #256

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

See the markdown file with the details of this report here.

HardlyDifficult commented 2 years ago

++i costs less than i++

Agree and will fix.

unchecked loop in getFeesAndRecipients

getFeesAndRecipients is a read only function not intended to be used on-chain, but as a best practice we will add unchecked there as well.

Cache Array Length Outside of Loop

May be theoretically valid, but won't fix. I tested this: gas-reporter and our gas-stories suite is reporting a small regression using this technique. It also hurts readability a bit so we wouldn't want to include it unless it was a clear win.

L445 Consider evaluating the cheaper condition first

Fair point, will consider this.