code-423n4 / 2021-10-covalent-findings

0 stars 0 forks source link

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

Closed code423n4 closed 3 years ago

code423n4 commented 3 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:

kitti-katy commented 3 years ago

duplicate of #2

GalloDaSballo commented 3 years ago

Duplicate of #2