@@ -23,10 +23,8 @@ const DELIMITERS = {
2323 Delimiter3 : "\u0016" ,
2424 Delimiter4 : "\u0017" ,
2525} ;
26- const servers = 4 ;
2726const msg = "hello world" ;
2827const msgHash = keccak256 ( msg ) ;
29- const clientIndex = servers - 1 ;
3028const ec = getEcCrypto ( ) ;
3129
3230const log = ( ...args : unknown [ ] ) => {
@@ -38,7 +36,7 @@ const log = (...args: unknown[]) => {
3836 console . log ( msg ) ;
3937} ;
4038
41- const setupMockShares = async ( endpoints : string [ ] , parties : number [ ] , session : string ) => {
39+ const setupMockShares = async ( endpoints : string [ ] , parties : number [ ] , session : string , clientIndex : number ) => {
4240 const privKey = new BN ( eccrypto . generatePrivate ( ) ) ;
4341
4442 const pubKeyElliptic = ec . curve . g . mul ( privKey ) ;
@@ -118,10 +116,13 @@ const runPostNonceTest = async () => {
118116 const { endpoints, tssWSEndpoints, partyIndexes } = generateEndpoints ( parties , clientIndex ) ;
119117
120118 // setup mock shares, sockets and tss wasm files.
121- const [ { pubKey, privKey } , sockets ] = await Promise . all ( [ setupMockShares ( endpoints , partyIndexes , session ) , setupSockets ( tssWSEndpoints ) ] ) ;
119+ const [ { pubKey, privKey } , sockets ] = await Promise . all ( [
120+ setupMockShares ( endpoints , partyIndexes , session , clientIndex ) ,
121+ setupSockets ( tssWSEndpoints ) ,
122+ ] ) ;
122123
123124 const serverCoeffs : Record < number , string > = { } ;
124- const participatingServerDKGIndexes = [ 1 , 2 , 3 ] ;
125+ const participatingServerDKGIndexes = Array . from ( { length : parties - 1 } , ( _ , i ) => i + 1 ) ;
125126
126127 for ( let i = 0 ; i < participatingServerDKGIndexes . length ; i ++ ) {
127128 const serverIndex = participatingServerDKGIndexes [ i ] ;
@@ -196,10 +197,13 @@ const runPreNonceTest = async () => {
196197 const { endpoints, tssWSEndpoints, partyIndexes } = generateEndpoints ( parties , clientIndex ) ;
197198
198199 // setup mock shares, sockets and tss wasm files.
199- const [ { pubKey, privKey } , sockets ] = await Promise . all ( [ setupMockShares ( endpoints , partyIndexes , session ) , setupSockets ( tssWSEndpoints ) ] ) ;
200+ const [ { pubKey, privKey } , sockets ] = await Promise . all ( [
201+ setupMockShares ( endpoints , partyIndexes , session , clientIndex ) ,
202+ setupSockets ( tssWSEndpoints ) ,
203+ ] ) ;
200204
201205 const serverCoeffs : Record < number , string > = { } ;
202- const participatingServerDKGIndexes = [ 1 , 2 , 3 ] ;
206+ const participatingServerDKGIndexes = Array . from ( { length : parties - 1 } , ( _ , i ) => i + 1 ) ;
203207
204208 for ( let i = 0 ; i < participatingServerDKGIndexes . length ; i ++ ) {
205209 const serverIndex = participatingServerDKGIndexes [ i ] ;
0 commit comments