Skip to content

Commit

Permalink
test: improve sim tests for some remaining feedback (#6654)
Browse files Browse the repository at this point in the history
* Restructure web3.js plugin

* Verify the blobs

* Fix plugin cache

* Compare blobs as buffer not as strings

* Fix the blobs assertion
  • Loading branch information
nazarhussain committed Apr 12, 2024
1 parent 669239b commit ae984f0
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 70 deletions.
42 changes: 35 additions & 7 deletions packages/cli/test/utils/simulation/assertions/blobsAssertion.ts
Expand Up @@ -4,14 +4,15 @@ import {fromHex, toHex} from "@lodestar/utils";
import {SimulationAssertion, AssertionMatch, AssertionResult, NodePair} from "../interfaces.js";
import {EL_GENESIS_ACCOUNT, EL_GENESIS_SECRET_KEY, SIM_ENV_CHAIN_ID} from "../constants.js";
import {generateBlobsForTransaction} from "../utils/blobs.js";
import {BlobsEIP4844Transaction} from "../web3JsPlugins.js";
import {BlobsEIP4844Transaction} from "../web3js/blobsEIP4844Transaction.js";

const numberOfBlobs = 6;
const sentBlobs: Uint8Array[] = [];

export function createBlobsAssertion(
nodes: NodePair[],
{sendBlobsAtSlot, validateBlobsAt}: {sendBlobsAtSlot: number; validateBlobsAt: number}
): SimulationAssertion<string, number> {
): SimulationAssertion<string, Uint8Array[]> {
return {
id: `blobs-${nodes.map((n) => n.id).join("-")}`,
match: ({slot}) => {
Expand Down Expand Up @@ -45,33 +46,60 @@ export function createBlobsAssertion(
});
const signedTx = tx.sign(fromHex(`0x${EL_GENESIS_SECRET_KEY}`));
await node.execution.provider?.extended.sendRawTransaction(toHex(signedTx.serialize()));

sentBlobs.push(...blobs.map((b) => fromHex(b)));
}

const blobSideCars = await node.beacon.api.beacon.getBlobSidecars(slot);
ApiError.assert(blobSideCars);

return blobSideCars.response.data.length;
return blobSideCars.response.data.map((b) => b.blob);
},

assert: async ({store}) => {
const errors: AssertionResult[] = [];

let eip4844Blobs = 0;
const blobs: Uint8Array[] = [];

for (let slot = sendBlobsAtSlot; slot <= validateBlobsAt; slot++) {
eip4844Blobs += store[slot] ?? 0;
blobs.push(...(store[slot] ?? []));
}

if (eip4844Blobs !== numberOfBlobs) {
if (blobs.length !== numberOfBlobs) {
errors.push([
"Node does not have right number of blobs",
{
expectedBlobs: numberOfBlobs,
currentBlobs: eip4844Blobs,
currentBlobs: blobs.length,
},
]);
}

for (let i = 0; i < blobs.length; i++) {
if (!Buffer.from(blobs[i]).equals(Buffer.from(sentBlobs[i]))) {
errors.push(["Node does not have the correct blobs", {index: i}]);
}
}
return errors;
},

async dump({store, nodes}) {
const result: Record<string, string> = {
"expectedBlobs.txt": sentBlobs.map(toHex).join("\n"),
};

for (const node of nodes) {
const blobs: Uint8Array[] = [];
for (let slot = sendBlobsAtSlot; slot <= validateBlobsAt; slot++) {
if (store[node.beacon.id] !== undefined) {
blobs.push(...(store[node.beacon.id][slot] ?? []));
}
}

result[`blobs-${node.beacon.id}.txt`] = blobs.map(toHex).join("\n");
}

return result;
},
};
}
Expand Up @@ -9,7 +9,7 @@ import {
SHARED_JWT_SECRET,
SIM_ENV_NETWORK_ID,
} from "../../constants.js";
import {registerWeb3JsPlugins} from "../../web3JsPlugins.js";
import {registerWeb3JsPlugins} from "../../web3js/plugins/index.js";
import {ExecutionClient, ExecutionNodeGenerator, ExecutionStartMode, JobOptions, RunnerType} from "../../interfaces.js";
import {getNodeMountedPaths} from "../../utils/paths.js";
import {getNodePorts} from "../../utils/ports.js";
Expand Down
Expand Up @@ -2,7 +2,7 @@ import {writeFile} from "node:fs/promises";
import path from "node:path";
import got from "got";
import {Web3} from "web3";
import {registerWeb3JsPlugins} from "../../web3JsPlugins.js";
import {registerWeb3JsPlugins} from "../../web3js/plugins/index.js";
import {ExecutionClient, ExecutionNodeGenerator, JobOptions, RunnerType} from "../../interfaces.js";
import {getNethermindChainSpec} from "../../utils/executionGenesis.js";
import {getNodeMountedPaths} from "../../utils/paths.js";
Expand Down
@@ -1,4 +1,3 @@
import {Web3PluginBase, Web3} from "web3";
import {RLP} from "@ethereumjs/rlp";
import {keccak256} from "ethereum-cryptography/keccak.js";
import {
Expand Down Expand Up @@ -158,63 +157,3 @@ export class BlobsEIP4844Transaction extends FeeMarketEIP1559Transaction {
);
}
}

class Web3AdminPlugin extends Web3PluginBase {
/**
* The admin plugin as available via the provider object
* like in the example below.
*
* await node.web3.admin.addPeer(elIdentity.enode);
*/
pluginNamespace = "admin";

async nodeInfo(): Promise<{
enode: string;
id: string;
ip: string;
listenAddr: string;
name: string;
ports: {
discovery: number;
listener: number;
};
protocols: {
eth: {
difficulty: number;
genesis: string;
head: string;
network: number;
};
};
}> {
return this.requestManager.send({method: "admin_nodeInfo", params: []});
}

async addPeer(enode: string): Promise<boolean> {
return this.requestManager.send({method: "admin_addPeer", params: [enode]});
}
}

class Web3ExtendedEthPlugin extends Web3PluginBase {
pluginNamespace = "extended";

async sendRawTransaction(tx: string): Promise<string> {
return this.requestManager.send({method: "eth_sendRawTransaction", params: [tx]});
}

async sendPlainTransaction(...params: unknown[]): Promise<string> {
return this.requestManager.send({method: "eth_sendTransaction", params: [...params]});
}
}

declare module "web3" {
interface Web3Context {
admin: Web3AdminPlugin;
extended: Web3ExtendedEthPlugin;
}
}

export function registerWeb3JsPlugins(web3: Web3): void {
web3.registerPlugin(new Web3AdminPlugin());
web3.registerPlugin(new Web3ExtendedEthPlugin());
}
8 changes: 8 additions & 0 deletions packages/cli/test/utils/simulation/web3js/plugins/index.ts
@@ -0,0 +1,8 @@
import {Web3} from "web3";
import {Web3AdminPlugin} from "./web3AdminPlugin.js";
import {Web3ExtendedEthPlugin} from "./web3ExtendedEthPlugin.js";

export function registerWeb3JsPlugins(web3: Web3): void {
web3.registerPlugin(new Web3AdminPlugin());
web3.registerPlugin(new Web3ExtendedEthPlugin());
}
@@ -0,0 +1,43 @@
import {Web3PluginBase} from "web3";

export class Web3AdminPlugin extends Web3PluginBase {
/**
* The admin plugin as available via the provider object
* like in the example below.
*
* await node.web3.admin.addPeer(elIdentity.enode);
*/
pluginNamespace = "admin";

async nodeInfo(): Promise<{
enode: string;
id: string;
ip: string;
listenAddr: string;
name: string;
ports: {
discovery: number;
listener: number;
};
protocols: {
eth: {
difficulty: number;
genesis: string;
head: string;
network: number;
};
};
}> {
return this.requestManager.send({method: "admin_nodeInfo", params: []});
}

async addPeer(enode: string): Promise<boolean> {
return this.requestManager.send({method: "admin_addPeer", params: [enode]});
}
}

declare module "web3" {
interface Web3Context {
admin: Web3AdminPlugin;
}
}
@@ -0,0 +1,19 @@
import {Web3PluginBase} from "web3";

export class Web3ExtendedEthPlugin extends Web3PluginBase {
pluginNamespace = "extended";

async sendRawTransaction(tx: string): Promise<string> {
return this.requestManager.send({method: "eth_sendRawTransaction", params: [tx]});
}

async sendPlainTransaction(...params: unknown[]): Promise<string> {
return this.requestManager.send({method: "eth_sendTransaction", params: [...params]});
}
}

declare module "web3" {
interface Web3Context {
extended: Web3ExtendedEthPlugin;
}
}

1 comment on commit ae984f0

@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: ae984f0 Previous: 669239b Ratio
isKnown best case - 1 super set check 740.00 ns/op 235.00 ns/op 3.15
isKnown normal case - 2 super set checks 739.00 ns/op 233.00 ns/op 3.17
BeaconState.hashTreeRoot - No change 820.00 ns/op 267.00 ns/op 3.07
Buffer.compare 123687377 - diff last byte 13.285 ms/op 4.4224 ms/op 3.00
Full benchmark results
Benchmark suite Current: ae984f0 Previous: 669239b Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 679.83 us/op 1.1323 ms/op 0.60
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 107.00 us/op 111.90 us/op 0.96
BLS verify - blst-native 1.3826 ms/op 1.1196 ms/op 1.23
BLS verifyMultipleSignatures 3 - blst-native 2.8539 ms/op 2.3493 ms/op 1.21
BLS verifyMultipleSignatures 8 - blst-native 6.2462 ms/op 5.2425 ms/op 1.19
BLS verifyMultipleSignatures 32 - blst-native 22.893 ms/op 19.424 ms/op 1.18
BLS verifyMultipleSignatures 64 - blst-native 46.461 ms/op 38.217 ms/op 1.22
BLS verifyMultipleSignatures 128 - blst-native 94.462 ms/op 75.469 ms/op 1.25
BLS deserializing 10000 signatures 968.93 ms/op 823.72 ms/op 1.18
BLS deserializing 100000 signatures 8.9732 s/op 8.4494 s/op 1.06
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.3743 ms/op 1.1357 ms/op 1.21
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.5601 ms/op 1.2905 ms/op 1.21
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.3996 ms/op 2.0201 ms/op 1.19
BLS verifyMultipleSignatures - same message - 64 - blst-native 3.4012 ms/op 3.8050 ms/op 0.89
BLS verifyMultipleSignatures - same message - 128 - blst-native 5.7714 ms/op 4.8925 ms/op 1.18
BLS aggregatePubkeys 32 - blst-native 26.284 us/op 23.030 us/op 1.14
BLS aggregatePubkeys 128 - blst-native 100.33 us/op 88.903 us/op 1.13
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 64.205 ms/op 48.941 ms/op 1.31
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 59.169 ms/op 47.780 ms/op 1.24
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 53.250 ms/op 30.884 ms/op 1.72
getSlashingsAndExits - default max 207.45 us/op 159.62 us/op 1.30
getSlashingsAndExits - 2k 597.64 us/op 464.24 us/op 1.29
proposeBlockBody type=full, size=empty 8.0017 ms/op 5.2791 ms/op 1.52
isKnown best case - 1 super set check 740.00 ns/op 235.00 ns/op 3.15
isKnown normal case - 2 super set checks 739.00 ns/op 233.00 ns/op 3.17
isKnown worse case - 16 super set checks 649.00 ns/op 222.00 ns/op 2.92
InMemoryCheckpointStateCache - add get delete 8.7280 us/op 3.8380 us/op 2.27
validate api signedAggregateAndProof - struct 3.0190 ms/op 2.4351 ms/op 1.24
validate gossip signedAggregateAndProof - struct 2.9503 ms/op 2.3955 ms/op 1.23
validate gossip attestation - vc 640000 1.4169 ms/op 1.1466 ms/op 1.24
batch validate gossip attestation - vc 640000 - chunk 32 169.53 us/op 141.45 us/op 1.20
batch validate gossip attestation - vc 640000 - chunk 64 148.73 us/op 129.61 us/op 1.15
batch validate gossip attestation - vc 640000 - chunk 128 139.53 us/op 122.57 us/op 1.14
batch validate gossip attestation - vc 640000 - chunk 256 127.81 us/op 114.46 us/op 1.12
pickEth1Vote - no votes 1.1556 ms/op 920.86 us/op 1.25
pickEth1Vote - max votes 9.1164 ms/op 13.692 ms/op 0.67
pickEth1Vote - Eth1Data hashTreeRoot value x2048 15.981 ms/op 20.103 ms/op 0.79
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 24.409 ms/op 28.073 ms/op 0.87
pickEth1Vote - Eth1Data fastSerialize value x2048 597.39 us/op 521.40 us/op 1.15
pickEth1Vote - Eth1Data fastSerialize tree x2048 4.2496 ms/op 7.8683 ms/op 0.54
bytes32 toHexString 481.00 ns/op 382.00 ns/op 1.26
bytes32 Buffer.toString(hex) 284.00 ns/op 201.00 ns/op 1.41
bytes32 Buffer.toString(hex) from Uint8Array 411.00 ns/op 404.00 ns/op 1.02
bytes32 Buffer.toString(hex) + 0x 288.00 ns/op 222.00 ns/op 1.30
Object access 1 prop 0.15900 ns/op 0.13000 ns/op 1.22
Map access 1 prop 0.14800 ns/op 0.10000 ns/op 1.48
Object get x1000 7.2450 ns/op 4.7520 ns/op 1.52
Map get x1000 0.73400 ns/op 0.71400 ns/op 1.03
Object set x1000 48.062 ns/op 29.365 ns/op 1.64
Map set x1000 38.120 ns/op 22.370 ns/op 1.70
Return object 10000 times 0.23690 ns/op 0.21760 ns/op 1.09
Throw Error 10000 times 3.8225 us/op 2.7258 us/op 1.40
fastMsgIdFn sha256 / 200 bytes 3.2360 us/op 1.9280 us/op 1.68
fastMsgIdFn h32 xxhash / 200 bytes 277.00 ns/op 257.00 ns/op 1.08
fastMsgIdFn h64 xxhash / 200 bytes 345.00 ns/op 261.00 ns/op 1.32
fastMsgIdFn sha256 / 1000 bytes 11.231 us/op 6.0260 us/op 1.86
fastMsgIdFn h32 xxhash / 1000 bytes 395.00 ns/op 361.00 ns/op 1.09
fastMsgIdFn h64 xxhash / 1000 bytes 413.00 ns/op 343.00 ns/op 1.20
fastMsgIdFn sha256 / 10000 bytes 102.94 us/op 51.002 us/op 2.02
fastMsgIdFn h32 xxhash / 10000 bytes 1.8900 us/op 1.7560 us/op 1.08
fastMsgIdFn h64 xxhash / 10000 bytes 1.2900 us/op 1.1420 us/op 1.13
send data - 1000 256B messages 18.299 ms/op 12.427 ms/op 1.47
send data - 1000 512B messages 25.403 ms/op 19.675 ms/op 1.29
send data - 1000 1024B messages 39.722 ms/op 22.871 ms/op 1.74
send data - 1000 1200B messages 40.113 ms/op 30.836 ms/op 1.30
send data - 1000 2048B messages 50.297 ms/op 41.642 ms/op 1.21
send data - 1000 4096B messages 44.953 ms/op 35.701 ms/op 1.26
send data - 1000 16384B messages 120.57 ms/op 103.06 ms/op 1.17
send data - 1000 65536B messages 460.66 ms/op 393.54 ms/op 1.17
enrSubnets - fastDeserialize 64 bits 1.2750 us/op 870.00 ns/op 1.47
enrSubnets - ssz BitVector 64 bits 432.00 ns/op 322.00 ns/op 1.34
enrSubnets - fastDeserialize 4 bits 175.00 ns/op 128.00 ns/op 1.37
enrSubnets - ssz BitVector 4 bits 437.00 ns/op 345.00 ns/op 1.27
prioritizePeers score -10:0 att 32-0.1 sync 2-0 217.84 us/op 139.42 us/op 1.56
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 273.90 us/op 179.13 us/op 1.53
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 342.17 us/op 287.25 us/op 1.19
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 594.39 us/op 427.23 us/op 1.39
prioritizePeers score 0:0 att 64-1 sync 4-1 730.03 us/op 511.67 us/op 1.43
array of 16000 items push then shift 1.6575 us/op 1.5020 us/op 1.10
LinkedList of 16000 items push then shift 9.0870 ns/op 6.2450 ns/op 1.46
array of 16000 items push then pop 87.564 ns/op 110.52 ns/op 0.79
LinkedList of 16000 items push then pop 8.8930 ns/op 7.4380 ns/op 1.20
array of 24000 items push then shift 2.4132 us/op 1.8335 us/op 1.32
LinkedList of 24000 items push then shift 9.0720 ns/op 7.7000 ns/op 1.18
array of 24000 items push then pop 120.35 ns/op 144.05 ns/op 0.84
LinkedList of 24000 items push then pop 8.8380 ns/op 5.9510 ns/op 1.49
intersect bitArray bitLen 8 5.9310 ns/op 4.8970 ns/op 1.21
intersect array and set length 8 65.118 ns/op 49.848 ns/op 1.31
intersect bitArray bitLen 128 36.181 ns/op 29.251 ns/op 1.24
intersect array and set length 128 904.72 ns/op 713.42 ns/op 1.27
bitArray.getTrueBitIndexes() bitLen 128 1.6080 us/op 1.2970 us/op 1.24
bitArray.getTrueBitIndexes() bitLen 248 2.6890 us/op 2.2290 us/op 1.21
bitArray.getTrueBitIndexes() bitLen 512 5.2060 us/op 3.7470 us/op 1.39
Buffer.concat 32 items 1.1760 us/op 919.00 ns/op 1.28
Uint8Array.set 32 items 1.9210 us/op 2.4550 us/op 0.78
Set add up to 64 items then delete first 4.3733 us/op 1.9929 us/op 2.19
OrderedSet add up to 64 items then delete first 5.5538 us/op 2.8534 us/op 1.95
Set add up to 64 items then delete last 4.6900 us/op 2.0530 us/op 2.28
OrderedSet add up to 64 items then delete last 5.8771 us/op 3.0679 us/op 1.92
Set add up to 64 items then delete middle 4.8264 us/op 2.0841 us/op 2.32
OrderedSet add up to 64 items then delete middle 7.1851 us/op 5.1237 us/op 1.40
Set add up to 128 items then delete first 9.6574 us/op 4.7850 us/op 2.02
OrderedSet add up to 128 items then delete first 13.130 us/op 7.0097 us/op 1.87
Set add up to 128 items then delete last 9.5139 us/op 3.8744 us/op 2.46
OrderedSet add up to 128 items then delete last 11.967 us/op 5.8344 us/op 2.05
Set add up to 128 items then delete middle 9.3372 us/op 4.0111 us/op 2.33
OrderedSet add up to 128 items then delete middle 17.978 us/op 10.897 us/op 1.65
Set add up to 256 items then delete first 19.790 us/op 8.0310 us/op 2.46
OrderedSet add up to 256 items then delete first 28.492 us/op 14.054 us/op 2.03
Set add up to 256 items then delete last 19.309 us/op 9.4283 us/op 2.05
OrderedSet add up to 256 items then delete last 24.277 us/op 11.886 us/op 2.04
Set add up to 256 items then delete middle 19.030 us/op 9.4149 us/op 2.02
OrderedSet add up to 256 items then delete middle 47.200 us/op 35.413 us/op 1.33
transfer serialized Status (84 B) 1.7500 us/op 1.4800 us/op 1.18
copy serialized Status (84 B) 1.3280 us/op 1.0410 us/op 1.28
transfer serialized SignedVoluntaryExit (112 B) 1.9950 us/op 1.5620 us/op 1.28
copy serialized SignedVoluntaryExit (112 B) 1.6570 us/op 1.1130 us/op 1.49
transfer serialized ProposerSlashing (416 B) 3.2420 us/op 1.9260 us/op 1.68
copy serialized ProposerSlashing (416 B) 2.9820 us/op 2.9560 us/op 1.01
transfer serialized Attestation (485 B) 3.4460 us/op 2.9380 us/op 1.17
copy serialized Attestation (485 B) 3.1520 us/op 2.6380 us/op 1.19
transfer serialized AttesterSlashing (33232 B) 3.3010 us/op 2.4970 us/op 1.32
copy serialized AttesterSlashing (33232 B) 6.4470 us/op 8.6090 us/op 0.75
transfer serialized Small SignedBeaconBlock (128000 B) 3.4130 us/op 2.9360 us/op 1.16
copy serialized Small SignedBeaconBlock (128000 B) 16.319 us/op 13.610 us/op 1.20
transfer serialized Avg SignedBeaconBlock (200000 B) 3.7740 us/op 2.6510 us/op 1.42
copy serialized Avg SignedBeaconBlock (200000 B) 23.907 us/op 15.155 us/op 1.58
transfer serialized BlobsSidecar (524380 B) 3.8790 us/op 2.5370 us/op 1.53
copy serialized BlobsSidecar (524380 B) 189.82 us/op 138.36 us/op 1.37
transfer serialized Big SignedBeaconBlock (1000000 B) 4.0430 us/op 3.1880 us/op 1.27
copy serialized Big SignedBeaconBlock (1000000 B) 159.69 us/op 168.36 us/op 0.95
pass gossip attestations to forkchoice per slot 4.6671 ms/op 2.7351 ms/op 1.71
forkChoice updateHead vc 100000 bc 64 eq 0 700.41 us/op 489.79 us/op 1.43
forkChoice updateHead vc 600000 bc 64 eq 0 5.0507 ms/op 2.7861 ms/op 1.81
forkChoice updateHead vc 1000000 bc 64 eq 0 7.3799 ms/op 4.7562 ms/op 1.55
forkChoice updateHead vc 600000 bc 320 eq 0 4.3554 ms/op 2.7645 ms/op 1.58
forkChoice updateHead vc 600000 bc 1200 eq 0 4.4869 ms/op 2.9176 ms/op 1.54
forkChoice updateHead vc 600000 bc 7200 eq 0 5.9469 ms/op 4.0037 ms/op 1.49
forkChoice updateHead vc 600000 bc 64 eq 1000 11.548 ms/op 10.121 ms/op 1.14
forkChoice updateHead vc 600000 bc 64 eq 10000 12.239 ms/op 11.143 ms/op 1.10
forkChoice updateHead vc 600000 bc 64 eq 300000 16.697 ms/op 12.090 ms/op 1.38
computeDeltas 500000 validators 300 proto nodes 7.0034 ms/op 3.4742 ms/op 2.02
computeDeltas 500000 validators 1200 proto nodes 6.9346 ms/op 3.4384 ms/op 2.02
computeDeltas 500000 validators 7200 proto nodes 6.5988 ms/op 3.3030 ms/op 2.00
computeDeltas 750000 validators 300 proto nodes 10.166 ms/op 5.1525 ms/op 1.97
computeDeltas 750000 validators 1200 proto nodes 10.070 ms/op 5.2449 ms/op 1.92
computeDeltas 750000 validators 7200 proto nodes 10.077 ms/op 5.0659 ms/op 1.99
computeDeltas 1400000 validators 300 proto nodes 19.209 ms/op 10.141 ms/op 1.89
computeDeltas 1400000 validators 1200 proto nodes 19.126 ms/op 9.8342 ms/op 1.94
computeDeltas 1400000 validators 7200 proto nodes 19.163 ms/op 9.6649 ms/op 1.98
computeDeltas 2100000 validators 300 proto nodes 28.235 ms/op 15.607 ms/op 1.81
computeDeltas 2100000 validators 1200 proto nodes 27.520 ms/op 15.311 ms/op 1.80
computeDeltas 2100000 validators 7200 proto nodes 28.962 ms/op 14.403 ms/op 2.01
altair processAttestation - 250000 vs - 7PWei normalcase 2.7419 ms/op 1.6522 ms/op 1.66
altair processAttestation - 250000 vs - 7PWei worstcase 4.1149 ms/op 2.9627 ms/op 1.39
altair processAttestation - setStatus - 1/6 committees join 206.03 us/op 120.58 us/op 1.71
altair processAttestation - setStatus - 1/3 committees join 375.34 us/op 241.47 us/op 1.55
altair processAttestation - setStatus - 1/2 committees join 522.27 us/op 288.28 us/op 1.81
altair processAttestation - setStatus - 2/3 committees join 672.60 us/op 378.03 us/op 1.78
altair processAttestation - setStatus - 4/5 committees join 885.73 us/op 561.54 us/op 1.58
altair processAttestation - setStatus - 100% committees join 1.0630 ms/op 594.66 us/op 1.79
altair processBlock - 250000 vs - 7PWei normalcase 9.4320 ms/op 7.6770 ms/op 1.23
altair processBlock - 250000 vs - 7PWei normalcase hashState 40.689 ms/op 34.930 ms/op 1.16
altair processBlock - 250000 vs - 7PWei worstcase 55.116 ms/op 36.133 ms/op 1.53
altair processBlock - 250000 vs - 7PWei worstcase hashState 126.97 ms/op 95.826 ms/op 1.32
phase0 processBlock - 250000 vs - 7PWei normalcase 4.1865 ms/op 2.1381 ms/op 1.96
phase0 processBlock - 250000 vs - 7PWei worstcase 38.385 ms/op 28.775 ms/op 1.33
altair processEth1Data - 250000 vs - 7PWei normalcase 803.69 us/op 280.08 us/op 2.87
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 26.507 us/op 14.373 us/op 1.84
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 88.056 us/op 32.972 us/op 2.67
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 32.963 us/op 17.727 us/op 1.86
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 24.755 us/op 9.0110 us/op 2.75
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 240.26 us/op 148.76 us/op 1.62
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.8372 ms/op 1.0563 ms/op 1.74
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.7300 ms/op 1.8290 ms/op 1.49
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.6109 ms/op 1.3441 ms/op 1.94
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 5.2719 ms/op 2.6521 ms/op 1.99
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 3.5065 ms/op 1.8722 ms/op 1.87
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 7.4469 ms/op 4.4778 ms/op 1.66
Tree 40 250000 create 782.38 ms/op 346.30 ms/op 2.26
Tree 40 250000 get(125000) 260.80 ns/op 123.45 ns/op 2.11
Tree 40 250000 set(125000) 3.2939 us/op 855.09 ns/op 3.85
Tree 40 250000 toArray() 33.072 ms/op 23.259 ms/op 1.42
Tree 40 250000 iterate all - toArray() + loop 32.464 ms/op 22.786 ms/op 1.42
Tree 40 250000 iterate all - get(i) 87.995 ms/op 50.373 ms/op 1.75
MutableVector 250000 create 19.581 ms/op 7.3393 ms/op 2.67
MutableVector 250000 get(125000) 7.7060 ns/op 5.6410 ns/op 1.37
MutableVector 250000 set(125000) 690.85 ns/op 219.81 ns/op 3.14
MutableVector 250000 toArray() 5.3295 ms/op 2.3133 ms/op 2.30
MutableVector 250000 iterate all - toArray() + loop 5.5741 ms/op 2.5731 ms/op 2.17
MutableVector 250000 iterate all - get(i) 1.6992 ms/op 1.3498 ms/op 1.26
Array 250000 create 4.4676 ms/op 2.3406 ms/op 1.91
Array 250000 clone - spread 1.8013 ms/op 1.3174 ms/op 1.37
Array 250000 get(125000) 1.4220 ns/op 1.0400 ns/op 1.37
Array 250000 set(125000) 6.0350 ns/op 1.2480 ns/op 4.84
Array 250000 iterate all - loop 192.60 us/op 158.06 us/op 1.22
effectiveBalanceIncrements clone Uint8Array 300000 69.487 us/op 19.311 us/op 3.60
effectiveBalanceIncrements clone MutableVector 300000 540.00 ns/op 397.00 ns/op 1.36
effectiveBalanceIncrements rw all Uint8Array 300000 225.03 us/op 186.25 us/op 1.21
effectiveBalanceIncrements rw all MutableVector 300000 161.94 ms/op 71.802 ms/op 2.26
phase0 afterProcessEpoch - 250000 vs - 7PWei 138.33 ms/op 82.578 ms/op 1.68
phase0 beforeProcessEpoch - 250000 vs - 7PWei 51.168 ms/op 61.178 ms/op 0.84
altair processEpoch - mainnet_e81889 600.59 ms/op 382.65 ms/op 1.57
mainnet_e81889 - altair beforeProcessEpoch 101.39 ms/op 77.872 ms/op 1.30
mainnet_e81889 - altair processJustificationAndFinalization 17.748 us/op 19.237 us/op 0.92
mainnet_e81889 - altair processInactivityUpdates 8.5947 ms/op 5.1091 ms/op 1.68
mainnet_e81889 - altair processRewardsAndPenalties 66.367 ms/op 73.555 ms/op 0.90
mainnet_e81889 - altair processRegistryUpdates 2.8010 us/op 2.7590 us/op 1.02
mainnet_e81889 - altair processSlashings 502.00 ns/op 692.00 ns/op 0.73
mainnet_e81889 - altair processEth1DataReset 818.00 ns/op 670.00 ns/op 1.22
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.6723 ms/op 1.5013 ms/op 1.11
mainnet_e81889 - altair processSlashingsReset 4.9530 us/op 3.2230 us/op 1.54
mainnet_e81889 - altair processRandaoMixesReset 8.5010 us/op 4.0420 us/op 2.10
mainnet_e81889 - altair processHistoricalRootsUpdate 1.2940 us/op 606.00 ns/op 2.14
mainnet_e81889 - altair processParticipationFlagUpdates 3.7510 us/op 1.2010 us/op 3.12
mainnet_e81889 - altair processSyncCommitteeUpdates 924.00 ns/op 588.00 ns/op 1.57
mainnet_e81889 - altair afterProcessEpoch 131.21 ms/op 84.536 ms/op 1.55
capella processEpoch - mainnet_e217614 3.5070 s/op 1.8646 s/op 1.88
mainnet_e217614 - capella beforeProcessEpoch 750.51 ms/op 408.19 ms/op 1.84
mainnet_e217614 - capella processJustificationAndFinalization 35.132 us/op 8.2570 us/op 4.25
mainnet_e217614 - capella processInactivityUpdates 33.453 ms/op 18.469 ms/op 1.81
mainnet_e217614 - capella processRewardsAndPenalties 799.51 ms/op 419.50 ms/op 1.91
mainnet_e217614 - capella processRegistryUpdates 46.184 us/op 23.545 us/op 1.96
mainnet_e217614 - capella processSlashings 1.7450 us/op 438.00 ns/op 3.98
mainnet_e217614 - capella processEth1DataReset 2.1040 us/op 296.00 ns/op 7.11
mainnet_e217614 - capella processEffectiveBalanceUpdates 7.2041 ms/op 3.1207 ms/op 2.31
mainnet_e217614 - capella processSlashingsReset 9.3440 us/op 2.0430 us/op 4.57
mainnet_e217614 - capella processRandaoMixesReset 15.891 us/op 3.0940 us/op 5.14
mainnet_e217614 - capella processHistoricalRootsUpdate 1.8200 us/op 454.00 ns/op 4.01
mainnet_e217614 - capella processParticipationFlagUpdates 5.8550 us/op 1.2140 us/op 4.82
mainnet_e217614 - capella afterProcessEpoch 427.01 ms/op 202.73 ms/op 2.11
phase0 processEpoch - mainnet_e58758 714.70 ms/op 405.16 ms/op 1.76
mainnet_e58758 - phase0 beforeProcessEpoch 191.59 ms/op 105.55 ms/op 1.82
mainnet_e58758 - phase0 processJustificationAndFinalization 33.445 us/op 9.5230 us/op 3.51
mainnet_e58758 - phase0 processRewardsAndPenalties 62.011 ms/op 58.536 ms/op 1.06
mainnet_e58758 - phase0 processRegistryUpdates 24.904 us/op 6.5720 us/op 3.79
mainnet_e58758 - phase0 processSlashings 1.8740 us/op 359.00 ns/op 5.22
mainnet_e58758 - phase0 processEth1DataReset 1.2460 us/op 342.00 ns/op 3.64
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.7601 ms/op 1.5273 ms/op 1.15
mainnet_e58758 - phase0 processSlashingsReset 5.4440 us/op 3.1190 us/op 1.75
mainnet_e58758 - phase0 processRandaoMixesReset 12.913 us/op 2.6350 us/op 4.90
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.2930 us/op 493.00 ns/op 2.62
mainnet_e58758 - phase0 processParticipationRecordUpdates 7.5960 us/op 3.2140 us/op 2.36
mainnet_e58758 - phase0 afterProcessEpoch 119.59 ms/op 64.044 ms/op 1.87
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.7889 ms/op 1.0185 ms/op 1.76
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.9182 ms/op 1.0837 ms/op 2.69
altair processInactivityUpdates - 250000 normalcase 31.878 ms/op 21.041 ms/op 1.52
altair processInactivityUpdates - 250000 worstcase 33.416 ms/op 24.106 ms/op 1.39
phase0 processRegistryUpdates - 250000 normalcase 22.024 us/op 6.7000 us/op 3.29
phase0 processRegistryUpdates - 250000 badcase_full_deposits 723.80 us/op 482.62 us/op 1.50
phase0 processRegistryUpdates - 250000 worstcase 0.5 217.15 ms/op 132.77 ms/op 1.64
altair processRewardsAndPenalties - 250000 normalcase 89.324 ms/op 63.744 ms/op 1.40
altair processRewardsAndPenalties - 250000 worstcase 85.414 ms/op 62.377 ms/op 1.37
phase0 getAttestationDeltas - 250000 normalcase 14.978 ms/op 5.7884 ms/op 2.59
phase0 getAttestationDeltas - 250000 worstcase 14.747 ms/op 5.7044 ms/op 2.59
phase0 processSlashings - 250000 worstcase 149.09 us/op 78.709 us/op 1.89
altair processSyncCommitteeUpdates - 250000 186.25 ms/op 110.37 ms/op 1.69
BeaconState.hashTreeRoot - No change 820.00 ns/op 267.00 ns/op 3.07
BeaconState.hashTreeRoot - 1 full validator 165.36 us/op 136.80 us/op 1.21
BeaconState.hashTreeRoot - 32 full validator 1.7205 ms/op 1.5123 ms/op 1.14
BeaconState.hashTreeRoot - 512 full validator 21.641 ms/op 16.324 ms/op 1.33
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 206.03 us/op 144.95 us/op 1.42
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.6467 ms/op 2.0147 ms/op 1.31
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 38.020 ms/op 32.985 ms/op 1.15
BeaconState.hashTreeRoot - 1 balances 175.68 us/op 143.11 us/op 1.23
BeaconState.hashTreeRoot - 32 balances 1.5925 ms/op 1.2595 ms/op 1.26
BeaconState.hashTreeRoot - 512 balances 15.784 ms/op 11.131 ms/op 1.42
BeaconState.hashTreeRoot - 250000 balances 242.48 ms/op 152.33 ms/op 1.59
aggregationBits - 2048 els - zipIndexesInBitList 48.298 us/op 19.257 us/op 2.51
byteArrayEquals 32 115.05 ns/op 63.656 ns/op 1.81
Buffer.compare 32 67.474 ns/op 38.507 ns/op 1.75
byteArrayEquals 1024 2.2824 us/op 1.7210 us/op 1.33
Buffer.compare 1024 93.152 ns/op 43.417 ns/op 2.15
byteArrayEquals 16384 45.140 us/op 27.511 us/op 1.64
Buffer.compare 16384 283.07 ns/op 229.25 ns/op 1.23
byteArrayEquals 123687377 319.75 ms/op 189.02 ms/op 1.69
Buffer.compare 123687377 12.145 ms/op 4.8832 ms/op 2.49
byteArrayEquals 32 - diff last byte 92.297 ns/op 58.765 ns/op 1.57
Buffer.compare 32 - diff last byte 73.255 ns/op 39.213 ns/op 1.87
byteArrayEquals 1024 - diff last byte 2.5725 us/op 1.7524 us/op 1.47
Buffer.compare 1024 - diff last byte 86.800 ns/op 43.737 ns/op 1.98
byteArrayEquals 16384 - diff last byte 37.036 us/op 27.840 us/op 1.33
Buffer.compare 16384 - diff last byte 300.36 ns/op 220.47 ns/op 1.36
byteArrayEquals 123687377 - diff last byte 317.83 ms/op 207.19 ms/op 1.53
Buffer.compare 123687377 - diff last byte 13.285 ms/op 4.4224 ms/op 3.00
byteArrayEquals 32 - random bytes 8.5920 ns/op 4.5760 ns/op 1.88
Buffer.compare 32 - random bytes 87.609 ns/op 47.298 ns/op 1.85
byteArrayEquals 1024 - random bytes 8.7870 ns/op 4.5920 ns/op 1.91
Buffer.compare 1024 - random bytes 75.831 ns/op 47.624 ns/op 1.59
byteArrayEquals 16384 - random bytes 8.7550 ns/op 4.7710 ns/op 1.84
Buffer.compare 16384 - random bytes 76.354 ns/op 46.098 ns/op 1.66
byteArrayEquals 123687377 - random bytes 21.340 ns/op 7.1700 ns/op 2.98
Buffer.compare 123687377 - random bytes 90.070 ns/op 48.150 ns/op 1.87
regular array get 100000 times 65.254 us/op 40.895 us/op 1.60
wrappedArray get 100000 times 59.678 us/op 41.151 us/op 1.45
arrayWithProxy get 100000 times 16.892 ms/op 11.329 ms/op 1.49
ssz.Root.equals 64.385 ns/op 55.401 ns/op 1.16
byteArrayEquals 63.602 ns/op 54.005 ns/op 1.18
Buffer.compare 14.672 ns/op 9.6400 ns/op 1.52
shuffle list - 16384 els 9.5762 ms/op 5.6118 ms/op 1.71
shuffle list - 250000 els 145.73 ms/op 83.585 ms/op 1.74
processSlot - 1 slots 26.589 us/op 11.284 us/op 2.36
processSlot - 32 slots 5.6918 ms/op 2.1886 ms/op 2.60
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 72.778 ms/op 47.723 ms/op 1.53
getCommitteeAssignments - req 1 vs - 250000 vc 2.9460 ms/op 2.4390 ms/op 1.21
getCommitteeAssignments - req 100 vs - 250000 vc 4.1339 ms/op 3.4977 ms/op 1.18
getCommitteeAssignments - req 1000 vs - 250000 vc 4.7432 ms/op 3.8150 ms/op 1.24
findModifiedValidators - 10000 modified validators 483.54 ms/op 288.80 ms/op 1.67
findModifiedValidators - 1000 modified validators 311.92 ms/op 158.39 ms/op 1.97
findModifiedValidators - 100 modified validators 305.58 ms/op 159.90 ms/op 1.91
findModifiedValidators - 10 modified validators 245.66 ms/op 156.50 ms/op 1.57
findModifiedValidators - 1 modified validators 252.45 ms/op 142.32 ms/op 1.77
findModifiedValidators - no difference 227.26 ms/op 161.24 ms/op 1.41
compare ViewDUs 5.5458 s/op 3.7193 s/op 1.49
compare each validator Uint8Array 2.0277 s/op 1.7513 s/op 1.16
compare ViewDU to Uint8Array 1.5043 s/op 823.04 ms/op 1.83
migrate state 1000000 validators, 24 modified, 0 new 871.52 ms/op 671.93 ms/op 1.30
migrate state 1000000 validators, 1700 modified, 1000 new 1.3018 s/op 896.71 ms/op 1.45
migrate state 1000000 validators, 3400 modified, 2000 new 1.5074 s/op 1.0667 s/op 1.41
migrate state 1500000 validators, 24 modified, 0 new 881.46 ms/op 729.76 ms/op 1.21
migrate state 1500000 validators, 1700 modified, 1000 new 1.4174 s/op 1.0584 s/op 1.34
migrate state 1500000 validators, 3400 modified, 2000 new 1.6414 s/op 1.2998 s/op 1.26
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 7.7500 ns/op 4.8300 ns/op 1.60
state getBlockRootAtSlot - 250000 vs - 7PWei 1.2254 us/op 735.44 ns/op 1.67
computeProposers - vc 250000 13.980 ms/op 8.0411 ms/op 1.74
computeEpochShuffling - vc 250000 147.31 ms/op 88.795 ms/op 1.66
getNextSyncCommittee - vc 250000 211.70 ms/op 147.51 ms/op 1.44
computeSigningRoot for AttestationData 37.229 us/op 25.499 us/op 1.46
hash AttestationData serialized data then Buffer.toString(base64) 2.7138 us/op 1.4732 us/op 1.84
toHexString serialized data 1.6882 us/op 929.93 ns/op 1.82
Buffer.toString(base64) 291.46 ns/op 190.56 ns/op 1.53

Please sign in to comment.