Skip to content

Commit 8f70c58

Browse files
authored
fix: weigthed ecdsa validator (#90)
* fix: avoid infinite loop on renew * fix: set max address as first guardian when renew * fix: update code for dummy signature issue
1 parent 3118026 commit 8f70c58

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/validator/WeightedECDSAValidator.sol

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ contract WeightedECDSAValidator is EIP712, IKernelValidator {
104104
{
105105
require(weightedStorage[msg.sender].totalWeight != 0, "Not enabled");
106106
address currentGuardian = weightedStorage[msg.sender].firstGuardian;
107-
while (currentGuardian != msg.sender) {
107+
while (currentGuardian != address(uint160(type(uint160).max))) {
108108
address nextGuardian = guardian[currentGuardian][msg.sender].nextGuardian;
109109
emit GuardianRemoved(currentGuardian, msg.sender);
110110
delete guardian[currentGuardian][msg.sender];
111111
currentGuardian = nextGuardian;
112112
}
113113
delete weightedStorage[msg.sender];
114114
require(_guardians.length == _weights.length, "Length mismatch");
115-
weightedStorage[msg.sender].firstGuardian = _guardians[0];
115+
weightedStorage[msg.sender].firstGuardian = address(uint160(type(uint160).max));
116116
_addGuardians(_guardians, _weights, msg.sender);
117117
weightedStorage[msg.sender].delay = _delay;
118118
weightedStorage[msg.sender].threshold = _threshold;
@@ -217,10 +217,11 @@ contract WeightedECDSAValidator is EIP712, IKernelValidator {
217217
passed = true;
218218
}
219219
}
220+
proposal.status = ProposalStatus.Executed;
220221
if (passed && guardian[signer][msg.sender].weight != 0) {
221-
proposal.status = ProposalStatus.Executed;
222222
return packValidationData(ValidAfter.wrap(0), ValidUntil.wrap(0));
223223
}
224+
return SIG_VALIDATION_FAILED;
224225
} else if (proposal.status == ProposalStatus.Approved || passed) {
225226
if (userOp.paymasterAndData.length == 0 || address(bytes20(userOp.paymasterAndData[0:20])) == address(0)) {
226227
address signer = ECDSA.recover(ECDSA.toEthSignedMessageHash(userOpHash), userOp.signature);

0 commit comments

Comments
 (0)