Skip to content

Commit

Permalink
chore: improve the sim tests logs (#6394)
Browse files Browse the repository at this point in the history
* Improve the sim tests logs

* Update packages/utils/src/format.ts

---------

Co-authored-by: Nico Flaig <nflaig@protonmail.com>
  • Loading branch information
nazarhussain and nflaig committed Feb 6, 2024
1 parent cb754f6 commit 274871d
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 21 deletions.
3 changes: 3 additions & 0 deletions packages/cli/test/sim/backup_eth_provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,7 @@ await waitForSlot(env.clock.getLastSlotOfEpoch(bellatrixForkEpoch) + activePrese
env,
});

await node2.beacon.job.stop();
await node3.beacon.job.stop();

await env.stop();
3 changes: 3 additions & 0 deletions packages/cli/test/sim/multi_fork.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,7 @@ await waitForHead(env, unknownBlockSync, {
slot: headForUnknownBlockSync.response.data.message.slot,
});

await unknownBlockSync.beacon.job.stop();
await unknownBlockSync.execution.job.stop();

await env.stop();
30 changes: 23 additions & 7 deletions packages/cli/test/utils/simulation/SimulationEnvironment.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/naming-convention */
import {EventEmitter} from "node:events";
import fs from "node:fs";
import {mkdir, writeFile} from "node:fs/promises";
import path from "node:path";
Expand All @@ -9,6 +8,7 @@ import {nodeUtils} from "@lodestar/beacon-node";
import {ChainForkConfig} from "@lodestar/config";
import {activePreset} from "@lodestar/params";
import {BeaconStateAllForks, interopSecretKey} from "@lodestar/state-transition";
import {prettyMsToTime} from "@lodestar/utils";
import {EpochClock, MS_IN_SEC} from "./EpochClock.js";
import {ExternalSignerServer} from "./ExternalSignerServer.js";
import {SimulationTracker} from "./SimulationTracker.js";
Expand Down Expand Up @@ -42,7 +42,6 @@ export class SimulationEnvironment {
readonly nodes: NodePair[] = [];
readonly clock: EpochClock;
readonly tracker: SimulationTracker;
readonly emitter: EventEmitter;
readonly runner: IRunner;
readonly externalSigner: ExternalSignerServer;

Expand All @@ -52,6 +51,7 @@ export class SimulationEnvironment {
private keysCount = 0;
private nodePairCount = 0;
private genesisState?: BeaconStateAllForks;
private runTimeout?: NodeJS.Timeout;

private constructor(forkConfig: ChainForkConfig, options: SimulationOptions) {
this.forkConfig = forkConfig;
Expand All @@ -64,7 +64,6 @@ export class SimulationEnvironment {
signal: this.options.controller.signal,
});

this.emitter = new EventEmitter();
this.externalSigner = new ExternalSignerServer([]);
this.runner = new Runner({logsDir: this.options.logsDir});
this.tracker = SimulationTracker.initWithDefaultAssertions({
Expand Down Expand Up @@ -96,8 +95,14 @@ export class SimulationEnvironment {

async start(opts: StartOpts): Promise<void> {
const currentTime = Date.now();
console.log(
`Starting simulation environment "${this.options.id}". currentTime=${new Date(
currentTime
).toISOString()} simulationTimeout=${prettyMsToTime(opts.runTimeoutMs)}`
);

if (opts.runTimeoutMs > 0) {
setTimeout(() => {
this.runTimeout = setTimeout(() => {
const slots = this.clock.getSlotFor((currentTime + opts.runTimeoutMs) / MS_IN_SEC);
const epoch = this.clock.getEpochForSlot(slots);
const slot = this.clock.getSlotIndexInEpoch(slots);
Expand All @@ -116,7 +121,7 @@ export class SimulationEnvironment {

this.stop(
1,
`Start sequence not completed before genesis, in ${msToGenesis}ms (approx. ${epoch}/${slot}).`
`Start sequence not completed before genesis, in ${prettyMsToTime(msToGenesis)} (approx. ${epoch}/${slot}).`
).catch((e) => console.error("Error on stop", e));
}, msToGenesis);

Expand All @@ -126,21 +131,27 @@ export class SimulationEnvironment {
await mkdir(this.options.rootDir);
}

console.log("Starting the simulation runner");
await this.runner.start();

console.log("Starting execution nodes");
await Promise.all(this.nodes.map((node) => node.execution.job.start()));

console.log("Initializing genesis state for beacon nodes");
await this.initGenesisState();
if (!this.genesisState) {
throw new Error("The genesis state for CL clients is not defined.");
}

console.log("Starting beacon nodes");
await Promise.all(this.nodes.map((node) => node.beacon.job.start()));

console.log("Starting validators");
await Promise.all(this.nodes.map((node) => node.validator?.job.start()));

if (this.nodes.some((node) => node.validator?.keys.type === "remote")) {
console.log("Starting external signer...");
console.log("Starting external signer");
await this.externalSigner.start();
console.log("Started external signer");

for (const node of this.nodes) {
if (node.validator?.keys.type === "remote") {
Expand All @@ -156,6 +167,7 @@ export class SimulationEnvironment {
}
}

console.log("Starting the simulation tracker");
await this.tracker.start();
await Promise.all(this.nodes.map((node) => this.tracker.track(node)));
} catch (error) {
Expand All @@ -179,6 +191,10 @@ export class SimulationEnvironment {
await this.runner.stop();
this.options.controller.abort();

if (this.runTimeout) {
clearTimeout(this.runTimeout);
}

if (this.tracker.getErrorCount() > 0) {
this.tracker.reporter.summary();
process.exit(this.tracker.getErrorCount() > 0 ? 1 : code);
Expand Down
14 changes: 7 additions & 7 deletions packages/cli/test/utils/simulation/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ export type SimulationOptions = {
};

export enum BeaconClient {
Lodestar = "beacon_lodestar",
Lighthouse = "beacon_lighthouse",
Lodestar = "beacon-lodestar",
Lighthouse = "beacon-lighthouse",
}

export enum ValidatorClient {
Lodestar = "validator_lodestar",
Lighthouse = "validator_lighthouse",
Lodestar = "validator-lodestar",
Lighthouse = "validator-lighthouse",
}

export enum ExecutionClient {
Mock = "execution_mock",
Geth = "execution_geth",
Nethermind = "execution_nethermind",
Mock = "execution-mock",
Geth = "execution-geth",
Nethermind = "execution-nethermind",
}

export enum ExecutionStartMode {
Expand Down
18 changes: 11 additions & 7 deletions packages/test-utils/src/childProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import childProcess from "node:child_process";
import stream from "node:stream";
import fs from "node:fs";
import path from "node:path";
import {sleep} from "@lodestar/utils";
import {prettyMsToTime, sleep} from "@lodestar/utils";
import {TestContext} from "./interfaces.js";

/**
Expand Down Expand Up @@ -328,13 +328,15 @@ export async function spawnChildProcess(
const timeSinceHealthCheckStart = Date.now() - startHealthCheckMs;
if (timeSinceHealthCheckStart > logHealthChecksAfterMs) {
console.log(
`Health check unsuccessful. logPrefix=${logPrefix} pid=${proc.pid} timeSinceHealthCheckStart=${timeSinceHealthCheckStart}`
`Health check unsuccessful. logPrefix=${logPrefix} pid=${
proc.pid
} timeSinceHealthCheckStart=${prettyMsToTime(timeSinceHealthCheckStart)}`
);
}
}
})
.catch((e) => {
console.error("error on health check, health functions must never throw", e);
console.error("Error on health check, health functions must never throw", e);
});
}, healthCheckIntervalMs);

Expand All @@ -344,7 +346,9 @@ export async function spawnChildProcess(
if (intervalId !== undefined) {
reject(
new Error(
`Health check timeout. logPrefix=${logPrefix} pid=${proc.pid} healthTimeoutMs=${healthTimeoutMs}`
`Health check timeout. logPrefix=${logPrefix} pid=${proc.pid} healthTimeout=${prettyMsToTime(
healthTimeoutMs ?? 0
)}`
)
);
}
Expand All @@ -358,9 +362,9 @@ export async function spawnChildProcess(

reject(
new Error(
`process exited before healthy. logPrefix=${logPrefix} pid=${
proc.pid
} healthTimeoutMs=${healthTimeoutMs} code=${code} command="${command} ${args.join(" ")}"`
`Process exited before healthy. logPrefix=${logPrefix} pid=${proc.pid} healthTimeout=${prettyMsToTime(
healthTimeoutMs ?? 0
)} code=${code} command="${command} ${args.join(" ")}"`
)
);
});
Expand Down
8 changes: 8 additions & 0 deletions packages/utils/src/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,11 @@ export function prettyWeiToEth(wei: bigint, suffix = false): string {
if (suffix) eth += " ETH";
return eth;
}

/**
* Format milliseconds to time format HH:MM:SS.ms
*/
export function prettyMsToTime(timeMs: number): string {
const date = new Date(0, 0, 0, 0, 0, 0, timeMs);
return `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}.${date.getMilliseconds()}`;
}

1 comment on commit 274871d

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for some benchmarks.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold.

Benchmark suite Current: 274871d Previous: cb754f6 Ratio
getSlashingsAndExits - default max 714.98 us/op 198.19 us/op 3.61
fastMsgIdFn h64 xxhash / 1000 bytes 1.8400 us/op 419.00 ns/op 4.39
Full benchmark results
Benchmark suite Current: 274871d Previous: cb754f6 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 862.63 us/op 548.88 us/op 1.57
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 179.27 us/op 114.11 us/op 1.57
BLS verify - blst-native 1.7192 ms/op 1.3223 ms/op 1.30
BLS verifyMultipleSignatures 3 - blst-native 3.4827 ms/op 2.7878 ms/op 1.25
BLS verifyMultipleSignatures 8 - blst-native 7.6729 ms/op 6.1552 ms/op 1.25
BLS verifyMultipleSignatures 32 - blst-native 29.203 ms/op 22.497 ms/op 1.30
BLS verifyMultipleSignatures 64 - blst-native 53.956 ms/op 44.399 ms/op 1.22
BLS verifyMultipleSignatures 128 - blst-native 109.05 ms/op 89.758 ms/op 1.21
BLS deserializing 10000 signatures 1.1042 s/op 952.69 ms/op 1.16
BLS deserializing 100000 signatures 10.697 s/op 9.6456 s/op 1.11
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.4878 ms/op 1.3793 ms/op 1.08
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.6453 ms/op 1.5217 ms/op 1.08
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.6092 ms/op 2.3593 ms/op 1.11
BLS verifyMultipleSignatures - same message - 64 - blst-native 3.9907 ms/op 4.5593 ms/op 0.88
BLS verifyMultipleSignatures - same message - 128 - blst-native 6.8032 ms/op 5.9495 ms/op 1.14
BLS aggregatePubkeys 32 - blst-native 29.607 us/op 26.249 us/op 1.13
BLS aggregatePubkeys 128 - blst-native 112.44 us/op 101.79 us/op 1.10
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 117.35 ms/op 53.187 ms/op 2.21
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 90.010 ms/op 52.958 ms/op 1.70
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 63.087 ms/op 34.074 ms/op 1.85
getSlashingsAndExits - default max 714.98 us/op 198.19 us/op 3.61
getSlashingsAndExits - 2k 786.04 us/op 591.91 us/op 1.33
proposeBlockBody type=full, size=empty 9.6860 ms/op 5.5570 ms/op 1.74
isKnown best case - 1 super set check 867.00 ns/op 560.00 ns/op 1.55
isKnown normal case - 2 super set checks 861.00 ns/op 569.00 ns/op 1.51
isKnown worse case - 16 super set checks 897.00 ns/op 536.00 ns/op 1.67
CheckpointStateCache - add get delete 7.7620 us/op 6.5020 us/op 1.19
validate api signedAggregateAndProof - struct 3.1212 ms/op 2.8785 ms/op 1.08
validate gossip signedAggregateAndProof - struct 3.0643 ms/op 2.8414 ms/op 1.08
validate gossip attestation - vc 640000 1.5800 ms/op 1.3996 ms/op 1.13
batch validate gossip attestation - vc 640000 - chunk 32 209.06 us/op 180.55 us/op 1.16
batch validate gossip attestation - vc 640000 - chunk 64 195.52 us/op 149.47 us/op 1.31
batch validate gossip attestation - vc 640000 - chunk 128 212.01 us/op 146.81 us/op 1.44
batch validate gossip attestation - vc 640000 - chunk 256 195.20 us/op 131.03 us/op 1.49
pickEth1Vote - no votes 1.8481 ms/op 1.2645 ms/op 1.46
pickEth1Vote - max votes 17.736 ms/op 13.339 ms/op 1.33
pickEth1Vote - Eth1Data hashTreeRoot value x2048 27.629 ms/op 17.733 ms/op 1.56
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 44.570 ms/op 35.791 ms/op 1.25
pickEth1Vote - Eth1Data fastSerialize value x2048 1.4274 ms/op 624.76 us/op 2.28
pickEth1Vote - Eth1Data fastSerialize tree x2048 11.585 ms/op 4.4230 ms/op 2.62
bytes32 toHexString 1.2460 us/op 669.00 ns/op 1.86
bytes32 Buffer.toString(hex) 533.00 ns/op 306.00 ns/op 1.74
bytes32 Buffer.toString(hex) from Uint8Array 1.0060 us/op 486.00 ns/op 2.07
bytes32 Buffer.toString(hex) + 0x 443.00 ns/op 307.00 ns/op 1.44
Object access 1 prop 0.40600 ns/op 0.20000 ns/op 2.03
Map access 1 prop 0.22300 ns/op 0.15200 ns/op 1.47
Object get x1000 13.936 ns/op 7.6350 ns/op 1.83
Map get x1000 1.3160 ns/op 0.84500 ns/op 1.56
Object set x1000 121.34 ns/op 54.734 ns/op 2.22
Map set x1000 80.616 ns/op 43.403 ns/op 1.86
Return object 10000 times 0.45720 ns/op 0.24300 ns/op 1.88
Throw Error 10000 times 4.8228 us/op 3.8881 us/op 1.24
fastMsgIdFn sha256 / 200 bytes 4.3770 us/op 3.3520 us/op 1.31
fastMsgIdFn h32 xxhash / 200 bytes 499.00 ns/op 330.00 ns/op 1.51
fastMsgIdFn h64 xxhash / 200 bytes 576.00 ns/op 372.00 ns/op 1.55
fastMsgIdFn sha256 / 1000 bytes 12.867 us/op 11.572 us/op 1.11
fastMsgIdFn h32 xxhash / 1000 bytes 706.00 ns/op 419.00 ns/op 1.68
fastMsgIdFn h64 xxhash / 1000 bytes 1.8400 us/op 419.00 ns/op 4.39
fastMsgIdFn sha256 / 10000 bytes 135.41 us/op 102.64 us/op 1.32
fastMsgIdFn h32 xxhash / 10000 bytes 3.6340 us/op 1.9380 us/op 1.88
fastMsgIdFn h64 xxhash / 10000 bytes 2.6490 us/op 1.3200 us/op 2.01
send data - 1000 256B messages 44.848 ms/op 19.809 ms/op 2.26
send data - 1000 512B messages 34.639 ms/op 26.864 ms/op 1.29
send data - 1000 1024B messages 72.063 ms/op 38.932 ms/op 1.85
send data - 1000 1200B messages 91.977 ms/op 38.857 ms/op 2.37
send data - 1000 2048B messages 98.090 ms/op 49.694 ms/op 1.97
send data - 1000 4096B messages 81.999 ms/op 27.933 ms/op 2.94
send data - 1000 16384B messages 217.43 ms/op 115.69 ms/op 1.88
send data - 1000 65536B messages 960.52 ms/op 522.50 ms/op 1.84
enrSubnets - fastDeserialize 64 bits 2.7680 us/op 1.7090 us/op 1.62
enrSubnets - ssz BitVector 64 bits 755.00 ns/op 554.00 ns/op 1.36
enrSubnets - fastDeserialize 4 bits 387.00 ns/op 243.00 ns/op 1.59
enrSubnets - ssz BitVector 4 bits 818.00 ns/op 567.00 ns/op 1.44
prioritizePeers score -10:0 att 32-0.1 sync 2-0 163.66 us/op 121.50 us/op 1.35
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 271.32 us/op 160.07 us/op 1.69
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 364.39 us/op 220.65 us/op 1.65
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 594.40 us/op 366.45 us/op 1.62
prioritizePeers score 0:0 att 64-1 sync 4-1 498.86 us/op 399.38 us/op 1.25
array of 16000 items push then shift 2.0026 us/op 1.7211 us/op 1.16
LinkedList of 16000 items push then shift 14.525 ns/op 10.681 ns/op 1.36
array of 16000 items push then pop 169.20 ns/op 129.35 ns/op 1.31
LinkedList of 16000 items push then pop 12.266 ns/op 9.4230 ns/op 1.30
array of 24000 items push then shift 2.9893 us/op 2.5483 us/op 1.17
LinkedList of 24000 items push then shift 17.090 ns/op 9.3050 ns/op 1.84
array of 24000 items push then pop 277.07 ns/op 154.67 ns/op 1.79
LinkedList of 24000 items push then pop 14.832 ns/op 8.7480 ns/op 1.70
intersect bitArray bitLen 8 8.8620 ns/op 5.8180 ns/op 1.52
intersect array and set length 8 142.67 ns/op 66.336 ns/op 2.15
intersect bitArray bitLen 128 45.097 ns/op 36.693 ns/op 1.23
intersect array and set length 128 1.5192 us/op 967.83 ns/op 1.57
bitArray.getTrueBitIndexes() bitLen 128 3.1360 us/op 1.4640 us/op 2.14
bitArray.getTrueBitIndexes() bitLen 248 5.2940 us/op 2.4100 us/op 2.20
bitArray.getTrueBitIndexes() bitLen 512 10.094 us/op 4.8360 us/op 2.09
Buffer.concat 32 items 1.4270 us/op 1.0870 us/op 1.31
Uint8Array.set 32 items 2.7210 us/op 1.9120 us/op 1.42
Set add up to 64 items then delete first 5.6194 us/op 4.7750 us/op 1.18
OrderedSet add up to 64 items then delete first 7.6799 us/op 5.9941 us/op 1.28
Set add up to 64 items then delete last 5.8975 us/op 5.0287 us/op 1.17
OrderedSet add up to 64 items then delete last 8.3405 us/op 6.0948 us/op 1.37
Set add up to 64 items then delete middle 6.2202 us/op 4.7583 us/op 1.31
OrderedSet add up to 64 items then delete middle 9.7094 us/op 7.1985 us/op 1.35
Set add up to 128 items then delete first 12.016 us/op 9.7144 us/op 1.24
OrderedSet add up to 128 items then delete first 16.838 us/op 13.001 us/op 1.30
Set add up to 128 items then delete last 11.594 us/op 9.5932 us/op 1.21
OrderedSet add up to 128 items then delete last 15.903 us/op 12.033 us/op 1.32
Set add up to 128 items then delete middle 13.207 us/op 9.4470 us/op 1.40
OrderedSet add up to 128 items then delete middle 27.826 us/op 18.582 us/op 1.50
Set add up to 256 items then delete first 26.035 us/op 19.733 us/op 1.32
OrderedSet add up to 256 items then delete first 36.303 us/op 26.170 us/op 1.39
Set add up to 256 items then delete last 25.346 us/op 18.822 us/op 1.35
OrderedSet add up to 256 items then delete last 35.699 us/op 24.143 us/op 1.48
Set add up to 256 items then delete middle 26.179 us/op 19.523 us/op 1.34
OrderedSet add up to 256 items then delete middle 65.110 us/op 46.228 us/op 1.41
transfer serialized Status (84 B) 2.4310 us/op 1.6900 us/op 1.44
copy serialized Status (84 B) 1.7350 us/op 1.2600 us/op 1.38
transfer serialized SignedVoluntaryExit (112 B) 2.5490 us/op 1.8030 us/op 1.41
copy serialized SignedVoluntaryExit (112 B) 1.7600 us/op 1.3840 us/op 1.27
transfer serialized ProposerSlashing (416 B) 3.6770 us/op 2.0760 us/op 1.77
copy serialized ProposerSlashing (416 B) 3.5760 us/op 1.9320 us/op 1.85
transfer serialized Attestation (485 B) 3.7150 us/op 2.1590 us/op 1.72
copy serialized Attestation (485 B) 3.0570 us/op 1.9330 us/op 1.58
transfer serialized AttesterSlashing (33232 B) 3.5450 us/op 2.0500 us/op 1.73
copy serialized AttesterSlashing (33232 B) 12.875 us/op 7.1600 us/op 1.80
transfer serialized Small SignedBeaconBlock (128000 B) 3.4270 us/op 2.6700 us/op 1.28
copy serialized Small SignedBeaconBlock (128000 B) 30.152 us/op 18.460 us/op 1.63
transfer serialized Avg SignedBeaconBlock (200000 B) 3.3550 us/op 3.1820 us/op 1.05
copy serialized Avg SignedBeaconBlock (200000 B) 42.553 us/op 30.251 us/op 1.41
transfer serialized BlobsSidecar (524380 B) 4.8700 us/op 3.7690 us/op 1.29
copy serialized BlobsSidecar (524380 B) 159.33 us/op 90.652 us/op 1.76
transfer serialized Big SignedBeaconBlock (1000000 B) 7.1300 us/op 3.9770 us/op 1.79
copy serialized Big SignedBeaconBlock (1000000 B) 606.34 us/op 165.56 us/op 3.66
pass gossip attestations to forkchoice per slot 5.5253 ms/op 4.7441 ms/op 1.16
forkChoice updateHead vc 100000 bc 64 eq 0 742.33 us/op 691.23 us/op 1.07
forkChoice updateHead vc 600000 bc 64 eq 0 6.8001 ms/op 8.8591 ms/op 0.77
forkChoice updateHead vc 1000000 bc 64 eq 0 9.6245 ms/op 7.5317 ms/op 1.28
forkChoice updateHead vc 600000 bc 320 eq 0 5.8468 ms/op 4.3029 ms/op 1.36
forkChoice updateHead vc 600000 bc 1200 eq 0 5.1138 ms/op 4.3211 ms/op 1.18
forkChoice updateHead vc 600000 bc 7200 eq 0 6.1965 ms/op 5.6189 ms/op 1.10
forkChoice updateHead vc 600000 bc 64 eq 1000 12.693 ms/op 11.190 ms/op 1.13
forkChoice updateHead vc 600000 bc 64 eq 10000 14.981 ms/op 11.894 ms/op 1.26
forkChoice updateHead vc 600000 bc 64 eq 300000 33.502 ms/op 16.394 ms/op 2.04
computeDeltas 500000 validators 300 proto nodes 7.4894 ms/op 6.6313 ms/op 1.13
computeDeltas 500000 validators 1200 proto nodes 7.3463 ms/op 6.7779 ms/op 1.08
computeDeltas 500000 validators 7200 proto nodes 6.9166 ms/op 6.6595 ms/op 1.04
computeDeltas 750000 validators 300 proto nodes 10.318 ms/op 10.049 ms/op 1.03
computeDeltas 750000 validators 1200 proto nodes 10.591 ms/op 9.9207 ms/op 1.07
computeDeltas 750000 validators 7200 proto nodes 10.457 ms/op 10.104 ms/op 1.03
computeDeltas 1400000 validators 300 proto nodes 20.403 ms/op 20.093 ms/op 1.02
computeDeltas 1400000 validators 1200 proto nodes 20.947 ms/op 19.740 ms/op 1.06
computeDeltas 1400000 validators 7200 proto nodes 20.268 ms/op 20.855 ms/op 0.97
computeDeltas 2100000 validators 300 proto nodes 30.403 ms/op 30.900 ms/op 0.98
computeDeltas 2100000 validators 1200 proto nodes 32.397 ms/op 30.338 ms/op 1.07
computeDeltas 2100000 validators 7200 proto nodes 32.870 ms/op 29.257 ms/op 1.12
altair processAttestation - 250000 vs - 7PWei normalcase 4.3835 ms/op 2.9732 ms/op 1.47
altair processAttestation - 250000 vs - 7PWei worstcase 5.6935 ms/op 4.2030 ms/op 1.35
altair processAttestation - setStatus - 1/6 committees join 233.81 us/op 197.11 us/op 1.19
altair processAttestation - setStatus - 1/3 committees join 408.95 us/op 380.99 us/op 1.07
altair processAttestation - setStatus - 1/2 committees join 631.01 us/op 510.41 us/op 1.24
altair processAttestation - setStatus - 2/3 committees join 713.48 us/op 623.70 us/op 1.14
altair processAttestation - setStatus - 4/5 committees join 1.0075 ms/op 880.31 us/op 1.14
altair processAttestation - setStatus - 100% committees join 1.0464 ms/op 1.0229 ms/op 1.02
altair processBlock - 250000 vs - 7PWei normalcase 12.957 ms/op 12.079 ms/op 1.07
altair processBlock - 250000 vs - 7PWei normalcase hashState 54.827 ms/op 37.690 ms/op 1.45
altair processBlock - 250000 vs - 7PWei worstcase 49.905 ms/op 41.652 ms/op 1.20
altair processBlock - 250000 vs - 7PWei worstcase hashState 146.08 ms/op 104.64 ms/op 1.40
phase0 processBlock - 250000 vs - 7PWei normalcase 4.0952 ms/op 3.0934 ms/op 1.32
phase0 processBlock - 250000 vs - 7PWei worstcase 38.262 ms/op 34.530 ms/op 1.11
altair processEth1Data - 250000 vs - 7PWei normalcase 773.10 us/op 715.75 us/op 1.08
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 22.206 us/op 17.176 us/op 1.29
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 76.020 us/op 50.923 us/op 1.49
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 36.579 us/op 22.845 us/op 1.60
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 22.570 us/op 20.326 us/op 1.11
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 224.29 us/op 221.68 us/op 1.01
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.5984 ms/op 1.4775 ms/op 1.08
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.5031 ms/op 1.8075 ms/op 1.38
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.4128 ms/op 1.9522 ms/op 1.24
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.7321 ms/op 4.5208 ms/op 1.05
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.9030 ms/op 2.7895 ms/op 1.04
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 7.8313 ms/op 7.0573 ms/op 1.11
Tree 40 250000 create 607.58 ms/op 374.44 ms/op 1.62
Tree 40 250000 get(125000) 232.23 ns/op 222.82 ns/op 1.04
Tree 40 250000 set(125000) 1.7610 us/op 1.0788 us/op 1.63
Tree 40 250000 toArray() 25.410 ms/op 21.927 ms/op 1.16
Tree 40 250000 iterate all - toArray() + loop 25.520 ms/op 20.944 ms/op 1.22
Tree 40 250000 iterate all - get(i) 85.123 ms/op 71.056 ms/op 1.20
MutableVector 250000 create 17.038 ms/op 13.424 ms/op 1.27
MutableVector 250000 get(125000) 7.0380 ns/op 6.5310 ns/op 1.08
MutableVector 250000 set(125000) 341.22 ns/op 293.10 ns/op 1.16
MutableVector 250000 toArray() 4.3206 ms/op 3.4342 ms/op 1.26
MutableVector 250000 iterate all - toArray() + loop 4.7392 ms/op 3.9579 ms/op 1.20
MutableVector 250000 iterate all - get(i) 1.6394 ms/op 1.5573 ms/op 1.05
Array 250000 create 3.9158 ms/op 3.5807 ms/op 1.09
Array 250000 clone - spread 1.5201 ms/op 1.4360 ms/op 1.06
Array 250000 get(125000) 1.5830 ns/op 1.1810 ns/op 1.34
Array 250000 set(125000) 5.6750 ns/op 4.3900 ns/op 1.29
Array 250000 iterate all - loop 181.02 us/op 170.33 us/op 1.06
effectiveBalanceIncrements clone Uint8Array 300000 72.332 us/op 41.806 us/op 1.73
effectiveBalanceIncrements clone MutableVector 300000 526.00 ns/op 454.00 ns/op 1.16
effectiveBalanceIncrements rw all Uint8Array 300000 218.73 us/op 201.46 us/op 1.09
effectiveBalanceIncrements rw all MutableVector 300000 146.44 ms/op 98.074 ms/op 1.49
phase0 afterProcessEpoch - 250000 vs - 7PWei 136.16 ms/op 114.39 ms/op 1.19
phase0 beforeProcessEpoch - 250000 vs - 7PWei 66.664 ms/op 52.825 ms/op 1.26
altair processEpoch - mainnet_e81889 628.75 ms/op 532.72 ms/op 1.18
mainnet_e81889 - altair beforeProcessEpoch 105.80 ms/op 86.994 ms/op 1.22
mainnet_e81889 - altair processJustificationAndFinalization 23.300 us/op 16.593 us/op 1.40
mainnet_e81889 - altair processInactivityUpdates 8.1556 ms/op 6.9656 ms/op 1.17
mainnet_e81889 - altair processRewardsAndPenalties 83.227 ms/op 45.878 ms/op 1.81
mainnet_e81889 - altair processRegistryUpdates 4.0050 us/op 3.1020 us/op 1.29
mainnet_e81889 - altair processSlashings 950.00 ns/op 443.00 ns/op 2.14
mainnet_e81889 - altair processEth1DataReset 1.0280 us/op 693.00 ns/op 1.48
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.8278 ms/op 1.4429 ms/op 1.27
mainnet_e81889 - altair processSlashingsReset 7.1570 us/op 5.7030 us/op 1.25
mainnet_e81889 - altair processRandaoMixesReset 11.216 us/op 5.6310 us/op 1.99
mainnet_e81889 - altair processHistoricalRootsUpdate 1.1020 us/op 743.00 ns/op 1.48
mainnet_e81889 - altair processParticipationFlagUpdates 4.9040 us/op 3.2820 us/op 1.49
mainnet_e81889 - altair processSyncCommitteeUpdates 1.8780 us/op 770.00 ns/op 2.44
mainnet_e81889 - altair afterProcessEpoch 134.07 ms/op 120.87 ms/op 1.11
capella processEpoch - mainnet_e217614 2.8327 s/op 2.4569 s/op 1.15
mainnet_e217614 - capella beforeProcessEpoch 891.09 ms/op 550.79 ms/op 1.62
mainnet_e217614 - capella processJustificationAndFinalization 59.009 us/op 20.586 us/op 2.87
mainnet_e217614 - capella processInactivityUpdates 54.171 ms/op 20.308 ms/op 2.67
mainnet_e217614 - capella processRewardsAndPenalties 602.15 ms/op 412.34 ms/op 1.46
mainnet_e217614 - capella processRegistryUpdates 48.200 us/op 37.181 us/op 1.30
mainnet_e217614 - capella processSlashings 1.7740 us/op 523.00 ns/op 3.39
mainnet_e217614 - capella processEth1DataReset 1.0480 us/op 544.00 ns/op 1.93
mainnet_e217614 - capella processEffectiveBalanceUpdates 7.1020 ms/op 10.458 ms/op 0.68
mainnet_e217614 - capella processSlashingsReset 6.3280 us/op 4.5790 us/op 1.38
mainnet_e217614 - capella processRandaoMixesReset 7.2310 us/op 4.9160 us/op 1.47
mainnet_e217614 - capella processHistoricalRootsUpdate 853.00 ns/op 695.00 ns/op 1.23
mainnet_e217614 - capella processParticipationFlagUpdates 4.4840 us/op 1.6930 us/op 2.65
mainnet_e217614 - capella afterProcessEpoch 348.42 ms/op 335.29 ms/op 1.04
phase0 processEpoch - mainnet_e58758 701.50 ms/op 472.09 ms/op 1.49
mainnet_e58758 - phase0 beforeProcessEpoch 255.87 ms/op 140.90 ms/op 1.82
mainnet_e58758 - phase0 processJustificationAndFinalization 35.289 us/op 16.422 us/op 2.15
mainnet_e58758 - phase0 processRewardsAndPenalties 77.732 ms/op 54.088 ms/op 1.44
mainnet_e58758 - phase0 processRegistryUpdates 24.756 us/op 10.610 us/op 2.33
mainnet_e58758 - phase0 processSlashings 2.2020 us/op 521.00 ns/op 4.23
mainnet_e58758 - phase0 processEth1DataReset 1.4060 us/op 410.00 ns/op 3.43
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.3819 ms/op 1.1715 ms/op 2.03
mainnet_e58758 - phase0 processSlashingsReset 6.7830 us/op 2.7330 us/op 2.48
mainnet_e58758 - phase0 processRandaoMixesReset 11.407 us/op 4.0110 us/op 2.84
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.8060 us/op 362.00 ns/op 4.99
mainnet_e58758 - phase0 processParticipationRecordUpdates 15.229 us/op 4.7320 us/op 3.22
mainnet_e58758 - phase0 afterProcessEpoch 127.44 ms/op 96.590 ms/op 1.32
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.8760 ms/op 1.4476 ms/op 1.99
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.2311 ms/op 1.5441 ms/op 1.44
altair processInactivityUpdates - 250000 normalcase 33.447 ms/op 33.371 ms/op 1.00
altair processInactivityUpdates - 250000 worstcase 37.422 ms/op 33.123 ms/op 1.13
phase0 processRegistryUpdates - 250000 normalcase 20.215 us/op 9.8600 us/op 2.05
phase0 processRegistryUpdates - 250000 badcase_full_deposits 683.36 us/op 434.29 us/op 1.57
phase0 processRegistryUpdates - 250000 worstcase 0.5 201.62 ms/op 155.69 ms/op 1.30
altair processRewardsAndPenalties - 250000 normalcase 63.392 ms/op 62.111 ms/op 1.02
altair processRewardsAndPenalties - 250000 worstcase 74.468 ms/op 61.482 ms/op 1.21
phase0 getAttestationDeltas - 250000 normalcase 14.963 ms/op 11.423 ms/op 1.31
phase0 getAttestationDeltas - 250000 worstcase 15.448 ms/op 11.792 ms/op 1.31
phase0 processSlashings - 250000 worstcase 147.46 us/op 133.33 us/op 1.11
altair processSyncCommitteeUpdates - 250000 192.99 ms/op 167.29 ms/op 1.15
BeaconState.hashTreeRoot - No change 1.0530 us/op 674.00 ns/op 1.56
BeaconState.hashTreeRoot - 1 full validator 201.25 us/op 185.64 us/op 1.08
BeaconState.hashTreeRoot - 32 full validator 1.7858 ms/op 1.6074 ms/op 1.11
BeaconState.hashTreeRoot - 512 full validator 20.876 ms/op 19.137 ms/op 1.09
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 202.06 us/op 200.65 us/op 1.01
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 3.0815 ms/op 2.7472 ms/op 1.12
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 38.747 ms/op 33.597 ms/op 1.15
BeaconState.hashTreeRoot - 1 balances 223.34 us/op 145.51 us/op 1.53
BeaconState.hashTreeRoot - 32 balances 1.8515 ms/op 1.1830 ms/op 1.57
BeaconState.hashTreeRoot - 512 balances 19.184 ms/op 14.032 ms/op 1.37
BeaconState.hashTreeRoot - 250000 balances 282.18 ms/op 231.36 ms/op 1.22
aggregationBits - 2048 els - zipIndexesInBitList 32.829 us/op 21.947 us/op 1.50
byteArrayEquals 32 84.343 ns/op 77.535 ns/op 1.09
Buffer.compare 32 60.581 ns/op 58.306 ns/op 1.04
byteArrayEquals 1024 2.2938 us/op 2.1079 us/op 1.09
Buffer.compare 1024 77.220 ns/op 73.945 ns/op 1.04
byteArrayEquals 16384 37.246 us/op 33.803 us/op 1.10
Buffer.compare 16384 277.22 ns/op 270.67 ns/op 1.02
byteArrayEquals 123687377 330.26 ms/op 263.83 ms/op 1.25
Buffer.compare 123687377 13.911 ms/op 10.284 ms/op 1.35
byteArrayEquals 32 - diff last byte 106.69 ns/op 78.304 ns/op 1.36
Buffer.compare 32 - diff last byte 70.002 ns/op 57.925 ns/op 1.21
byteArrayEquals 1024 - diff last byte 2.3370 us/op 2.2443 us/op 1.04
Buffer.compare 1024 - diff last byte 89.002 ns/op 74.049 ns/op 1.20
byteArrayEquals 16384 - diff last byte 44.963 us/op 35.555 us/op 1.26
Buffer.compare 16384 - diff last byte 361.69 ns/op 261.95 ns/op 1.38
byteArrayEquals 123687377 - diff last byte 308.09 ms/op 261.82 ms/op 1.18
Buffer.compare 123687377 - diff last byte 12.594 ms/op 8.4688 ms/op 1.49
byteArrayEquals 32 - random bytes 8.3620 ns/op 6.5570 ns/op 1.28
Buffer.compare 32 - random bytes 70.209 ns/op 63.932 ns/op 1.10
byteArrayEquals 1024 - random bytes 7.6680 ns/op 6.3180 ns/op 1.21
Buffer.compare 1024 - random bytes 71.417 ns/op 63.106 ns/op 1.13
byteArrayEquals 16384 - random bytes 7.2910 ns/op 6.3000 ns/op 1.16
Buffer.compare 16384 - random bytes 72.881 ns/op 63.194 ns/op 1.15
byteArrayEquals 123687377 - random bytes 18.100 ns/op 9.3700 ns/op 1.93
Buffer.compare 123687377 - random bytes 80.820 ns/op 75.220 ns/op 1.07
regular array get 100000 times 48.973 us/op 47.132 us/op 1.04
wrappedArray get 100000 times 48.585 us/op 47.403 us/op 1.02
arrayWithProxy get 100000 times 14.800 ms/op 14.802 ms/op 1.00
ssz.Root.equals 58.489 ns/op 56.130 ns/op 1.04
byteArrayEquals 57.350 ns/op 55.481 ns/op 1.03
Buffer.compare 12.740 ns/op 12.210 ns/op 1.04
shuffle list - 16384 els 7.4867 ms/op 7.2286 ms/op 1.04
shuffle list - 250000 els 108.63 ms/op 108.52 ms/op 1.00
processSlot - 1 slots 19.861 us/op 18.366 us/op 1.08
processSlot - 32 slots 4.0745 ms/op 4.5940 ms/op 0.89
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 70.461 ms/op 63.490 ms/op 1.11
getCommitteeAssignments - req 1 vs - 250000 vc 2.7201 ms/op 2.6030 ms/op 1.04
getCommitteeAssignments - req 100 vs - 250000 vc 4.1739 ms/op 3.7253 ms/op 1.12
getCommitteeAssignments - req 1000 vs - 250000 vc 4.6255 ms/op 4.1100 ms/op 1.13
findModifiedValidators - 10000 modified validators 590.92 ms/op 547.68 ms/op 1.08
findModifiedValidators - 1000 modified validators 543.93 ms/op 462.63 ms/op 1.18
findModifiedValidators - 100 modified validators 550.81 ms/op 427.58 ms/op 1.29
findModifiedValidators - 10 modified validators 561.36 ms/op 433.52 ms/op 1.29
findModifiedValidators - 1 modified validators 551.46 ms/op 413.46 ms/op 1.33
findModifiedValidators - no difference 599.62 ms/op 400.03 ms/op 1.50
compare ViewDUs 7.8685 s/op 4.5912 s/op 1.71
compare each validator Uint8Array 2.0961 s/op 1.6007 s/op 1.31
compare ViewDU to Uint8Array 1.3115 s/op 1.3866 s/op 0.95
migrate state 1000000 validators, 24 modified, 0 new 920.39 ms/op 863.24 ms/op 1.07
migrate state 1000000 validators, 1700 modified, 1000 new 1.3346 s/op 1.0714 s/op 1.25
migrate state 1000000 validators, 3400 modified, 2000 new 1.7749 s/op 1.3535 s/op 1.31
migrate state 1500000 validators, 24 modified, 0 new 1.0176 s/op 827.74 ms/op 1.23
migrate state 1500000 validators, 1700 modified, 1000 new 1.2795 s/op 1.0906 s/op 1.17
migrate state 1500000 validators, 3400 modified, 2000 new 1.4224 s/op 1.3264 s/op 1.07
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.7600 ns/op 4.4500 ns/op 1.07
state getBlockRootAtSlot - 250000 vs - 7PWei 578.01 ns/op 557.37 ns/op 1.04
computeProposers - vc 250000 9.8300 ms/op 9.3982 ms/op 1.05
computeEpochShuffling - vc 250000 105.94 ms/op 106.92 ms/op 0.99
getNextSyncCommittee - vc 250000 160.12 ms/op 159.91 ms/op 1.00
computeSigningRoot for AttestationData 25.716 us/op 26.436 us/op 0.97
hash AttestationData serialized data then Buffer.toString(base64) 2.4666 us/op 2.4054 us/op 1.03
toHexString serialized data 1.1430 us/op 1.1814 us/op 0.97
Buffer.toString(base64) 235.24 ns/op 245.01 ns/op 0.96

Please sign in to comment.