OpenZeppelin / openzeppelin-contracts

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

Low level call and memory management #5091

Open Amxx opened 1 week ago

Amxx commented 1 week ago

Fixes #5013

PR Checklist

changeset-bot[bot] commented 1 week ago

⚠️ No Changeset found

Latest commit: 9ff7d4d97415a17ad8ffd57e181fc48ee4eba532

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Amxx commented 1 week ago

I tried using a library like this one https://github.com/eth-infinitism/account-abstraction/blob/develop/contracts/utils/Exec.sol. The result did not really look good to me. I found the use of assembly actually cleaner ... because we automatically copy X bytes of the returndata, without having to call an additional returndatacopy.

I found that the most valuable thing from the 4337 draft PR was the free memory management, to dealocate memory.