-
Notifications
You must be signed in to change notification settings - Fork 281
Description
Context / issue
This is in between a feature request and a bug report.
When using a Safe with a passkey signer by calling Safe4337Pack.init, the Safe4337Pack.#SAFE_WEBAUTHN_SHARED_SIGNER_ADDRESS property does not get initialized unless using a predicted safe configuration. Which means that when we are inputting options.safeAddress (for a deployed Safe), Safe4337Pack methods that need the WebAuthn signer address will behave unexpectedly.
For instance, Safe4337Pack.getEstimateFee ends up calling getDummySignature with a zero address, which makes the bundler fail its user operation estimation (in the case of Pimlico this means returning revert AA33).
| signature: getDummySignature(this.#SAFE_WEBAUTHN_SHARED_SIGNER_ADDRESS, threshold) |
Proposed solution
There are already two ways for the user to avoid this bug:
- initializing
Safe4337Packusing a predicted safe config (removingsafeAddressfromoptions, making this block runsafeWebAuthnSharedSignerAddress = - initializing
Safe4337Packwith the WebAuthn signer address incustomContracts.safeWebAuthnSharedSignerAddress
But they are not obvious and could have their place in the Safe4337Pack docs, maybe under "customContracts" which doesn't say that you can override safeWebAuthnSharedSignerAddress.
Or it could be fixed in the SDK by also checking in this if block if the signer is a passkey (and go fetch the right signer address) in the same way it checks for it in the else block.
Steps to reproduce
- Deploy a Safe with a passkey signer
- Initialize
Safe4337Packwith asafeAddressand without overridingcustomContracts - Test a transaction with the Pimlico bundler/paymaster
- Pimlico should return
revert AA33because the initial gas estimation (using a wronggetDummySignature) lacks one signature verification, and so it underestimates the realverificationGasLimitneeded
Additional context
I can make a PR that checks for a passkey signer in the if ('safeAddress' in options) block, but I don't know if there was a particular reason why it wasn't added. I tried making a transaction with a deployed Safe config and passkey signer (by having updated customContracts) and it worked, so I'm assuming it's fine.