Skip to content

Commit 1cc5c63

Browse files
committed
chore: remove unecessary first for loop
chore: `BN254.plus` -> `apk.plus`
1 parent e6adbaa commit 1cc5c63

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/unaudited/BLSSigCheckOperatorStateRetriever.sol

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {ECUtils} from "./ECUtils.sol";
1919
*/
2020
contract BLSSigCheckOperatorStateRetriever is OperatorStateRetriever {
2121
using ECUtils for BN254.G1Point;
22+
using BN254 for BN254.G1Point;
2223
using BitmapUtils for uint256;
2324

2425
/// @dev Thrown when the signature is not on the curve.
@@ -146,12 +147,9 @@ contract BLSSigCheckOperatorStateRetriever is OperatorStateRetriever {
146147

147148
// Trim the nonSignerOperatorIds array to the actual count
148149
bytes32[] memory trimmedNonSignerOperatorIds = new bytes32[](nonSignerOperatorsCount);
149-
for (uint256 i = 0; i < nonSignerOperatorsCount; i++) {
150-
trimmedNonSignerOperatorIds[i] = nonSignerOperatorIds[i];
151-
}
152-
153150
BN254.G1Point[] memory nonSignerPubkeys = new BN254.G1Point[](nonSignerOperatorsCount);
154151
for (uint256 i = 0; i < nonSignerOperatorsCount; i++) {
152+
trimmedNonSignerOperatorIds[i] = nonSignerOperatorIds[i];
155153
address nonSignerOperator =
156154
registryCoordinator.getOperatorFromId(trimmedNonSignerOperatorIds[i]);
157155
(nonSignerPubkeys[i],) = m.blsApkRegistry.getRegisteredPubkey(nonSignerOperator);
@@ -189,7 +187,7 @@ contract BLSSigCheckOperatorStateRetriever is OperatorStateRetriever {
189187
address operator = registryCoordinator.getOperatorFromId(operatorIds[i]);
190188
BN254.G1Point memory operatorPk;
191189
(operatorPk.X, operatorPk.Y) = blsApkRegistry.operatorToPubkey(operator);
192-
apk = BN254.plus(apk, operatorPk);
190+
apk = apk.plus(operatorPk);
193191
}
194192
return apk;
195193
}

0 commit comments

Comments
 (0)