-
Notifications
You must be signed in to change notification settings - Fork 25
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
[3/n] Enable validation composability and add composable single singer validation and tests #96
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d22bec9
add ecdsa validation
fangting-alchemy 03f9cf3
update ecdsa validation and add more test
fangting-alchemy 7488ffd
add account as passed in param in validate runtime
fangting-alchemy 6fb6dee
add account as param in validateSignature method and add 1271 support…
fangting-alchemy 7685790
rename ecdsa to SingleSigner
fangting-alchemy d66b6b8
rename validationId in SingleSignerValidation to entityId
fangting-alchemy dc9ed79
[4/n] validation series - delete SingleOwnerPlugin (#97)
fangting-alchemy 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 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 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 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 |
---|---|---|
|
@@ -18,13 +18,15 @@ interface IValidation is IPlugin { | |
|
||
/// @notice Run the runtime validationFunction specified by the `entityId`. | ||
/// @dev To indicate the entire call should revert, the function MUST revert. | ||
/// @param account the account to validate for. | ||
/// @param entityId An identifier that routes the call to different internal implementations, should there | ||
/// be more than one. | ||
/// @param sender The caller address. | ||
/// @param value The call value. | ||
/// @param data The calldata sent. | ||
/// @param authorization Additional data for the validation function to use. | ||
function validateRuntime( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for updating these other two validation functions - with this, we should have full composability across all of the different types of validation functions. |
||
address account, | ||
uint32 entityId, | ||
address sender, | ||
uint256 value, | ||
|
@@ -34,14 +36,18 @@ interface IValidation is IPlugin { | |
|
||
/// @notice Validates a signature using ERC-1271. | ||
/// @dev To indicate the entire call should revert, the function MUST revert. | ||
/// @param account the account to validate for. | ||
/// @param entityId An identifier that routes the call to different internal implementations, should there | ||
/// be more than one. | ||
/// @param sender the address that sent the ERC-1271 request to the smart account | ||
/// @param hash the hash of the ERC-1271 request | ||
/// @param signature the signature of the ERC-1271 request | ||
/// @return the ERC-1271 `MAGIC_VALUE` if the signature is valid, or 0xFFFFFFFF if invalid. | ||
function validateSignature(uint32 entityId, address sender, bytes32 hash, bytes calldata signature) | ||
external | ||
view | ||
returns (bytes4); | ||
function validateSignature( | ||
address account, | ||
uint32 entityId, | ||
address sender, | ||
bytes32 hash, | ||
bytes calldata signature | ||
) external view returns (bytes4); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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,28 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity ^0.8.25; | ||
|
||
import {IValidation} from "../../interfaces/IValidation.sol"; | ||
|
||
interface ISingleSignerValidation is IValidation { | ||
/// @notice This event is emitted when Signer of the account's validation changes. | ||
/// @param account The account whose validation Signer changed. | ||
/// @param entityId The entityId for the account and the signer. | ||
/// @param previousSigner The address of the previous signer. | ||
/// @param newSigner The address of the new signer. | ||
event SignerTransferred( | ||
address indexed account, uint32 indexed entityId, address previousSigner, address newSigner | ||
); | ||
|
||
error NotAuthorized(); | ||
|
||
/// @notice Transfer Signer of the account's validation to `newSigner`. | ||
/// @param entityId The entityId for the account and the signer. | ||
/// @param newSigner The address of the new signer. | ||
function transferSigner(uint32 entityId, address newSigner) external; | ||
|
||
/// @notice Get the signer of the `account`'s validation. | ||
/// @param entityId The entityId for the account and the signer. | ||
/// @param account The account to get the signer of. | ||
/// @return The address of the signer. | ||
function signerOf(uint32 entityId, address account) external view returns (address); | ||
} |
Oops, something went wrong.
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.
not sure if this should be addressed in this PR, but if the return values are
_1271_MAGIC_VALUE
or_1271_INVALID
, would prefer to just remove the if/else part and doreturn IValidation(plugin).validateSignature(address(this), entityId, msg.sender, hash, signature[24:])
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.
I think it's preferable to do the equivalence check before returning, because then we can absorb any bad values that are valid
bytes4
types but aren't_1271_MAGIC_VALUE
or_1271_INVALID
.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.
mmm from the spec, returning anything thats not
_1271_MAGIC_VALUE
should be considered invalid. Don't feel super strongly about this, just a LOC reduction maxi