Skip to content

Conversation

@ernestognw
Copy link
Member

@ernestognw ernestognw commented May 2, 2025

Moves the community contracts account abstraction framework to this repository.
Check #5664 before

It just moves files from community contracts. To review, it's enough if you go over files and check whether there are differences from the community repository

PR Checklist

  • Tests
  • Documentation
  • Changeset entry (run npx changeset add)

@changeset-bot
Copy link

changeset-bot bot commented May 2, 2025

🦋 Changeset detected

Latest commit: 8fa6fd9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openzeppelin-solidity Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ernestognw ernestognw marked this pull request as ready for review May 3, 2025 07:06
@ernestognw ernestognw requested review from arr00, gonzaotc and luiz-lvj May 6, 2025 19:22
Comment on lines +342 to +343
+ name: '', // Not initialized in the context of signer
+ version: '', // Not initialized in the context of signer
Copy link
Member Author

Choose a reason for hiding this comment

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

As part of the upgradeable transpilation pipeline, we generate the upgradeable versions and the run tests against them. However, ERC-7702 accounts will delegate to an EIP-712 (through ERC7739) contract, so the domain separator will be rebuilt each time without the name or version set in the EOA's storage.

In practice, if users are delegating to an upgradeable contract, it should be a proxy pointing to an implementation that uses the EIP712Upgradeable version so that the domain can be initialized (and reinitialized) properly.

Copy link
Collaborator

@Amxx Amxx Jun 2, 2025

Choose a reason for hiding this comment

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

In practice, if users are delegating to an upgradeable contract, it should be a proxy pointing to an implementation that uses the EIP712Upgradeable version so that the domain can be initialized (and reinitialized) properly.

I don't get that part. If an EOA delegates to a proxy, stuff will just not work. The proxy logic will be applied, and it will try to read from the EOA storage. That is true of the name and version ... but actually it is also true of the implementation address, which is likelly not set at all.

The proxy initialization of the implementation is on the proxy's storage, so its not visible from the EOA doing the delgation.

My understanding is that 7702 should never target proxies, and it should also NOT be used with EIP712Upgradeable

Copy link
Member Author

@ernestognw ernestognw Jun 2, 2025

Choose a reason for hiding this comment

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

I don't get that part. If an EOA delegates to a proxy, stuff will just not work.

You literally just described how not to use a proxy, but nothing to do with an EOA in particular. An ERC-4337 upgradeable account would be deployed by a proxy factory and set its own implementation address in storage as a proxy would do, and a delegated EOA can delegate to a proxy too. I understand it'd be more desirable to delegate with 7702 to a new implementation, but the implementations must be upgradeable variants (e.g. stateless or with initializers).

My understanding is that 7702 should never target proxies,

This is a strong statement. A 7702 account could decide to manage itself as a proxy if the developer wants to. Remember users aren't always supposed to pick their accounts, so I see valid reasons to use a proxy if you're a developer and you want a managed upgrading experience

... and it should also NOT be used with EIP712Upgradeable

There's an important difference here, either you want your 7702 account to use the implementation's domain separator or the account's own domain separator. I would argue it should be the account's own domain and therefore they should delegate to an EIP712Upgradeable contract. (Both are fine btw)

@ernestognw ernestognw merged commit 83d2a24 into OpenZeppelin:master Jun 2, 2025
23 checks passed
Copy link

@mohdjuhawieshah mohdjuhawieshah left a comment

Choose a reason for hiding this comment

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

Mantap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants