-
Notifications
You must be signed in to change notification settings - Fork 0
EIP 7702
support
#8
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
Open
cryptonoyaiba
wants to merge
12
commits into
master
Choose a base branch
from
`EIP-7702`
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
85d9aea
`ResourceLockValidator` test cleanup and integration of Soldeer
cryptonoyaiba 5572901
Merge branch 'master' into `ResourceLockValidator`
cryptonoyaiba 691f28f
Merge remote-tracking branch 'origin/master' into `ResourceLockValida…
cryptonoyaiba 8608a80
Fix deploy script and configs
cryptonoyaiba bc6282b
`EIP-7702` support
cryptonoyaiba 8994b54
Update ModularEtherspotWalletEIP7702.t.sol
cryptonoyaiba f3f0f80
Update `_isEIP7702Account` and test
cryptonoyaiba d2dad60
Create .gas-snapshot
cryptonoyaiba 72c7866
Fix EntryPoint dependency issue
cryptonoyaiba 7282475
Updated ResourceLockValidator with nonce management
cryptonoyaiba 392a0b6
Added nonce validation
cryptonoyaiba d08be4b
`ResourceLockValidator` proof unpacking fix
cryptonoyaiba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,5 +19,5 @@ out/ | |
lcov.info | ||
coverage/ | ||
|
||
# Node | ||
node_modules/ | ||
# Soldeer | ||
/dependencies |
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# Resource Lock Validator | ||
|
||
The ResourceLockValidator is a validator module for ERC-7579 smart accounts that enables secure session key management through resource locking mechanisms and merkle proofs. | ||
|
||
## Overview | ||
|
||
This validator implements signature verification for both direct ECDSA signatures and merkle proof-based validations. It supports standard ethereum signatures as well as merkle proof verification for batched resource lock authorizations. | ||
|
||
## Key Features | ||
|
||
- ECDSA signature validation | ||
- Merkle proof verification | ||
- Resource lock management | ||
- ERC-1271 compatible signature verification | ||
- Support for both direct and eth-signed message recovery | ||
|
||
## Contract Methods | ||
|
||
### Installation Methods | ||
|
||
#### `onInstall(bytes calldata _data)` | ||
|
||
Installs the validator for a smart account, setting the owner from the provided data. | ||
|
||
- Reverts if already installed | ||
- Emits `RLV_ValidatorEnabled` event | ||
|
||
#### `onUninstall(bytes calldata)` | ||
|
||
Removes the validator from a smart account. | ||
|
||
- Reverts if not installed | ||
- Emits `RLV_ValidatorDisabled` event | ||
|
||
### Validation Methods | ||
|
||
#### `validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)` | ||
|
||
Validates user operations through either direct signatures or merkle proofs. | ||
|
||
- Returns validation success/failure status | ||
- Handles both standard 65-byte signatures and merkle proof packed signatures | ||
|
||
#### `isValidSignatureWithSender(address sender, bytes32 hash, bytes calldata signature)` | ||
|
||
ERC-1271 compatible signature verification method. | ||
|
||
- Returns ERC-1271 magic value for valid signatures | ||
- Supports both direct signatures and merkle proof verification | ||
|
||
### Utility Methods | ||
|
||
#### `isModuleType(uint256 typeID)` | ||
|
||
Checks if the module is a validator type. | ||
|
||
#### `isInitialized(address smartAccount)` | ||
|
||
Checks if the validator is initialized for a given smart account. | ||
|
||
## Resource Lock Structure | ||
|
||
Resource locks contain the following parameters: | ||
|
||
- Chain ID | ||
- Smart wallet address | ||
- Session key address | ||
- Valid after timestamp | ||
- Valid until timestamp | ||
- Token data array | ||
- Nonce | ||
|
||
## Token Data Structure | ||
|
||
Each token data entry contains: | ||
|
||
- Token address | ||
- Amount | ||
|
||
## Events | ||
|
||
- `RLV_ValidatorEnabled(address smartAccount, address owner)` | ||
- `RLV_ValidatorDisabled(address smartAccount)` | ||
|
||
## Error Conditions | ||
|
||
- `RLV_AlreadyInstalled`: Validator already installed for account | ||
- `RLV_NotInstalled`: Validator not installed for account | ||
- `RLV_ResourceLockHashNotInProof`: Resource lock hash not found in merkle proof | ||
- `RLV_OnlyCallTypeSingle`: Only single call type operations supported | ||
|
||
## Security Considerations | ||
|
||
- Merkle proofs must be properly validated | ||
- Signature recovery includes both standard and eth-signed message formats | ||
- Resource lock parameters should be carefully validated | ||
- Nonce management is critical for replay protection | ||
|
||
## Integration Guide | ||
|
||
1. Install validator on smart account | ||
2. Generate resource lock with desired parameters | ||
3. Create merkle tree if batching multiple locks | ||
4. Sign either directly or through merkle root | ||
5. Submit user operation with appropriate signature format | ||
|
||
## Dependencies | ||
|
||
- Solady ECDSA | ||
- Solady MerkleProofLib |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,44 @@ | ||
[profile.default] | ||
src = "src" | ||
out = "out" | ||
libs = ["lib"] | ||
libs = ["dependencies"] | ||
bytecodeHash = "none" | ||
cbor_metadata = false | ||
solc_version = '0.8.23' | ||
evm_version = "london" | ||
evm_version = "cancun" | ||
optimizer = true | ||
runs = 1000 | ||
gas_reports = [ | ||
"ModularEtherspotWallet", | ||
"ModularEtherspotWalletFactory", | ||
"MultipleOwnerECDSAValidator", | ||
"ERC20SessionKeyValidator", | ||
"ModuleIsolationHook", | ||
"SessionKeyValidator", | ||
runs = 256 | ||
gas_reports = ["*"] | ||
|
||
remappings = [ | ||
"@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-5.2.0/", | ||
"ERC4337/=dependencies/eth-infinitism-account-abstraction-0.7/contracts/", | ||
"ERC7579/=src/ERC7579/", | ||
"excessively-safe-call/=dependencies/excessively-safe-call-1.0.0/", | ||
"forge-std/=dependencies/forge-std-1.9.6/src/", | ||
"solady/=dependencies/solady-0.1.8/", | ||
"solarray/=dependencies/solarray-0.1/src/", | ||
] | ||
auto_detect_remappings = false | ||
|
||
[fuzz] | ||
runs = 256 | ||
via_ir = true | ||
|
||
[soldeer] | ||
remappings_generate = false | ||
remappings_regenerate = false | ||
remappings_version = false | ||
remappings_location = "txt" | ||
remappings_prefix = "" | ||
recursive_deps = true | ||
|
||
[dependencies] | ||
solady = "0.1.8" | ||
"@openzeppelin-contracts" = "5.2.0" | ||
eth-infinitism-account-abstraction = "0.7" | ||
forge-std = "1.9.6" | ||
solarray = { version = "0.1", git = "[email protected]:evmcheb/solarray.git", rev = "a547630f9bf7837af9e6919d217672afe7abf7f1" } | ||
excessively-safe-call = { version = "1.0.0", git = "https://github.com/nomad-xyz/ExcessivelySafeCall.git", rev = "81cd99ce3e69117d665d7601c330ea03b97acce0" } | ||
|
||
[rpc_endpoints] | ||
# mainnets | ||
|
Submodule account-abstraction
deleted from
7af70c
Submodule forge-std
deleted from
bf909b
Submodule openzeppelin-contracts
deleted from
f42376
Submodule solady
deleted from
be154c
Submodule solarray
deleted from
a54763
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.27; | ||
|
||
import "forge-std/Script.sol"; | ||
import {console2} from "forge-std/console2.sol"; | ||
import {IERC7484} from "../src/interfaces/ercs/IERC7484.sol"; | ||
import {HookMultiPlexer} from "../src/modules/hooks/HookMultiPlexer.sol"; | ||
import {CredibleAccountValidator} from "../src/modules/validators/CredibleAccountValidator.sol"; | ||
import {CredibleAccountHook} from "../src/modules/hooks/CredibleAccountHook.sol"; | ||
|
||
contract CredibleAccountSetupScript is Script { | ||
bytes32 public immutable SALT = bytes32(abi.encodePacked("ModularEtherspotWallet:Create2:salt")); | ||
address public constant DEPLOYER = 0x09FD4F6088f2025427AB1e89257A44747081Ed59; | ||
address public constant ERC7484_REGISTRY_ADDRESS = 0x000000000069E2a187AEFFb852bF3cCdC95151B2; // on Sepolia | ||
address public constant EXPECTED_MULTIPLEXER_ADDRESS = 0x0000000000000000000000000000000000000000; | ||
address public constant EXPECTED_VALIDATOR_ADDRESS = 0x0000000000000000000000000000000000000000; | ||
address public constant EXPECTED_HOOK_ADDRESS = 0x0000000000000000000000000000000000000000; | ||
|
||
function run() external { | ||
IERC7484 erc7484Registry = IERC7484(ERC7484_REGISTRY_ADDRESS); | ||
HookMultiPlexer hookMultiPlexer; | ||
CredibleAccountValidator credibleAccountValidator; | ||
CredibleAccountHook credibleAccountHook; | ||
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY"); | ||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
/*////////////////////////////////////////////////////////////// | ||
Starting Deployment | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
console2.log("Starting deployment sequence..."); | ||
|
||
/*////////////////////////////////////////////////////////////// | ||
Deploy HookMultiPlexer | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
console2.log("Deploying HookMultiPlexer..."); | ||
// if (EXPECTED_MULTIPLEXER_ADDRESS.code.length == 0) { | ||
hookMultiPlexer = new HookMultiPlexer{salt: SALT}(); | ||
// if (address(hookMultiPlexer) != EXPECTED_MULTIPLEXER_ADDRESS) { | ||
// revert("Unexpected HookMultiPlexer address!!!"); | ||
// } else { | ||
console2.log("HookMultiPlexer deployed at address", address(hookMultiPlexer)); | ||
// } | ||
// } else { | ||
// console2.log("HookMultiPlexer already deployed at address", EXPECTED_MULTIPLEXER_ADDRESS); | ||
// } | ||
|
||
/*////////////////////////////////////////////////////////////// | ||
Deploy CredibleAccountValidator | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
console2.log("Deploying CredibleAccountValidator..."); | ||
// if (EXPECTED_VALIDATOR_ADDRESS.code.length == 0) { | ||
credibleAccountValidator = new CredibleAccountValidator{salt: SALT}(DEPLOYER, hookMultiPlexer); | ||
// if (address(credibleAccountValidator) != EXPECTED_VALIDATOR_ADDRESS) { | ||
// revert("Unexpected CredibleAccountValidator address!!!"); | ||
// } else { | ||
console2.log("CredibleAccountValidator deployed at address", address(credibleAccountValidator)); | ||
// } | ||
// } else { | ||
// console2.log("CredibleAccountValidator already deployed at address", EXPECTED_VALIDATOR_ADDRESS); | ||
// } | ||
|
||
/*////////////////////////////////////////////////////////////// | ||
Deploy CredibleAccountHook | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
console2.log("Deploying CredibleAccountHook..."); | ||
// if (EXPECTED_HOOK_ADDRESS.code.length == 0) { | ||
credibleAccountHook = new CredibleAccountHook{salt: SALT}(credibleAccountValidator); | ||
// if (address(credibleAccountHook) != EXPECTED_HOOK_ADDRESS) { | ||
// revert("Unexpected CredibleAccountHook address!!!"); | ||
// } else { | ||
console2.log("CredibleAccountHook deployed at address", address(credibleAccountHook)); | ||
// } | ||
// } else { | ||
// console2.log("CredibleAccountHook already deployed at address", EXPECTED_HOOK_ADDRESS); | ||
// } | ||
|
||
/*////////////////////////////////////////////////////////////// | ||
Initialization of CredibleAccountValidator | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
console2.log("Initializing CredibleAccountValidator..."); | ||
credibleAccountValidator.initialize(credibleAccountHook); | ||
console2.log( | ||
"CredibleAccountValidator initialized?", | ||
address(credibleAccountValidator.caHook()) == address(credibleAccountHook) | ||
); | ||
|
||
/*////////////////////////////////////////////////////////////// | ||
Finishing Deployment | ||
//////////////////////////////////////////////////////////////*/ | ||
console2.log("Finished deployment sequence!"); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
HookMultiPlexer deployment with commented-out validation.
The deployment logic works, but the address validation is commented out. This might be intentional for development but should be addressed before production use.
If this script is intended for production deployment, consider uncommenting and implementing the address validation logic, or explicitly documenting why the validation is disabled.
🏁 Script executed:
Length of output: 141
Action Required: Address Commented-out Address Validation in Production Deployment Script
The grep results confirm that the
CredibleAccountScript.s.sol
file is used in production (it referencesCredibleAccountSetupScript
), so leaving the address validation commented out poses a risk. Please either:HookMultiPlexer
address matches the expected value.Affected Location:
script/CredibleAccountScript.s.sol
, Lines: 31-47