Skip to content

Commit

Permalink
refactor(test): use the configurable logger consistently via top leve…
Browse files Browse the repository at this point in the history
…l interface of crucible (#6871)

* Use the logger consistently

* Fix types

* Fix lint errors

* Fix types
  • Loading branch information
nazarhussain authored Jun 10, 2024
1 parent 4ef27ac commit ff253a7
Show file tree
Hide file tree
Showing 12 changed files with 206 additions and 227 deletions.
5 changes: 2 additions & 3 deletions packages/cli/test/utils/crucible/clients/beacon/lighthouse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,11 @@ export const generateLighthouseBeaconNode: BeaconNodeGenerator<BeaconClient.Ligh
health: async () => {
try {
await got.get(`http://127.0.0.1:${ports.beacon.httpPort}/eth/v1/node/health`);
return {ok: true};
} catch (err) {
if (err instanceof RequestError && err.code !== "ECONNREFUSED") {
return {ok: true};
return;
}
return {ok: false, reason: (err as Error).message, checkId: "/eth/v1/node/health query"};
throw err;
}
},
},
Expand Down
7 changes: 1 addition & 6 deletions packages/cli/test/utils/crucible/clients/beacon/lodestar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,7 @@ export const generateLodestarBeaconNode: BeaconNodeGenerator<BeaconClient.Lodest
stdoutFilePath: logFilePath,
},
health: async () => {
try {
await got.get(`http://${address}:${ports.beacon.httpPort}/eth/v1/node/health`);
return {ok: true};
} catch (err) {
return {ok: false, reason: (err as Error).message, checkId: "eth/v1/node/health query"};
}
await got.get(`http://${address}:${ports.beacon.httpPort}/eth/v1/node/health`);
},
},
]);
Expand Down
7 changes: 1 addition & 6 deletions packages/cli/test/utils/crucible/clients/execution/geth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,7 @@ export const generateGethNode: ExecutionNodeGenerator<ExecutionClient.Geth> = (o
stdoutFilePath: logFilePath,
},
health: async () => {
try {
await got.post(ethRpcPublicUrl, {json: {jsonrpc: "2.0", method: "net_version", params: [], id: 67}});
return {ok: true};
} catch (err) {
return {ok: false, reason: (err as Error).message, checkId: "JSON RPC query net_version"};
}
await got.post(ethRpcPublicUrl, {json: {jsonrpc: "2.0", method: "net_version", params: [], id: 67}});
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,7 @@ export const generateNethermindNode: ExecutionNodeGenerator<ExecutionClient.Neth
stdoutFilePath: logFilePath,
},
health: async () => {
try {
await got.post(ethRpcPublicUrl, {json: {jsonrpc: "2.0", method: "net_version", params: [], id: 67}});
return {ok: true};
} catch (err) {
return {ok: false, reason: (err as Error).message, checkId: "JSON RPC query net_version"};
}
await got.post(ethRpcPublicUrl, {json: {jsonrpc: "2.0", method: "net_version", params: [], id: 67}});
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,11 @@ export const generateLighthouseValidatorNode: ValidatorNodeGenerator<ValidatorCl
health: async () => {
try {
await got.get(`http://127.0.0.1:${ports.validator.keymanagerPort}/lighthouse/health`);
return {ok: true};
} catch (err) {
if (err instanceof RequestError) {
return {ok: true};
return;
}
return {ok: false, reason: (err as Error).message, checkId: "/lighthouse/health query"};
throw err;
}
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,7 @@ export const generateLodestarValidatorNode: ValidatorNodeGenerator<ValidatorClie
stdoutFilePath: logFilePath,
},
health: async () => {
try {
await got.get(`http://127.0.0.1:${ports.validator.keymanagerPort}/eth/v1/keystores`);
return {ok: true};
} catch (err) {
return {ok: false, reason: (err as Error).message, checkId: "eth/v1/keystores query"};
}
await got.get(`http://127.0.0.1:${ports.validator.keymanagerPort}/eth/v1/keystores`);
},
},
]);
Expand Down
7 changes: 3 additions & 4 deletions packages/cli/test/utils/crucible/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {ApiClient as KeyManagerApi} from "@lodestar/api/keymanager";
import {ChainForkConfig} from "@lodestar/config";
import {ForkName} from "@lodestar/params";
import {Slot, allForks, Epoch} from "@lodestar/types";
import {Logger} from "@lodestar/logger";
import {LogLevel, Logger} from "@lodestar/logger";
import {BeaconArgs} from "../../../src/cmds/beacon/options.js";
import {IValidatorCliArgs} from "../../../src/cmds/validator/options.js";
import {GlobalArgs} from "../../../src/options/index.js";
Expand All @@ -29,6 +29,7 @@ export type SimulationOptions = {
controller: AbortController;
genesisTime: number;
trustedSetup?: boolean;
logLevel?: LogLevel;
};

export enum BeaconClient {
Expand Down Expand Up @@ -234,8 +235,6 @@ export type ExecutionNodeGenerator<E extends ExecutionClient> = (
runner: IRunner
) => ExecutionNode;

export type HealthStatus = {ok: true} | {ok: false; reason: string; checkId: string};

export type JobOptions<T extends RunnerType = RunnerType.ChildProcess | RunnerType.Docker> = {
readonly id: string;

Expand All @@ -257,7 +256,7 @@ export type JobOptions<T extends RunnerType = RunnerType.ChildProcess | RunnerTy

// Will be called frequently to check the health of job startup
// If not present then wait for the job to exit
health?(): Promise<HealthStatus>;
health?(): Promise<void>;

// Called once before the `job.start` is called
bootstrap?(): Promise<void>;
Expand Down
23 changes: 8 additions & 15 deletions packages/cli/test/utils/crucible/runner/childProcessRunner.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {ChildProcess} from "node:child_process";
import {
spawnChildProcess,
stopChildProcess,
ChildProcessHealthStatus,
SpawnChildProcessOptions,
ChildProcessResolve,
} from "@lodestar/test-utils";
import {spawnChildProcess, stopChildProcess, SpawnChildProcessOptions, ChildProcessResolve} from "@lodestar/test-utils";
import {Logger} from "@lodestar/logger";
import {Job, JobOptions, RunnerEnv, RunnerType} from "../interfaces.js";

export class ChildProcessRunner implements RunnerEnv<RunnerType.ChildProcess> {
type = RunnerType.ChildProcess as const;
private logger: Logger;

constructor(opts: {logger: Logger}) {
this.logger = opts.logger;
}

create(jobOption: Omit<JobOptions<RunnerType.ChildProcess>, "children">): Job {
let childProcess: ChildProcess;
Expand All @@ -24,14 +24,7 @@ export class ChildProcessRunner implements RunnerEnv<RunnerType.ChildProcess> {

if (health) {
spawnOpts.healthTimeoutMs = 30000;
spawnOpts.health = async (): Promise<ChildProcessHealthStatus> =>
health()
.then((status) => {
return status.ok ? {healthy: true} : {healthy: false};
})
.catch((error) => {
return {healthy: false, message: (error as Error).message};
});
spawnOpts.health = health;
} else {
spawnOpts.resolveOn = ChildProcessResolve.Completion;
}
Expand Down
32 changes: 9 additions & 23 deletions packages/cli/test/utils/crucible/runner/dockerRunner.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
import {ChildProcess} from "node:child_process";
import {Logger} from "@lodestar/logger";
import {sleep} from "@lodestar/utils";
import {
ChildProcessHealthStatus,
SpawnChildProcessOptions,
execChildProcess,
spawnChildProcess,
ChildProcessResolve,
} from "@lodestar/test-utils";
import {SpawnChildProcessOptions, execChildProcess, spawnChildProcess, ChildProcessResolve} from "@lodestar/test-utils";
import {Job, JobOptions, RunnerEnv, RunnerType} from "../interfaces.js";

const dockerNetworkIpRange = "192.168.0";
const dockerNetworkName = "sim-env-net";

export class DockerRunner implements RunnerEnv<RunnerType.Docker> {
type = RunnerType.Docker as const;
private logger: Logger;

private ipIndex = 2;
private logFilePath: string;

constructor(logFilePath: string) {
this.logFilePath = logFilePath;
constructor(opts: {logger: Logger}) {
this.logger = opts.logger;
}

async start(): Promise<void> {
try {
await execChildProcess(`docker network create --subnet ${dockerNetworkIpRange}.0/24 ${dockerNetworkName}`, {
logPrefix: "docker-runner",
pipeStdioToFile: this.logFilePath,
logger: this.logger,
});
} catch {
// During multiple sim tests files the network might already exist
Expand All @@ -38,8 +32,7 @@ export class DockerRunner implements RunnerEnv<RunnerType.Docker> {
for (let i = 0; i < 5; i++) {
try {
await execChildProcess(`docker network rm ${dockerNetworkName}`, {
logPrefix: "docker-runner",
pipeStdioToFile: this.logFilePath,
logger: this.logger,
});
return;
} catch {
Expand Down Expand Up @@ -97,14 +90,7 @@ export class DockerRunner implements RunnerEnv<RunnerType.Docker> {

if (health) {
spawnOpts.healthTimeoutMs = 30000;
spawnOpts.health = async (): Promise<ChildProcessHealthStatus> =>
health()
.then((status) => {
return status.ok ? {healthy: true} : {healthy: false};
})
.catch((error) => {
return {healthy: false, message: (error as Error).message};
});
spawnOpts.health = health;
} else {
spawnOpts.resolveOn = ChildProcessResolve.Completion;
}
Expand All @@ -120,7 +106,7 @@ export class DockerRunner implements RunnerEnv<RunnerType.Docker> {
}
// TODO: Debug why stopping the process was not killing the container
// await stopChildProcess(childProcess);
await execChildProcess(`docker stop ${jobOption.id} --time 2 || true`, {pipeStdioToParent: true});
await execChildProcess(`docker stop ${jobOption.id} --time 2 || true`, {logger: this.logger});
},
};
}
Expand Down
15 changes: 7 additions & 8 deletions packages/cli/test/utils/crucible/runner/index.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import {EventEmitter} from "node:events";
import path from "node:path";
import {Logger} from "@lodestar/logger";
import {LoggerNode} from "@lodestar/logger/node";
import {IRunner, Job, JobOptions, RunnerEvent, RunnerType} from "../interfaces.js";
import {ChildProcessRunner} from "./childProcessRunner.js";
import {DockerRunner} from "./dockerRunner.js";

export class Runner implements IRunner {
readonly logger: Logger;
readonly logger: LoggerNode;
private emitter = new EventEmitter({captureRejections: true});
private runners: {[RunnerType.ChildProcess]: ChildProcessRunner; [RunnerType.Docker]: DockerRunner};

constructor({logsDir, logger}: {logsDir: string; logger: Logger}) {
constructor({logger}: {logger: LoggerNode}) {
this.logger = logger;
this.runners = {
[RunnerType.ChildProcess]: new ChildProcessRunner(),
[RunnerType.Docker]: new DockerRunner(path.join(logsDir, "docker_runner.log")),
[RunnerType.ChildProcess]: new ChildProcessRunner({logger: this.logger.child({module: "cp"})}),
[RunnerType.Docker]: new DockerRunner({logger: this.logger.child({module: "docker"})}),
};
}

Expand Down Expand Up @@ -59,7 +58,7 @@ export class Runner implements IRunner {
await job.start();

this.emitter.emit("started", jobOption.id);
this.logger.info(`Started "${jobOption.id}" logFile=${jobOption.logs.stdoutFilePath}...`);
this.logger.debug(`Started "${jobOption.id}" logFile=${jobOption.logs.stdoutFilePath}...`);

if (childrenJob) await childrenJob.start();
});
Expand All @@ -71,7 +70,7 @@ export class Runner implements IRunner {
if (childrenJob) await childrenJob.stop();
await job.stop();
this.emitter.emit("stopped", jobOption.id);
this.logger.info(`Stopped "${jobOption.id}"...`);
this.logger.debug(`Stopped "${jobOption.id}"...`);
});
}

Expand Down
7 changes: 5 additions & 2 deletions packages/cli/test/utils/crucible/simulation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ export class Simulation {
timestampFormat: {
format: TimestampFormatCode.DateRegular,
},
file: {level: LogLevel.debug, filepath: path.join(options.logsDir, `simulation-${this.options.id}.log`)},
file: {
level: options.logLevel ?? LogLevel.debug,
filepath: path.join(options.logsDir, `simulation-${this.options.id}.log`),
},
});
this.clock = new EpochClock({
genesisTime: this.options.genesisTime + this.forkConfig.GENESIS_DELAY,
Expand All @@ -74,7 +77,7 @@ export class Simulation {
});

this.externalSigner = new ExternalSignerServer([]);
this.runner = new Runner({logsDir: this.options.logsDir, logger: this.logger.child({module: "runner"})});
this.runner = new Runner({logger: this.logger});
this.tracker = SimulationTracker.initWithDefaults({
logsDir: options.logsDir,
logger: this.logger,
Expand Down
Loading

1 comment on commit ff253a7

@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: ff253a7 Previous: 14855ea Ratio
forkChoice updateHead vc 600000 bc 64 eq 300000 73.838 ms/op 14.722 ms/op 5.02
Full benchmark results
Benchmark suite Current: ff253a7 Previous: 14855ea Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 566.25 us/op 842.05 us/op 0.67
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 60.172 us/op 49.203 us/op 1.22
BLS verify - blst-native 1.3310 ms/op 1.2079 ms/op 1.10
BLS verifyMultipleSignatures 3 - blst-native 2.8969 ms/op 2.5709 ms/op 1.13
BLS verifyMultipleSignatures 8 - blst-native 6.4035 ms/op 5.6705 ms/op 1.13
BLS verifyMultipleSignatures 32 - blst-native 23.830 ms/op 20.917 ms/op 1.14
BLS verifyMultipleSignatures 64 - blst-native 48.311 ms/op 41.047 ms/op 1.18
BLS verifyMultipleSignatures 128 - blst-native 100.25 ms/op 81.417 ms/op 1.23
BLS deserializing 10000 signatures 949.93 ms/op 841.72 ms/op 1.13
BLS deserializing 100000 signatures 9.7080 s/op 8.4261 s/op 1.15
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.5031 ms/op 1.2146 ms/op 1.24
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.6520 ms/op 1.3729 ms/op 1.20
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.6124 ms/op 2.1451 ms/op 1.22
BLS verifyMultipleSignatures - same message - 64 - blst-native 3.8801 ms/op 3.5655 ms/op 1.09
BLS verifyMultipleSignatures - same message - 128 - blst-native 7.2870 ms/op 5.3018 ms/op 1.37
BLS aggregatePubkeys 32 - blst-native 29.809 us/op 24.034 us/op 1.24
BLS aggregatePubkeys 128 - blst-native 107.20 us/op 94.785 us/op 1.13
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 88.909 ms/op 61.503 ms/op 1.45
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 72.533 ms/op 46.955 ms/op 1.54
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 40.182 ms/op 28.615 ms/op 1.40
getSlashingsAndExits - default max 180.05 us/op 74.700 us/op 2.41
getSlashingsAndExits - 2k 550.80 us/op 254.20 us/op 2.17
proposeBlockBody type=full, size=empty 7.3523 ms/op 4.9966 ms/op 1.47
isKnown best case - 1 super set check 710.00 ns/op 276.00 ns/op 2.57
isKnown normal case - 2 super set checks 737.00 ns/op 265.00 ns/op 2.78
isKnown worse case - 16 super set checks 710.00 ns/op 260.00 ns/op 2.73
InMemoryCheckpointStateCache - add get delete 7.1850 us/op 4.2220 us/op 1.70
validate api signedAggregateAndProof - struct 3.2465 ms/op 2.5720 ms/op 1.26
validate gossip signedAggregateAndProof - struct 2.9356 ms/op 2.5780 ms/op 1.14
validate gossip attestation - vc 640000 1.4338 ms/op 1.2431 ms/op 1.15
batch validate gossip attestation - vc 640000 - chunk 32 194.93 us/op 144.93 us/op 1.35
batch validate gossip attestation - vc 640000 - chunk 64 156.41 us/op 129.23 us/op 1.21
batch validate gossip attestation - vc 640000 - chunk 128 140.62 us/op 124.97 us/op 1.13
batch validate gossip attestation - vc 640000 - chunk 256 131.45 us/op 116.21 us/op 1.13
pickEth1Vote - no votes 1.3909 ms/op 1.0583 ms/op 1.31
pickEth1Vote - max votes 12.256 ms/op 6.3184 ms/op 1.94
pickEth1Vote - Eth1Data hashTreeRoot value x2048 19.315 ms/op 11.337 ms/op 1.70
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 23.485 ms/op 14.968 ms/op 1.57
pickEth1Vote - Eth1Data fastSerialize value x2048 542.01 us/op 490.61 us/op 1.10
pickEth1Vote - Eth1Data fastSerialize tree x2048 4.3803 ms/op 6.7930 ms/op 0.64
bytes32 toHexString 568.00 ns/op 433.00 ns/op 1.31
bytes32 Buffer.toString(hex) 272.00 ns/op 245.00 ns/op 1.11
bytes32 Buffer.toString(hex) from Uint8Array 488.00 ns/op 355.00 ns/op 1.37
bytes32 Buffer.toString(hex) + 0x 313.00 ns/op 248.00 ns/op 1.26
Object access 1 prop 0.19000 ns/op 0.14700 ns/op 1.29
Map access 1 prop 0.14600 ns/op 0.13900 ns/op 1.05
Object get x1000 6.3450 ns/op 6.1760 ns/op 1.03
Map get x1000 6.9510 ns/op 6.6220 ns/op 1.05
Object set x1000 50.200 ns/op 33.838 ns/op 1.48
Map set x1000 33.821 ns/op 22.413 ns/op 1.51
Return object 10000 times 0.32030 ns/op 0.29050 ns/op 1.10
Throw Error 10000 times 3.5825 us/op 3.4325 us/op 1.04
fastMsgIdFn sha256 / 200 bytes 2.5110 us/op 2.1930 us/op 1.15
fastMsgIdFn h32 xxhash / 200 bytes 322.00 ns/op 231.00 ns/op 1.39
fastMsgIdFn h64 xxhash / 200 bytes 318.00 ns/op 271.00 ns/op 1.17
fastMsgIdFn sha256 / 1000 bytes 8.4530 us/op 7.4330 us/op 1.14
fastMsgIdFn h32 xxhash / 1000 bytes 480.00 ns/op 358.00 ns/op 1.34
fastMsgIdFn h64 xxhash / 1000 bytes 390.00 ns/op 342.00 ns/op 1.14
fastMsgIdFn sha256 / 10000 bytes 72.701 us/op 64.252 us/op 1.13
fastMsgIdFn h32 xxhash / 10000 bytes 2.1760 us/op 1.8140 us/op 1.20
fastMsgIdFn h64 xxhash / 10000 bytes 1.4060 us/op 1.1930 us/op 1.18
send data - 1000 256B messages 17.160 ms/op 11.535 ms/op 1.49
send data - 1000 512B messages 23.000 ms/op 16.518 ms/op 1.39
send data - 1000 1024B messages 32.074 ms/op 25.909 ms/op 1.24
send data - 1000 1200B messages 23.999 ms/op 18.455 ms/op 1.30
send data - 1000 2048B messages 36.771 ms/op 31.063 ms/op 1.18
send data - 1000 4096B messages 36.951 ms/op 30.323 ms/op 1.22
send data - 1000 16384B messages 91.637 ms/op 68.164 ms/op 1.34
send data - 1000 65536B messages 249.69 ms/op 200.62 ms/op 1.24
enrSubnets - fastDeserialize 64 bits 1.7370 us/op 1.1120 us/op 1.56
enrSubnets - ssz BitVector 64 bits 494.00 ns/op 360.00 ns/op 1.37
enrSubnets - fastDeserialize 4 bits 227.00 ns/op 149.00 ns/op 1.52
enrSubnets - ssz BitVector 4 bits 483.00 ns/op 364.00 ns/op 1.33
prioritizePeers score -10:0 att 32-0.1 sync 2-0 204.31 us/op 138.86 us/op 1.47
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 223.82 us/op 170.04 us/op 1.32
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 356.19 us/op 236.54 us/op 1.51
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 515.38 us/op 385.47 us/op 1.34
prioritizePeers score 0:0 att 64-1 sync 4-1 1.0434 ms/op 585.45 us/op 1.78
array of 16000 items push then shift 2.1462 us/op 1.6180 us/op 1.33
LinkedList of 16000 items push then shift 10.144 ns/op 7.2190 ns/op 1.41
array of 16000 items push then pop 165.37 ns/op 107.70 ns/op 1.54
LinkedList of 16000 items push then pop 8.8790 ns/op 7.1720 ns/op 1.24
array of 24000 items push then shift 3.2436 us/op 2.4083 us/op 1.35
LinkedList of 24000 items push then shift 10.557 ns/op 7.3280 ns/op 1.44
array of 24000 items push then pop 218.51 ns/op 136.41 ns/op 1.60
LinkedList of 24000 items push then pop 9.1160 ns/op 7.2260 ns/op 1.26
intersect bitArray bitLen 8 7.4280 ns/op 6.4330 ns/op 1.15
intersect array and set length 8 71.239 ns/op 46.472 ns/op 1.53
intersect bitArray bitLen 128 33.053 ns/op 30.107 ns/op 1.10
intersect array and set length 128 958.40 ns/op 681.46 ns/op 1.41
bitArray.getTrueBitIndexes() bitLen 128 2.1850 us/op 1.6820 us/op 1.30
bitArray.getTrueBitIndexes() bitLen 248 4.7000 us/op 3.0670 us/op 1.53
bitArray.getTrueBitIndexes() bitLen 512 9.1070 us/op 6.1270 us/op 1.49
Buffer.concat 32 items 1.1960 us/op 943.00 ns/op 1.27
Uint8Array.set 32 items 1.9110 us/op 2.2540 us/op 0.85
Buffer.copy 2.3880 us/op 2.4630 us/op 0.97
Uint8Array.set - with subarray 3.7480 us/op 2.7140 us/op 1.38
Uint8Array.set - without subarray 1.8990 us/op 1.4970 us/op 1.27
Set add up to 64 items then delete first 3.3985 us/op 2.1437 us/op 1.59
OrderedSet add up to 64 items then delete first 5.3623 us/op 3.2881 us/op 1.63
Set add up to 64 items then delete last 3.9550 us/op 2.4138 us/op 1.64
OrderedSet add up to 64 items then delete last 5.7294 us/op 3.5351 us/op 1.62
Set add up to 64 items then delete middle 3.6915 us/op 2.4498 us/op 1.51
OrderedSet add up to 64 items then delete middle 7.6669 us/op 5.1130 us/op 1.50
Set add up to 128 items then delete first 7.3534 us/op 4.9645 us/op 1.48
OrderedSet add up to 128 items then delete first 11.574 us/op 7.7510 us/op 1.49
Set add up to 128 items then delete last 7.1334 us/op 4.7724 us/op 1.49
OrderedSet add up to 128 items then delete last 11.443 us/op 7.0127 us/op 1.63
Set add up to 128 items then delete middle 7.5259 us/op 4.7167 us/op 1.60
OrderedSet add up to 128 items then delete middle 18.675 us/op 13.335 us/op 1.40
Set add up to 256 items then delete first 16.399 us/op 10.034 us/op 1.63
OrderedSet add up to 256 items then delete first 25.764 us/op 15.631 us/op 1.65
Set add up to 256 items then delete last 15.176 us/op 9.5107 us/op 1.60
OrderedSet add up to 256 items then delete last 23.902 us/op 14.207 us/op 1.68
Set add up to 256 items then delete middle 15.139 us/op 9.4065 us/op 1.61
OrderedSet add up to 256 items then delete middle 56.248 us/op 40.149 us/op 1.40
transfer serialized Status (84 B) 1.8610 us/op 1.4640 us/op 1.27
copy serialized Status (84 B) 1.6060 us/op 1.1640 us/op 1.38
transfer serialized SignedVoluntaryExit (112 B) 2.1790 us/op 1.6410 us/op 1.33
copy serialized SignedVoluntaryExit (112 B) 1.7400 us/op 1.2030 us/op 1.45
transfer serialized ProposerSlashing (416 B) 2.6390 us/op 2.0550 us/op 1.28
copy serialized ProposerSlashing (416 B) 2.0590 us/op 1.5090 us/op 1.36
transfer serialized Attestation (485 B) 2.2810 us/op 1.6050 us/op 1.42
copy serialized Attestation (485 B) 2.8450 us/op 1.5750 us/op 1.81
transfer serialized AttesterSlashing (33232 B) 2.8980 us/op 2.0270 us/op 1.43
copy serialized AttesterSlashing (33232 B) 10.141 us/op 4.8730 us/op 2.08
transfer serialized Small SignedBeaconBlock (128000 B) 4.0000 us/op 2.7450 us/op 1.46
copy serialized Small SignedBeaconBlock (128000 B) 32.794 us/op 14.011 us/op 2.34
transfer serialized Avg SignedBeaconBlock (200000 B) 5.2380 us/op 3.3640 us/op 1.56
copy serialized Avg SignedBeaconBlock (200000 B) 48.345 us/op 21.251 us/op 2.27
transfer serialized BlobsSidecar (524380 B) 6.4660 us/op 3.1320 us/op 2.06
copy serialized BlobsSidecar (524380 B) 147.44 us/op 88.126 us/op 1.67
transfer serialized Big SignedBeaconBlock (1000000 B) 6.6190 us/op 3.0010 us/op 2.21
copy serialized Big SignedBeaconBlock (1000000 B) 267.26 us/op 143.00 us/op 1.87
pass gossip attestations to forkchoice per slot 4.0568 ms/op 2.9812 ms/op 1.36
forkChoice updateHead vc 100000 bc 64 eq 0 613.60 us/op 487.16 us/op 1.26
forkChoice updateHead vc 600000 bc 64 eq 0 4.2988 ms/op 3.0584 ms/op 1.41
forkChoice updateHead vc 1000000 bc 64 eq 0 7.4005 ms/op 5.2555 ms/op 1.41
forkChoice updateHead vc 600000 bc 320 eq 0 4.0507 ms/op 3.5567 ms/op 1.14
forkChoice updateHead vc 600000 bc 1200 eq 0 4.4448 ms/op 3.0360 ms/op 1.46
forkChoice updateHead vc 600000 bc 7200 eq 0 6.0651 ms/op 3.4649 ms/op 1.75
forkChoice updateHead vc 600000 bc 64 eq 1000 20.542 ms/op 10.461 ms/op 1.96
forkChoice updateHead vc 600000 bc 64 eq 10000 19.573 ms/op 10.841 ms/op 1.81
forkChoice updateHead vc 600000 bc 64 eq 300000 73.838 ms/op 14.722 ms/op 5.02
computeDeltas 500000 validators 300 proto nodes 6.9559 ms/op 3.4851 ms/op 2.00
computeDeltas 500000 validators 1200 proto nodes 6.8333 ms/op 3.5093 ms/op 1.95
computeDeltas 500000 validators 7200 proto nodes 6.2646 ms/op 3.5005 ms/op 1.79
computeDeltas 750000 validators 300 proto nodes 9.1945 ms/op 5.1852 ms/op 1.77
computeDeltas 750000 validators 1200 proto nodes 7.7589 ms/op 5.1219 ms/op 1.51
computeDeltas 750000 validators 7200 proto nodes 7.5843 ms/op 5.1559 ms/op 1.47
computeDeltas 1400000 validators 300 proto nodes 15.151 ms/op 9.5973 ms/op 1.58
computeDeltas 1400000 validators 1200 proto nodes 12.889 ms/op 9.8207 ms/op 1.31
computeDeltas 1400000 validators 7200 proto nodes 12.181 ms/op 9.7398 ms/op 1.25
computeDeltas 2100000 validators 300 proto nodes 19.190 ms/op 14.557 ms/op 1.32
computeDeltas 2100000 validators 1200 proto nodes 18.545 ms/op 14.673 ms/op 1.26
computeDeltas 2100000 validators 7200 proto nodes 17.256 ms/op 14.723 ms/op 1.17
altair processAttestation - 250000 vs - 7PWei normalcase 1.9577 ms/op 1.7706 ms/op 1.11
altair processAttestation - 250000 vs - 7PWei worstcase 3.1392 ms/op 2.4851 ms/op 1.26
altair processAttestation - setStatus - 1/6 committees join 105.78 us/op 93.452 us/op 1.13
altair processAttestation - setStatus - 1/3 committees join 207.41 us/op 176.08 us/op 1.18
altair processAttestation - setStatus - 1/2 committees join 266.74 us/op 254.38 us/op 1.05
altair processAttestation - setStatus - 2/3 committees join 349.49 us/op 327.96 us/op 1.07
altair processAttestation - setStatus - 4/5 committees join 531.29 us/op 526.38 us/op 1.01
altair processAttestation - setStatus - 100% committees join 622.15 us/op 589.53 us/op 1.06
altair processBlock - 250000 vs - 7PWei normalcase 6.4184 ms/op 5.2086 ms/op 1.23
altair processBlock - 250000 vs - 7PWei normalcase hashState 30.924 ms/op 26.457 ms/op 1.17
altair processBlock - 250000 vs - 7PWei worstcase 43.337 ms/op 46.450 ms/op 0.93
altair processBlock - 250000 vs - 7PWei worstcase hashState 92.219 ms/op 90.511 ms/op 1.02
phase0 processBlock - 250000 vs - 7PWei normalcase 2.0154 ms/op 2.3637 ms/op 0.85
phase0 processBlock - 250000 vs - 7PWei worstcase 31.958 ms/op 30.508 ms/op 1.05
altair processEth1Data - 250000 vs - 7PWei normalcase 346.27 us/op 418.59 us/op 0.83
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 8.7450 us/op 8.3980 us/op 1.04
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 30.755 us/op 35.366 us/op 0.87
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 10.042 us/op 13.356 us/op 0.75
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 8.0380 us/op 9.6500 us/op 0.83
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 113.30 us/op 141.66 us/op 0.80
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 818.73 us/op 762.32 us/op 1.07
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.0784 ms/op 1.0140 ms/op 1.06
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.0657 ms/op 949.03 us/op 1.12
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.1223 ms/op 2.5009 ms/op 1.25
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.8687 ms/op 1.8269 ms/op 1.02
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.3715 ms/op 4.3170 ms/op 1.01
Tree 40 250000 create 243.61 ms/op 279.38 ms/op 0.87
Tree 40 250000 get(125000) 164.91 ns/op 162.63 ns/op 1.01
Tree 40 250000 set(125000) 733.35 ns/op 924.03 ns/op 0.79
Tree 40 250000 toArray() 19.248 ms/op 22.598 ms/op 0.85
Tree 40 250000 iterate all - toArray() + loop 19.422 ms/op 22.773 ms/op 0.85
Tree 40 250000 iterate all - get(i) 60.574 ms/op 61.348 ms/op 0.99
MutableVector 250000 create 10.912 ms/op 9.2495 ms/op 1.18
MutableVector 250000 get(125000) 7.3540 ns/op 6.5090 ns/op 1.13
MutableVector 250000 set(125000) 233.65 ns/op 278.30 ns/op 0.84
MutableVector 250000 toArray() 4.6253 ms/op 5.0603 ms/op 0.91
MutableVector 250000 iterate all - toArray() + loop 4.4357 ms/op 5.2390 ms/op 0.85
MutableVector 250000 iterate all - get(i) 1.7378 ms/op 1.7054 ms/op 1.02
Array 250000 create 4.3207 ms/op 4.5569 ms/op 0.95
Array 250000 clone - spread 1.7960 ms/op 2.0674 ms/op 0.87
Array 250000 get(125000) 0.46500 ns/op 0.45300 ns/op 1.03
Array 250000 set(125000) 0.47700 ns/op 0.47900 ns/op 1.00
Array 250000 iterate all - loop 92.672 us/op 92.013 us/op 1.01
effectiveBalanceIncrements clone Uint8Array 300000 38.460 us/op 61.230 us/op 0.63
effectiveBalanceIncrements clone MutableVector 300000 133.00 ns/op 129.00 ns/op 1.03
effectiveBalanceIncrements rw all Uint8Array 300000 211.71 us/op 210.89 us/op 1.00
effectiveBalanceIncrements rw all MutableVector 300000 91.456 ms/op 105.54 ms/op 0.87
phase0 afterProcessEpoch - 250000 vs - 7PWei 97.275 ms/op 92.492 ms/op 1.05
phase0 beforeProcessEpoch - 250000 vs - 7PWei 43.945 ms/op 46.613 ms/op 0.94
altair processEpoch - mainnet_e81889 439.50 ms/op 392.78 ms/op 1.12
mainnet_e81889 - altair beforeProcessEpoch 73.329 ms/op 61.640 ms/op 1.19
mainnet_e81889 - altair processJustificationAndFinalization 14.015 us/op 21.905 us/op 0.64
mainnet_e81889 - altair processInactivityUpdates 6.9989 ms/op 7.5334 ms/op 0.93
mainnet_e81889 - altair processRewardsAndPenalties 41.222 ms/op 45.497 ms/op 0.91
mainnet_e81889 - altair processRegistryUpdates 1.8640 us/op 2.5480 us/op 0.73
mainnet_e81889 - altair processSlashings 812.00 ns/op 530.00 ns/op 1.53
mainnet_e81889 - altair processEth1DataReset 575.00 ns/op 608.00 ns/op 0.95
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.4997 ms/op 1.1493 ms/op 2.17
mainnet_e81889 - altair processSlashingsReset 6.8780 us/op 3.1740 us/op 2.17
mainnet_e81889 - altair processRandaoMixesReset 7.2970 us/op 5.5650 us/op 1.31
mainnet_e81889 - altair processHistoricalRootsUpdate 641.00 ns/op 783.00 ns/op 0.82
mainnet_e81889 - altair processParticipationFlagUpdates 2.3640 us/op 3.1410 us/op 0.75
mainnet_e81889 - altair processSyncCommitteeUpdates 810.00 ns/op 549.00 ns/op 1.48
mainnet_e81889 - altair afterProcessEpoch 112.68 ms/op 92.816 ms/op 1.21
capella processEpoch - mainnet_e217614 1.4401 s/op 1.2345 s/op 1.17
mainnet_e217614 - capella beforeProcessEpoch 286.88 ms/op 236.79 ms/op 1.21
mainnet_e217614 - capella processJustificationAndFinalization 16.452 us/op 11.829 us/op 1.39
mainnet_e217614 - capella processInactivityUpdates 19.248 ms/op 15.970 ms/op 1.21
mainnet_e217614 - capella processRewardsAndPenalties 246.54 ms/op 227.46 ms/op 1.08
mainnet_e217614 - capella processRegistryUpdates 14.596 us/op 12.385 us/op 1.18
mainnet_e217614 - capella processSlashings 347.00 ns/op 369.00 ns/op 0.94
mainnet_e217614 - capella processEth1DataReset 349.00 ns/op 300.00 ns/op 1.16
mainnet_e217614 - capella processEffectiveBalanceUpdates 11.053 ms/op 10.264 ms/op 1.08
mainnet_e217614 - capella processSlashingsReset 8.8330 us/op 4.0940 us/op 2.16
mainnet_e217614 - capella processRandaoMixesReset 5.0850 us/op 4.3870 us/op 1.16
mainnet_e217614 - capella processHistoricalRootsUpdate 879.00 ns/op 545.00 ns/op 1.61
mainnet_e217614 - capella processParticipationFlagUpdates 3.1340 us/op 2.0690 us/op 1.51
mainnet_e217614 - capella afterProcessEpoch 314.47 ms/op 273.22 ms/op 1.15
phase0 processEpoch - mainnet_e58758 364.75 ms/op 354.60 ms/op 1.03
mainnet_e58758 - phase0 beforeProcessEpoch 127.01 ms/op 110.45 ms/op 1.15
mainnet_e58758 - phase0 processJustificationAndFinalization 19.252 us/op 13.981 us/op 1.38
mainnet_e58758 - phase0 processRewardsAndPenalties 36.423 ms/op 34.802 ms/op 1.05
mainnet_e58758 - phase0 processRegistryUpdates 11.929 us/op 7.3380 us/op 1.63
mainnet_e58758 - phase0 processSlashings 383.00 ns/op 383.00 ns/op 1.00
mainnet_e58758 - phase0 processEth1DataReset 505.00 ns/op 329.00 ns/op 1.53
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 991.31 us/op 956.28 us/op 1.04
mainnet_e58758 - phase0 processSlashingsReset 4.0890 us/op 2.3900 us/op 1.71
mainnet_e58758 - phase0 processRandaoMixesReset 7.3400 us/op 3.6900 us/op 1.99
mainnet_e58758 - phase0 processHistoricalRootsUpdate 607.00 ns/op 318.00 ns/op 1.91
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.8440 us/op 2.5460 us/op 1.90
mainnet_e58758 - phase0 afterProcessEpoch 89.425 ms/op 74.238 ms/op 1.20
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.4396 ms/op 1.4607 ms/op 0.99
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.1449 ms/op 2.0003 ms/op 1.07
altair processInactivityUpdates - 250000 normalcase 18.924 ms/op 15.835 ms/op 1.20
altair processInactivityUpdates - 250000 worstcase 21.260 ms/op 16.143 ms/op 1.32
phase0 processRegistryUpdates - 250000 normalcase 9.4300 us/op 6.3070 us/op 1.50
phase0 processRegistryUpdates - 250000 badcase_full_deposits 289.62 us/op 231.80 us/op 1.25
phase0 processRegistryUpdates - 250000 worstcase 0.5 114.31 ms/op 116.32 ms/op 0.98
altair processRewardsAndPenalties - 250000 normalcase 45.700 ms/op 37.578 ms/op 1.22
altair processRewardsAndPenalties - 250000 worstcase 65.785 ms/op 41.204 ms/op 1.60
phase0 getAttestationDeltas - 250000 normalcase 9.6050 ms/op 6.7671 ms/op 1.42
phase0 getAttestationDeltas - 250000 worstcase 11.642 ms/op 6.9649 ms/op 1.67
phase0 processSlashings - 250000 worstcase 102.58 us/op 73.997 us/op 1.39
altair processSyncCommitteeUpdates - 250000 179.78 ms/op 125.84 ms/op 1.43
BeaconState.hashTreeRoot - No change 507.00 ns/op 255.00 ns/op 1.99
BeaconState.hashTreeRoot - 1 full validator 175.07 us/op 126.88 us/op 1.38
BeaconState.hashTreeRoot - 32 full validator 1.9233 ms/op 1.2624 ms/op 1.52
BeaconState.hashTreeRoot - 512 full validator 17.904 ms/op 10.467 ms/op 1.71
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 196.01 us/op 135.96 us/op 1.44
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.5191 ms/op 1.8717 ms/op 1.35
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 32.824 ms/op 23.458 ms/op 1.40
BeaconState.hashTreeRoot - 1 balances 134.62 us/op 106.47 us/op 1.26
BeaconState.hashTreeRoot - 32 balances 1.2079 ms/op 1.1359 ms/op 1.06
BeaconState.hashTreeRoot - 512 balances 12.975 ms/op 7.7953 ms/op 1.66
BeaconState.hashTreeRoot - 250000 balances 190.83 ms/op 176.76 ms/op 1.08
aggregationBits - 2048 els - zipIndexesInBitList 41.732 us/op 23.203 us/op 1.80
byteArrayEquals 32 64.204 ns/op 53.282 ns/op 1.20
Buffer.compare 32 52.805 ns/op 45.654 ns/op 1.16
byteArrayEquals 1024 1.8491 us/op 1.5768 us/op 1.17
Buffer.compare 1024 61.445 ns/op 54.460 ns/op 1.13
byteArrayEquals 16384 29.277 us/op 25.061 us/op 1.17
Buffer.compare 16384 279.75 ns/op 223.47 ns/op 1.25
byteArrayEquals 123687377 212.44 ms/op 189.06 ms/op 1.12
Buffer.compare 123687377 8.9582 ms/op 6.0588 ms/op 1.48
byteArrayEquals 32 - diff last byte 54.916 ns/op 52.127 ns/op 1.05
Buffer.compare 32 - diff last byte 55.497 ns/op 46.241 ns/op 1.20
byteArrayEquals 1024 - diff last byte 1.7685 us/op 1.5704 us/op 1.13
Buffer.compare 1024 - diff last byte 62.152 ns/op 53.448 ns/op 1.16
byteArrayEquals 16384 - diff last byte 28.866 us/op 25.051 us/op 1.15
Buffer.compare 16384 - diff last byte 288.39 ns/op 241.30 ns/op 1.20
byteArrayEquals 123687377 - diff last byte 210.37 ms/op 189.00 ms/op 1.11
Buffer.compare 123687377 - diff last byte 8.8891 ms/op 6.2463 ms/op 1.42
byteArrayEquals 32 - random bytes 5.6210 ns/op 5.1380 ns/op 1.09
Buffer.compare 32 - random bytes 54.833 ns/op 47.990 ns/op 1.14
byteArrayEquals 1024 - random bytes 7.3370 ns/op 5.0880 ns/op 1.44
Buffer.compare 1024 - random bytes 51.563 ns/op 45.994 ns/op 1.12
byteArrayEquals 16384 - random bytes 6.0820 ns/op 5.1110 ns/op 1.19
Buffer.compare 16384 - random bytes 53.694 ns/op 46.084 ns/op 1.17
byteArrayEquals 123687377 - random bytes 7.8100 ns/op 6.3300 ns/op 1.23
Buffer.compare 123687377 - random bytes 54.650 ns/op 47.340 ns/op 1.15
regular array get 100000 times 43.602 us/op 35.354 us/op 1.23
wrappedArray get 100000 times 36.436 us/op 32.711 us/op 1.11
arrayWithProxy get 100000 times 14.761 ms/op 12.692 ms/op 1.16
ssz.Root.equals 51.417 ns/op 45.640 ns/op 1.13
byteArrayEquals 49.865 ns/op 44.980 ns/op 1.11
Buffer.compare 11.951 ns/op 10.348 ns/op 1.15
shuffle list - 16384 els 6.9445 ms/op 6.1637 ms/op 1.13
shuffle list - 250000 els 99.759 ms/op 89.758 ms/op 1.11
processSlot - 1 slots 17.818 us/op 13.595 us/op 1.31
processSlot - 32 slots 3.4824 ms/op 2.7954 ms/op 1.25
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 39.533 ms/op 37.215 ms/op 1.06
getCommitteeAssignments - req 1 vs - 250000 vc 2.6162 ms/op 2.1280 ms/op 1.23
getCommitteeAssignments - req 100 vs - 250000 vc 4.9802 ms/op 4.1202 ms/op 1.21
getCommitteeAssignments - req 1000 vs - 250000 vc 5.4003 ms/op 4.3665 ms/op 1.24
findModifiedValidators - 10000 modified validators 345.76 ms/op 254.87 ms/op 1.36
findModifiedValidators - 1000 modified validators 249.88 ms/op 173.24 ms/op 1.44
findModifiedValidators - 100 modified validators 253.70 ms/op 152.58 ms/op 1.66
findModifiedValidators - 10 modified validators 293.37 ms/op 147.90 ms/op 1.98
findModifiedValidators - 1 modified validators 239.71 ms/op 156.53 ms/op 1.53
findModifiedValidators - no difference 225.06 ms/op 144.44 ms/op 1.56
compare ViewDUs 3.7701 s/op 2.9063 s/op 1.30
compare each validator Uint8Array 1.6611 s/op 1.5876 s/op 1.05
compare ViewDU to Uint8Array 1.4805 s/op 1.0114 s/op 1.46
migrate state 1000000 validators, 24 modified, 0 new 796.27 ms/op 596.63 ms/op 1.33
migrate state 1000000 validators, 1700 modified, 1000 new 1.0720 s/op 798.65 ms/op 1.34
migrate state 1000000 validators, 3400 modified, 2000 new 1.3014 s/op 1.0478 s/op 1.24
migrate state 1500000 validators, 24 modified, 0 new 865.61 ms/op 626.04 ms/op 1.38
migrate state 1500000 validators, 1700 modified, 1000 new 932.88 ms/op 861.33 ms/op 1.08
migrate state 1500000 validators, 3400 modified, 2000 new 1.2246 s/op 1.0388 s/op 1.18
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.1500 ns/op 4.3000 ns/op 1.20
state getBlockRootAtSlot - 250000 vs - 7PWei 829.81 ns/op 496.24 ns/op 1.67
computeProposers - vc 250000 9.2172 ms/op 8.4079 ms/op 1.10
computeEpochShuffling - vc 250000 109.03 ms/op 97.198 ms/op 1.12
getNextSyncCommittee - vc 250000 150.14 ms/op 141.07 ms/op 1.06
computeSigningRoot for AttestationData 25.041 us/op 23.717 us/op 1.06
hash AttestationData serialized data then Buffer.toString(base64) 1.6868 us/op 1.5014 us/op 1.12
toHexString serialized data 1.0742 us/op 898.40 ns/op 1.20
Buffer.toString(base64) 236.29 ns/op 195.60 ns/op 1.21

Please sign in to comment.