Closed jaydenwindle closed 1 year ago
After further exploration, I don't plan to move forward with this approach. This approach works when the caller of the registry is the authenticated user, but fails if there is an intermediary contract which calls the registry (such as the ERC-4337 entry point contract), since msg.sender
will be the contract and not the caller.
Using tx.origin
for authentication is insufficient here as well, as it cannot authenticate smart contract callers.
To enable authenticated initialization of ERC-6551 accounts, implementations are encouraged to accept a signature argument to their initialization function, allowing the validity of the initialization to be verified.
This PR modifies the ERC-6551 Registry contract to append
msg.sender
toinitData
prior to calling into to the created account contract. It also changes the error handling logic to bubble up any revert messages from the account contract rather than reverting with a custom error. Finally, it adds an example account implementation showing how to permit initialization only by the current token holder.These changes allow account implementations that wish to authenticate callers from within the account's initialization function to do so using an ERC-2771 style
_msgSender()
check.