|
|
@ -3,7 +3,7 @@ let jobId = 0;
|
|
|
|
let currentTrace = 0;
|
|
|
|
let currentTrace = 0;
|
|
|
|
let plotlyDiv;
|
|
|
|
let plotlyDiv;
|
|
|
|
const workers = [];
|
|
|
|
const workers = [];
|
|
|
|
async function run(messageLength, numWorkers = 1, nonceTrials = 100, ttl = 72) {
|
|
|
|
async function run(messageLength, numWorkers = 1, difficulty = 100, ttl = 72) {
|
|
|
|
const timestamp = Math.floor(Date.now() / 1000);
|
|
|
|
const timestamp = Math.floor(Date.now() / 1000);
|
|
|
|
const pubKey =
|
|
|
|
const pubKey =
|
|
|
|
'05ec8635a07a13743516c7c9b3412f3e8252efb7fcaf67eb1615ffba62bebc6802';
|
|
|
|
'05ec8635a07a13743516c7c9b3412f3e8252efb7fcaf67eb1615ffba62bebc6802';
|
|
|
@ -29,7 +29,7 @@ async function run(messageLength, numWorkers = 1, nonceTrials = 100, ttl = 72) {
|
|
|
|
pubKey,
|
|
|
|
pubKey,
|
|
|
|
data,
|
|
|
|
data,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
nonceTrials,
|
|
|
|
difficulty,
|
|
|
|
increment,
|
|
|
|
increment,
|
|
|
|
index,
|
|
|
|
index,
|
|
|
|
]);
|
|
|
|
]);
|
|
|
@ -50,12 +50,12 @@ async function run(messageLength, numWorkers = 1, nonceTrials = 100, ttl = 72) {
|
|
|
|
|
|
|
|
|
|
|
|
async function runPoW({
|
|
|
|
async function runPoW({
|
|
|
|
iteration,
|
|
|
|
iteration,
|
|
|
|
nonceTrials,
|
|
|
|
difficulty,
|
|
|
|
numWorkers,
|
|
|
|
numWorkers,
|
|
|
|
messageLength = 50,
|
|
|
|
messageLength = 50,
|
|
|
|
ttl = 72,
|
|
|
|
ttl = 72,
|
|
|
|
}) {
|
|
|
|
}) {
|
|
|
|
const name = `W:${numWorkers} - NT: ${nonceTrials} - L:${messageLength} - TTL:${ttl}`;
|
|
|
|
const name = `W:${numWorkers} - NT: ${difficulty} - L:${messageLength} - TTL:${ttl}`;
|
|
|
|
Plotly.addTraces(plotlyDiv, {
|
|
|
|
Plotly.addTraces(plotlyDiv, {
|
|
|
|
y: [],
|
|
|
|
y: [],
|
|
|
|
type: 'box',
|
|
|
|
type: 'box',
|
|
|
@ -64,7 +64,7 @@ async function runPoW({
|
|
|
|
});
|
|
|
|
});
|
|
|
|
for (let i = 0; i < iteration; i += 1) {
|
|
|
|
for (let i = 0; i < iteration; i += 1) {
|
|
|
|
// eslint-disable-next-line no-await-in-loop
|
|
|
|
// eslint-disable-next-line no-await-in-loop
|
|
|
|
await run(messageLength, numWorkers, nonceTrials, ttl);
|
|
|
|
await run(messageLength, numWorkers, difficulty, ttl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
currentTrace += 1;
|
|
|
|
currentTrace += 1;
|
|
|
|
|
|
|
|
|
|
|
@ -86,9 +86,7 @@ function addPoint(duration) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
async function startMessageLengthRun() {
|
|
|
|
async function startMessageLengthRun() {
|
|
|
|
const iteration0 = parseFloat(document.getElementById('iteration0').value);
|
|
|
|
const iteration0 = parseFloat(document.getElementById('iteration0').value);
|
|
|
|
const nonceTrials0 = parseFloat(
|
|
|
|
const difficulty0 = parseFloat(document.getElementById('difficulty0').value);
|
|
|
|
document.getElementById('nonceTrials0').value
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
const numWorkers0 = parseFloat(document.getElementById('numWorkers0').value);
|
|
|
|
const numWorkers0 = parseFloat(document.getElementById('numWorkers0').value);
|
|
|
|
const messageLengthStart0 = parseFloat(
|
|
|
|
const messageLengthStart0 = parseFloat(
|
|
|
|
document.getElementById('messageLengthStart0').value
|
|
|
|
document.getElementById('messageLengthStart0').value
|
|
|
@ -108,7 +106,7 @@ async function startMessageLengthRun() {
|
|
|
|
// eslint-disable-next-line no-await-in-loop
|
|
|
|
// eslint-disable-next-line no-await-in-loop
|
|
|
|
await runPoW({
|
|
|
|
await runPoW({
|
|
|
|
iteration: iteration0,
|
|
|
|
iteration: iteration0,
|
|
|
|
nonceTrials: nonceTrials0,
|
|
|
|
difficulty: difficulty0,
|
|
|
|
numWorkers: numWorkers0,
|
|
|
|
numWorkers: numWorkers0,
|
|
|
|
messageLength: l,
|
|
|
|
messageLength: l,
|
|
|
|
ttl: TTL0,
|
|
|
|
ttl: TTL0,
|
|
|
@ -117,9 +115,7 @@ async function startMessageLengthRun() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
async function startNumWorkerRun() {
|
|
|
|
async function startNumWorkerRun() {
|
|
|
|
const iteration1 = parseFloat(document.getElementById('iteration1').value);
|
|
|
|
const iteration1 = parseFloat(document.getElementById('iteration1').value);
|
|
|
|
const nonceTrials1 = parseFloat(
|
|
|
|
const difficulty1 = parseFloat(document.getElementById('difficulty1').value);
|
|
|
|
document.getElementById('nonceTrials1').value
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
const numWorkersStart1 = parseFloat(
|
|
|
|
const numWorkersStart1 = parseFloat(
|
|
|
|
document.getElementById('numWorkersStart1').value
|
|
|
|
document.getElementById('numWorkersStart1').value
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -138,34 +134,34 @@ async function startNumWorkerRun() {
|
|
|
|
// eslint-disable-next-line no-await-in-loop
|
|
|
|
// eslint-disable-next-line no-await-in-loop
|
|
|
|
await runPoW({
|
|
|
|
await runPoW({
|
|
|
|
iteration: iteration1,
|
|
|
|
iteration: iteration1,
|
|
|
|
nonceTrials: nonceTrials1,
|
|
|
|
difficulty: difficulty1,
|
|
|
|
numWorkers,
|
|
|
|
numWorkers,
|
|
|
|
messageLength: messageLength1,
|
|
|
|
messageLength: messageLength1,
|
|
|
|
ttl: TTL1,
|
|
|
|
ttl: TTL1,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
async function startNonceTrialsRun() {
|
|
|
|
async function startDifficultyRun() {
|
|
|
|
const iteration2 = parseFloat(document.getElementById('iteration2').value);
|
|
|
|
const iteration2 = parseFloat(document.getElementById('iteration2').value);
|
|
|
|
const messageLength2 = parseFloat(
|
|
|
|
const messageLength2 = parseFloat(
|
|
|
|
document.getElementById('messageLength2').value
|
|
|
|
document.getElementById('messageLength2').value
|
|
|
|
);
|
|
|
|
);
|
|
|
|
const numWorkers2 = parseFloat(document.getElementById('numWorkers2').value);
|
|
|
|
const numWorkers2 = parseFloat(document.getElementById('numWorkers2').value);
|
|
|
|
const nonceTrialsStart2 = parseFloat(
|
|
|
|
const difficultyStart2 = parseFloat(
|
|
|
|
document.getElementById('nonceTrialsStart2').value
|
|
|
|
document.getElementById('difficultyStart2').value
|
|
|
|
);
|
|
|
|
);
|
|
|
|
const nonceTrialsStop2 = parseFloat(
|
|
|
|
const difficultyStop2 = parseFloat(
|
|
|
|
document.getElementById('nonceTrialsStop2').value
|
|
|
|
document.getElementById('difficultyStop2').value
|
|
|
|
);
|
|
|
|
);
|
|
|
|
const nonceTrialsStep2 = parseFloat(
|
|
|
|
const difficultyStep2 = parseFloat(
|
|
|
|
document.getElementById('nonceTrialsStep2').value
|
|
|
|
document.getElementById('difficultyStep2').value
|
|
|
|
);
|
|
|
|
);
|
|
|
|
const TTL2 = parseFloat(document.getElementById('TTL2').value);
|
|
|
|
const TTL2 = parseFloat(document.getElementById('TTL2').value);
|
|
|
|
for (let n = nonceTrialsStart2; n < nonceTrialsStop2; n += nonceTrialsStep2) {
|
|
|
|
for (let n = difficultyStart2; n < difficultyStop2; n += difficultyStep2) {
|
|
|
|
// eslint-disable-next-line no-await-in-loop
|
|
|
|
// eslint-disable-next-line no-await-in-loop
|
|
|
|
await runPoW({
|
|
|
|
await runPoW({
|
|
|
|
iteration: iteration2,
|
|
|
|
iteration: iteration2,
|
|
|
|
nonceTrials: n,
|
|
|
|
difficulty: n,
|
|
|
|
numWorkers: numWorkers2,
|
|
|
|
numWorkers: numWorkers2,
|
|
|
|
messageLength: messageLength2,
|
|
|
|
messageLength: messageLength2,
|
|
|
|
ttl: TTL2,
|
|
|
|
ttl: TTL2,
|
|
|
@ -174,9 +170,7 @@ async function startNonceTrialsRun() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
async function starTTLRun() {
|
|
|
|
async function starTTLRun() {
|
|
|
|
const iteration3 = parseFloat(document.getElementById('iteration3').value);
|
|
|
|
const iteration3 = parseFloat(document.getElementById('iteration3').value);
|
|
|
|
const nonceTrials3 = parseFloat(
|
|
|
|
const difficulty3 = parseFloat(document.getElementById('difficulty3').value);
|
|
|
|
document.getElementById('nonceTrials3').value
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
const messageLength3 = parseFloat(
|
|
|
|
const messageLength3 = parseFloat(
|
|
|
|
document.getElementById('messageLength3').value
|
|
|
|
document.getElementById('messageLength3').value
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -188,7 +182,7 @@ async function starTTLRun() {
|
|
|
|
// eslint-disable-next-line no-await-in-loop
|
|
|
|
// eslint-disable-next-line no-await-in-loop
|
|
|
|
await runPoW({
|
|
|
|
await runPoW({
|
|
|
|
iteration: iteration3,
|
|
|
|
iteration: iteration3,
|
|
|
|
nonceTrials: nonceTrials3,
|
|
|
|
difficulty: difficulty3,
|
|
|
|
numWorkers: numWorkers3,
|
|
|
|
numWorkers: numWorkers3,
|
|
|
|
messageLength: messageLength3,
|
|
|
|
messageLength: messageLength3,
|
|
|
|
ttl,
|
|
|
|
ttl,
|
|
|
@ -216,7 +210,7 @@ async function start(index) {
|
|
|
|
await startNumWorkerRun();
|
|
|
|
await startNumWorkerRun();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
case 2:
|
|
|
|
await startNonceTrialsRun();
|
|
|
|
await startDifficultyRun();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
case 3:
|
|
|
|
await starTTLRun();
|
|
|
|
await starTTLRun();
|
|
|
|