Skip to content

Commit

Permalink
fix: revert napi bls (#6853)
Browse files Browse the repository at this point in the history
* Revert "feat: use @chainsafe/blst directly (#6706)"

This reverts commit 66fe753.

* Revert "feat: switch bls to napi rebuild (#6616)"

This reverts commit 97d9aa8.
  • Loading branch information
wemeetagain authored Jun 4, 2024
1 parent 519b05e commit cbb8946
Show file tree
Hide file tree
Showing 114 changed files with 821 additions and 765 deletions.
1 change: 0 additions & 1 deletion .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ orchestrator
osx
overriden
params
peerDependency
pid
plaintext
pre
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"test-coverage:e2e": "c8 --config .c8rc.json --report-dir coverage/e2e/ --all npm run test:e2e",
"test-coverage:e2e-sim": "c8 --config .c8rc.json --report-dir coverage/e2e-sim/ --all npm run test:e2e:sim",
"test-coverage:spec": "c8 --config .c8rc.json --report-dir coverage/spec/ --all npm run test:spec",
"benchmark": "UV_THREADPOOL_SIZE=$(node -e 'console.log(require(`os`).availableParallelism())') yarn benchmark:files 'packages/*/test/perf/**/*.test.ts'",
"benchmark:files": "UV_THREADPOOL_SIZE=$(node -e 'console.log(require(`os`).availableParallelism())') NODE_OPTIONS='--max-old-space-size=4096 --loader=ts-node/esm' benchmark --config .benchrc.yaml --defaultBranch unstable",
"benchmark": "yarn benchmark:files 'packages/*/test/perf/**/*.test.ts'",
"benchmark:files": "NODE_OPTIONS='--max-old-space-size=4096 --loader=ts-node/esm' benchmark --config .benchrc.yaml --defaultBranch unstable",
"release:create-rc": "node scripts/release/create_rc.mjs",
"release:tag-rc": "node scripts/release/tag_rc.mjs",
"release:tag-stable": "node scripts/release/tag_stable.mjs",
Expand Down
3 changes: 2 additions & 1 deletion packages/beacon-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@
},
"dependencies": {
"@chainsafe/as-sha256": "^0.4.1",
"@chainsafe/blst": "^1.0.1",
"@chainsafe/bls": "7.1.3",
"@chainsafe/blst": "^0.2.10",
"@chainsafe/discv5": "^9.0.0",
"@chainsafe/enr": "^3.0.0",
"@chainsafe/libp2p-gossipsub": "^13.0.0",
Expand Down
5 changes: 2 additions & 3 deletions packages/beacon-node/src/chain/bls/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export type {IBlsVerifier} from "./interface.js";
export type {JobQueueItemType} from "./jobItem.js";
export type {BlsMultiThreadWorkerPoolModules} from "./multiThread.js";
export {BlsMultiThreadWorkerPool} from "./multiThread.js";
export type {BlsMultiThreadWorkerPoolModules, JobQueueItemType} from "./multithread/index.js";
export {BlsMultiThreadWorkerPool} from "./multithread/index.js";
export {BlsSingleThreadVerifier} from "./singleThread.js";
2 changes: 1 addition & 1 deletion packages/beacon-node/src/chain/bls/interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {PublicKey} from "@chainsafe/blst";
import {PublicKey} from "@chainsafe/bls/types";
import {ISignatureSet} from "@lodestar/state-transition";

export type VerifySignatureOpts = {
Expand Down
46 changes: 46 additions & 0 deletions packages/beacon-node/src/chain/bls/maybeBatch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import {CoordType, PublicKey} from "@chainsafe/bls/types";
import bls from "@chainsafe/bls";

const MIN_SET_COUNT_TO_BATCH = 2;

export type SignatureSetDeserialized = {
publicKey: PublicKey;
message: Uint8Array;
signature: Uint8Array;
};

/**
* Verify signatures sets with batch verification or regular core verify depending on the set count.
* Abstracted in a separate file to be consumed by the threaded pool and the main thread implementation.
*/
export function verifySignatureSetsMaybeBatch(sets: SignatureSetDeserialized[]): boolean {
try {
if (sets.length >= MIN_SET_COUNT_TO_BATCH) {
return bls.Signature.verifyMultipleSignatures(
sets.map((s) => ({
publicKey: s.publicKey,
message: s.message,
// true = validate signature
signature: bls.Signature.fromBytes(s.signature, CoordType.affine, true),
}))
);
}

// .every on an empty array returns true
if (sets.length === 0) {
throw Error("Empty signature set");
}

// If too few signature sets verify them without batching
return sets.every((set) => {
// true = validate signature
const sig = bls.Signature.fromBytes(set.signature, CoordType.affine, true);
return sig.verify(set.publicKey, set.message);
});
} catch (_) {
// A signature could be malformed, in that case fromBytes throws error
// blst-ts `verifyMultipleSignatures` is also a fallible operation if mul_n_aggregate fails
// see https://github.com/ChainSafe/blst-ts/blob/b1ba6333f664b08e5c50b2b0d18c4f079203962b/src/lib.ts#L291
return false;
}
}
Loading

1 comment on commit cbb8946

@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: cbb8946 Previous: 519b05e Ratio
altair processAttestation - setStatus - 100% committees join 1.9035 ms/op 604.16 us/op 3.15
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 16.822 us/op 5.0710 us/op 3.32
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 21.514 us/op 6.8340 us/op 3.15
BeaconState.hashTreeRoot - No change 841.00 ns/op 262.00 ns/op 3.21
Full benchmark results
Benchmark suite Current: cbb8946 Previous: 519b05e Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 464.72 us/op 1.1064 ms/op 0.42
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 49.819 us/op 59.024 us/op 0.84
BLS verify - blst-native 1.2718 ms/op 1.5007 ms/op 0.85
BLS verifyMultipleSignatures 3 - blst-native 2.8323 ms/op 3.1512 ms/op 0.90
BLS verifyMultipleSignatures 8 - blst-native 6.2894 ms/op 6.8303 ms/op 0.92
BLS verifyMultipleSignatures 32 - blst-native 24.148 ms/op 24.707 ms/op 0.98
BLS verifyMultipleSignatures 64 - blst-native 45.899 ms/op 49.143 ms/op 0.93
BLS verifyMultipleSignatures 128 - blst-native 88.307 ms/op 113.83 ms/op 0.78
BLS deserializing 10000 signatures 966.75 ms/op 1.1575 s/op 0.84
BLS deserializing 100000 signatures 9.7228 s/op 14.531 s/op 0.67
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.3171 ms/op 1.9952 ms/op 0.66
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.5925 ms/op 2.8956 ms/op 0.55
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.4297 ms/op 4.1321 ms/op 0.59
BLS verifyMultipleSignatures - same message - 64 - blst-native 3.6164 ms/op 7.4951 ms/op 0.48
BLS verifyMultipleSignatures - same message - 128 - blst-native 6.1902 ms/op 13.481 ms/op 0.46
BLS aggregatePubkeys 32 - blst-native 28.380 us/op 67.717 us/op 0.42
BLS aggregatePubkeys 128 - blst-native 111.69 us/op 260.45 us/op 0.43
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 57.875 ms/op 79.742 ms/op 0.73
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 56.267 ms/op 96.907 ms/op 0.58
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 37.623 ms/op 60.976 ms/op 0.62
getSlashingsAndExits - default max 111.05 us/op 146.64 us/op 0.76
getSlashingsAndExits - 2k 311.78 us/op 348.92 us/op 0.89
proposeBlockBody type=full, size=empty 6.3445 ms/op 11.974 ms/op 0.53
isKnown best case - 1 super set check 465.00 ns/op 545.00 ns/op 0.85
isKnown normal case - 2 super set checks 422.00 ns/op 540.00 ns/op 0.78
isKnown worse case - 16 super set checks 401.00 ns/op 546.00 ns/op 0.73
InMemoryCheckpointStateCache - add get delete 5.2020 us/op 9.7760 us/op 0.53
validate api signedAggregateAndProof - struct 3.1970 ms/op 4.6324 ms/op 0.69
validate gossip signedAggregateAndProof - struct 2.8165 ms/op 4.5830 ms/op 0.61
validate gossip attestation - vc 640000 1.5065 ms/op 2.2865 ms/op 0.66
batch validate gossip attestation - vc 640000 - chunk 32 167.18 us/op 300.21 us/op 0.56
batch validate gossip attestation - vc 640000 - chunk 64 135.81 us/op 306.33 us/op 0.44
batch validate gossip attestation - vc 640000 - chunk 128 136.43 us/op 278.13 us/op 0.49
batch validate gossip attestation - vc 640000 - chunk 256 131.19 us/op 319.50 us/op 0.41
pickEth1Vote - no votes 1.2103 ms/op 3.2707 ms/op 0.37
pickEth1Vote - max votes 10.397 ms/op 21.563 ms/op 0.48
pickEth1Vote - Eth1Data hashTreeRoot value x2048 20.937 ms/op 40.907 ms/op 0.51
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 26.479 ms/op 68.319 ms/op 0.39
pickEth1Vote - Eth1Data fastSerialize value x2048 642.42 us/op 1.0010 ms/op 0.64
pickEth1Vote - Eth1Data fastSerialize tree x2048 6.5920 ms/op 11.410 ms/op 0.58
bytes32 toHexString 549.00 ns/op 1.2800 us/op 0.43
bytes32 Buffer.toString(hex) 305.00 ns/op 425.00 ns/op 0.72
bytes32 Buffer.toString(hex) from Uint8Array 462.00 ns/op 801.00 ns/op 0.58
bytes32 Buffer.toString(hex) + 0x 293.00 ns/op 696.00 ns/op 0.42
Object access 1 prop 0.17700 ns/op 0.33500 ns/op 0.53
Map access 1 prop 0.16900 ns/op 0.25200 ns/op 0.67
Object get x1000 7.6600 ns/op 9.0180 ns/op 0.85
Map get x1000 8.5710 ns/op 8.1460 ns/op 1.05
Object set x1000 49.682 ns/op 52.233 ns/op 0.95
Map set x1000 33.351 ns/op 36.132 ns/op 0.92
Return object 10000 times 0.33830 ns/op 0.46610 ns/op 0.73
Throw Error 10000 times 4.2762 us/op 5.2612 us/op 0.81
fastMsgIdFn sha256 / 200 bytes 2.7290 us/op 3.3040 us/op 0.83
fastMsgIdFn h32 xxhash / 200 bytes 293.00 ns/op 485.00 ns/op 0.60
fastMsgIdFn h64 xxhash / 200 bytes 323.00 ns/op 549.00 ns/op 0.59
fastMsgIdFn sha256 / 1000 bytes 8.8230 us/op 16.651 us/op 0.53
fastMsgIdFn h32 xxhash / 1000 bytes 493.00 ns/op 702.00 ns/op 0.70
fastMsgIdFn h64 xxhash / 1000 bytes 397.00 ns/op 624.00 ns/op 0.64
fastMsgIdFn sha256 / 10000 bytes 75.787 us/op 135.44 us/op 0.56
fastMsgIdFn h32 xxhash / 10000 bytes 2.0990 us/op 3.5580 us/op 0.59
fastMsgIdFn h64 xxhash / 10000 bytes 1.3610 us/op 2.3630 us/op 0.58
send data - 1000 256B messages 17.902 ms/op 24.541 ms/op 0.73
send data - 1000 512B messages 23.777 ms/op 32.955 ms/op 0.72
send data - 1000 1024B messages 32.030 ms/op 51.615 ms/op 0.62
send data - 1000 1200B messages 33.465 ms/op 35.790 ms/op 0.94
send data - 1000 2048B messages 36.646 ms/op 54.992 ms/op 0.67
send data - 1000 4096B messages 36.453 ms/op 62.449 ms/op 0.58
send data - 1000 16384B messages 86.204 ms/op 116.03 ms/op 0.74
send data - 1000 65536B messages 237.05 ms/op 591.57 ms/op 0.40
enrSubnets - fastDeserialize 64 bits 1.3820 us/op 2.9260 us/op 0.47
enrSubnets - ssz BitVector 64 bits 440.00 ns/op 744.00 ns/op 0.59
enrSubnets - fastDeserialize 4 bits 167.00 ns/op 282.00 ns/op 0.59
enrSubnets - ssz BitVector 4 bits 438.00 ns/op 557.00 ns/op 0.79
prioritizePeers score -10:0 att 32-0.1 sync 2-0 195.17 us/op 308.30 us/op 0.63
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 214.03 us/op 297.32 us/op 0.72
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 322.20 us/op 704.69 us/op 0.46
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 584.35 us/op 817.53 us/op 0.71
prioritizePeers score 0:0 att 64-1 sync 4-1 1.1457 ms/op 1.2247 ms/op 0.94
array of 16000 items push then shift 1.9306 us/op 3.1285 us/op 0.62
LinkedList of 16000 items push then shift 8.8500 ns/op 10.086 ns/op 0.88
array of 16000 items push then pop 140.60 ns/op 158.27 ns/op 0.89
LinkedList of 16000 items push then pop 7.5440 ns/op 8.4170 ns/op 0.90
array of 24000 items push then shift 2.5657 us/op 3.1974 us/op 0.80
LinkedList of 24000 items push then shift 7.9330 ns/op 11.095 ns/op 0.72
array of 24000 items push then pop 164.95 ns/op 235.03 ns/op 0.70
LinkedList of 24000 items push then pop 7.4830 ns/op 9.8250 ns/op 0.76
intersect bitArray bitLen 8 7.0640 ns/op 10.194 ns/op 0.69
intersect array and set length 8 52.236 ns/op 66.795 ns/op 0.78
intersect bitArray bitLen 128 32.535 ns/op 47.189 ns/op 0.69
intersect array and set length 128 743.38 ns/op 1.8596 us/op 0.40
bitArray.getTrueBitIndexes() bitLen 128 2.4940 us/op 3.5750 us/op 0.70
bitArray.getTrueBitIndexes() bitLen 248 4.9190 us/op 5.2600 us/op 0.94
bitArray.getTrueBitIndexes() bitLen 512 9.2940 us/op 10.051 us/op 0.92
Buffer.concat 32 items 1.2110 us/op 1.2220 us/op 0.99
Uint8Array.set 32 items 1.9150 us/op 2.2780 us/op 0.84
Buffer.copy 2.1790 us/op 3.3540 us/op 0.65
Uint8Array.set - with subarray 3.1170 us/op 4.4710 us/op 0.70
Uint8Array.set - without subarray 1.8030 us/op 2.9580 us/op 0.61
Set add up to 64 items then delete first 2.7699 us/op 2.8907 us/op 0.96
OrderedSet add up to 64 items then delete first 4.4036 us/op 3.9670 us/op 1.11
Set add up to 64 items then delete last 3.1573 us/op 3.2952 us/op 0.96
OrderedSet add up to 64 items then delete last 4.3136 us/op 5.0313 us/op 0.86
Set add up to 64 items then delete middle 3.0043 us/op 3.3552 us/op 0.90
OrderedSet add up to 64 items then delete middle 6.5583 us/op 6.9259 us/op 0.95
Set add up to 128 items then delete first 6.2805 us/op 7.0067 us/op 0.90
OrderedSet add up to 128 items then delete first 10.529 us/op 10.252 us/op 1.03
Set add up to 128 items then delete last 6.6688 us/op 6.6409 us/op 1.00
OrderedSet add up to 128 items then delete last 9.5949 us/op 9.1194 us/op 1.05
Set add up to 128 items then delete middle 5.9940 us/op 6.4983 us/op 0.92
OrderedSet add up to 128 items then delete middle 16.922 us/op 19.045 us/op 0.89
Set add up to 256 items then delete first 13.284 us/op 14.674 us/op 0.91
OrderedSet add up to 256 items then delete first 20.240 us/op 26.183 us/op 0.77
Set add up to 256 items then delete last 13.936 us/op 13.918 us/op 1.00
OrderedSet add up to 256 items then delete last 22.051 us/op 19.871 us/op 1.11
Set add up to 256 items then delete middle 14.182 us/op 13.605 us/op 1.04
OrderedSet add up to 256 items then delete middle 58.547 us/op 54.954 us/op 1.07
transfer serialized Status (84 B) 2.0020 us/op 1.7210 us/op 1.16
copy serialized Status (84 B) 1.3810 us/op 1.4400 us/op 0.96
transfer serialized SignedVoluntaryExit (112 B) 1.7880 us/op 2.7800 us/op 0.64
copy serialized SignedVoluntaryExit (112 B) 1.4720 us/op 2.2860 us/op 0.64
transfer serialized ProposerSlashing (416 B) 1.9500 us/op 3.3870 us/op 0.58
copy serialized ProposerSlashing (416 B) 1.9380 us/op 3.1270 us/op 0.62
transfer serialized Attestation (485 B) 2.9960 us/op 2.1280 us/op 1.41
copy serialized Attestation (485 B) 2.0100 us/op 2.0840 us/op 0.96
transfer serialized AttesterSlashing (33232 B) 2.0700 us/op 2.3400 us/op 0.88
copy serialized AttesterSlashing (33232 B) 5.9480 us/op 5.3990 us/op 1.10
transfer serialized Small SignedBeaconBlock (128000 B) 2.9750 us/op 4.0020 us/op 0.74
copy serialized Small SignedBeaconBlock (128000 B) 21.346 us/op 18.383 us/op 1.16
transfer serialized Avg SignedBeaconBlock (200000 B) 3.2750 us/op 3.7020 us/op 0.88
copy serialized Avg SignedBeaconBlock (200000 B) 32.243 us/op 22.738 us/op 1.42
transfer serialized BlobsSidecar (524380 B) 4.4020 us/op 2.9870 us/op 1.47
copy serialized BlobsSidecar (524380 B) 93.104 us/op 106.05 us/op 0.88
transfer serialized Big SignedBeaconBlock (1000000 B) 3.8750 us/op 3.2560 us/op 1.19
copy serialized Big SignedBeaconBlock (1000000 B) 242.28 us/op 157.04 us/op 1.54
pass gossip attestations to forkchoice per slot 3.7137 ms/op 3.6555 ms/op 1.02
forkChoice updateHead vc 100000 bc 64 eq 0 780.57 us/op 678.82 us/op 1.15
forkChoice updateHead vc 600000 bc 64 eq 0 3.6751 ms/op 3.7612 ms/op 0.98
forkChoice updateHead vc 1000000 bc 64 eq 0 6.4581 ms/op 6.5963 ms/op 0.98
forkChoice updateHead vc 600000 bc 320 eq 0 3.7131 ms/op 3.9690 ms/op 0.94
forkChoice updateHead vc 600000 bc 1200 eq 0 3.9261 ms/op 3.5592 ms/op 1.10
forkChoice updateHead vc 600000 bc 7200 eq 0 4.7465 ms/op 4.7845 ms/op 0.99
forkChoice updateHead vc 600000 bc 64 eq 1000 12.238 ms/op 11.427 ms/op 1.07
forkChoice updateHead vc 600000 bc 64 eq 10000 11.886 ms/op 11.612 ms/op 1.02
forkChoice updateHead vc 600000 bc 64 eq 300000 17.820 ms/op 16.294 ms/op 1.09
computeDeltas 500000 validators 300 proto nodes 4.3438 ms/op 4.1740 ms/op 1.04
computeDeltas 500000 validators 1200 proto nodes 5.1644 ms/op 4.9411 ms/op 1.05
computeDeltas 500000 validators 7200 proto nodes 4.6158 ms/op 3.8390 ms/op 1.20
computeDeltas 750000 validators 300 proto nodes 7.5131 ms/op 6.5631 ms/op 1.14
computeDeltas 750000 validators 1200 proto nodes 8.4981 ms/op 6.6814 ms/op 1.27
computeDeltas 750000 validators 7200 proto nodes 8.7670 ms/op 7.3708 ms/op 1.19
computeDeltas 1400000 validators 300 proto nodes 15.141 ms/op 12.529 ms/op 1.21
computeDeltas 1400000 validators 1200 proto nodes 16.012 ms/op 22.225 ms/op 0.72
computeDeltas 1400000 validators 7200 proto nodes 19.727 ms/op 13.711 ms/op 1.44
computeDeltas 2100000 validators 300 proto nodes 32.270 ms/op 17.956 ms/op 1.80
computeDeltas 2100000 validators 1200 proto nodes 29.701 ms/op 16.772 ms/op 1.77
computeDeltas 2100000 validators 7200 proto nodes 33.433 ms/op 16.193 ms/op 2.06
altair processAttestation - 250000 vs - 7PWei normalcase 3.6157 ms/op 1.7702 ms/op 2.04
altair processAttestation - 250000 vs - 7PWei worstcase 6.8405 ms/op 2.8448 ms/op 2.40
altair processAttestation - setStatus - 1/6 committees join 210.10 us/op 98.946 us/op 2.12
altair processAttestation - setStatus - 1/3 committees join 436.79 us/op 189.43 us/op 2.31
altair processAttestation - setStatus - 1/2 committees join 625.52 us/op 259.48 us/op 2.41
altair processAttestation - setStatus - 2/3 committees join 786.39 us/op 348.34 us/op 2.26
altair processAttestation - setStatus - 4/5 committees join 1.2905 ms/op 502.81 us/op 2.57
altair processAttestation - setStatus - 100% committees join 1.9035 ms/op 604.16 us/op 3.15
altair processBlock - 250000 vs - 7PWei normalcase 10.925 ms/op 5.5015 ms/op 1.99
altair processBlock - 250000 vs - 7PWei normalcase hashState 67.747 ms/op 26.387 ms/op 2.57
altair processBlock - 250000 vs - 7PWei worstcase 92.193 ms/op 45.648 ms/op 2.02
altair processBlock - 250000 vs - 7PWei worstcase hashState 143.82 ms/op 82.330 ms/op 1.75
phase0 processBlock - 250000 vs - 7PWei normalcase 4.4917 ms/op 1.9343 ms/op 2.32
phase0 processBlock - 250000 vs - 7PWei worstcase 68.514 ms/op 27.296 ms/op 2.51
altair processEth1Data - 250000 vs - 7PWei normalcase 803.62 us/op 348.50 us/op 2.31
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 16.822 us/op 5.0710 us/op 3.32
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 57.482 us/op 20.220 us/op 2.84
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 21.514 us/op 6.8340 us/op 3.15
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 9.5280 us/op 4.8890 us/op 1.95
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 136.92 us/op 73.299 us/op 1.87
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.3000 ms/op 689.61 us/op 1.89
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.9667 ms/op 951.65 us/op 2.07
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.6638 ms/op 892.85 us/op 1.86
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 5.4540 ms/op 3.9571 ms/op 1.38
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 3.1112 ms/op 1.6791 ms/op 1.85
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 7.4451 ms/op 3.5726 ms/op 2.08
Tree 40 250000 create 641.89 ms/op 209.07 ms/op 3.07
Tree 40 250000 get(125000) 391.42 ns/op 145.25 ns/op 2.69
Tree 40 250000 set(125000) 1.6287 us/op 627.27 ns/op 2.60
Tree 40 250000 toArray() 29.723 ms/op 15.040 ms/op 1.98
Tree 40 250000 iterate all - toArray() + loop 28.976 ms/op 15.153 ms/op 1.91
Tree 40 250000 iterate all - get(i) 83.934 ms/op 51.451 ms/op 1.63
MutableVector 250000 create 20.123 ms/op 8.9307 ms/op 2.25
MutableVector 250000 get(125000) 15.774 ns/op 7.1770 ns/op 2.20
MutableVector 250000 set(125000) 510.95 ns/op 185.91 ns/op 2.75
MutableVector 250000 toArray() 6.2173 ms/op 3.4237 ms/op 1.82
MutableVector 250000 iterate all - toArray() + loop 7.9803 ms/op 3.5442 ms/op 2.25
MutableVector 250000 iterate all - get(i) 2.5423 ms/op 1.7572 ms/op 1.45
Array 250000 create 4.7606 ms/op 2.9421 ms/op 1.62
Array 250000 clone - spread 1.8295 ms/op 1.3408 ms/op 1.36
Array 250000 get(125000) 0.49400 ns/op 0.40400 ns/op 1.22
Array 250000 set(125000) 0.82800 ns/op 0.42500 ns/op 1.95
Array 250000 iterate all - loop 203.44 us/op 84.071 us/op 2.42
effectiveBalanceIncrements clone Uint8Array 300000 71.703 us/op 24.694 us/op 2.90
effectiveBalanceIncrements clone MutableVector 300000 218.00 ns/op 120.00 ns/op 1.82
effectiveBalanceIncrements rw all Uint8Array 300000 280.90 us/op 202.52 us/op 1.39
effectiveBalanceIncrements rw all MutableVector 300000 97.020 ms/op 62.699 ms/op 1.55
phase0 afterProcessEpoch - 250000 vs - 7PWei 104.15 ms/op 91.334 ms/op 1.14
phase0 beforeProcessEpoch - 250000 vs - 7PWei 56.630 ms/op 47.876 ms/op 1.18
altair processEpoch - mainnet_e81889 573.74 ms/op 445.92 ms/op 1.29
mainnet_e81889 - altair beforeProcessEpoch 79.180 ms/op 76.309 ms/op 1.04
mainnet_e81889 - altair processJustificationAndFinalization 14.024 us/op 13.204 us/op 1.06
mainnet_e81889 - altair processInactivityUpdates 6.7365 ms/op 6.2196 ms/op 1.08
mainnet_e81889 - altair processRewardsAndPenalties 52.588 ms/op 57.016 ms/op 0.92
mainnet_e81889 - altair processRegistryUpdates 2.7740 us/op 1.7970 us/op 1.54
mainnet_e81889 - altair processSlashings 650.00 ns/op 375.00 ns/op 1.73
mainnet_e81889 - altair processEth1DataReset 472.00 ns/op 290.00 ns/op 1.63
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.9747 ms/op 1.1255 ms/op 1.75
mainnet_e81889 - altair processSlashingsReset 4.9500 us/op 2.8830 us/op 1.72
mainnet_e81889 - altair processRandaoMixesReset 5.4950 us/op 4.0380 us/op 1.36
mainnet_e81889 - altair processHistoricalRootsUpdate 945.00 ns/op 326.00 ns/op 2.90
mainnet_e81889 - altair processParticipationFlagUpdates 3.0080 us/op 1.3930 us/op 2.16
mainnet_e81889 - altair processSyncCommitteeUpdates 702.00 ns/op 257.00 ns/op 2.73
mainnet_e81889 - altair afterProcessEpoch 171.42 ms/op 95.570 ms/op 1.79
capella processEpoch - mainnet_e217614 1.9207 s/op 1.4889 s/op 1.29
mainnet_e217614 - capella beforeProcessEpoch 424.49 ms/op 258.17 ms/op 1.64
mainnet_e217614 - capella processJustificationAndFinalization 41.389 us/op 12.805 us/op 3.23
mainnet_e217614 - capella processInactivityUpdates 40.404 ms/op 17.632 ms/op 2.29
mainnet_e217614 - capella processRewardsAndPenalties 508.81 ms/op 240.14 ms/op 2.12
mainnet_e217614 - capella processRegistryUpdates 42.760 us/op 11.903 us/op 3.59
mainnet_e217614 - capella processSlashings 1.8420 us/op 375.00 ns/op 4.91
mainnet_e217614 - capella processEth1DataReset 1.8870 us/op 280.00 ns/op 6.74
mainnet_e217614 - capella processEffectiveBalanceUpdates 30.012 ms/op 11.332 ms/op 2.65
mainnet_e217614 - capella processSlashingsReset 19.489 us/op 2.5390 us/op 7.68
mainnet_e217614 - capella processRandaoMixesReset 20.317 us/op 4.0300 us/op 5.04
mainnet_e217614 - capella processHistoricalRootsUpdate 4.3570 us/op 329.00 ns/op 13.24
mainnet_e217614 - capella processParticipationFlagUpdates 14.791 us/op 1.1640 us/op 12.71
mainnet_e217614 - capella afterProcessEpoch 782.50 ms/op 277.11 ms/op 2.82
phase0 processEpoch - mainnet_e58758 1.1860 s/op 409.51 ms/op 2.90
mainnet_e58758 - phase0 beforeProcessEpoch 225.32 ms/op 113.77 ms/op 1.98
mainnet_e58758 - phase0 processJustificationAndFinalization 66.431 us/op 16.096 us/op 4.13
mainnet_e58758 - phase0 processRewardsAndPenalties 71.829 ms/op 22.533 ms/op 3.19
mainnet_e58758 - phase0 processRegistryUpdates 23.299 us/op 6.9620 us/op 3.35
mainnet_e58758 - phase0 processSlashings 1.5010 us/op 353.00 ns/op 4.25
mainnet_e58758 - phase0 processEth1DataReset 1.8870 us/op 303.00 ns/op 6.23
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 3.2179 ms/op 873.75 us/op 3.68
mainnet_e58758 - phase0 processSlashingsReset 11.949 us/op 2.3000 us/op 5.20
mainnet_e58758 - phase0 processRandaoMixesReset 15.337 us/op 4.1460 us/op 3.70
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.4060 us/op 313.00 ns/op 4.49
mainnet_e58758 - phase0 processParticipationRecordUpdates 11.890 us/op 3.3300 us/op 3.57
mainnet_e58758 - phase0 afterProcessEpoch 204.12 ms/op 78.621 ms/op 2.60
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.7868 ms/op 1.0456 ms/op 2.67
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 3.3326 ms/op 1.8830 ms/op 1.77
altair processInactivityUpdates - 250000 normalcase 29.585 ms/op 17.596 ms/op 1.68
altair processInactivityUpdates - 250000 worstcase 35.219 ms/op 15.622 ms/op 2.25
phase0 processRegistryUpdates - 250000 normalcase 28.860 us/op 6.3550 us/op 4.54
phase0 processRegistryUpdates - 250000 badcase_full_deposits 567.36 us/op 228.78 us/op 2.48
phase0 processRegistryUpdates - 250000 worstcase 0.5 222.95 ms/op 101.44 ms/op 2.20
altair processRewardsAndPenalties - 250000 normalcase 57.121 ms/op 38.111 ms/op 1.50
altair processRewardsAndPenalties - 250000 worstcase 66.773 ms/op 39.755 ms/op 1.68
phase0 getAttestationDeltas - 250000 normalcase 13.757 ms/op 7.2882 ms/op 1.89
phase0 getAttestationDeltas - 250000 worstcase 19.437 ms/op 7.4099 ms/op 2.62
phase0 processSlashings - 250000 worstcase 201.63 us/op 74.376 us/op 2.71
altair processSyncCommitteeUpdates - 250000 307.56 ms/op 128.77 ms/op 2.39
BeaconState.hashTreeRoot - No change 841.00 ns/op 262.00 ns/op 3.21
BeaconState.hashTreeRoot - 1 full validator 256.48 us/op 121.36 us/op 2.11
BeaconState.hashTreeRoot - 32 full validator 2.6169 ms/op 1.4740 ms/op 1.78
BeaconState.hashTreeRoot - 512 full validator 24.252 ms/op 10.738 ms/op 2.26
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 300.33 us/op 168.41 us/op 1.78
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 4.8657 ms/op 2.0332 ms/op 2.39
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 65.521 ms/op 29.811 ms/op 2.20
BeaconState.hashTreeRoot - 1 balances 291.94 us/op 156.30 us/op 1.87
BeaconState.hashTreeRoot - 32 balances 2.5592 ms/op 1.5815 ms/op 1.62
BeaconState.hashTreeRoot - 512 balances 23.353 ms/op 11.127 ms/op 2.10
BeaconState.hashTreeRoot - 250000 balances 409.79 ms/op 235.06 ms/op 1.74
aggregationBits - 2048 els - zipIndexesInBitList 59.368 us/op 38.721 us/op 1.53
byteArrayEquals 32 112.29 ns/op 60.621 ns/op 1.85
Buffer.compare 32 112.35 ns/op 54.172 ns/op 2.07
byteArrayEquals 1024 3.9377 us/op 1.7990 us/op 2.19
Buffer.compare 1024 124.38 ns/op 72.305 ns/op 1.72
byteArrayEquals 16384 59.066 us/op 41.661 us/op 1.42
Buffer.compare 16384 438.77 ns/op 404.73 ns/op 1.08
byteArrayEquals 123687377 268.03 ms/op 295.55 ms/op 0.91
Buffer.compare 123687377 8.7525 ms/op 7.7289 ms/op 1.13
byteArrayEquals 32 - diff last byte 91.886 ns/op 81.429 ns/op 1.13
Buffer.compare 32 - diff last byte 83.915 ns/op 70.880 ns/op 1.18
byteArrayEquals 1024 - diff last byte 2.1623 us/op 2.0143 us/op 1.07
Buffer.compare 1024 - diff last byte 72.024 ns/op 68.449 ns/op 1.05
byteArrayEquals 16384 - diff last byte 30.506 us/op 32.687 us/op 0.93
Buffer.compare 16384 - diff last byte 281.40 ns/op 273.42 ns/op 1.03
byteArrayEquals 123687377 - diff last byte 240.98 ms/op 290.51 ms/op 0.83
Buffer.compare 123687377 - diff last byte 6.7673 ms/op 9.0999 ms/op 0.74
byteArrayEquals 32 - random bytes 6.7930 ns/op 6.4130 ns/op 1.06
Buffer.compare 32 - random bytes 58.086 ns/op 55.262 ns/op 1.05
byteArrayEquals 1024 - random bytes 6.4000 ns/op 6.0560 ns/op 1.06
Buffer.compare 1024 - random bytes 59.445 ns/op 53.361 ns/op 1.11
byteArrayEquals 16384 - random bytes 6.9530 ns/op 6.1220 ns/op 1.14
Buffer.compare 16384 - random bytes 59.800 ns/op 54.678 ns/op 1.09
byteArrayEquals 123687377 - random bytes 7.2000 ns/op 7.6200 ns/op 0.94
Buffer.compare 123687377 - random bytes 56.030 ns/op 56.090 ns/op 1.00
regular array get 100000 times 49.809 us/op 39.678 us/op 1.26
wrappedArray get 100000 times 43.302 us/op 38.440 us/op 1.13
arrayWithProxy get 100000 times 17.796 ms/op 16.141 ms/op 1.10
ssz.Root.equals 55.221 ns/op 59.029 ns/op 0.94
byteArrayEquals 55.240 ns/op 58.177 ns/op 0.95
Buffer.compare 13.080 ns/op 12.906 ns/op 1.01
shuffle list - 16384 els 6.8850 ms/op 10.950 ms/op 0.63
shuffle list - 250000 els 101.25 ms/op 167.19 ms/op 0.61
processSlot - 1 slots 16.889 us/op 20.630 us/op 0.82
processSlot - 32 slots 3.4116 ms/op 3.4726 ms/op 0.98
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 38.563 ms/op 51.407 ms/op 0.75
getCommitteeAssignments - req 1 vs - 250000 vc 2.4689 ms/op 3.2587 ms/op 0.76
getCommitteeAssignments - req 100 vs - 250000 vc 4.6991 ms/op 5.3329 ms/op 0.88
getCommitteeAssignments - req 1000 vs - 250000 vc 5.0522 ms/op 5.9450 ms/op 0.85
findModifiedValidators - 10000 modified validators 269.33 ms/op 511.68 ms/op 0.53
findModifiedValidators - 1000 modified validators 197.65 ms/op 229.66 ms/op 0.86
findModifiedValidators - 100 modified validators 215.18 ms/op 358.73 ms/op 0.60
findModifiedValidators - 10 modified validators 238.29 ms/op 396.39 ms/op 0.60
findModifiedValidators - 1 modified validators 199.54 ms/op 191.97 ms/op 1.04
findModifiedValidators - no difference 167.41 ms/op 290.74 ms/op 0.58
compare ViewDUs 4.2979 s/op 3.4975 s/op 1.23
compare each validator Uint8Array 2.0051 s/op 1.6347 s/op 1.23
compare ViewDU to Uint8Array 1.6150 s/op 1.3116 s/op 1.23
migrate state 1000000 validators, 24 modified, 0 new 926.05 ms/op 624.02 ms/op 1.48
migrate state 1000000 validators, 1700 modified, 1000 new 1.3885 s/op 1.0714 s/op 1.30
migrate state 1000000 validators, 3400 modified, 2000 new 2.3532 s/op 1.5877 s/op 1.48
migrate state 1500000 validators, 24 modified, 0 new 1.6288 s/op 1.1871 s/op 1.37
migrate state 1500000 validators, 1700 modified, 1000 new 1.7615 s/op 1.5231 s/op 1.16
migrate state 1500000 validators, 3400 modified, 2000 new 2.1653 s/op 1.6208 s/op 1.34
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 9.2700 ns/op 6.5800 ns/op 1.41
state getBlockRootAtSlot - 250000 vs - 7PWei 1.3657 us/op 1.6151 us/op 0.85
computeProposers - vc 250000 22.506 ms/op 19.503 ms/op 1.15
computeEpochShuffling - vc 250000 205.00 ms/op 244.52 ms/op 0.84
getNextSyncCommittee - vc 250000 247.49 ms/op 342.63 ms/op 0.72
computeSigningRoot for AttestationData 43.418 us/op 50.466 us/op 0.86
hash AttestationData serialized data then Buffer.toString(base64) 3.4812 us/op 3.3235 us/op 1.05
toHexString serialized data 1.9215 us/op 2.4712 us/op 0.78
Buffer.toString(base64) 368.49 ns/op 437.26 ns/op 0.84

Please sign in to comment.