Skip to content

Commit b0f40ef

Browse files
committed
refactor(contracts): optimize gas
1 parent dd1e3a1 commit b0f40ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/contracts/contracts/base/SemaphoreGroups.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ abstract contract SemaphoreGroups is ISemaphoreGroups {
6868
uint256 groupId,
6969
uint256 identityCommitment
7070
) internal virtual onlyExistingGroup(groupId) onlyGroupAdmin(groupId) {
71+
uint256 leafIndex = getMerkleTreeSize(groupId);
7172
uint256 merkleTreeRoot = merkleTrees[groupId]._insert(identityCommitment);
72-
uint256 leafIndex = getMerkleTreeSize(groupId) - 1;
7373

7474
emit MemberAdded(groupId, leafIndex, identityCommitment, merkleTreeRoot);
7575
}

0 commit comments

Comments
 (0)