Remove benchmark-utils dependency

This commit is contained in:
Cayman 2020-02-20 13:27:06 -06:00
parent eca3c70833
commit c93b5c130b
No known key found for this signature in database
GPG Key ID: 54B21AEC3C53E1F5
8 changed files with 0 additions and 256 deletions

View File

@ -43,7 +43,6 @@
"assert": "^1.4.1"
},
"devDependencies": {
"@chainsafe/benchmark-utils": "^0.1.0",
"js-sha256": "^0.9.0",
"js-yaml": "^3.13.1",
"karma": "^4.4.1",

View File

@ -1,13 +0,0 @@
// Import benchmarks
import * as suites from "./suites";
import {createReportDir, runSuite} from "@chainsafe/benchmark-utils";
import {initBLS} from "../../src";
// Create file
const directory: string = createReportDir();
initBLS().then(() => {
// Run benchmarks
Object.values(suites).forEach((suite) => {
runSuite(suite(directory));
});
});

View File

@ -1,5 +0,0 @@
// export {verifyInValidSignatureBenchmark} from "./verifyInValidSignature";
export {verifyValidSignatureBenchmark} from "./verifyValidSignature";
// export {verifyValidAggregatedSignature} from "./verifyValidAggregatedSignature";
// export {verifyInvalidAggregatedSignature} from "./verifyInvalidAggregatedSignature";
// export {aggregateSignaturesBenchmark} from "./signatureAggregation";

View File

@ -1,40 +0,0 @@
/* eslint-disable @typescript-eslint/no-require-imports,@typescript-eslint/no-var-requires */
import {BenchSuite} from "@chainsafe/benchmark-utils";
import {aggregateSignatures} from "../../../src";
// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace global {
export let signatures: Buffer[];
export let aggregateSignatures: Function;
}
// @ts-ignore
global.require = require;
global.aggregateSignatures = aggregateSignatures;
export function aggregateSignaturesBenchmark(dir: string): BenchSuite {
// Set the function test
const FUNCTION_NAME = "verifyValidSignature"; // PLEASE FILL THIS OUT
const aggregateSignatures = function (): void {
global.aggregateSignatures(global.signatures);
};
return {
name: FUNCTION_NAME,
testFunctions: [aggregateSignatures],
setup: function() {
global.signatures = [];
const {Keypair} = require("../../../src");
const {sha256} = require('js-sha256');
const keypair = Keypair.generate();
const message = Buffer.from(sha256.arrayBuffer(Math.random().toString(36)));
global.signatures.push(keypair.privateKey.signMessage(Buffer.from(message), Buffer.alloc(8)).toBytesCompressed());
},
file: dir + FUNCTION_NAME + ".txt"
};
}

View File

@ -1,43 +0,0 @@
import {BenchSuite} from "@chainsafe/benchmark-utils";
import {verify} from "../../../src";
// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace global {
export let domain: Buffer;
export let message: Buffer;
export let signature: Buffer;
export let publicKey: Buffer;
export let verify: Function;
}
// @ts-ignore
global.require = require;
global.domain = Buffer.alloc(8);
global.verify = verify;
export function verifyInValidSignatureBenchmark(dir: string): BenchSuite {
// Set the function test
const FUNCTION_NAME = "verifyInValidSignature"; // PLEASE FILL THIS OUT
const verifyInValidSignature = function (): void {
global.verify(global.publicKey, global.message, global.signature, global.domain);
};
return {
name: FUNCTION_NAME,
testFunctions: [verifyInValidSignature],
setup: function() {
const {Keypair} = require("../../../src");
const {sha256} = require('js-sha256');
const keypair = Keypair.generate();
const keypair2 = Keypair.generate();
global.publicKey = keypair2.publicKey.toBytesCompressed();
global.message = Buffer.from(sha256.arrayBuffer(Math.random().toString(36)));
global.signature = keypair.privateKey.signMessage(Buffer.from(global.message), global.domain).toBytesCompressed();
},
file: dir + FUNCTION_NAME + ".txt"
};
}

View File

@ -1,49 +0,0 @@
import {BenchSuite} from "@chainsafe/benchmark-utils";
import {aggregateSignatures, verifyMultiple} from "../../../src";
// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace global {
export let domain: Buffer;
export let messages: Buffer[];
export let signature: Buffer;
export let publicKeys: Buffer[];
export let verify: Function;
}
// @ts-ignore
global.require = require;
global.domain = Buffer.alloc(8);
global.verify = verifyMultiple;
export function verifyInvalidAggregatedSignature(dir: string): BenchSuite {
// Set the function test
const FUNCTION_NAME = "verifyInvalidAggregatedSignature"; // PLEASE FILL THIS OUT
const verifyInvalidAggregatedSignature = function (): void {
global.verify(global.publicKeys, global.messages, global.signature, global.domain);
};
return {
name: FUNCTION_NAME,
testFunctions: [verifyInvalidAggregatedSignature],
setup: function() {
const {Keypair, aggregateSignatures} = require("../../../src");
const {sha256} = require('js-sha256');
const signatures = [];
global.publicKeys = [];
const message = Buffer.from(sha256.arrayBuffer(Math.random().toString(36)));
const message2 = Buffer.from(sha256.arrayBuffer(Math.random().toString(36)));
for(let i = 0; i < 128; i++) {
const keypair = Keypair.generate();
global.publicKeys.push(keypair.publicKey.toBytesCompressed());
signatures.push(keypair.privateKey.signMessage(Buffer.from(message), global.domain).toBytesCompressed());
}
global.messages = global.publicKeys.map(() => message2);
global.signature = aggregateSignatures(signatures);
},
file: dir + FUNCTION_NAME + ".txt"
};
}

View File

@ -1,56 +0,0 @@
import {BenchSuite} from "@chainsafe/benchmark-utils";
import {aggregateSignatures, Keypair, verifyMultiple} from "../../../src";
// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace global {
export let domain: Buffer;
export let messages: Buffer[];
export let signature: Buffer;
export let publicKeys: Buffer[];
export let keypairs: Keypair[];
export let verify: Function;
}
// @ts-ignore
global.require = require;
global.domain = Buffer.alloc(8);
global.verify = verifyMultiple;
export function verifyValidAggregatedSignature(dir: string): BenchSuite {
global.publicKeys = [];
global.keypairs = [];
for(let i = 0; i < 128; i++) {
const keypair = Keypair.generate();
global.keypairs.push(keypair);
global.publicKeys.push(keypair.publicKey.toBytesCompressed());
}
// Set the function test
const FUNCTION_NAME = "verifyValidAggregatedSignature"; // PLEASE FILL THIS OUT
const verifyValidAggregatedSignature = function (): void {
global.verify(global.publicKeys, global.messages, global.signature, global.domain);
};
return {
testFunctions: [verifyValidAggregatedSignature],
setup: function() {
const sha256 = require("js-sha256");
const {aggregateSignatures} = require("../../../src");
const message = Buffer.from(sha256.arrayBuffer(Math.random().toString(36)));
const signatures: any[] = [];
global.messages = [];
global.keypairs.forEach((keypair) => {
signatures.push(keypair.privateKey.signMessage(message, global.domain).toBytesCompressed());
global.messages.push(message);
});
global.signature = aggregateSignatures(signatures);
},
file: dir + FUNCTION_NAME + ".txt",
// profile: true,
name: FUNCTION_NAME,
};
}

View File

@ -1,49 +0,0 @@
/* eslint-disable @typescript-eslint/no-require-imports,@typescript-eslint/no-var-requires */
import {BenchSuite} from "@chainsafe/benchmark-utils";
import {verify} from "../../../src";
import {sha256} from "js-sha256";
// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace global {
export let domain: Buffer;
export let message: Buffer;
export let signature: Buffer;
export let publicKey: Buffer;
export let verify: Function;
}
// @ts-ignore
global.require = require;
global.domain = Buffer.alloc(8);
global.verify = verify;
global.message = Buffer.from(sha256.arrayBuffer(Math.random().toString(36)));
export function verifyValidSignatureBenchmark(dir: string): BenchSuite {
// Set the function test
const FUNCTION_NAME = "verifyValidSignature"; // PLEASE FILL THIS OUT
const verifyValidSignature = function (): void {
global.verify(global.publicKey, global.message, global.signature, global.domain);
};
return {
name: FUNCTION_NAME,
testFunctions: [verifyValidSignature],
setup: function() {
let i = 0;
const {Keypair, PrivateKey} = require("../../../src");
const keypair = new Keypair(PrivateKey.fromInt(i));
i = i+1;
global.publicKey = keypair.publicKey.toBytesCompressed();
global.signature = keypair.privateKey.signMessage(Buffer.from(global.message), global.domain).toBytesCompressed();
},
file: dir + FUNCTION_NAME + ".txt"
};
}