Skip to content

Commit 98a43df

Browse files
authored
Merge branch 'master' into typo-fixes
2 parents 6caac66 + f9f7db0 commit 98a43df

File tree

8 files changed

+122
-113
lines changed

8 files changed

+122
-113
lines changed

contracts/utils/cryptography/signers/MultiSignerERC7913.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ abstract contract MultiSignerERC7913 is AbstractSigner {
218218

219219
/**
220220
* @dev Validates the signatures using the signers and their corresponding signatures.
221-
* Returns whether whether the signers are authorized and the signatures are valid for the given hash.
221+
* Returns whether the signers are authorized and the signatures are valid for the given hash.
222222
*
223223
* IMPORTANT: Sorting the signers by their `keccak256` hash will improve the gas efficiency of this function.
224224
* See {SignatureChecker-areValidSignaturesNow-bytes32-bytes[]-bytes[]} for more details.

contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.8.27;
3+
pragma solidity ^0.8.26;
44

55
import {SafeCast} from "../../math/SafeCast.sol";
66
import {MultiSignerERC7913} from "./MultiSignerERC7913.sol";
@@ -104,18 +104,22 @@ abstract contract MultiSignerERC7913Weighted is MultiSignerERC7913 {
104104
uint256 extraWeightRemoved = 0;
105105
for (uint256 i = 0; i < signers.length; ++i) {
106106
bytes memory signer = signers[i];
107-
uint64 weight = weights[i];
108-
109107
require(isSigner(signer), MultiSignerERC7913NonexistentSigner(signer));
108+
109+
uint64 weight = weights[i];
110110
require(weight > 0, MultiSignerERC7913WeightedInvalidWeight(signer, weight));
111111

112112
unchecked {
113-
// Overflow impossible: weight values are bounded by uint64 and economic constraints
114-
extraWeightRemoved += _extraWeights[signer];
115-
extraWeightAdded += _extraWeights[signer] = weight - 1;
113+
uint64 oldExtraWeight = _extraWeights[signer];
114+
uint64 newExtraWeight = weight - 1;
115+
116+
if (oldExtraWeight != newExtraWeight) {
117+
// Overflow impossible: weight values are bounded by uint64 and economic constraints
118+
extraWeightRemoved += oldExtraWeight;
119+
extraWeightAdded += _extraWeights[signer] = newExtraWeight;
120+
emit ERC7913SignerWeightChanged(signer, weight);
121+
}
116122
}
117-
118-
emit ERC7913SignerWeightChanged(signer, weight);
119123
}
120124
unchecked {
121125
// Safe from underflow: `extraWeightRemoved` is bounded by `_totalExtraWeight` by construction

contracts/utils/structs/EnumerableMap.sol

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ library EnumerableMap {
136136
}
137137

138138
/**
139-
* @dev Tries to returns the value associated with `key`. O(1).
139+
* @dev Tries to return the value associated with `key`. O(1).
140140
* Does not revert if `key` is not in the map.
141141
*/
142142
function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool exists, bytes32 value) {
@@ -256,7 +256,7 @@ library EnumerableMap {
256256
}
257257

258258
/**
259-
* @dev Tries to returns the value associated with `key`. O(1).
259+
* @dev Tries to return the value associated with `key`. O(1).
260260
* Does not revert if `key` is not in the map.
261261
*/
262262
function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool exists, uint256 value) {
@@ -276,7 +276,7 @@ library EnumerableMap {
276276
}
277277

278278
/**
279-
* @dev Return the an array containing all the keys
279+
* @dev Returns an array containing all the keys
280280
*
281281
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
282282
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -295,7 +295,7 @@ library EnumerableMap {
295295
}
296296

297297
/**
298-
* @dev Return the an array containing a slice of the keys
298+
* @dev Returns an array containing a slice of the keys
299299
*
300300
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
301301
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -378,7 +378,7 @@ library EnumerableMap {
378378
}
379379

380380
/**
381-
* @dev Tries to returns the value associated with `key`. O(1).
381+
* @dev Tries to return the value associated with `key`. O(1).
382382
* Does not revert if `key` is not in the map.
383383
*/
384384
function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool exists, address value) {
@@ -398,7 +398,7 @@ library EnumerableMap {
398398
}
399399

400400
/**
401-
* @dev Return the an array containing all the keys
401+
* @dev Returns an array containing all the keys
402402
*
403403
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
404404
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -417,7 +417,7 @@ library EnumerableMap {
417417
}
418418

419419
/**
420-
* @dev Return the an array containing a slice of the keys
420+
* @dev Returns an array containing a slice of the keys
421421
*
422422
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
423423
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -500,7 +500,7 @@ library EnumerableMap {
500500
}
501501

502502
/**
503-
* @dev Tries to returns the value associated with `key`. O(1).
503+
* @dev Tries to return the value associated with `key`. O(1).
504504
* Does not revert if `key` is not in the map.
505505
*/
506506
function tryGet(UintToBytes32Map storage map, uint256 key) internal view returns (bool exists, bytes32 value) {
@@ -520,7 +520,7 @@ library EnumerableMap {
520520
}
521521

522522
/**
523-
* @dev Return the an array containing all the keys
523+
* @dev Returns an array containing all the keys
524524
*
525525
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
526526
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -539,7 +539,7 @@ library EnumerableMap {
539539
}
540540

541541
/**
542-
* @dev Return the an array containing a slice of the keys
542+
* @dev Returns an array containing a slice of the keys
543543
*
544544
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
545545
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -622,7 +622,7 @@ library EnumerableMap {
622622
}
623623

624624
/**
625-
* @dev Tries to returns the value associated with `key`. O(1).
625+
* @dev Tries to return the value associated with `key`. O(1).
626626
* Does not revert if `key` is not in the map.
627627
*/
628628
function tryGet(AddressToUintMap storage map, address key) internal view returns (bool exists, uint256 value) {
@@ -642,7 +642,7 @@ library EnumerableMap {
642642
}
643643

644644
/**
645-
* @dev Return the an array containing all the keys
645+
* @dev Returns an array containing all the keys
646646
*
647647
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
648648
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -661,7 +661,7 @@ library EnumerableMap {
661661
}
662662

663663
/**
664-
* @dev Return the an array containing a slice of the keys
664+
* @dev Returns an array containing a slice of the keys
665665
*
666666
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
667667
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -744,7 +744,7 @@ library EnumerableMap {
744744
}
745745

746746
/**
747-
* @dev Tries to returns the value associated with `key`. O(1).
747+
* @dev Tries to return the value associated with `key`. O(1).
748748
* Does not revert if `key` is not in the map.
749749
*/
750750
function tryGet(AddressToAddressMap storage map, address key) internal view returns (bool exists, address value) {
@@ -764,7 +764,7 @@ library EnumerableMap {
764764
}
765765

766766
/**
767-
* @dev Return the an array containing all the keys
767+
* @dev Returns an array containing all the keys
768768
*
769769
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
770770
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -783,7 +783,7 @@ library EnumerableMap {
783783
}
784784

785785
/**
786-
* @dev Return the an array containing a slice of the keys
786+
* @dev Returns an array containing a slice of the keys
787787
*
788788
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
789789
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -870,7 +870,7 @@ library EnumerableMap {
870870
}
871871

872872
/**
873-
* @dev Tries to returns the value associated with `key`. O(1).
873+
* @dev Tries to return the value associated with `key`. O(1).
874874
* Does not revert if `key` is not in the map.
875875
*/
876876
function tryGet(AddressToBytes32Map storage map, address key) internal view returns (bool exists, bytes32 value) {
@@ -890,7 +890,7 @@ library EnumerableMap {
890890
}
891891

892892
/**
893-
* @dev Return the an array containing all the keys
893+
* @dev Returns an array containing all the keys
894894
*
895895
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
896896
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -909,7 +909,7 @@ library EnumerableMap {
909909
}
910910

911911
/**
912-
* @dev Return the an array containing a slice of the keys
912+
* @dev Returns an array containing a slice of the keys
913913
*
914914
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
915915
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -996,7 +996,7 @@ library EnumerableMap {
996996
}
997997

998998
/**
999-
* @dev Tries to returns the value associated with `key`. O(1).
999+
* @dev Tries to return the value associated with `key`. O(1).
10001000
* Does not revert if `key` is not in the map.
10011001
*/
10021002
function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool exists, uint256 value) {
@@ -1016,7 +1016,7 @@ library EnumerableMap {
10161016
}
10171017

10181018
/**
1019-
* @dev Return the an array containing all the keys
1019+
* @dev Returns an array containing all the keys
10201020
*
10211021
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
10221022
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -1035,7 +1035,7 @@ library EnumerableMap {
10351035
}
10361036

10371037
/**
1038-
* @dev Return the an array containing a slice of the keys
1038+
* @dev Returns an array containing a slice of the keys
10391039
*
10401040
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
10411041
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -1118,7 +1118,7 @@ library EnumerableMap {
11181118
}
11191119

11201120
/**
1121-
* @dev Tries to returns the value associated with `key`. O(1).
1121+
* @dev Tries to return the value associated with `key`. O(1).
11221122
* Does not revert if `key` is not in the map.
11231123
*/
11241124
function tryGet(Bytes32ToAddressMap storage map, bytes32 key) internal view returns (bool exists, address value) {
@@ -1138,7 +1138,7 @@ library EnumerableMap {
11381138
}
11391139

11401140
/**
1141-
* @dev Return the an array containing all the keys
1141+
* @dev Returns an array containing all the keys
11421142
*
11431143
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
11441144
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -1157,7 +1157,7 @@ library EnumerableMap {
11571157
}
11581158

11591159
/**
1160-
* @dev Return the an array containing a slice of the keys
1160+
* @dev Returns an array containing a slice of the keys
11611161
*
11621162
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
11631163
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -1259,7 +1259,7 @@ library EnumerableMap {
12591259
}
12601260

12611261
/**
1262-
* @dev Tries to returns the value associated with `key`. O(1).
1262+
* @dev Tries to return the value associated with `key`. O(1).
12631263
* Does not revert if `key` is not in the map.
12641264
*/
12651265
function tryGet(

0 commit comments

Comments
 (0)