diff --git a/benchmark/index.ts b/benchmark/index.ts index df38fd8..3f787be 100644 --- a/benchmark/index.ts +++ b/benchmark/index.ts @@ -86,29 +86,25 @@ import {aggCount, runs} from "./params"; // Verify multiple signatures - await runBenchmark<{pks: PublicKey[]; msgs: Uint8Array[]; sigs: Signature[]}, boolean>({ + await runBenchmark({ id: `${implementation} verifyMultipleSignatures (${aggCount})`, prepareTest: () => { - const dataArr = range(aggCount).map(() => { + const sets = range(aggCount).map(() => { const sk = bls.SecretKey.fromKeygen(); const pk = sk.toPublicKey(); const msg = randomMessage(); const sig = sk.sign(msg); - return {pk, msg, sig}; + return {publicKey: pk, message: msg, signature: sig}; }); - const pks = dataArr.map((data) => data.pk); - const msgs = dataArr.map((data) => data.msg); - const sigs = dataArr.map((data) => data.sig); - return { - input: {pks, msgs, sigs}, + input: sets, resultCheck: (valid) => valid === true, }; }, - testRunner: ({pks, msgs, sigs}) => { - return bls.Signature.verifyMultipleSignatures(pks, msgs, sigs); + testRunner: (sets) => { + return bls.Signature.verifyMultipleSignatures(sets); }, runs, }); diff --git a/benchmark/verifyMultipleSignaturesSavings.ts b/benchmark/verifyMultipleSignaturesSavings.ts index 16357da..d506602 100644 --- a/benchmark/verifyMultipleSignaturesSavings.ts +++ b/benchmark/verifyMultipleSignaturesSavings.ts @@ -12,7 +12,7 @@ import {range, randomMessage} from "../test/util"; const pk = sk.toPublicKey(); const msg = randomMessage(); const sig = sk.sign(msg); - return {pk, msg, sig}; + return {publicKey: pk, message: msg, signature: sig}; }); const startMulti = process.hrtime.bigint(); @@ -21,8 +21,8 @@ import {range, randomMessage} from "../test/util"; const diffMulti = endMulti - startMulti; const startSingle = process.hrtime.bigint(); - for (const {pk, msg, sig} of dataArr) { - sig.verify(pk, msg); + for (const {publicKey, message, signature} of dataArr) { + signature.verify(publicKey, message); } const endSingle = process.hrtime.bigint(); const diffSingle = endSingle - startSingle; diff --git a/benchmark/yarn.lock b/benchmark/yarn.lock index 25594ae..5fdc9a2 100644 --- a/benchmark/yarn.lock +++ b/benchmark/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -noble-bls12-381@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/noble-bls12-381/-/noble-bls12-381-0.6.1.tgz#b44bb5443b4b5c409723f19a8288155f0b3ad126" - integrity sha512-Dt0lq24ez75HqOqNIsxxbzfY7YOuwArtE3H6Clp1XbwnY4Ga1OjFbTaXq5aDBE3+ab1wLK11s0b3yR3+RiWWqw== +noble-bls12-381@^0.7.2: + version "0.7.2" + resolved "https://registry.yarnpkg.com/noble-bls12-381/-/noble-bls12-381-0.7.2.tgz#9a9384891569ba32785d6e4ff8588b783487eae4" + integrity sha512-Z5isbU6opuWPL3dxsGqO5BdOE8WP1XUM7HFIn/xeE5pATTnml/PEIy4MFQQrktHiitkuJdsCDtzEOnS9eIpC3Q==