@semaphore-protocol/contracts 4.0.0-beta.1 → 4.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Semaphore.sol CHANGED
@@ -4,6 +4,7 @@ pragma solidity 0.8.23;
4
4
  import {ISemaphore} from "./interfaces/ISemaphore.sol";
5
5
  import {ISemaphoreVerifier} from "./interfaces/ISemaphoreVerifier.sol";
6
6
  import {SemaphoreGroups} from "./base/SemaphoreGroups.sol";
7
+ import {MIN_DEPTH, MAX_DEPTH} from "./base/Constants.sol";
7
8
 
8
9
  /// @title Semaphore
9
10
  /// @dev This contract uses the Semaphore base contracts to provide a complete service
@@ -17,6 +18,9 @@ contract Semaphore is ISemaphore, SemaphoreGroups {
17
18
  /// @dev Gets a group id and returns the group parameters.
18
19
  mapping(uint256 => Group) public groups;
19
20
 
21
+ /// @dev Counter to assign an incremental id to the groups.
22
+ uint256 public groupCounter;
23
+
20
24
  /// @dev Initializes the Semaphore verifier used to verify the user's ZK proofs.
21
25
  /// @param _verifier: Semaphore verifier addresse.
22
26
  constructor(ISemaphoreVerifier _verifier) {
@@ -24,14 +28,24 @@ contract Semaphore is ISemaphore, SemaphoreGroups {
24
28
  }
25
29
 
26
30
  /// @dev See {SemaphoreGroups-_createGroup}.
27
- function createGroup(uint256 groupId, address admin) external override {
31
+ function createGroup() external override returns (uint256 groupId) {
32
+ groupId = groupCounter++;
33
+ _createGroup(groupId, msg.sender);
34
+
35
+ groups[groupId].merkleTreeDuration = 1 hours;
36
+ }
37
+
38
+ /// @dev See {SemaphoreGroups-_createGroup}.
39
+ function createGroup(address admin) external override returns (uint256 groupId) {
40
+ groupId = groupCounter++;
28
41
  _createGroup(groupId, admin);
29
42
 
30
43
  groups[groupId].merkleTreeDuration = 1 hours;
31
44
  }
32
45
 
33
46
  /// @dev See {ISemaphore-createGroup}.
34
- function createGroup(uint256 groupId, address admin, uint256 merkleTreeDuration) external override {
47
+ function createGroup(address admin, uint256 merkleTreeDuration) external override returns (uint256 groupId) {
48
+ groupId = groupCounter++;
35
49
  _createGroup(groupId, admin);
36
50
 
37
51
  groups[groupId].merkleTreeDuration = merkleTreeDuration;
@@ -42,11 +56,16 @@ contract Semaphore is ISemaphore, SemaphoreGroups {
42
56
  _updateGroupAdmin(groupId, newAdmin);
43
57
  }
44
58
 
59
+ /// @dev See {SemaphoreGroups- acceptGroupAdmin}.
60
+ function acceptGroupAdmin(uint256 groupId) external override {
61
+ _acceptGroupAdmin(groupId);
62
+ }
63
+
45
64
  /// @dev See {ISemaphore-updateGroupMerkleTreeDuration}.
46
65
  function updateGroupMerkleTreeDuration(
47
66
  uint256 groupId,
48
67
  uint256 newMerkleTreeDuration
49
- ) external override onlyExistingGroup(groupId) onlyGroupAdmin(groupId) {
68
+ ) external override onlyGroupAdmin(groupId) {
50
69
  uint256 oldMerkleTreeDuration = groups[groupId].merkleTreeDuration;
51
70
 
52
71
  groups[groupId].merkleTreeDuration = newMerkleTreeDuration;
@@ -56,18 +75,14 @@ contract Semaphore is ISemaphore, SemaphoreGroups {
56
75
 
57
76
  /// @dev See {SemaphoreGroups-_addMember}.
58
77
  function addMember(uint256 groupId, uint256 identityCommitment) external override {
59
- _addMember(groupId, identityCommitment);
60
-
61
- uint256 merkleTreeRoot = getMerkleTreeRoot(groupId);
78
+ uint256 merkleTreeRoot = _addMember(groupId, identityCommitment);
62
79
 
63
80
  groups[groupId].merkleRootCreationDates[merkleTreeRoot] = block.timestamp;
64
81
  }
65
82
 
66
83
  /// @dev See {SemaphoreGroups-_addMembers}.
67
84
  function addMembers(uint256 groupId, uint256[] calldata identityCommitments) external override {
68
- _addMembers(groupId, identityCommitments);
69
-
70
- uint256 merkleTreeRoot = getMerkleTreeRoot(groupId);
85
+ uint256 merkleTreeRoot = _addMembers(groupId, identityCommitments);
71
86
 
72
87
  groups[groupId].merkleRootCreationDates[merkleTreeRoot] = block.timestamp;
73
88
  }
@@ -79,9 +94,7 @@ contract Semaphore is ISemaphore, SemaphoreGroups {
79
94
  uint256 newIdentityCommitment,
80
95
  uint256[] calldata merkleProofSiblings
81
96
  ) external override {
82
- _updateMember(groupId, identityCommitment, newIdentityCommitment, merkleProofSiblings);
83
-
84
- uint256 merkleTreeRoot = getMerkleTreeRoot(groupId);
97
+ uint256 merkleTreeRoot = _updateMember(groupId, identityCommitment, newIdentityCommitment, merkleProofSiblings);
85
98
 
86
99
  groups[groupId].merkleRootCreationDates[merkleTreeRoot] = block.timestamp;
87
100
  }
@@ -92,18 +105,13 @@ contract Semaphore is ISemaphore, SemaphoreGroups {
92
105
  uint256 identityCommitment,
93
106
  uint256[] calldata merkleProofSiblings
94
107
  ) external override {
95
- _removeMember(groupId, identityCommitment, merkleProofSiblings);
96
-
97
- uint256 merkleTreeRoot = getMerkleTreeRoot(groupId);
108
+ uint256 merkleTreeRoot = _removeMember(groupId, identityCommitment, merkleProofSiblings);
98
109
 
99
110
  groups[groupId].merkleRootCreationDates[merkleTreeRoot] = block.timestamp;
100
111
  }
101
112
 
102
113
  /// @dev See {ISemaphore-validateProof}.
103
- function validateProof(
104
- uint256 groupId,
105
- SemaphoreProof calldata proof
106
- ) external override onlyExistingGroup(groupId) {
114
+ function validateProof(uint256 groupId, SemaphoreProof calldata proof) external override {
107
115
  // The function will revert if the nullifier that is part of the proof,
108
116
  // was already used inside the group with id groupId.
109
117
  if (groups[groupId].nullifiers[proof.nullifier]) {
@@ -136,7 +144,7 @@ contract Semaphore is ISemaphore, SemaphoreGroups {
136
144
  SemaphoreProof calldata proof
137
145
  ) public view override onlyExistingGroup(groupId) returns (bool) {
138
146
  // The function will revert if the Merkle tree depth is not supported.
139
- if (proof.merkleTreeDepth < 1 || proof.merkleTreeDepth > 12) {
147
+ if (proof.merkleTreeDepth < MIN_DEPTH || proof.merkleTreeDepth > MAX_DEPTH) {
140
148
  revert Semaphore__MerkleTreeDepthIsNotSupported();
141
149
  }
142
150
 
@@ -0,0 +1,8 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity 0.8.23;
3
+
4
+ /// @dev Minimum supported tree depth.
5
+ uint8 constant MIN_DEPTH = 1;
6
+
7
+ /// @dev Maximum supported tree depth.
8
+ uint8 constant MAX_DEPTH = 32;
@@ -19,6 +19,10 @@ abstract contract SemaphoreGroups is ISemaphoreGroups {
19
19
  /// The admin can be an Ethereum account or a smart contract.
20
20
  mapping(uint256 => address) internal admins;
21
21
 
22
+ /// @dev Gets a group id and returns any pending admin.
23
+ /// The pending admin can be an Ethereum account or a smart contract.
24
+ mapping(uint256 => address) internal pendingAdmins;
25
+
22
26
  /// @dev Checks if the group admin is the transaction sender.
23
27
  /// @param groupId: Id of the group.
24
28
  modifier onlyGroupAdmin(uint256 groupId) {
@@ -42,37 +46,48 @@ abstract contract SemaphoreGroups is ISemaphoreGroups {
42
46
  /// @param groupId: Id of the group.
43
47
  /// @param admin: Admin of the group.
44
48
  function _createGroup(uint256 groupId, address admin) internal virtual {
45
- if (admins[groupId] != address(0)) {
46
- revert Semaphore__GroupAlreadyExists();
47
- }
48
-
49
49
  admins[groupId] = admin;
50
50
 
51
51
  emit GroupCreated(groupId);
52
52
  emit GroupAdminUpdated(groupId, address(0), admin);
53
53
  }
54
54
 
55
- /// @dev Updates the group admin.
55
+ /// @dev Updates the group admin. In order for the new admin to actually be updated,
56
+ /// they must explicitly accept by calling `_acceptGroupAdmin`.
56
57
  /// @param groupId: Id of the group.
57
58
  /// @param newAdmin: New admin of the group.
58
- function _updateGroupAdmin(
59
- uint256 groupId,
60
- address newAdmin
61
- ) internal virtual onlyExistingGroup(groupId) onlyGroupAdmin(groupId) {
62
- admins[groupId] = newAdmin;
59
+ function _updateGroupAdmin(uint256 groupId, address newAdmin) internal virtual onlyGroupAdmin(groupId) {
60
+ pendingAdmins[groupId] = newAdmin;
63
61
 
64
- emit GroupAdminUpdated(groupId, msg.sender, newAdmin);
62
+ emit GroupAdminPending(groupId, msg.sender, newAdmin);
63
+ }
64
+
65
+ /// @dev Allows the new admin to accept to update the group admin with their address.
66
+ /// @param groupId: Id of the group.
67
+ function _acceptGroupAdmin(uint256 groupId) internal virtual {
68
+ if (pendingAdmins[groupId] != msg.sender) {
69
+ revert Semaphore__CallerIsNotThePendingGroupAdmin();
70
+ }
71
+
72
+ address oldAdmin = admins[groupId];
73
+
74
+ admins[groupId] = msg.sender;
75
+
76
+ delete pendingAdmins[groupId];
77
+
78
+ emit GroupAdminUpdated(groupId, oldAdmin, msg.sender);
65
79
  }
66
80
 
67
81
  /// @dev Adds an identity commitment to an existing group.
68
82
  /// @param groupId: Id of the group.
69
83
  /// @param identityCommitment: New identity commitment.
84
+ /// @return merkleTreeRoot New root hash of the tree.
70
85
  function _addMember(
71
86
  uint256 groupId,
72
87
  uint256 identityCommitment
73
- ) internal virtual onlyExistingGroup(groupId) onlyGroupAdmin(groupId) {
88
+ ) internal virtual onlyGroupAdmin(groupId) returns (uint256 merkleTreeRoot) {
74
89
  uint256 index = getMerkleTreeSize(groupId);
75
- uint256 merkleTreeRoot = merkleTrees[groupId]._insert(identityCommitment);
90
+ merkleTreeRoot = merkleTrees[groupId]._insert(identityCommitment);
76
91
 
77
92
  emit MemberAdded(groupId, index, identityCommitment, merkleTreeRoot);
78
93
  }
@@ -80,9 +95,13 @@ abstract contract SemaphoreGroups is ISemaphoreGroups {
80
95
  /// @dev Adds new members to an existing group.
81
96
  /// @param groupId: Id of the group.
82
97
  /// @param identityCommitments: New identity commitments.
83
- function _addMembers(uint256 groupId, uint256[] calldata identityCommitments) internal virtual {
98
+ /// @return merkleTreeRoot New root hash of the tree.
99
+ function _addMembers(
100
+ uint256 groupId,
101
+ uint256[] calldata identityCommitments
102
+ ) internal virtual onlyGroupAdmin(groupId) returns (uint256 merkleTreeRoot) {
84
103
  uint256 startIndex = getMerkleTreeSize(groupId);
85
- uint256 merkleTreeRoot = merkleTrees[groupId]._insertMany(identityCommitments);
104
+ merkleTreeRoot = merkleTrees[groupId]._insertMany(identityCommitments);
86
105
 
87
106
  emit MembersAdded(groupId, startIndex, identityCommitments, merkleTreeRoot);
88
107
  }
@@ -93,14 +112,15 @@ abstract contract SemaphoreGroups is ISemaphoreGroups {
93
112
  /// @param oldIdentityCommitment: Existing identity commitment to be updated.
94
113
  /// @param newIdentityCommitment: New identity commitment.
95
114
  /// @param merkleProofSiblings: Array of the sibling nodes of the proof of membership.
115
+ /// @return merkleTreeRoot New root hash of the tree.
96
116
  function _updateMember(
97
117
  uint256 groupId,
98
118
  uint256 oldIdentityCommitment,
99
119
  uint256 newIdentityCommitment,
100
120
  uint256[] calldata merkleProofSiblings
101
- ) internal virtual onlyExistingGroup(groupId) onlyGroupAdmin(groupId) {
121
+ ) internal virtual onlyGroupAdmin(groupId) returns (uint256 merkleTreeRoot) {
102
122
  uint256 index = merkleTrees[groupId]._indexOf(oldIdentityCommitment);
103
- uint256 merkleTreeRoot = merkleTrees[groupId]._update(
123
+ merkleTreeRoot = merkleTrees[groupId]._update(
104
124
  oldIdentityCommitment,
105
125
  newIdentityCommitment,
106
126
  merkleProofSiblings
@@ -114,14 +134,15 @@ abstract contract SemaphoreGroups is ISemaphoreGroups {
114
134
  /// @param groupId: Id of the group.
115
135
  /// @param identityCommitment: Existing identity commitment to be removed.
116
136
  /// @param merkleProofSiblings: Array of the sibling nodes of the proof of membership.
137
+ /// @return merkleTreeRoot New root hash of the tree.
117
138
  function _removeMember(
118
139
  uint256 groupId,
119
140
  uint256 identityCommitment,
120
141
  uint256[] calldata merkleProofSiblings
121
- ) internal virtual onlyExistingGroup(groupId) onlyGroupAdmin(groupId) {
142
+ ) internal virtual onlyGroupAdmin(groupId) returns (uint256 merkleTreeRoot) {
122
143
  uint256 index = merkleTrees[groupId]._indexOf(identityCommitment);
123
144
 
124
- uint256 merkleTreeRoot = merkleTrees[groupId]._remove(identityCommitment, merkleProofSiblings);
145
+ merkleTreeRoot = merkleTrees[groupId]._remove(identityCommitment, merkleProofSiblings);
125
146
 
126
147
  emit MemberRemoved(groupId, index, identityCommitment, merkleTreeRoot);
127
148
  }
@@ -3,6 +3,8 @@
3
3
 
4
4
  pragma solidity 0.8.23;
5
5
 
6
+ import {MAX_DEPTH} from "./Constants.sol";
7
+
6
8
  contract SemaphoreVerifier {
7
9
  // Scalar field size
8
10
  uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
@@ -21,204 +23,521 @@ contract SemaphoreVerifier {
21
23
  uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
22
24
  uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
23
25
 
24
- // TODO: Add more variables when Semaphore supports tree depth > 12.
25
- // Right now Semaphore supports tree depth 1-12.
26
-
27
26
  // Verification Key points.
28
27
  // These values are taken from the verification key json file generated with snarkjs.
29
28
  // It allows to use the same verifier to verify proofs for all the tree depths supported by Semaphore.
30
- uint256[14][12] VK_POINTS = [
31
- [
32
- 563562783592406106461234396505774794044312891062077216951605541624542949349,
33
- 16293410697967515504861065986355060225819302510590370360517024529684437085892,
34
- 718666295291146285397081607986058864287612968465033527894198098928522749430,
35
- 10971164449179097832515056670594147898894418081309026322805549037082528587660,
36
- 16397970494781113622140409380710514277504568512202481522431528914560031562762,
37
- 15987991045804318696151558137607070651882190737142560406194591976742796145195,
38
- 19175554796060272870947844726785784415291967441071791144616572094703752022787,
39
- 14708716857471570462880683190724447733812118518043273649838616424043548023127,
40
- 5109703116431086866657790821388182053265093586387384935734011036204399393630,
41
- 1612476077210311180626421664389270104678910550524363357381847966959374674423,
42
- 16028984344157742576452936855797086856968817024956118691418341585143424903639,
43
- 6905323418829609143361434077039383502192920586565275784934386988372483556465,
44
- 5037234187699234788733084505200789125332575456459095878140727750253994537245,
45
- 5152780378461098676484401284161685966625077837157208907964141131514955942959
29
+ uint256[14][MAX_DEPTH] VK_POINTS = [
30
+ [
31
+ 3494501265090266483323776427125076982570488036063792468650150218138148835293,
32
+ 13059836359816425778553975687206846338164409479984923255114294465523619970040,
33
+ 15151249351679674757179857367151108866106292017800258580857323337349056252481,
34
+ 18815265419617029498036243865004357229581831642357407445454759910979500165426,
35
+ 11373228439083951786763438874368468668602473169346848394664028118071804690004,
36
+ 2392728274936215006016716287711141290248196217507457308817981648956555973842,
37
+ 21165236263460891597139480651611604342552675916374159149811150532317922022637,
38
+ 2205889866435138776852640052657720558691248366998420655585799331913362910317,
39
+ 5142950424486523257531761394520431861723450305642839631787321698382624066484,
40
+ 15189409525440736600177098582380596261100810741418368942552492853472187151232,
41
+ 15166768161845773257369241904008805578918273462394677953758522994830670545180,
42
+ 11585842449811129847758954303386730558495513604993443241740010514431580852767,
43
+ 18309269743519286170259635930367379586611051469932392196263349325096833776404,
44
+ 5169422438906150387687192335052847822734742081564185146089879581734761329500
45
+ ],
46
+ [
47
+ 13532761187117457776267167491166240112603073699238075603358405884195273308130,
48
+ 21284355201064049515013725567964698308458995747497567769096321545369178267664,
49
+ 14708709266814413125869923160757837040371326884025433917243343433022571511137,
50
+ 13755025500407841928271808574327563222159647895255773830113509677575485710439,
51
+ 9858819933413872566321287453112479619079314892623028633956302548255682218967,
52
+ 8978980794620905465584214544974627507731009260328687273037813961789203643024,
53
+ 10076358326823042048333094257819800797834453359160913022846795563251044706095,
54
+ 19803968301016597767781555029004899114416563609613744105056144083718519453457,
55
+ 5163620256392555974431339018883081297271688900512864797552560460039668157036,
56
+ 14255936460639291949681319740874191007595598327244735898045668418052144766452,
57
+ 14537605621065916653836904827349546258169731169287489407049733321313440129043,
58
+ 13697104552179432948127977631695913762483329167428550338828664939969524379194,
59
+ 10518837188707767707511411972157042015637825295037224566646839468274503919246,
60
+ 20859740531774787409224706405964614133972994888613078458739440328759279998775
61
+ ],
62
+ [
63
+ 16288589209448575059850904513787407047800601393647902754951819632644221425590,
64
+ 16786097788016607790742808610154813235622999962925024769202024012743068916317,
65
+ 11802625068933862043088882453234658125803235172103758441218874440784454679433,
66
+ 19054287618327819080244377924220084730619755297417179223777968789329427435290,
67
+ 8295798606560676055262757451569098075661634806877203374010954805416034560369,
68
+ 17823033916327857017646050340986899797748134226556967395794361949180557598708,
69
+ 7863282428525672743372793899382505053760053469668593484933349016990801573594,
70
+ 18331488006684435728676028523354067877257617459721620528326034910754871664656,
71
+ 3208791308718324440134969236351379590643354353649811828887575168234009128404,
72
+ 10257765481441384707633559757593912517257134336953024015057545492286789467798,
73
+ 211202131360446365222702196868578991195656024430005775334667458570635430182,
74
+ 20847900408506094777967626429608261593000174750467914924458433091857566381170,
75
+ 12874163201492094577931796006056258188942453406826318262453514614280169978298,
76
+ 6030254908603478785612749007917517401778254879153565233016575793713168729906
77
+ ],
78
+ [
79
+ 6754034540226318773202391358963433276871786953717809855694353846932854329785,
80
+ 2467775821309410353298170614346797970620091442818193435415958276311437053860,
81
+ 3795882684032276797539296527637960192876033451771193231958863625204108357841,
82
+ 11900626424250849274937718621509251345343138630887182003298279365567651532774,
83
+ 5698226291009392212509456603087660757167892215070748391710298686451794945150,
84
+ 6157973895099184288402315817801807399850034827661856468278605062696847353498,
85
+ 15141526076642728649535042926649597908183234939224775055067110611584500129001,
86
+ 4384760212321739848884344304193577499977798066111221580475869690599633722806,
87
+ 4172483707996304656828832165635673373391709578552982633845732115764569616109,
88
+ 18703118242791177268087540217341214701751955061868356627779317654228486952499,
89
+ 19450300041750343627209216069867232901980973906626832440586455706765725761024,
90
+ 16059746288175455494980620176090534670137960271693908437020084988051972211964,
91
+ 20545976615820429183066000767405817531114365884543728191728740956241774393365,
92
+ 441682222632036954103668474012025602234972690129065917741930205184363335774
93
+ ],
94
+ [
95
+ 17333116859502962840043101407562668240640230466282480836955810105410227775068,
96
+ 12933614295322559340061757843860755814119074678469087137971477853826215320477,
97
+ 16047936521695868738870018107292105532713465015164559404074987652783597045737,
98
+ 7294988186022326345519392644681725286083380252049244042196946627153179228896,
99
+ 5694780594861626040122686431862072023944220266576706715410778734338641503716,
100
+ 8712472904136893949123536631603982882802768648960668490262215595304129180625,
101
+ 1995786476093573828491499692373505173525336583145392096683467783999902548268,
102
+ 4926925836258627177637371690839427994092983220113811290959738100072290144384,
103
+ 3791559722445528845247206264702403543222196830021730221796818130566106209767,
104
+ 18417761581887733852915376127193234657558128442956795523445623750943914605716,
105
+ 6559711611059474660788123194641390228396298237139470196512451543415077405796,
106
+ 10546964127996233691569839986330212916129646278460480030759233831657936468012,
107
+ 19639002331873293572459373894235941550278985499149213248754356208213460657162,
108
+ 16617740711303077578250556582154106231075844388484693766277639059298286987625
109
+ ],
110
+ [
111
+ 15568762761287080334123901982501029099057449591979709935902691107711749249022,
112
+ 13605330538883882809690822917231786498790079369748019502396183248967388405806,
113
+ 4557473062770366777369570006933550632897701110895009604852123748934703573598,
114
+ 663727981727505127530084497770681234757756087785765426261978801707046251460,
115
+ 10137887164821194167739010222610234245229180897989876335252633099720202939025,
116
+ 13556557929447859629157159796541922173969485671491640178139584889369979056605,
117
+ 18001826336416230108554083436980932740049468855770464827475781769090259294957,
118
+ 10997751199060512644156045915284269336171252742084691214654620601348632057908,
119
+ 79913969765597476108932900497715672182891152853885723893501837676479334643,
120
+ 5339064100797178384601587097901074769415731437415874905101259438574150065725,
121
+ 11790468783349396195257730524002236946005794800506042451697489501177528985869,
122
+ 2058745275642252757008568790584694831559296102476273845301514491747777902,
123
+ 8569838436054970055409792695113682207394942064434307728493565465575383738014,
124
+ 13183322615830117090366962414504200812495447396240587506161350006490578304105
125
+ ],
126
+ [
127
+ 19054688611757691116083119485406638328516261425570134055761099438916542083510,
128
+ 5537576101367227927432290079717223894972087264645714861714512123692630233528,
129
+ 6979029193706864774816090585159218044225824044811622589489754672108831626492,
130
+ 8586836112195763056179953883229406431968181502947295115552125062679854083702,
131
+ 3610567344582501189941093515503625764015617358100951789070992465620388014770,
132
+ 10092557495034796324189431780067983533486688638792444215776822879681822814418,
133
+ 1266136239205073111432095590744834423814511894190159459963868637184138842722,
134
+ 11374864676654295041142699893206238903356920702572230940823052344171478284171,
135
+ 7496182320409371534981231046400216671163346135425875811178408606577271153492,
136
+ 1462528704706444827904493040179558039394825924259061934534583958249261959624,
137
+ 16141406653410498360525438265360373701532563198050057601030953589813051750690,
138
+ 14018180053857919258735952789533727227462568550710713906158448711665296451356,
139
+ 511374127838749625770334668647416912569313578777284750605965725458096929607,
140
+ 17635169227434142694714979150654436187903738366738972509867831826867283825221
141
+ ],
142
+ [
143
+ 19578851418759832732932704168311617005093075745056434533146726479017829863318,
144
+ 15652564582439405385221211230207905588664570626471430290387353913847742289423,
145
+ 16643936505220289641562675739145660599904253967999119934999861447807565341362,
146
+ 14106834159967458301881233489789009851186059673153032928358078463768578862295,
147
+ 10971489037448711908698715978943908500318707562175731815741960924655210840831,
148
+ 6006427343343794957952233726619963086279381477900155964075102505701412817059,
149
+ 15106747726469907788692287944434907296109850836405367650663267344226048690859,
150
+ 20492702082677255463093066854699770210633096845859381878102473765397334244292,
151
+ 20017671604137050517701389289600332952924272776091967565221423262198791114477,
152
+ 19092277823744726322414075820335182617528620489612060910384627313255069537857,
153
+ 521420364975417235554366424369539937652264103736140177007376087084617840969,
154
+ 3996914661098703435279657116324643068485300222550651293916442007463647760470,
155
+ 4679024209278631191232555253447082923762821738851347894762954616029136450469,
156
+ 8497347026541846312098745702841179850966624542794907236048342704145659678775
157
+ ],
158
+ [
159
+ 1685688713043683238718199465856766482066511448257730427497355513493739531611,
160
+ 9848634919654176463577373224145330482034525085313091961003436980620107331892,
161
+ 18196877315995240142437674253225787667859373842602255491217815157552464034485,
162
+ 13480350431152755858527378560944736211973688467090758274688486468999380580617,
163
+ 6504013699913689711099075581237522738280971836923813934562267069952131008789,
164
+ 9335304366750096675257996749136859439347731736177301019673263812644758419624,
165
+ 18674691980838913091347677991332234920479452203295602521958600357998616141596,
166
+ 4741568400157063102689633599777211724821079787176561142252991434247861983373,
167
+ 6081240166901015395566231760209678592881994305266889564610929100038948121840,
168
+ 6726099338457783260423971895907643672217936148382337363967495541886267184664,
169
+ 1518231630037540558074208692256894068220282655237665440528391362801123567400,
170
+ 6814959623000862963349418000763326032812413890585599160227546882616685479781,
171
+ 17691964860627566514162469663546469998385191762053312278765810284413361692706,
172
+ 8886638770454932775046812264172460584356331780532116653693013498914944507850
173
+ ],
174
+ [
175
+ 21786356007381173571659640827279042005211499352757309589075661822822184336792,
176
+ 12236736981369574728236515244179429788162438563725746867632140895351148551552,
177
+ 10863564205627431677272082241703292907572336123388414891152924237169726048989,
178
+ 19080091339088228168648496513310089433965291972445393982881627786426476832461,
179
+ 6051337981942268387146348592741777699916830790184591013400952407193740242722,
180
+ 14813309083853385461981331205467429689964041093530055551198131882311452944165,
181
+ 13243916879266487104491184915617833718034439141755271499342847081003561471291,
182
+ 20559308417239116672012110806712907520758637467837138402161111223933628840592,
183
+ 19581439469161095403630005805154174170687505024117879919441181595776240034092,
184
+ 17149923765379212333833055145767060687040557826663126725983709990821216291941,
185
+ 8848229792169763857187638630433883807573443546037902935946980878173551942434,
186
+ 9076584903972238461379608530218901607367189390010139393438137978954314962294,
187
+ 2838594782505936821949168913265923356032509180068328675364337511551145041706,
188
+ 12082207822506113008552336146445599677710895859529470992436917935385155760011
189
+ ],
190
+ [
191
+ 10309025318092075922877899889998376514894538129513157785184221239491816007275,
192
+ 18087906293812032247545697502040580639160189604135547745784396926653417233054,
193
+ 13762379406944901802406147105406409563171519837674920666882385732457367565067,
194
+ 184008375360758173891663157848136305080059410478051745043500682115967930421,
195
+ 7221075042299165070640763584725863160347647659704278782330562384672809305162,
196
+ 13601198331885563117630840819920283945716376381432043240564878006092148603574,
197
+ 17966363662480886855360210401838893312981368660270687414500495451106355682632,
198
+ 9255647376958236127578779968319205385670535134228597865566167852255941456992,
199
+ 8203959912436866237932353632392355578980349384400645301966843912631449233592,
200
+ 20011411139499301504584228175724552542130947288854633651397978547089429982167,
201
+ 1820524505387064465309460998360793499775868154592043137422833944836520606454,
202
+ 1959603910351136409471920269505238383870634384371099582856753558856496902512,
203
+ 4198694051360120490653446337443734423586650228488283685090646499268901675490,
204
+ 21526524841382152147992421724785801038770676270240714297859552516739773492697
205
+ ],
206
+ [
207
+ 1756370075610000391065900031440928534228372460166358020032744967867009404739,
208
+ 13069258073213826018511225623792777048865648697927965549278238995976541682378,
209
+ 7782751275919236901187777136923054830643484083829974136976698114515315637057,
210
+ 9140577809263846446846557996533548785843500894717723604305025713383218414559,
211
+ 11332498437023113295175458390938230450212523402749978995184951126111215368275,
212
+ 7016084735586326731105326496042171157633237979413962565940384222454876829020,
213
+ 5013383022618445727921740844767853050438275291216971327851792785650669011741,
214
+ 528618354489883480125467549183593651465882051681270315858578353218107644734,
215
+ 6932115924239435517832880685428272633342271017032662880345701095160428372300,
216
+ 5520601709801507363146277496110244143378961419982733100311341395981490633588,
217
+ 434079293392651414251114604226309649137438107252197032381696615267775897288,
218
+ 18623332313653972273799518879682220458729835518812577091590130632605360081933,
219
+ 16981203870828204556408891045732712151034600645789784935821356391746701607849,
220
+ 10839961472824284602079430847341654099878245597092020402049973455392611362164
221
+ ],
222
+ [
223
+ 2013822349576539187255170167791292904450945890590676031546564364203578428335,
224
+ 4288116053201917097935075684000732434752594062540657362132573163825118214678,
225
+ 8077112032513125799331495973006800784299892868940747570902318145444056767128,
226
+ 21859395070840197113042028262962323095719784329051140880224965059514424348831,
227
+ 10532694937633872732615221785339191399998813277853598590284977223084586265406,
228
+ 18569891906743239236657790847950300608514739578359676359176841830736581922673,
229
+ 5204330292569275288250153279775499240677764904182920564782936399035494759139,
230
+ 14869136923170104943599081137392440247136712268832152014557322866069417673392,
231
+ 16609139756845639786750046885223171804867949172280450359139781662901766868597,
232
+ 7367747621397764356413880321758620580129087430671669202576071458908338963767,
233
+ 18157171842959734937470210968648189999811759058976098804831380331978049484161,
234
+ 14612065821098816890897211924691530301447930045836897440401478111363414764157,
235
+ 3678851330338811698871212394774190592148694554830208940152772420325429207592,
236
+ 1261073646471879421850354957670569129175034189935008550219832398890385831603
237
+ ],
238
+ [
239
+ 20175815417917544319876056782814914933529560976800336038485418111883227853782,
240
+ 19016912455127243850008892664785684778896975209193735443658242892839245034020,
241
+ 16407892224237245445759181057634763320099880121738727631152800143921701752766,
242
+ 1733299003416816864259549315192082251876301168870557296608277844652111933728,
243
+ 18128060449612109642142496525936963279825759724692188014181733764391545826501,
244
+ 6412545369924963430376339636555328095118045874871394681127600419621347748574,
245
+ 9178419128141821432265215706509797566711681420667049266964463482093364121974,
246
+ 12757958736224258162889762688354106158996770313065275427510212926355720788806,
247
+ 21697843782274732041256438596018216848529426578597975296740068185709056950695,
248
+ 9641329027897013830146943496858364657344657408442613002988204006109548012670,
249
+ 10157462635214395067310714425532743819094195406756516970796212542533337329791,
250
+ 6756552332702121619038049584093175387814338143922613739401669728656840170909,
251
+ 9276003791014657516094759987195269349958840151064358512535335441437526577719,
252
+ 17177335596130235736675313878734353760926293469390853206840228086544227127243
253
+ ],
254
+ [
255
+ 11732104488418080835742848495999449390672991477162489659934147182999672535901,
256
+ 6459673724557348935705566417966034360840940513046631280825724658596691372236,
257
+ 6029012855434716453595719715412319477813852483210244923240854148622030700333,
258
+ 4646055529276583783430546562443788975802459143056296894781022758410365840191,
259
+ 4691701433964504850819405353426875432448611177084640879664399563684106977201,
260
+ 6997026109056305304958456212770850719737661180940807196442278723629505898836,
261
+ 21862540916562048400075167198394269266629631981308358022452061330955535980535,
262
+ 20203136947717696850833432049217389834551585785220431602620838951128875924332,
263
+ 6166688558584392552732686802822787347815166465668907688252438119180905848686,
264
+ 1515830657197384709067854833370847128665474205967014377229527531272518040510,
265
+ 9783110166666159719262248155776421656845594701278593694743917659000214566949,
266
+ 14498343612651837182986000137068086166435021811504906980633109697812438152688,
267
+ 7451534988011232583608528483663880320228268776552285912767998924492654022315,
268
+ 14389118774297616531519885127100101489071211382178872997387065906551438715617
269
+ ],
270
+ [
271
+ 10984413251461965647935549809134853212592257018647144589799535518309030045652,
272
+ 18119791555976875181530385865721092494224184674421992280086192965672251542369,
273
+ 9145503195549781954670301741558506961167250692965330519317415426822517754673,
274
+ 7130566849274623382593449799430907546738108731698918345554426216822781939144,
275
+ 17586200399272141670685001491641162521294196727236050999778548238215046166017,
276
+ 281329337697491075931159352771449215426528517554332825727307529327678211850,
277
+ 13587768455979634277266588196077051473493752291227370910424884771755142551393,
278
+ 12132714832736811067697324782216133875324337588127071061942622831539088199516,
279
+ 5424242637034241045316293106740200282134858230716641545833281265555664814058,
280
+ 4099977807866045222441365441679488428090978308192769063472099506097446172444,
281
+ 20991094374514370732056452708323057419772785522538068181419368097559064487764,
282
+ 17494034245166301533444525935585362973100718889755879021217726039762737332309,
283
+ 21513377844056886482755561165035200163740875639723610667981589251852648290497,
284
+ 9065101624205101464784359744884631484276281653365096468139033730232168384170
285
+ ],
286
+ [
287
+ 13720910810322640236241345084228368577289121108674469591653285046643807920592,
288
+ 20130681839683286699999162868559569892047546290445540680321104858780927447891,
289
+ 19384575604207898920571405644263255260754982283494527106631330593535635397279,
290
+ 19975766244574254201679709416326566199725210321908005962311647177117814001433,
291
+ 20984349344022619370458450579312578055808523135369866643465670885076660164806,
292
+ 418264638272070574199167297855020670696708537402223370097894154915338824856,
293
+ 21427513166561351336822904548010728579322568176247623689193394481261310743729,
294
+ 17218242846472515735641714187716984107651753683015981795233490838798663005098,
295
+ 21103921212558832170255972733170723908475938955264614598038505509464559335152,
296
+ 10402439116707708662126524824676626448483957064152280120730850351913612702748,
297
+ 17902409153345924357919108278878752639341210912451068626743802458423268435162,
298
+ 17156991212231172773517848502387153524430619870630373199856683436943875771004,
299
+ 10646416238055467241386416360395574804199761155307993872061057698215892822922,
300
+ 9567771666871218298332873263950533751702773388778384953522740303362056866931
301
+ ],
302
+ [
303
+ 3623654015087414721623407943467672461002500175886362625657458770102123762131,
304
+ 9443203291481021710901029750383878696924345181407701672283832773787973929357,
305
+ 10936780876916181422574139993481684366447129939437423271868090426234211011172,
306
+ 20783980223895248302225054295761481013954415663729096577932141772215407111525,
307
+ 271501919920560807144690888833558109667061334163559001274202634455325808979,
308
+ 14794481401072540343622539363544947515055760970979041148841701973173121160867,
309
+ 16241413887148836912852878034655069636111245133456457252704664072852738020971,
310
+ 4616891037946851677520624578755099324972320662835976914889099357030429177473,
311
+ 3608927726708508538381205233592212299638621918906539441231152707366248326730,
312
+ 20453218571243012416227036764366636460616051978680116597236464784651135817662,
313
+ 21663166035926867176571290287267617498655213253914511123571589436615865760399,
314
+ 6820544505512911561421102139415733480016159315919965296282806777526762552747,
315
+ 1241495087165602740391581058509323079765010896996258108944819093246488858318,
316
+ 8124857698166498408579282540958166224847900470279217858870563626568969324640
317
+ ],
318
+ [
319
+ 2691056408064763934730579100312307365419695285915108108510025624053099691059,
320
+ 9354292212142814677109747486323108648096936042340817605919210179321989308917,
321
+ 20671296014916566316534621652773273840585037550883195749265386216295483140229,
322
+ 6884402260223763449545988617300286545815739386455462315027606685140336580267,
323
+ 12006824962639473646619675695320713559632292589665720351249509600690404062910,
324
+ 13276706600670868735848192943347104623934461144298261448190397129714774342173,
325
+ 18264760419082021650494509547780257751527429714087988777838583561869870161497,
326
+ 16206621246021864196868319303736926716510401444517967423381020552156354105325,
327
+ 1711726122386296242553570383485323505029934793448519517467561601648909492476,
328
+ 424608816752490157168394436055547341686841853472229245627510525503910492101,
329
+ 15415617655332841541287596609058338190575210759281068404604554729079985521497,
330
+ 18478290351885872204755929772605378173281926792205081562405194750294909414375,
331
+ 1332104917854036528393448566746555920300729960761914526841432630705030394652,
332
+ 4875500610885916981959937005615629475085341806101091219174051361012752723259
333
+ ],
334
+ [
335
+ 3068590229007175726652350825575975480933564242399453586465825082294647475860,
336
+ 18234746072930724806231995798390096761122848034387635694143726587529010836110,
337
+ 1919684949146675959680323349314941369203574019150554584779991024393742280845,
338
+ 20400009938273944278780991216131489368203720208632049864993233212641381825170,
339
+ 1105636691459466684354861615642532458695547504319491829198944901848354002466,
340
+ 12426506081436950451531584361567271522327297423292681691257507245865800741808,
341
+ 21744454903360799020170340278186587365704908765309976031542813238813825084489,
342
+ 11372248299010487313898881702904101518095247949018830132141430386679279269802,
343
+ 21355163712164844869530150285034119671090568151924216195709912115114996041497,
344
+ 5914269246724008463378274526282819036767424774567321843447592335886063108576,
345
+ 11757178117438262829005662514573037965023628709384135799022098340275235227691,
346
+ 12324099857879926506512664547633107100872133202763933183968148074461422444945,
347
+ 19030167447913285073203707487614824348154933215474799593455300093917690498309,
348
+ 10756138991756861027792433599825283466492898786698456971350016301834120358130
349
+ ],
350
+ [
351
+ 8447854758365235234650174914302032784976268667989384822851416849728373375962,
352
+ 2774371060614150609505152344392883392716265245943510628736114293073040141197,
353
+ 3015263507065482193204789265551006236425156693888783715997203837690906201829,
354
+ 7186617426186972817855986804168941432350281910461206569148058741387131498151,
355
+ 5818698629865247565077962768609742022241069606093835632689725123770908238374,
356
+ 10032230959981143208283946841992758493223859540652919348005062379046462012203,
357
+ 11522228664628777947230879504212386210128576797203829606594158165912469543023,
358
+ 13272285677937114294437486001063514791939240537126238704993220742500063989359,
359
+ 8471655692275117723910962427858752915984310638982095612617085072826817856111,
360
+ 4389133967757502017802977428616053155133503096651056259096018766643340643444,
361
+ 14833683426056097377459837308704611274315245609945506612281500340707955071545,
362
+ 21735047966739217600224642583481593664121921255631091231639049365846545339271,
363
+ 7278464060898751306868720821317869528105334779561787036194323452374165351865,
364
+ 6039871164511288641970658426390882746101314533737081850970345002118723705339
46
365
  ],
47
366
  [
48
- 6925326031648378844726759441690273332175949886518827719224741736678266471462,
49
- 8087990171976409378525016197066789089596692733769545253942804888352233244331,
50
- 10115242383701466910539784663900956956505212347433548599529944880163612117847,
51
- 15618724583521291135890928658458637081479213437530496494788106479523123480134,
52
- 19573269191775350978579562905764743103417752180580176229566975904395505694207,
53
- 2381522187377974692257359562587606852360557473353020907100590706767276986457,
54
- 3570865353993345507636525265023758855364727230473021611280650482974485897542,
55
- 3026650225811133060402545160946181194870257210933662802529138266788423022235,
56
- 10948020004642082805202152014062303498984706484599503419636897666877701726029,
57
- 16425328653566008388486740080892552688012772956429074139489785673820307770702,
58
- 20638502839000044414864636985783149953889799151008745227055624454042471377832,
59
- 977321369609271151576827768083353705509746900519279122286818202637470656742,
60
- 18662986393280647182646025762677321210586855801774577114215804961111542726195,
61
- 9182414327249389553719378979750943052880001176853490206379257023646169811116
367
+ 4840070530275546035801699608444700918579228818207171384987643157345263587158,
368
+ 8966253575788130771852727739125896841145906149133271403123431077749138822231,
369
+ 2601469036026438601891277833343663261084005848061139271388586828809996187097,
370
+ 9962709838557371377047621521224985762013252610725145923403828793639693121455,
371
+ 3562081668776383619644089086241623016377051210290983257053604147762967187048,
372
+ 4553365292908760204444921066083280974740968313355524357160308575327815731986,
373
+ 9612674806513362915023578944934656419542782185316845654919222232866782079973,
374
+ 2856039308549766546769489569358317466998141815061340660074603482372423614916,
375
+ 17144423089194150938664044057037571466137059216126551322826296560818480520188,
376
+ 7777587218396926909905079292812226413674978129026320051535300425275288555883,
377
+ 13348600530906896077492067999286804922009589548263122827764204432718850414877,
378
+ 3504452333162729816257605356258771813994176063517472700088677353335099652978,
379
+ 9271993074172346116417190887626439840621996383820554885726881799780298924983,
380
+ 19415901227000992567609415633317148788461729474913900357094507534384428975572
62
381
  ],
63
382
  [
64
- 7699900854308622607636895140107457213471038801393300399043779958706267744510,
65
- 7699563868952902688273782470023919811229667532027732585467624469008534197561,
66
- 8605006500231713390564760089884965869867818332514275728271802101761117177706,
67
- 15390497513810955087868026868634948499789494261604405008298272598684585331879,
68
- 1172653041469601107707030355715854571110526375194334139771259673595104816259,
69
- 139822645729727942447876327389754883087551266970976361358585992124005959663,
70
- 807568760006422352594797418374693945705914727214443753238278163089338607471,
71
- 19362805143026565781098954744725161233661862485826387437200176803022106919133,
72
- 9457043262004277983171082100772969689099515860060732671699192102623198243288,
73
- 19229090298682361289811638032020124933114889462217199961448135904896325661193,
74
- 18883326163102164343877677909116984239805709949130729675634413304023108763212,
75
- 2795333364660917174391473381893559091159208514832297547909172862364581446206,
76
- 18012979848063967305324818138773222084850070233834350625943804711450349870116,
77
- 11425098272720529401115253745902976848228234025625773037823969253767737500443
383
+ 10518236799651118399986483301765863768027777545669908907880159551621810126849,
384
+ 5094820268025857505363635119835975858756772232205804973699906431827658031964,
385
+ 20859555010758118604073361508744352301840967631704468041131681426037983213002,
386
+ 11572692692867396499761538666196116586305865304015349724077332249273828973395,
387
+ 7693170882539863875701602528545342311434468852163389086171388853464572270633,
388
+ 3908303967241020812745991584454294385640133430208468916543029049706292930305,
389
+ 14200361022064175872846252914915938901018673724842857113422899538373627654493,
390
+ 1887985090111673428008310095306101841985601166058324952496388205310462613383,
391
+ 11573157656525163647952907768764423420183350046483835223957092582860133547451,
392
+ 9173604865670358445639146193904526160076171763657483567287015999631297551260,
393
+ 8178722693917751358075016256308930447648179998714325218415150487090497217243,
394
+ 16479808796736995387921450370830080669813035631409450618705788666753274143975,
395
+ 20533543720941262967922843401527010251494136604304116450329194230919992456714,
396
+ 21738708027542248258448002258354036928076950567990414271901435012481250510866
78
397
  ],
79
398
  [
80
- 9243647856126339588200227750973237380809101852206502177952556679680468734813,
81
- 2561989864654045354260435368824127763249975523256535586391379695256700207392,
82
- 1308059969166897152269078839315249187046718124106168932020710683189419160756,
83
- 18264861452415533737686303596832882667852638121244187636443702248458018416929,
84
- 5735580005765404165535708760854311053102182143614810924129912232734875728422,
85
- 12547270286864340931439010083179993915942911007015778927394042746771813715897,
86
- 17861179987982979247789643870162154315308943006677455616368767345181299723498,
87
- 12520843301982976970226379882714814545061255956743392202788539428471921045815,
88
- 709419095293140562723620898844593712074413125125086760533949250121053456086,
89
- 20254885558410038279405227446341995510955697359900050994091569463713580982280,
90
- 8876829807505794597615690202974184696287415186921508358861381955321520402876,
91
- 9692396410060123455009190221005078571838194435772371581970098240972280778466,
92
- 11541729643712807778212647011796800767186857085220105751644556558522744760878,
93
- 7117533920695574619512162711113223946930183977424569115798612426749467545080
399
+ 11661383417324806615558394659220516610247089928376070440522188291505784724873,
400
+ 19629232294794264734516475644320504923384252747453171010407820919121492093097,
401
+ 14618693275952711587232205373188572480239428452313785044400368360917578177396,
402
+ 8350002947339764206858601679633707444815132923435432091284098864968718952059,
403
+ 705729203963801077445366659807159942042515811344776106038944684242779323077,
404
+ 8198640129213076396347058165827729949570109420499123900233622693161948493955,
405
+ 17567949859381263201697894705370978555666635560577878390586549308344241574720,
406
+ 16953629262080155066207979848352607491010984453917718285923448228568338552102,
407
+ 16571340903058171078202337397668804978258511905425857983395617262853832093164,
408
+ 8200869898550007995855767338315600003217265793696813934354774140864404387075,
409
+ 19245130308508431368191001431651810775716975255435369252757393063712397235401,
410
+ 19295429264588775090334360243373041256684104838925789132682844828445374541241,
411
+ 8244640034562580123950327146088236084020067479873470678893810764954021793820,
412
+ 6071779329882466654134795663117452253106971568263743258793999061311754781283
94
413
  ],
95
414
  [
96
- 12554869896570109663558999106053541183136083706372178136870048170147558661370,
97
- 21307904757295729894500052152251151076177124351059746872940558537429181679313,
98
- 13447792161027167738515744919555311619301071111923271126707713963292614473975,
99
- 11194665041440536766843756304212299788817698936187605770131686430625103172681,
100
- 7022760843802757109079393624924627417630030139055381384837279305453559861026,
101
- 14368180091281110030022253036601349874026580767275461373222397498585380849175,
102
- 20362090815079102760789516334841889611927869342884580401494938701237909313479,
103
- 11683916255585393494577805363227207275174890005674166623110857790951330330248,
104
- 21680925564107543632769644144771629045807478787600735681275069556336841549441,
105
- 1554686039880869088226596836931999292372497423378849142389700108361111176287,
106
- 9553151402225656007352139561853210183786116738154807824913092141416366824324,
107
- 21774504332021003611111291017295441063483107704370481606906960187337904118400,
108
- 3472743162059388238264946309663113383560193397376658519781344886918012396958,
109
- 21850707327192737842691835772722844106916466129654852946865863108319178245521
415
+ 5174537185495146345702880156705283203902425396197383898540057654655066753579,
416
+ 12950215329375055291643630373560741963997558430433168794073218970044384415372,
417
+ 18440638825319565738488991729556785679573678682023564191514526390075411141690,
418
+ 4431630864873466361387108635543958095498731270116355616225197767733734128861,
419
+ 12211353780794522017482442205152184029453185156252615419956272689806996867522,
420
+ 11858951133579915446931127734829983281450719684822534749146423795831786572024,
421
+ 18699083494838544659449334875917956720534604312394484877250282743052866694,
422
+ 749778821409550859537528691118971534871459292764959826137658158363222566834,
423
+ 2909597392070263345393422292436111503720531353687130181723707126400751447693,
424
+ 12217177777420376281128847110380606163261839348068116179245513037333903388087,
425
+ 6920254660239140919505113388774145966103232605095540610909080767264160069300,
426
+ 9696367212878183305057911542364374139977595200010754215085255727487778572962,
427
+ 14968323162826489282828176469636555044919206060463682988985750923782404039777,
428
+ 11757071201913114247059598621424329188966752420483410843397919162379753756933
110
429
  ],
111
430
  [
112
- 6841243505372324564043525805425666596605335849634400049689614462868641599622,
113
- 11706947284665470438085734275890584651957983546291282232304205898476084974953,
114
- 8134420958061302592465696766566203845441024351721660066575866529624350946525,
115
- 2674642993002069213220912300725195098434544703961492590713058622848310061455,
116
- 14007544454490183581525584522132854274412440955138184221862170710084681738226,
117
- 9427297140302346741340407818949601657384670126565058224960470754064287232598,
118
- 9424279417196769259939653963004219272435595656090601392111859177294419276463,
119
- 5159704841441138198509282351301933053602549958584575945916187562678590534936,
120
- 5934282708091541939003757621608766449985810436411564642900129758520734711260,
121
- 6572936900512215029112509161886160866328777917297795430264727434969553346474,
122
- 17332317297867087005634642159909283377570778576256008720318658354552654813365,
123
- 20469716791176463599463762213563135543375669917658488173798369718370224346075,
124
- 11895216520141526042182770992519307655836464153974170586288146149131884093776,
125
- 2345310584279491449819095573562431881564998414485162753036518957549727207513
431
+ 8179214450876128189786889463050502216503192251068580710356475166830402701708,
432
+ 5801648383242377039158295944236326894031930402176012010819307534933038347985,
433
+ 4693973538356763613860391593814220138320073026815959512078454125381217645788,
434
+ 19870706029300681613622543188539567928777315763585981640693685194301201982407,
435
+ 13128279467779141267539556181844646897000953259054467200148815485804849945589,
436
+ 19182542610668848202527767345596590904881280203255613775118909904478382941801,
437
+ 12622787765544530515623619382100437898246101834816376149292007743211956407286,
438
+ 12570391550772615838335361042568121892906867634448929202232001812492234390257,
439
+ 5735316164124731332271878247418185434228086026647700113833855177940542823181,
440
+ 9649474108395394754402030685603045386825744478341882098839846461266003368756,
441
+ 16190069071551003451113144390700917484497316557096684922619605534369669949534,
442
+ 10681321343942329435795471710031949263678373347092770298132700842902513672840,
443
+ 13863872929961730606993556753801300020729351590807975827100825368353540990573,
444
+ 11931534405924761866343686993715271905704590108489876499851774273982957911423
126
445
  ],
127
446
  [
128
- 16222168105567777760688113388791710300819703656136395550799888633073848798053,
129
- 14347453588631116202352669855016330076170847581618919999243717038742915487177,
130
- 1551977748690015855031859376084014992267998166583511614295554470740621685494,
131
- 5558376366205739247464101507558623934779699722049069497418188353860561540238,
132
- 15084362489402846752495176069529022447007294106313236924068931072406922960482,
133
- 17446301099629553693162731281967866078816607293341610477850995414321505446665,
134
- 15416633712259927998995598381829216728913683600537032862643171407716059372732,
135
- 6910124994917236999728700744617337824847623550680442113266553962793201270115,
136
- 3240338086312503075747637551773566329150860621223080774242357236897458479365,
137
- 9706162939164863315053907226494918827393300584078535638283184502242772542378,
138
- 3821371825593696440611637099905775310839636477646533943959149234595561019388,
139
- 12220054708690507765048929995921680127285008492320123722886943219569231705313,
140
- 16484014909498227505527128570845947338361237083477117662394990633734193572570,
141
- 15639273550026538537711009501005182488432976272250651065072907504931158455474
447
+ 20277284114925687078224763520355726939257825143391929434570333974997434560805,
448
+ 2064976285344404756281594929698931000697669900063301194291518290834961490240,
449
+ 7222144325382158947774651546068992150829509045485292683383357637997517326148,
450
+ 15643195784077230042834999110691483687428735466231422370142767293471863700387,
451
+ 454088003829163771011170852736324196796734198039551149147118112028488218145,
452
+ 19539522144446103612355666512646927077463791742130426065863787086655625062176,
453
+ 9677517649080056520842169551325292586844311652869297540972831144430102239541,
454
+ 12171721941568335982623293519100425613310698565606469058956892831634461540059,
455
+ 15037699242073552386046516617138931456404909452736126928849871092088157606104,
456
+ 2403475304123870051310189713205959145472986292698418380091083485671020127630,
457
+ 127899593359332180821632671011918317356219506177015610133494845926153175595,
458
+ 18684733307620435559282273679266280240730732702398400109727422417551972403102,
459
+ 17130978638728591547347686801647449269492555647218567636544356715497286682290,
460
+ 14514080855160049012448903996874963632870196574887173768510902774625324658544
142
461
  ],
143
462
  [
144
- 8039261311473792027408130340265108867783988336829815266149766357424909552805,
145
- 13742810756711208866393269789950822956196651488331544225304557369739035583007,
146
- 5732605965679620193714116075516176231919315490749768120227762344555213912038,
147
- 1426283383724925735279168010737048062664480092231550167387716017170422478271,
148
- 7289543915982634578897897440956973302403422297539950338836810160596047457980,
149
- 15177295033774438197517772642364420015492974487860823338193520175227862903717,
150
- 5412509155867259433944542755241941469706034032614068890113478300647952353475,
151
- 16755045912589178729548422106539306191579601567866216267685082373250783779841,
152
- 844425885324371282218176954530597075058496766373014736097970493596574863875,
153
- 12323478340077628423886836431146436403221716179764806398442271274194718652143,
154
- 19468406721151512215981453048984639951787280312568894384216547824763527840472,
155
- 6512636337641737270183934024333064400224464644359645491020358650071524340464,
156
- 8198878215192784492258585011520207242810327647198332623948351347768018051267,
157
- 8014960150646978739731831763393714179490854831922196242908407049327430863238
463
+ 5477988853386650384703921094948844062358006867640221757094709122931664258074,
464
+ 17975202799537991792439304164891754483380324452259562307747422259512624823212,
465
+ 13848136879177885045281819032248904935976168943919823007775235047173993770157,
466
+ 11185225860338384901020382557488674560018020486665010314728105461398537090194,
467
+ 5855924544364003112712450030145237149424995112678688873039358008205969147611,
468
+ 15570549396870292677660853760591267003520405786863190676970087082855555878636,
469
+ 14821240964410715386910463283745689087244285662861027299124772223732179089302,
470
+ 15446473065604291444037235422131957717379131935322344411928007251149202158658,
471
+ 586582749011680966506460208877749670972200690716863059163322868400282852300,
472
+ 6765443750336920009167305874738739551390685770965140484130502003990191861016,
473
+ 11516588183751421185156362409787679404091107770536300994982153030408504091807,
474
+ 9422281521245157165519221572217222566067379888854607677340273485846988818889,
475
+ 11972785834549950434085949313031360662160524117252689786653411157712853588295,
476
+ 1251548247225430075659521219630231228104532865302157324337575228144557232422
158
477
  ],
159
478
  [
160
- 12816421563768297608770270654146762017343826741755988834647936785087288245221,
161
- 4869230832458710492613139050501069397194236257402947715710705773326736170245,
162
- 18301439700961740613282752163964601039402055729651579152511810295028351855917,
163
- 11073344652802336528382437239976464979745376329678013840706100925574578891663,
164
- 9107882721143487446664847981273782313316003453386555221878701631432129058401,
165
- 9441695541513726822451572070540177043748046411169636568582927338148104680158,
166
- 8987068930426301924419900826390508311526176863992306858982473479912439758010,
167
- 1725109031239210601724581840155988791039497876559382612372874257775877974323,
168
- 18516110346729610211387987894593386281257834088357741109524145966500785499183,
169
- 114078214476076549461901405178268623018026929846201249476869510133510589766,
170
- 15915940069177053049090451855582611051242699463952201407239272373068542013292,
171
- 9373936080407194259749015269175580128112032582312467763484971165406599176646,
172
- 4922802633190996456945600288106639549790810185209505074744770090776471062338,
173
- 8883001810279320778962047313612748029483858862205749774979015238684570049088
479
+ 21436730469129810957180793723899276883659861043977115336277237822651402972650,
480
+ 14471888142065071281382782958750780204583311859320300053251117611975834609601,
481
+ 12182522103530455236540896653238430557347694672470208631350018699627212167843,
482
+ 12134671815483061401460971926351313472095768998015505567590046606262972345606,
483
+ 6083168185688688297667869638715177381772180226443830560342282797830104869062,
484
+ 926194281246578915103720926341497520082595828680525575284123365838007044551,
485
+ 9409122852531801098754556536729028548924539102103420345160677794564194221020,
486
+ 20542245913396046089533736519215869670909083018889617904362139603473474391693,
487
+ 16873198639240289433836743385124757917190871707428690095953534423420502659893,
488
+ 6588241760722454601615602907791715854928448488066342428651422663075975107816,
489
+ 19842357292988471204463611705572234531158701273234975255676630503476698710155,
490
+ 14693625717448698302951456188963654748379774732579848481403435079923870603157,
491
+ 20241432824683494982737262054148903653340519392174437358036298330854555784611,
492
+ 5945081237575571782036580504962786649821981413555607621373828735238630355652
174
493
  ],
175
494
  [
176
- 10621957863293158040009666146187340406300006617270113507997717497098731431645,
177
- 11544253490899949675932185200523769178642714850738952025947643180461452257027,
178
- 19367886286197174023585178612664391272570357530876044259219178006444442279835,
179
- 49583159539136224825737189586941489049516773623689603831917260806184061698,
180
- 14718035764669896417897962215694711502145567157050183561348015124983050763912,
181
- 16468329864686708461615593125586840110548434159129257976547738477143616225069,
182
- 19316680422470456517825967239402234468963225932355881906076897312088976727808,
183
- 3793008941035953637072065313624049788550692955904011087840457148221740889857,
184
- 8994123619474927749524041243795236789619386871069943230512200348341409025802,
185
- 2898455184193535874162795400065700362364113037155462125222703939894764399559,
186
- 7006987736985681119096469806956612323700302986805047546691419062106874738669,
187
- 6578526693577992862738197741211972861837397562647850241473856881198749597774,
188
- 18253609658317686864081972526657430282945609846265497350129963610508303097865,
189
- 20602454323920106770928127673050173555696255204782817307960073152139829286712
495
+ 5443396004119553565732772035623066322784594051319016117482037304612664713531,
496
+ 13908385405190960757317970925252036009769791894761756953363068981012257735159,
497
+ 2222951903387607415437785840368382110522618780807171086914436920475598995149,
498
+ 7952693491971973340290086005063781112666070579182591177579397309500032398151,
499
+ 20768578042859563979294333002563065924476840206018011719077318477769915880402,
500
+ 2001786654254515377677955109354751436919751171611935922531378122392365944293,
501
+ 2298051095199584549599791615579815921675635758326996304424561508720678758962,
502
+ 15610877986863106190281569495837881819071964316157027243989237288310023404773,
503
+ 21503958051574416294837474683907975773972588915544597427974161349505807601206,
504
+ 16176536100016079147853297185775543699660096471098091832015791823791903209774,
505
+ 3606739889472294515277184850587920470749374877850756839089044653095424769194,
506
+ 14664144387169595605857061033949425545099119522415523292224065111113602111904,
507
+ 19699387660834749955063410769084991520255142011324093146157127237115274380578,
508
+ 4331670811250121546993058308579590495468093227852181043972677680581964769228
190
509
  ],
191
510
  [
192
- 6919690594446594824660388293695365136302375315018989420609208580270256193473,
193
- 20152340858374022568747410447956756883573367358669429548835673215400335225747,
194
- 11674218038035204128186342498577020603218612593894174060137243207689886423596,
195
- 16509772385894559653132866836382733797078280267167499296517180188027714772070,
196
- 18387700354891683161007139598833533459740755646851082725263944626765753998128,
197
- 8496770255291121655312305725645117658510206297162207504909146686627154245846,
198
- 3295351580633631545204707236418977224205703294426182202748223245617942752953,
199
- 11318533876720817956139762907441156918032396007060817178042936071438547629319,
200
- 9798692489110933308397734193670030418121117030189402149994776248649813971130,
201
- 7253879530870754821836349446054636336833607432103959373798000294248292966203,
202
- 21808645514001764351825515375665639285586999794992628373968527911077248645185,
203
- 2859748802987042398453158245958377568437550705999358391809538153774651114865,
204
- 4373537692781319117201803895634857716202697229097770645380222493663057011429,
205
- 21723556418902236605356947828522543021755681613733490227407492902239152334538
511
+ 1773488589187652791865678688444883762637006202264973733401143478796059566247,
512
+ 7839940132195146952355178362620770241816809643056324587040019650105609048932,
513
+ 5994728489052927149244186850512435646422353844489887091765127572037304975403,
514
+ 14809325803961768849764967899586584580664329200871180582417984535228799191623,
515
+ 10631178625335401501457304969878852001559776191683447428857609753454937038299,
516
+ 11675745006421997275450756626998030285194831397590498324078767720340123952646,
517
+ 1759441622054752159360583922123536313476013806215300533220440946452846159126,
518
+ 3059329356920789196856680267147718801714171797250645043538678427768342056591,
519
+ 1809413652255811383678263677090386586529134039718623375196604927184100692799,
520
+ 7533217575609552382385270158875791232330359159976337796303987871112517604844,
521
+ 7704646641054955393597890923317433079643657350033170553840404545002600772539,
522
+ 19522826015127415513569513500635678903639248861485847260009074714535026926155,
523
+ 9396801995941988552875859512580723873116085524385365053682345361229348266222,
524
+ 8122885501816310710455960482459104382732335722838233409931476783790044860185
206
525
  ],
207
526
  [
208
- 3246325158773052647788911340476235648870186305670446321333841273770228016262,
209
- 21672319732433045166991956534762990382763080837755725716637027617201056105221,
210
- 1097625536358560225015844871776096852794298581720514105921271391131873344240,
211
- 5332470123606111842725808071294486759248878958039162159296029608796276205941,
212
- 4147129560663007063799754603731275683761368247704376766576071776957227165800,
213
- 7032402220603422034618210155106646820962552774510253688945919060625670415308,
214
- 5241022678363371404039324538224070321660623527603509392150146296843642044363,
215
- 5281273397025328620822441453790518717375265972202147684745427714882287252791,
216
- 8109626675067152219533782552336308649905522111608563670382254454484448073029,
217
- 4696661232179595878220108186097206302552300846640109174608389689072223809776,
218
- 13974026846148052806722306435446895222317781098029808723550029071117080027133,
219
- 14451415757463182353662034231421738047130904367363697865823311429455557043904,
220
- 9490728148230530026163178051838213576627639298618884515939110001242292217290,
221
- 227687333556127166330064214209948378192130717415165040791158610964406937909
527
+ 16305074860092225839285572393658030116082973338409399324682327571791603645660,
528
+ 12512046153695559034086723653253082259198022071585962475345129380985810571529,
529
+ 607599331353561746153970361104975756620522710317553470868937971490837920782,
530
+ 3474997222527127765405001531284334239342007770926956394825252881969982209496,
531
+ 16304360708182088008313907877667665892976553429106710412375369419780233976442,
532
+ 10460941404478613816427928998514834125407907547113907613807191273719986187223,
533
+ 20051043271541513424021087402997604909963063035826832503174487686321968961776,
534
+ 13432165841378395910455231038520827433713426813680931204822379789609795102053,
535
+ 18762866968227660024720719389346562423430884054824643430326826128394380607310,
536
+ 17713599719831815773421839749444223685540274101601039260510841144941870261910,
537
+ 1883157762896148563929088253054113240995256206097667755269496270918239318411,
538
+ 10985354533025938485092599481185428202087973711120611094551172933738810516920,
539
+ 670487064764400248463858966885752477833093767820377805346079091001272760417,
540
+ 8502840196732756246718058003393498205431869135787193347957619883686320532648
222
541
  ]
223
542
  ];
224
543
 
@@ -239,7 +558,7 @@ contract SemaphoreVerifier {
239
558
 
240
559
  assembly {
241
560
  function checkField(v) {
242
- if iszero(lt(v, q)) {
561
+ if iszero(lt(v, r)) {
243
562
  mstore(0, 0)
244
563
  return(0, 0x20)
245
564
  }
@@ -56,17 +56,23 @@ interface ISemaphore {
56
56
  );
57
57
 
58
58
  /// @dev See {SemaphoreGroups-_createGroup}.
59
- function createGroup(uint256 groupId, address admin) external;
59
+ function createGroup() external returns (uint256);
60
+
61
+ /// @dev See {SemaphoreGroups-_createGroup}.
62
+ function createGroup(address admin) external returns (uint256);
60
63
 
61
64
  /// @dev It creates a group with a custom Merkle tree duration.
62
- /// @param groupId: Id of the group.
63
65
  /// @param admin: Admin of the group. It can be an Ethereum account or a smart contract.
64
66
  /// @param merkleTreeDuration: Merkle tree duration.
65
- function createGroup(uint256 groupId, address admin, uint256 merkleTreeDuration) external;
67
+ /// @return Id of the group.
68
+ function createGroup(address admin, uint256 merkleTreeDuration) external returns (uint256);
66
69
 
67
70
  /// @dev See {SemaphoreGroups-_updateGroupAdmin}.
68
71
  function updateGroupAdmin(uint256 groupId, address newAdmin) external;
69
72
 
73
+ /// @dev See {SemaphoreGroups-_acceptGroupAdmin}.
74
+ function acceptGroupAdmin(uint256 groupId) external;
75
+
70
76
  /// @dev Updates the group Merkle tree duration.
71
77
  /// @param groupId: Id of the group.
72
78
  /// @param newMerkleTreeDuration: New Merkle tree duration.
@@ -4,19 +4,25 @@ pragma solidity 0.8.23;
4
4
  /// @title SemaphoreGroups contract interface.
5
5
  interface ISemaphoreGroups {
6
6
  error Semaphore__GroupDoesNotExist();
7
- error Semaphore__GroupAlreadyExists();
8
7
  error Semaphore__CallerIsNotTheGroupAdmin();
8
+ error Semaphore__CallerIsNotThePendingGroupAdmin();
9
9
 
10
10
  /// @dev Event emitted when a new group is created.
11
11
  /// @param groupId: Id of the group.
12
12
  event GroupCreated(uint256 indexed groupId);
13
13
 
14
- /// @dev Event emitted when an admin is assigned to a group.
14
+ /// @dev Event emitted when a new admin is assigned to a group.
15
15
  /// @param groupId: Id of the group.
16
16
  /// @param oldAdmin: Old admin of the group.
17
17
  /// @param newAdmin: New admin of the group.
18
18
  event GroupAdminUpdated(uint256 indexed groupId, address indexed oldAdmin, address indexed newAdmin);
19
19
 
20
+ /// @dev Event emitted when a group admin is being updated.
21
+ /// @param groupId: Id of the group.
22
+ /// @param oldAdmin: Old admin of the group.
23
+ /// @param newAdmin: New admin of the group.
24
+ event GroupAdminPending(uint256 indexed groupId, address indexed oldAdmin, address indexed newAdmin);
25
+
20
26
  /// @dev Event emitted when a new identity commitment is added.
21
27
  /// @param groupId: Group id of the group.
22
28
  /// @param index: Merkle tree leaf index.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@semaphore-protocol/contracts",
3
- "version": "4.0.0-beta.1",
3
+ "version": "4.0.0-beta.10",
4
4
  "description": "Semaphore contracts to manage groups and broadcast anonymous signals.",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -30,6 +30,6 @@
30
30
  "access": "public"
31
31
  },
32
32
  "dependencies": {
33
- "@zk-kit/imt.sol": "2.0.0-beta.5"
33
+ "@zk-kit/imt.sol": "2.0.0-beta.12"
34
34
  }
35
35
  }