feat: implement ERC-7821 minimal batch executor interface#360
Closed
dancoombs wants to merge 1 commit into
Closed
Conversation
Adds native ERC-7821 support to the modular account for EIP-7702 compatibility. This must be a native function (not a module) to properly enforce validation and hooks for limited keys. - Add IERC7821 interface with execute(bytes32,bytes) and supportsExecutionMode(bytes32) - Implement in ModularAccountBase with wrapNativeFunction for full validation/hook enforcement - Support mode 1 (batch) and mode 2 (batch with optional opData) - Handle address(0) → address(this) target replacement per spec - Register in supportsInterface and native function checks - Disambiguate execute overload references in tests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Contract sizes: | Contract | Runtime Size (B) | Initcode Size (B) | Runtime Margin (B) | Initcode Margin (B) |
|------------------------------|------------------|-------------------|--------------------|---------------------|
| AccountFactory | 6,604 | 7,161 | 17,972 | 41,991 |
| Address | 16 | 44 | 24,560 | 49,108 |
| AllowlistModule | 10,148 | 10,174 | 14,428 | 38,978 |
| Base64 | 16 | 44 | 24,560 | 49,108 |
| Create2 | 16 | 44 | 24,560 | 49,108 |
| ECDSA | 16 | 44 | 24,560 | 49,108 |
| ERC165Checker | 16 | 44 | 24,560 | 49,108 |
| ERC1967Utils | 16 | 44 | 24,560 | 49,108 |
| ExecutionInstallDelegate | 5,835 | 5,880 | 18,741 | 43,272 |
| FCL_Elliptic_ZZ | 16 | 44 | 24,560 | 49,108 |
| FCL_ecdsa | 16 | 44 | 24,560 | 49,108 |
| Math | 16 | 44 | 24,560 | 49,108 |
| MessageHashUtils | 16 | 44 | 24,560 | 49,108 |
-| ModularAccount | 22,935 | 23,323 | 1,641 | 25,829 |
+| ModularAccount | 23,744 | 24,132 | 832 | 25,020 |
| NativeTokenLimitModule | 4,917 | 4,943 | 19,659 | 44,209 |
| PaymasterGuardModule | 2,028 | 2,054 | 22,548 | 47,098 |
| SafeERC20 | 16 | 44 | 24,560 | 49,108 |
-| SemiModularAccount7702 | 23,336 | 23,717 | 1,240 | 25,435 |
-| SemiModularAccountBytecode | 23,812 | 24,200 | 764 | 24,952 |
+| SemiModularAccount7702 | 24,114 | 24,495 | 462 | 24,657 |
+| SemiModularAccountBytecode | 24,590 | 24,978 | -14 | 24,174 |
| SignatureChecker | 16 | 44 | 24,560 | 49,108 |
| SignedMath | 16 | 44 | 24,560 | 49,108 |
| SingleSignerValidationModule | 3,853 | 3,879 | 20,723 | 45,273 |
| StorageSlot | 16 | 44 | 24,560 | 49,108 |
| Strings | 16 | 44 | 24,560 | 49,108 |
| TimeRangeModule | 2,435 | 2,461 | 22,141 | 46,691 |
| WebAuthn | 16 | 44 | 24,560 | 49,108 |
| WebAuthnValidationModule | 9,277 | 9,303 | 15,299 | 39,849 |Code coverage:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
execute(bytes32,bytes)+supportsExecutionMode) toModularAccountBasefor EIP-7702 compatibilitywrapNativeFunctionto enforce validation/hooks for limited keys — cannot be a module due to security concerns with self-call permission enforcementaddress(0)→address(this)target replacement per specexecuteoverload references across test files (ModularAccountBase.execute→IModularAccount.execute)Test plan
ERC7821.t.solcovering both modes, UserOp + runtime paths, address(0) replacement, reverts, empty batches, andsupportsInterface/supportsExecutionModeforge fmtclean🤖 Generated with Claude Code