@@ -39,7 +39,6 @@ let mockUserDB = setupMockUserDB();
39
39
const RESPONSE_TIME = 500 ;
40
40
const CHANGE_STATUS_TIMER = 2000 ;
41
41
const INIT_TIMER = 1000 ;
42
- const SETUP_TIMER = 2000 ;
43
42
const SHUFFLE_TIMER = 2000 ;
44
43
const DECRYPT_TIMER = 1000 ;
45
44
@@ -63,7 +62,7 @@ export const handlers = [
63
62
? {
64
63
lastname : 'Bobster' ,
65
64
firstname : 'Alice' ,
66
- role : UserRole . Voter ,
65
+ role : UserRole . Admin ,
67
66
sciper : userId ,
68
67
}
69
68
: { } ;
@@ -263,16 +262,60 @@ export const handlers = [
263
262
const newDKGStatus = new Map ( mockDKG . get ( ElectionID as string ) ) ;
264
263
let node = '' ;
265
264
266
- mockElections . get ( ElectionID as string ) . Roster . forEach ( ( n ) => {
265
+ const roster = mockElections . get ( ElectionID as string ) . Roster ;
266
+
267
+ const INCREMENT = 1200 ;
268
+
269
+ roster . forEach ( ( n ) => {
267
270
const p = mockNodeProxyAddresses . get ( n ) ;
268
271
if ( p === body . Proxy ) {
269
272
node = n ;
270
273
}
271
274
} ) ;
272
275
273
- newDKGStatus . set ( node , NodeStatus . Setup ) ;
276
+ const setup = ( ) => {
277
+ newDKGStatus . set ( node , NodeStatus . Setup ) ;
278
+ mockDKG . set ( ElectionID as string , newDKGStatus ) ;
279
+ } ;
280
+
281
+ const certified = ( ) => {
282
+ roster . forEach ( ( n ) => {
283
+ newDKGStatus . set ( n , NodeStatus . Certified ) ;
284
+ } ) ;
285
+ mockDKG . set ( ElectionID as string , newDKGStatus ) ;
286
+
287
+ setTimeout ( setup , INCREMENT ) ;
288
+ } ;
289
+
290
+ const certifying = ( ) => {
291
+ roster . forEach ( ( n ) => {
292
+ newDKGStatus . set ( n , NodeStatus . Certifying ) ;
293
+ } ) ;
294
+ mockDKG . set ( ElectionID as string , newDKGStatus ) ;
295
+
296
+ setTimeout ( certified , INCREMENT ) ;
297
+ } ;
298
+
299
+ const responding = ( ) => {
300
+ roster . forEach ( ( n ) => {
301
+ newDKGStatus . set ( n , NodeStatus . Responding ) ;
302
+ } ) ;
303
+ mockDKG . set ( ElectionID as string , newDKGStatus ) ;
304
+
305
+ setTimeout ( certifying , INCREMENT ) ;
306
+ } ;
307
+
308
+ const dealing = ( ) => {
309
+ roster . forEach ( ( n ) => {
310
+ newDKGStatus . set ( n , NodeStatus . Dealing ) ;
311
+ } ) ;
312
+ mockDKG . set ( ElectionID as string , newDKGStatus ) ;
313
+
314
+ setTimeout ( responding , INCREMENT ) ;
315
+ } ;
316
+
317
+ setTimeout ( dealing , INCREMENT ) ;
274
318
275
- setTimeout ( ( ) => mockDKG . set ( ElectionID as string , newDKGStatus ) , SETUP_TIMER ) ;
276
319
break ;
277
320
case Action . BeginDecryption :
278
321
setTimeout (
0 commit comments