-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
further validation flow tests, add helper
- Loading branch information
Filipp Makarov
authored and
Filipp Makarov
committed
Oct 5, 2023
1 parent
6850c8f
commit acbe76e
Showing
5 changed files
with
385 additions
and
235 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; | |
* - It allows to _______________ | ||
* - ECDSA guardians only | ||
* - For security reasons guardian address is not stored, | ||
* instead its signature over CONTROL_HASH is used as | ||
* instead its signature over CONTROL_HASH is used as | ||
* | ||
* | ||
* @author Fil Makarov - <[email protected]> | ||
|
@@ -184,11 +184,12 @@ contract AccountRecoveryModule is BaseAuthorizationModule { | |
.recoveryThreshold; | ||
if (requiredSignatures == 0) | ||
revert ThresholdNotSetForSmartAccount(userOp.sender); | ||
|
||
(bytes memory signatures, ) = abi.decode( | ||
userOp.signature, | ||
(bytes, address) | ||
); | ||
if (signatures.length < requiredSignatures * 65) | ||
if (signatures.length < requiredSignatures * 2*65) | ||
revert InvalidSignaturesLength(); | ||
|
||
address lastGuardianAddress; | ||
|
@@ -218,8 +219,12 @@ contract AccountRecoveryModule is BaseAuthorizationModule { | |
return SIG_VALIDATION_FAILED; | ||
} | ||
|
||
validAfter = _guardians[keccak256(currentGuardianSig)][userOp.sender].validAfter; | ||
validUntil = _guardians[keccak256(currentGuardianSig)][userOp.sender].validUntil; | ||
validAfter = _guardians[keccak256(currentGuardianSig)][ | ||
userOp.sender | ||
].validAfter; | ||
validUntil = _guardians[keccak256(currentGuardianSig)][ | ||
userOp.sender | ||
].validUntil; | ||
|
||
// 0,0 means the `currentGuardian` has not been set as guardian for the userOp.sender smartAccount | ||
if (validUntil == 0 && validAfter == 0) { | ||
|
@@ -335,8 +340,7 @@ contract AccountRecoveryModule is BaseAuthorizationModule { | |
uint48 validUntil, | ||
uint48 validAfter | ||
) external { | ||
if (guardian == newGuardian) | ||
revert GuardiansAreIdentical(); | ||
if (guardian == newGuardian) revert GuardiansAreIdentical(); | ||
if (guardian == bytes32(0)) revert ZeroGuardian(); | ||
if (newGuardian == bytes32(0)) revert ZeroGuardian(); | ||
|
||
|
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
Oops, something went wrong.