Skip to content

Commit 157ca38

Browse files
Merge pull request #81 from torusresearch/fix/build
Allow changing number of parties in local example and fix tss lib version
2 parents 17f32a0 + 2d7d32a commit 157ca38

File tree

5 files changed

+14
-17
lines changed

5 files changed

+14
-17
lines changed

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
33
"npmClient": "npm",
44
"version": "independent",
5-
"packages": ["packages/tss-*"]
5+
"packages": ["packages/*"]
66
}

package-lock.json

Lines changed: 1 addition & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/tss-lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@toruslabs/tss-dkls-lib",
3-
"version": "5.0.0-alpha.0",
3+
"version": "4.1.0",
44
"description": "Packaged WASM library for DKLS threshold signing.",
55
"main": "dist/tssDklsLib.cjs.js",
66
"unpkg": "dist/tssDklsLib.umd.min.js",

packages/web-example/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"@toruslabs/torus.js": "^15.1.0",
3030
"@toruslabs/tss-client": "file:../tss-client",
3131
"@toruslabs/tss-dkls-lib": "file:../tss-lib",
32-
"@toruslabs/tss-lib": "^2.3.0",
3332
"axios": "^1.6.0",
3433
"base64url": "^3.0.1",
3534
"bn.js": "^5.2.1",

packages/web-example/src/local.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@ const DELIMITERS = {
2323
Delimiter3: "\u0016",
2424
Delimiter4: "\u0017",
2525
};
26-
const servers = 4;
2726
const msg = "hello world";
2827
const msgHash = keccak256(msg);
29-
const clientIndex = servers - 1;
3028
const ec = getEcCrypto();
3129

3230
const 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

Comments
 (0)