Merge pull request #1 from vpavlin/feat/optimize-loop-gas

chore: small gas optimization in a loop
This commit is contained in:
Aaryamann Challani 2023-07-26 14:35:40 +05:30 committed by GitHub
commit ab739fb92b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,8 +36,11 @@ contract RLN {
poseidonHasher = IPoseidonHasher(_poseidonHasher);
SET_SIZE = 1 << DEPTH;
if (constructMembers.length > SET_SIZE) revert FullTree();
for (uint256 i = 0; i < constructMembers.length; i++) {
for (uint256 i = 0; i < constructMembers.length;) {
_register(constructMembers[i]);
unchecked {
++i;
}
}
}