Skip to content

Commit

Permalink
fix: set max address as first guardian when renew
Browse files Browse the repository at this point in the history
  • Loading branch information
adnpark committed Mar 12, 2024
1 parent ba8b92d commit 9689fb5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/validator/WeightedECDSAValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ contract WeightedECDSAValidator is EIP712, IKernelValidator {
require(_guardians[i] != address(0), "Guardian cannot be 0");
require(_weights[i] != 0, "Weight cannot be 0");
require(guardian[_guardians[i]][_kernel].weight == 0, "Guardian already enabled");
// when index is 0 meaning that adding the first guardian, since prevGuardian is type(uint160).max, we skip the check
if (i != 0) {
// check if guardians are sorted
require(uint160(_guardians[i]) < prevGuardian, "Guardians not sorted");
}
require(uint160(_guardians[i]) < prevGuardian, "Guardians not sorted");
guardian[_guardians[i]][_kernel] =
GuardianStorage({weight: _weights[i], nextGuardian: weightedStorage[_kernel].firstGuardian});
weightedStorage[_kernel].firstGuardian = _guardians[i];
Expand Down Expand Up @@ -116,7 +112,7 @@ contract WeightedECDSAValidator is EIP712, IKernelValidator {
}
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

0 comments on commit 9689fb5

Please sign in to comment.