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

prototype for a generic ERC7579 recovery module #75

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

0xnonso
Copy link

@0xnonso 0xnonso commented Jan 6, 2025

see #66

Approach

This prototype preserves the initial flow of the recovery module with some modifications.
In order to make the recovery module more generic for multiple guardian types, this prototype separates the guardian verification mechanism from the recovery module contract which makes the core recovery module much more simpler. This separation allows for greater flexibility in supporting different kinds of guardians. For example, a user could choose to use a P-256 public key as a guardian, an EOA etc.

Smart contract changes

  • The guardian type is changed to bytes to support multiple types using abi.encode(...).
  • The guardian is not stored directly; instead, it is hashed and then stored in an enumerable map.
  • Mapping which stores whether the guardian verifier is supported by an account.
  • Mapping of the guardian identifier for an account to its guardian verifier.

Some example verifiers where created, such as EmailGuardianVerifier.sol and EDCSAGuardianVerifier.sol to demonstrate what the interface for guardian verifiers would look like (EmailGuardianVerifier.sol has not been tested; it is included only to illustrate how it could be implemented as a separate verifier).

Testing

The prototype tests demonstrate a happy path for recovering a validator using a direct EOA (msg.sender), ECDSA signatures, and a combination of both.
to run tests: forge test --match-path 'test/prototype/**/*.t.sol'

all changes can be found in src/prototype/* and test/prototype/*

Copy link

prototype for a generic ERC7579 recovery module

Generated at commit: 576b41ee8b5acd67bdf87ed100ad464b9a904ca9

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
0
1
0
4
24
29
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant