Skip to content

Commit

Permalink
fix: weigthed ecdsa validator (#90)
Browse files Browse the repository at this point in the history
* fix: avoid infinite loop on renew

* fix: set max address as first guardian when renew

* fix: update code for dummy signature issue
  • Loading branch information
adnpark authored Mar 27, 2024
1 parent 3118026 commit 8f70c58
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/validator/WeightedECDSAValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ contract WeightedECDSAValidator is EIP712, IKernelValidator {
{
require(weightedStorage[msg.sender].totalWeight != 0, "Not enabled");
address currentGuardian = weightedStorage[msg.sender].firstGuardian;
while (currentGuardian != msg.sender) {
while (currentGuardian != address(uint160(type(uint160).max))) {
address nextGuardian = guardian[currentGuardian][msg.sender].nextGuardian;
emit GuardianRemoved(currentGuardian, msg.sender);
delete guardian[currentGuardian][msg.sender];
currentGuardian = nextGuardian;
}
delete weightedStorage[msg.sender];
require(_guardians.length == _weights.length, "Length mismatch");
weightedStorage[msg.sender].firstGuardian = _guardians[0];
weightedStorage[msg.sender].firstGuardian = address(uint160(type(uint160).max));
_addGuardians(_guardians, _weights, msg.sender);
weightedStorage[msg.sender].delay = _delay;
weightedStorage[msg.sender].threshold = _threshold;
Expand Down Expand Up @@ -217,10 +217,11 @@ contract WeightedECDSAValidator is EIP712, IKernelValidator {
passed = true;
}
}
proposal.status = ProposalStatus.Executed;
if (passed && guardian[signer][msg.sender].weight != 0) {
proposal.status = ProposalStatus.Executed;
return packValidationData(ValidAfter.wrap(0), ValidUntil.wrap(0));
}
return SIG_VALIDATION_FAILED;
} else if (proposal.status == ProposalStatus.Approved || passed) {
if (userOp.paymasterAndData.length == 0 || address(bytes20(userOp.paymasterAndData[0:20])) == address(0)) {
address signer = ECDSA.recover(ECDSA.toEthSignedMessageHash(userOpHash), userOp.signature);
Expand Down

0 comments on commit 8f70c58

Please sign in to comment.