OpenZeppelin / openzeppelin-contracts

OpenZeppelin Contracts is a library for secure smart contract development.
https://openzeppelin.com/contracts
MIT License
24.48k stars 11.7k forks source link

Low level call library #5013

Open Amxx opened 2 months ago

Amxx commented 2 months ago

🧐 Motivation this library provides a solidity level interface to execute calls/staticcalls/delegate call without automatically dupping all the return data to memory. This makes it return-bomb safe.

We should build a similar library an use it in places such as the Forwarder.

ernestognw commented 1 month ago

@cairoeth brought up the idea of whether to add this functions as part of the Address. I see it could benefit discoverability since it would be easier for users already depending on this library to find out they have a version that ignores returndata available.

I think it's a good idea to consider but perhaps Address is already a weird name for developers looking for ways to perform variants of EVM calls.

Amxx commented 1 month ago

For the record, there is a "prototype" for this library in #4991 https://github.com/OpenZeppelin/openzeppelin-contracts/blob/fbf4ca5d17555cd2021b6e99717caa5ea5a4f835/contracts/utils/Call.sol

Amxx commented 1 month ago

As mentionned on slack, we should focus on avoiding any possible mistake between the current functions in Address.sol, and the "unsafe" ones proposed here. That can be using a separate library (my preference right now), or through proper naming.

We have to make sure mistakes are as unlkikelly to happen as possible.