-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Add ERC7579 modules #5888
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
base: master
Are you sure you want to change the base?
Add ERC7579 modules #5888
Conversation
🦋 Changeset detectedLatest commit: 16e9e2c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Reviewer's GuideThis PR introduces the ERC-7579 framework by adding a core executor module with execute support, a delayed executor extension with scheduling/expiration, an abstract validator base plus a concrete ERC-7913 signature validator, and both basic and weighted multisig modules, together with mocks, comprehensive tests, updated enums, documentation entries, and changeset metadata. Sequence diagram for delayed operation scheduling and execution (ERC7579DelayedExecutor)sequenceDiagram
actor User
participant Account
participant ERC7579DelayedExecutor
User->>ERC7579DelayedExecutor: schedule(account, salt, mode, data)
ERC7579DelayedExecutor->>Account: validate schedule (custom logic)
ERC7579DelayedExecutor->>ERC7579DelayedExecutor: store Schedule
Note over ERC7579DelayedExecutor: Wait for delay period
User->>ERC7579DelayedExecutor: execute(account, salt, mode, executionCalldata)
ERC7579DelayedExecutor->>ERC7579DelayedExecutor: check operation state (Ready)
ERC7579DelayedExecutor->>Account: executeFromExecutor(mode, executionCalldata)
Sequence diagram for multisig validation during operation (ERC7579Multisig)sequenceDiagram
actor User
participant Account
participant ERC7579Multisig
User->>ERC7579Multisig: execute(account, salt, mode, data)
ERC7579Multisig->>ERC7579Multisig: decode signers and signatures
ERC7579Multisig->>ERC7579Multisig: validate threshold
ERC7579Multisig->>ERC7579Multisig: validate signatures
ERC7579Multisig->>Account: executeFromExecutor(mode, executionCalldata)
Class diagram for new and updated ERC7579 modulesclassDiagram
class ERC7579Executor {
+execute(account, salt, mode, data)
+isModuleType(moduleTypeId)
#_validateExecution(account, salt, mode, data)
#_execute(account, mode, salt, executionCalldata)
}
class ERC7579DelayedExecutor {
+schedule(account, salt, mode, data)
+cancel(account, salt, mode, data)
+setDelay(newDelay)
+setExpiration(newExpiration)
+onInstall(initData)
+onUninstall(data)
#_validateSchedule(account, salt, mode, data)
#_validateCancel(account, salt, mode, data)
#_setDelay(account, newDelay, minimumSetback)
#_setExpiration(account, newExpiration)
#_scheduleAt(account, salt, mode, executionCalldata, timepoint, delay)
#_execute(account, salt, mode, executionCalldata)
#_cancel(account, mode, executionCalldata, salt)
#_validateStateBitmap(operationId, allowedStates)
#_encodeStateBitmap(operationState)
+state(account, salt, mode, executionCalldata)
+getDelay(account)
+getExpiration(account)
+getSchedule(account, salt, mode, executionCalldata)
+hashOperation(account, salt, mode, executionCalldata)
}
class ERC7579Validator {
+isModuleType(moduleTypeId)
+validateUserOp(userOp, userOpHash)
+isValidSignatureWithSender(sender, hash, signature)
#_rawERC7579Validation(account, hash, signature)
}
class ERC7579Signature {
+signer(account)
+onInstall(data)
+onUninstall(data)
+setSigner(signer_)
#_setSigner(account, signer_)
#_rawERC7579Validation(account, hash, signature)
}
class ERC7579Multisig {
+onInstall(initData)
+onUninstall(data)
+getSigners(account, start, end)
+getSignerCount(account)
+isSigner(account, signer)
+threshold(account)
+addSigners(newSigners)
+removeSigners(oldSigners)
+setThreshold(newThreshold)
#_addSigners(account, newSigners)
#_removeSigners(account, oldSigners)
#_setThreshold(account, newThreshold)
#_validateReachableThreshold(account)
#_validateSignatures(account, hash, signingSigners, signatures)
#_validateThreshold(account, validatingSigners)
#_rawERC7579Validation(account, hash, signature)
}
class ERC7579MultisigWeighted {
+signerWeight(account, signer)
+totalWeight(account)
+setSignerWeights(signers, weights)
#_setSignerWeights(account, signers, weights)
#_addSigners(account, newSigners)
#_removeSigners(account, oldSigners)
#_validateReachableThreshold(account)
#_validateThreshold(account, validatingSigners)
}
ERC7579DelayedExecutor --|> ERC7579Executor
ERC7579Signature --|> ERC7579Validator
ERC7579Multisig --|> ERC7579Validator
ERC7579MultisigWeighted --|> ERC7579Multisig
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
We should create an issue that is tracking the progress of this migration, with subtasks for each module. Then we do multiple smaller PRs with 1 (or 2 in the case of ERC7579Multisig / ERC7579MultisigWeighted) module per PR. Big PRs like this are hard to review, and will last forever it we don't split them into small easily attainable tasks |
Yes that makes sense. I still think it helps opening the full PR to check the CI and plan how to tackle the migration while this PR gets progressively smaller |
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Follow up to #5890 and #5891
PR Checklist
npx changeset add
)Summary by Sourcery
Add a suite of ERC-7579 modules including basic and delayed executors, a validator abstraction with signature and multisig implementations (including weighted variants), along with mocks, tests, documentation updates, enum extensions, and changeset entries
New Features:
Enhancements:
Documentation:
Tests:
Chores: