@@ -124,7 +124,7 @@ describe("Semaphore", () => {
124
124
125
125
describe ( "# addMember" , ( ) => {
126
126
it ( "Should not add a member if the caller is not the group admin" , async ( ) => {
127
- const member = BigInt ( 2 )
127
+ const member = 2n
128
128
129
129
const transaction = semaphoreContract . connect ( accounts [ 1 ] ) . addMember ( groupId , member )
130
130
@@ -149,7 +149,7 @@ describe("Semaphore", () => {
149
149
150
150
describe ( "# addMembers" , ( ) => {
151
151
it ( "Should not add members if the caller is not the group admin" , async ( ) => {
152
- const members = [ BigInt ( 1 ) , BigInt ( 2 ) , BigInt ( 3 ) ]
152
+ const members = [ 1n , 2n , 3n ]
153
153
154
154
const transaction = semaphoreContract . connect ( accounts [ 1 ] ) . addMembers ( groupId , members )
155
155
@@ -161,7 +161,7 @@ describe("Semaphore", () => {
161
161
162
162
it ( "Should add new members to an existing group" , async ( ) => {
163
163
const groupId = 3
164
- const members = [ BigInt ( 1 ) , BigInt ( 2 ) , BigInt ( 3 ) ]
164
+ const members = [ 1n , 2n , 3n ]
165
165
const group = new Group ( )
166
166
167
167
group . addMembers ( members )
@@ -178,7 +178,7 @@ describe("Semaphore", () => {
178
178
179
179
describe ( "# updateMember" , ( ) => {
180
180
it ( "Should not update a member if the caller is not the group admin" , async ( ) => {
181
- const member = BigInt ( 2 )
181
+ const member = 2n
182
182
183
183
const transaction = semaphoreContract . connect ( accounts [ 1 ] ) . updateMember ( groupId , member , 1 , [ 0 , 1 ] )
184
184
@@ -190,29 +190,27 @@ describe("Semaphore", () => {
190
190
191
191
it ( "Should update a member from an existing group" , async ( ) => {
192
192
const groupId = 4
193
- const members = [ BigInt ( 1 ) , BigInt ( 2 ) , BigInt ( 3 ) ]
193
+ const members = [ 1n , 2n , 3n ]
194
194
const group = new Group ( )
195
195
196
196
group . addMembers ( members )
197
197
198
- group . updateMember ( 0 , BigInt ( 4 ) )
198
+ group . updateMember ( 0 , 4n )
199
199
200
200
await semaphoreContract [ "createGroup(address)" ] ( accountAddresses [ 0 ] )
201
201
await semaphoreContract . addMembers ( groupId , members )
202
202
203
203
const { siblings, root } = group . generateMerkleProof ( 0 )
204
204
205
- const transaction = semaphoreContract . updateMember ( groupId , BigInt ( 1 ) , BigInt ( 4 ) , siblings )
205
+ const transaction = semaphoreContract . updateMember ( groupId , 1n , 4n , siblings )
206
206
207
- await expect ( transaction )
208
- . to . emit ( semaphoreContract , "MemberUpdated" )
209
- . withArgs ( groupId , 0 , BigInt ( 1 ) , BigInt ( 4 ) , root )
207
+ await expect ( transaction ) . to . emit ( semaphoreContract , "MemberUpdated" ) . withArgs ( groupId , 0 , 1n , 4n , root )
210
208
} )
211
209
} )
212
210
213
211
describe ( "# removeMember" , ( ) => {
214
212
it ( "Should not remove a member if the caller is not the group admin" , async ( ) => {
215
- const member = BigInt ( 2 )
213
+ const member = 2n
216
214
217
215
const transaction = semaphoreContract . connect ( accounts [ 1 ] ) . removeMember ( groupId , member , [ 0 , 1 ] )
218
216
@@ -224,7 +222,7 @@ describe("Semaphore", () => {
224
222
225
223
it ( "Should remove a member from an existing group" , async ( ) => {
226
224
const groupId = 5
227
- const members = [ BigInt ( 1 ) , BigInt ( 2 ) , BigInt ( 3 ) ]
225
+ const members = [ 1n , 2n , 3n ]
228
226
const group = new Group ( )
229
227
230
228
group . addMembers ( members )
@@ -236,9 +234,9 @@ describe("Semaphore", () => {
236
234
237
235
const { siblings, root } = group . generateMerkleProof ( 2 )
238
236
239
- const transaction = semaphoreContract . removeMember ( groupId , BigInt ( 3 ) , siblings )
237
+ const transaction = semaphoreContract . removeMember ( groupId , 3n , siblings )
240
238
241
- await expect ( transaction ) . to . emit ( semaphoreContract , "MemberRemoved" ) . withArgs ( groupId , 2 , BigInt ( 3 ) , root )
239
+ await expect ( transaction ) . to . emit ( semaphoreContract , "MemberRemoved" ) . withArgs ( groupId , 2 , 3n , root )
242
240
} )
243
241
} )
244
242
@@ -272,7 +270,7 @@ describe("Semaphore", () => {
272
270
273
271
await semaphoreContract . addMembers ( groupId , members )
274
272
275
- proof = await generateProof ( identity , group , message , group . root as string , merkleTreeDepth )
273
+ proof = await generateProof ( identity , group , message , group . root , merkleTreeDepth )
276
274
} )
277
275
278
276
it ( "Should not verify a proof if the group does not exist" , async ( ) => {
@@ -303,7 +301,7 @@ describe("Semaphore", () => {
303
301
304
302
group . addMembers ( [ members [ 0 ] , members [ 1 ] ] )
305
303
306
- const proof = await generateProof ( identity , group , message , group . root as string , merkleTreeDepth )
304
+ const proof = await generateProof ( identity , group , message , group . root , merkleTreeDepth )
307
305
308
306
const transaction = semaphoreContract . verifyProof ( groupId , proof )
309
307
@@ -358,12 +356,12 @@ describe("Semaphore", () => {
358
356
await semaphoreContract . addMembers ( groupId , [ members [ 1 ] , members [ 2 ] ] )
359
357
await semaphoreContract . addMember ( groupOneMemberId , members [ 0 ] )
360
358
361
- proof = await generateProof ( identity , group , message , group . root as string , merkleTreeDepth )
359
+ proof = await generateProof ( identity , group , message , group . root , merkleTreeDepth )
362
360
proofOneMember = await generateProof (
363
361
identity ,
364
362
groupOneMember ,
365
363
message ,
366
- groupOneMember . root as string ,
364
+ groupOneMember . root ,
367
365
merkleTreeDepth
368
366
)
369
367
} )
0 commit comments