-
Notifications
You must be signed in to change notification settings - Fork 23
Add ERC-7579 Social Recovery Executor Module (In Progress) #85
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
gonzaotc
wants to merge
13
commits into
OpenZeppelin:master
Choose a base branch
from
gonzaotc:feature/SocialRecoveryExecutor
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 6 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b724786
chore: renamed private storage variable with underscore
gonzaotc d0ac19b
chore: fix typo in Account.behavior.js
gonzaotc 4eadc83
chore: limt comments
gonzaotc 9186146
chore: multiple improvements including signature binding and guardian…
gonzaotc 0aedfa2
Merge branch 'master' of github.com:gonzaotc/openzeppelin-community-c…
gonzaotc 6f7f60f
chore: improved signature validation algorithmic complexity
gonzaotc 943d665
chore: improve contract visibility & overridability, added SocialReco…
gonzaotc 3a9758f
chore: improvements: adjusted events indexation, removed unused impor…
gonzaotc 12b56c3
chore: improvements: inherited docs, added virtual for digest getters…
gonzaotc a9d8c3d
improvement: remove guardian != address(0) restriction
gonzaotc 0634c96
feat: add initial docs for module
gonzaotc 48e9bd8
chore: re added trailing white line in prepare-docs.sh
gonzaotc 0cfb1b3
chore: restore scripts permissions
gonzaotc 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
459 changes: 459 additions & 0 deletions
459
contracts/account/extensions/ERC7579Modules/SocialRecoveryExecutor.sol
Large diffs are not rendered by default.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
contracts/mocks/account/modules/ERC7579ReconfigurableValidatorMock.sol
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,54 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.20; | ||
|
||
import {IERC7579Validator, MODULE_TYPE_VALIDATOR} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol"; | ||
import {SignatureChecker} from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol"; | ||
import {ERC4337Utils} from "@openzeppelin/contracts/account/utils/draft-ERC4337Utils.sol"; | ||
import {PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol"; | ||
import {IERC7579Module} from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol"; | ||
import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol"; | ||
import {ERC7579ModuleMock} from "./ERC7579ModuleMock.sol"; | ||
|
||
abstract contract ERC7579ReconfigurableValidatorMock is ERC7579ModuleMock(MODULE_TYPE_VALIDATOR), IERC7579Validator { | ||
mapping(address sender => address signer) private _associatedSigners; | ||
|
||
function onInstall(bytes calldata data) public virtual override(IERC7579Module, ERC7579ModuleMock) { | ||
_associatedSigners[msg.sender] = address(bytes20(data[0:20])); | ||
super.onInstall(data); | ||
} | ||
|
||
function onUninstall(bytes calldata data) public virtual override(IERC7579Module, ERC7579ModuleMock) { | ||
delete _associatedSigners[msg.sender]; | ||
super.onUninstall(data); | ||
} | ||
|
||
function validateUserOp( | ||
PackedUserOperation calldata userOp, | ||
bytes32 userOpHash | ||
) public view virtual returns (uint256) { | ||
return | ||
SignatureChecker.isValidSignatureNow(_associatedSigners[msg.sender], userOpHash, userOp.signature) | ||
? ERC4337Utils.SIG_VALIDATION_SUCCESS | ||
: ERC4337Utils.SIG_VALIDATION_FAILED; | ||
} | ||
|
||
function isValidSignatureWithSender( | ||
address sender, | ||
bytes32 hash, | ||
bytes calldata signature | ||
) public view virtual returns (bytes4) { | ||
return | ||
SignatureChecker.isValidSignatureNow(_associatedSigners[sender], hash, signature) | ||
? IERC1271.isValidSignature.selector | ||
: bytes4(0xffffffff); | ||
} | ||
|
||
function changeSigner(address newSigner) external { | ||
_associatedSigners[msg.sender] = newSigner; | ||
} | ||
|
||
function getSigner(address sender) external view returns (address) { | ||
return _associatedSigners[sender]; | ||
} | ||
} |
Submodule @openzeppelin-contracts
updated
22 files
Submodule @openzeppelin-contracts-upgradeable
updated
20 files
Submodule forge-std
updated
2 files
+150 −0 | src/interfaces/IERC7540.sol | |
+241 −0 | src/interfaces/IERC7575.sol |
gonzaotc marked this conversation as resolved.
Show resolved
Hide resolved
|
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 |
---|---|---|
|
@@ -59,4 +59,4 @@ | |
"solhint" | ||
] | ||
} | ||
} | ||
} | ||
gonzaotc marked this conversation as resolved.
Show resolved
Hide resolved
|
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.
Uh oh!
There was an error while loading. Please reload this page.