You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
setupModules makes a call to gasLeft() that is invalid in the ERC-4337 protocol during validation. To make use of the ERC-4337 factory pattern, the factory must adhere to the validation rules. Thus, the factory cannot call setupModules with a to address to setup its modules.
It seems like the gasLeft() could either be replaced with type(uint256).max (like is done in the same file) or, gasLeft() can be pushed down such that the GAS opcode occurs before CALL or DELEGATECALL which is valid in ERC-4337.
Context / issue
setupModules
makes a call togasLeft()
that is invalid in the ERC-4337 protocol during validation. To make use of the ERC-4337 factory pattern, the factory must adhere to the validation rules. Thus, the factory cannot callsetupModules
with ato
address to setup its modules.https://github.com/safe-global/safe-contracts/blob/ad9b3190d4889abeeaa02c5c05138d9c327f2460/contracts/base/ModuleManager.sol#L38
https://eips.ethereum.org/EIPS/eip-4337#specification-1
An example factory that uses this pattern and is currently invalid:
https://github.com/eth-infinitism/account-abstraction/blob/abff2aca61a8f0934e533d0d352978055fddbd96/contracts/samples/gnosis/GnosisAccountFactory.sol#L42
Proposed solution
It seems like the
gasLeft()
could either be replaced withtype(uint256).max
(like is done in the same file) or,gasLeft()
can be pushed down such that theGAS
opcode occurs beforeCALL
orDELEGATECALL
which is valid in ERC-4337.Could push the call down here: https://github.com/safe-global/safe-contracts/blob/ad9b3190d4889abeeaa02c5c05138d9c327f2460/contracts/base/Executor.sol#L31
The text was updated successfully, but these errors were encountered: