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

0 stars 0 forks source link

Changing function visibility from public to external can save gas #266

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

WatchPug

Vulnerability details

For public functions, the input parameters are copied to memory automatically which costs gas. If a function is only called externally, making its visibility as external will save gas because external functions’ parameters are not copied into memory and are instead read from calldata directly.

For example:

0xean commented 2 years ago

dupe of #260