safe-global / safe-smart-account

Safe allows secure management of blockchain assets.
https://safe.global
GNU Lesser General Public License v3.0
1.88k stars 927 forks source link

Using `returndatasize()` directly in assembly #734

Closed remedcu closed 8 months ago

remedcu commented 10 months ago

Description

Using returndatasize() directly instead of storing it in memory is ideal, as it requires only 2 gas to read, instead of doing an mstore and multiple mload's, each taking 3 gas for every use.

Currently, these contracts were found to use an intermediary variable:

mmv08 commented 10 months ago

Using returndatasize() directly instead of storing it in memory is ideal.

Nit: the issue should explain what + why, currently this only says what to do