File tree Expand file tree Collapse file tree
solidity/contracts/libraries/operator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ library Groups {
1010 using SafeMath for uint256 ;
1111 using BytesLib for bytes ;
1212
13+ // The index of a group is flagged with the most significant bit set,
14+ // to distinguish the group `0` from null.
15+ // The flag is toggled with bitwise XOR (`^`)
16+ // which keeps all other bits intact but flips the flag bit.
1317 uint256 constant GROUP_INDEX_FLAG = 1 << 255 ;
1418
1519 struct Group {
@@ -56,7 +60,7 @@ library Groups {
5660 Storage storage self ,
5761 bytes memory groupPubKey
5862 ) internal {
59- self.groupIndices[groupPubKey] = (self.groups.length | GROUP_INDEX_FLAG);
63+ self.groupIndices[groupPubKey] = (self.groups.length ^ GROUP_INDEX_FLAG);
6064 self.groups.push (Group (groupPubKey, uint64 (block .number ), false ));
6165 }
6266
You can’t perform that action at this time.
0 commit comments