Skip to content
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

Allow passing implementation address to factory #51

Closed
wants to merge 2 commits into from

Conversation

wilsoncusack
Copy link
Contributor

@wilsoncusack wilsoncusack commented Apr 10, 2024

A single factory with a frozen implementation address was chosen to

  1. Ensure users could get the same address across as many chains as possible
  2. Ensure users would opt into all upgrades and never be forced to upgrade via a factory on some chain having a new implementation.

However, the downside of our current approach is that totally new users in the future will create an account and then immediately need to call to upgrade their account to the last version. It would be better if new users could pass the implementation they want to use. They then would need to pass this same implementation on all future chains where they want the same address. This PR enables that.

Supersedes #50

@@ -46,12 +42,13 @@ contract CoinbaseSmartWalletFactory {
}

(bool alreadyDeployed, address accountAddress) =
LibClone.createDeterministicERC1967(msg.value, implementation, _getSalt(owners, nonce));
LibClone.createDeterministicERC1967(msg.value, emptyImplementation, _getSalt(owners, nonce, implementation));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's important for security that the original implementation address is in the hash. Otherwise anyone could deploy an account to your address with whatever implementation they want.

Currently this means that a users address across many chains always has to start at the same version in order to have the same address. And so the UX gain is mainly that new users can start at a certain version without needing to upgrade to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the whole EmptyUUPS is moot if we're doing this. May as well just pass implementation here

@wilsoncusack
Copy link
Contributor Author

Decided against this:

  • The EmptyUUPS is moot if we need implementation determining address for security
  • Users need to remember first implementation passed and pass again on every new chain to get same address. Easier to solve with factories.

Setland34 pushed a commit to Setland34/smart-wallet that referenced this pull request Feb 24, 2025
fix(factory): do not revert if account already exists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants