code-423n4 / 2022-01-yield-findings

1 stars 0 forks source link

Gas (unrecommended): Mark functions as payable to save gas #77

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

Dravee

Vulnerability details

Note: While this is a fact that can be brought to the sponsor's attention for him to make his own choice (and this can save several hundreds of gas in this solution), I would not recommend it, as it could bring new security issues.

Functions marked as payable are 24 gas cheaper than their counterpart (in non-payable functions, Solidity adds an extra check to ensure msg.value is zero).

devtooligan commented 2 years ago

bwahaha, good one

https://github.com/code-423n4/2022-01-yield#intentional-deviations-from-commonly-cited-best-practices

Screen Shot 2022-01-31 at 7 30 55 AM

GalloDaSballo commented 2 years ago

Technically applying the improvement on all functions would save more than 100 gas.

That said I wouldn't mind a nofix.