-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Launchpad Contract for ERC-4337-Compatible Initialisation #182
Conversation
f70ea1b
to
682f849
Compare
Pull Request Test Coverage Report for Build 7114753184
💛 - Coveralls |
While I like the overall solution, in my opinion, this is a huge downside, in my experience, many projects care about deterministic addresses and the "deploy as you go" approach. Also, this prevents cross-chain replays because the hash includes the chain ID, and even without it, it may be tricky because of the fluctuations in gas parameters. |
I agree - I don't think this is a great approach (just wanted to create the PR for completeness/documentation purposes). In the context of ERC-4337 + WebAuthn signer deployment, I do much prefer #184. If you are OK with it, I will close this PR in favour of the latter. |
Yes I'm very ok with it :) |
Closing in favour of #184 |
Related to #149
ERC-4337 limits the op-codes that can be used in account creation with
initCode
andvalidateUserOp
. In particular, it limitsCREATE2
calls to only a single call that results in the user operations account. This is a problem if you want to account setup to deploy more than one contract.In particular this is interesting in the context of P-256 signature verification (elliptic curve used by Passkeys and WebAuthn). It is typically implemented as:
P256Signer
This means that, when deploying a Safe with a single P-256 signer that has never been used before, we would need the initialisation to deploy two contracts:
SafeProxy
for the new accountP256Signer
contract for the specified public keyERC-4337 does not allow this, even for staked factories (see #147). In order to work around this, we use a “deferred setup” strategy, where the init code deploys what we call a “launchpad” contract and is tied to specific
UserOperation
parameters, and the user operation execution does the actual setup:An E2E test was added to verify this strategy works with the reference bundler (and, to no surprise, it does).
Implementation Notes
The
_getInitHash
function is strange - but a work around to ensure that theinitHash
is not self-referential.Downsides
The way it was currently implemented the Safe’s address is tied to the first user operation that the Safe executes. This means that given an owner (for example a P-256 signer) there is no way of knowing what the final address of the Safe account will be as it depends on the user operation’s calldata, gas parameters, etc.