Skip to content

Commit

Permalink
feat: allow to configure api client when initializing light client (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig authored Oct 2, 2024
1 parent c4952ee commit b457778
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/light-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import {

const config = getChainForkConfigFromNetwork("sepolia");
const logger = getConsoleLogger({logDebug: Boolean(process.env.DEBUG)});
const api = getApiFromUrl({urls: ["https://lodestar-sepolia.chainsafe.io"]}, {config});
const api = getApiFromUrl("https://lodestar-sepolia.chainsafe.io", "sepolia");

const lightclient = await Lightclient.initializeFromCheckpointRoot({
config,
Expand All @@ -82,11 +82,11 @@ await lightclient.start();
logger.info("Lightclient synced");

lightclient.emitter.on(LightclientEvent.lightClientFinalityHeader, async (finalityUpdate) => {
logger.info(finalityUpdate);
logger.info("Received finality update", {slot: finalityUpdate.beacon.slot});
});

lightclient.emitter.on(LightclientEvent.lightClientOptimisticHeader, async (optimisticUpdate) => {
logger.info(optimisticUpdate);
logger.info("Received optimistic update", {slot: optimisticUpdate.beacon.slot});
});
```

Expand Down
6 changes: 3 additions & 3 deletions packages/light-client/src/utils/api.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {getClient, ApiClient} from "@lodestar/api";
import {getClient, ApiClient, ApiRequestInit} from "@lodestar/api";
import {ChainForkConfig, createChainForkConfig} from "@lodestar/config";
import {NetworkName, networksChainConfig} from "@lodestar/config/networks";

export function getApiFromUrl(url: string, network: NetworkName): ApiClient {
export function getApiFromUrl(url: string, network: NetworkName, init?: ApiRequestInit): ApiClient {
if (!(network in networksChainConfig)) {
throw Error(`Invalid network name "${network}". Valid options are: ${Object.keys(networksChainConfig).join()}`);
}

return getClient({urls: [url]}, {config: createChainForkConfig(networksChainConfig[network])});
return getClient({urls: [url], globalInit: init}, {config: createChainForkConfig(networksChainConfig[network])});
}

export function getChainForkConfigFromNetwork(network: NetworkName): ChainForkConfig {
Expand Down

1 comment on commit b457778

@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: b457778 Previous: c4952ee Ratio
Array.fill - length 1000000 7.8587 ms/op 2.5448 ms/op 3.09
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 5.4876 ms/op 1.7735 ms/op 3.09
findModifiedValidators - 100 modified validators 497.75 ms/op 157.50 ms/op 3.16
findModifiedValidators - 1 modified validators 499.40 ms/op 164.46 ms/op 3.04
findModifiedValidators - no difference 502.01 ms/op 162.09 ms/op 3.10
Full benchmark results
Benchmark suite Current: b457778 Previous: c4952ee Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.3772 ms/op 1.6946 ms/op 1.40
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 77.120 us/op 44.915 us/op 1.72
BLS verify - blst 996.98 us/op 937.17 us/op 1.06
BLS verifyMultipleSignatures 3 - blst 1.3793 ms/op 1.3394 ms/op 1.03
BLS verifyMultipleSignatures 8 - blst 2.0048 ms/op 2.0250 ms/op 0.99
BLS verifyMultipleSignatures 32 - blst 5.3727 ms/op 5.7689 ms/op 0.93
BLS verifyMultipleSignatures 64 - blst 9.9630 ms/op 10.174 ms/op 0.98
BLS verifyMultipleSignatures 128 - blst 18.767 ms/op 17.953 ms/op 1.05
BLS deserializing 10000 signatures 714.92 ms/op 671.95 ms/op 1.06
BLS deserializing 100000 signatures 7.2146 s/op 6.7376 s/op 1.07
BLS verifyMultipleSignatures - same message - 3 - blst 1.0964 ms/op 910.73 us/op 1.20
BLS verifyMultipleSignatures - same message - 8 - blst 1.2417 ms/op 1.0690 ms/op 1.16
BLS verifyMultipleSignatures - same message - 32 - blst 1.9628 ms/op 1.8096 ms/op 1.08
BLS verifyMultipleSignatures - same message - 64 - blst 2.8922 ms/op 2.7168 ms/op 1.06
BLS verifyMultipleSignatures - same message - 128 - blst 4.4931 ms/op 4.3731 ms/op 1.03
BLS aggregatePubkeys 32 - blst 21.117 us/op 19.497 us/op 1.08
BLS aggregatePubkeys 128 - blst 74.626 us/op 69.259 us/op 1.08
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 94.390 ms/op 91.065 ms/op 1.04
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 59.614 ms/op 48.129 ms/op 1.24
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 36.467 ms/op 30.867 ms/op 1.18
getSlashingsAndExits - default max 192.44 us/op 88.792 us/op 2.17
getSlashingsAndExits - 2k 490.02 us/op 422.42 us/op 1.16
proposeBlockBody type=full, size=empty 6.7399 ms/op 5.0762 ms/op 1.33
isKnown best case - 1 super set check 747.00 ns/op 716.00 ns/op 1.04
isKnown normal case - 2 super set checks 741.00 ns/op 598.00 ns/op 1.24
isKnown worse case - 16 super set checks 708.00 ns/op 616.00 ns/op 1.15
InMemoryCheckpointStateCache - add get delete 4.1840 us/op 3.2260 us/op 1.30
updateUnfinalizedPubkeys - updating 10 pubkeys 2.0624 ms/op 981.16 us/op 2.10
updateUnfinalizedPubkeys - updating 100 pubkeys 5.9849 ms/op 3.2221 ms/op 1.86
updateUnfinalizedPubkeys - updating 1000 pubkeys 64.344 ms/op 40.461 ms/op 1.59
validate api signedAggregateAndProof - struct 1.7109 ms/op 1.6384 ms/op 1.04
validate gossip signedAggregateAndProof - struct 1.7379 ms/op 1.6408 ms/op 1.06
validate gossip attestation - vc 640000 1.1424 ms/op 1.0214 ms/op 1.12
batch validate gossip attestation - vc 640000 - chunk 32 165.10 us/op 133.33 us/op 1.24
batch validate gossip attestation - vc 640000 - chunk 64 145.48 us/op 124.97 us/op 1.16
batch validate gossip attestation - vc 640000 - chunk 128 131.00 us/op 113.90 us/op 1.15
batch validate gossip attestation - vc 640000 - chunk 256 145.82 us/op 107.43 us/op 1.36
pickEth1Vote - no votes 1.4340 ms/op 856.92 us/op 1.67
pickEth1Vote - max votes 11.632 ms/op 5.7749 ms/op 2.01
pickEth1Vote - Eth1Data hashTreeRoot value x2048 20.228 ms/op 15.075 ms/op 1.34
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 34.850 ms/op 20.515 ms/op 1.70
pickEth1Vote - Eth1Data fastSerialize value x2048 648.32 us/op 361.85 us/op 1.79
pickEth1Vote - Eth1Data fastSerialize tree x2048 4.9641 ms/op 3.6332 ms/op 1.37
bytes32 toHexString 818.00 ns/op 637.00 ns/op 1.28
bytes32 Buffer.toString(hex) 288.00 ns/op 463.00 ns/op 0.62
bytes32 Buffer.toString(hex) from Uint8Array 564.00 ns/op 590.00 ns/op 0.96
bytes32 Buffer.toString(hex) + 0x 300.00 ns/op 469.00 ns/op 0.64
Object access 1 prop 0.21200 ns/op 0.34100 ns/op 0.62
Map access 1 prop 0.14500 ns/op 0.33800 ns/op 0.43
Object get x1000 6.5460 ns/op 5.2030 ns/op 1.26
Map get x1000 6.9220 ns/op 5.8140 ns/op 1.19
Object set x1000 66.420 ns/op 29.189 ns/op 2.28
Map set x1000 45.936 ns/op 23.100 ns/op 1.99
Return object 10000 times 0.37820 ns/op 0.30690 ns/op 1.23
Throw Error 10000 times 3.9566 us/op 2.7222 us/op 1.45
toHex 219.57 ns/op 114.40 ns/op 1.92
Buffer.from 195.50 ns/op 109.66 ns/op 1.78
shared Buffer 106.58 ns/op 71.557 ns/op 1.49
fastMsgIdFn sha256 / 200 bytes 2.7590 us/op 2.1600 us/op 1.28
fastMsgIdFn h32 xxhash / 200 bytes 354.00 ns/op 529.00 ns/op 0.67
fastMsgIdFn h64 xxhash / 200 bytes 322.00 ns/op 543.00 ns/op 0.59
fastMsgIdFn sha256 / 1000 bytes 8.1620 us/op 6.1440 us/op 1.33
fastMsgIdFn h32 xxhash / 1000 bytes 479.00 ns/op 618.00 ns/op 0.78
fastMsgIdFn h64 xxhash / 1000 bytes 385.00 ns/op 583.00 ns/op 0.66
fastMsgIdFn sha256 / 10000 bytes 70.475 us/op 51.131 us/op 1.38
fastMsgIdFn h32 xxhash / 10000 bytes 2.0600 us/op 2.0430 us/op 1.01
fastMsgIdFn h64 xxhash / 10000 bytes 1.3350 us/op 1.3780 us/op 0.97
send data - 1000 256B messages 17.619 ms/op 11.889 ms/op 1.48
send data - 1000 512B messages 22.769 ms/op 17.469 ms/op 1.30
send data - 1000 1024B messages 33.163 ms/op 23.886 ms/op 1.39
send data - 1000 1200B messages 37.811 ms/op 27.162 ms/op 1.39
send data - 1000 2048B messages 43.700 ms/op 31.077 ms/op 1.41
send data - 1000 4096B messages 42.395 ms/op 29.136 ms/op 1.46
send data - 1000 16384B messages 83.898 ms/op 71.015 ms/op 1.18
send data - 1000 65536B messages 242.31 ms/op 264.70 ms/op 0.92
enrSubnets - fastDeserialize 64 bits 1.6050 us/op 1.1550 us/op 1.39
enrSubnets - ssz BitVector 64 bits 481.00 ns/op 605.00 ns/op 0.80
enrSubnets - fastDeserialize 4 bits 238.00 ns/op 340.00 ns/op 0.70
enrSubnets - ssz BitVector 4 bits 545.00 ns/op 573.00 ns/op 0.95
prioritizePeers score -10:0 att 32-0.1 sync 2-0 234.76 us/op 115.53 us/op 2.03
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 236.01 us/op 138.54 us/op 1.70
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 503.91 us/op 288.24 us/op 1.75
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 555.71 us/op 420.01 us/op 1.32
prioritizePeers score 0:0 att 64-1 sync 4-1 963.92 us/op 633.38 us/op 1.52
array of 16000 items push then shift 1.8015 us/op 1.3857 us/op 1.30
LinkedList of 16000 items push then shift 10.235 ns/op 10.450 ns/op 0.98
array of 16000 items push then pop 139.54 ns/op 119.16 ns/op 1.17
LinkedList of 16000 items push then pop 8.0390 ns/op 6.9800 ns/op 1.15
array of 24000 items push then shift 2.5084 us/op 1.9482 us/op 1.29
LinkedList of 24000 items push then shift 8.8360 ns/op 9.2060 ns/op 0.96
array of 24000 items push then pop 183.82 ns/op 167.91 ns/op 1.09
LinkedList of 24000 items push then pop 8.1180 ns/op 6.6430 ns/op 1.22
intersect bitArray bitLen 8 6.7490 ns/op 6.2910 ns/op 1.07
intersect array and set length 8 70.130 ns/op 40.833 ns/op 1.72
intersect bitArray bitLen 128 31.175 ns/op 26.915 ns/op 1.16
intersect array and set length 128 944.29 ns/op 580.29 ns/op 1.63
bitArray.getTrueBitIndexes() bitLen 128 2.4060 us/op 1.3880 us/op 1.73
bitArray.getTrueBitIndexes() bitLen 248 4.2390 us/op 2.1380 us/op 1.98
bitArray.getTrueBitIndexes() bitLen 512 9.4450 us/op 4.0520 us/op 2.33
Buffer.concat 32 items 1.2600 us/op 1.1100 us/op 1.14
Uint8Array.set 32 items 1.9040 us/op 1.8420 us/op 1.03
Buffer.copy 2.1490 us/op 2.0570 us/op 1.04
Uint8Array.set - with subarray 3.4290 us/op 1.9710 us/op 1.74
Uint8Array.set - without subarray 2.6420 us/op 2.3740 us/op 1.11
getUint32 - dataview 312.00 ns/op 515.00 ns/op 0.61
getUint32 - manual 268.00 ns/op 407.00 ns/op 0.66
Set add up to 64 items then delete first 3.0548 us/op 1.8220 us/op 1.68
OrderedSet add up to 64 items then delete first 4.7579 us/op 2.7694 us/op 1.72
Set add up to 64 items then delete last 3.4980 us/op 2.0692 us/op 1.69
OrderedSet add up to 64 items then delete last 5.1272 us/op 3.0598 us/op 1.68
Set add up to 64 items then delete middle 3.3333 us/op 2.0351 us/op 1.64
OrderedSet add up to 64 items then delete middle 6.7112 us/op 4.4995 us/op 1.49
Set add up to 128 items then delete first 6.7622 us/op 4.0283 us/op 1.68
OrderedSet add up to 128 items then delete first 11.014 us/op 6.4676 us/op 1.70
Set add up to 128 items then delete last 6.5166 us/op 3.9244 us/op 1.66
OrderedSet add up to 128 items then delete last 9.9508 us/op 6.1208 us/op 1.63
Set add up to 128 items then delete middle 6.5390 us/op 4.1056 us/op 1.59
OrderedSet add up to 128 items then delete middle 16.753 us/op 11.622 us/op 1.44
Set add up to 256 items then delete first 13.311 us/op 8.4452 us/op 1.58
OrderedSet add up to 256 items then delete first 21.685 us/op 13.369 us/op 1.62
Set add up to 256 items then delete last 12.529 us/op 7.7231 us/op 1.62
OrderedSet add up to 256 items then delete last 19.276 us/op 12.152 us/op 1.59
Set add up to 256 items then delete middle 12.284 us/op 8.6431 us/op 1.42
OrderedSet add up to 256 items then delete middle 47.160 us/op 40.580 us/op 1.16
transfer serialized Status (84 B) 1.6470 us/op 1.5360 us/op 1.07
copy serialized Status (84 B) 1.4310 us/op 1.5710 us/op 0.91
transfer serialized SignedVoluntaryExit (112 B) 1.6030 us/op 1.8990 us/op 0.84
copy serialized SignedVoluntaryExit (112 B) 1.3050 us/op 1.5990 us/op 0.82
transfer serialized ProposerSlashing (416 B) 1.9070 us/op 2.1220 us/op 0.90
copy serialized ProposerSlashing (416 B) 2.1070 us/op 2.2710 us/op 0.93
transfer serialized Attestation (485 B) 2.4160 us/op 2.3070 us/op 1.05
copy serialized Attestation (485 B) 2.1900 us/op 2.0070 us/op 1.09
transfer serialized AttesterSlashing (33232 B) 2.0870 us/op 2.7500 us/op 0.76
copy serialized AttesterSlashing (33232 B) 8.1390 us/op 10.288 us/op 0.79
transfer serialized Small SignedBeaconBlock (128000 B) 2.3360 us/op 5.0990 us/op 0.46
copy serialized Small SignedBeaconBlock (128000 B) 22.812 us/op 36.003 us/op 0.63
transfer serialized Avg SignedBeaconBlock (200000 B) 2.2990 us/op 6.4990 us/op 0.35
copy serialized Avg SignedBeaconBlock (200000 B) 28.275 us/op 46.535 us/op 0.61
transfer serialized BlobsSidecar (524380 B) 2.7720 us/op 6.8900 us/op 0.40
copy serialized BlobsSidecar (524380 B) 155.59 us/op 150.77 us/op 1.03
transfer serialized Big SignedBeaconBlock (1000000 B) 2.8890 us/op 11.602 us/op 0.25
copy serialized Big SignedBeaconBlock (1000000 B) 155.81 us/op 277.13 us/op 0.56
pass gossip attestations to forkchoice per slot 2.9190 ms/op 2.7361 ms/op 1.07
forkChoice updateHead vc 100000 bc 64 eq 0 508.73 us/op 574.49 us/op 0.89
forkChoice updateHead vc 600000 bc 64 eq 0 4.4521 ms/op 5.2710 ms/op 0.84
forkChoice updateHead vc 1000000 bc 64 eq 0 6.5518 ms/op 5.2055 ms/op 1.26
forkChoice updateHead vc 600000 bc 320 eq 0 3.5934 ms/op 3.2394 ms/op 1.11
forkChoice updateHead vc 600000 bc 1200 eq 0 3.4731 ms/op 6.4222 ms/op 0.54
forkChoice updateHead vc 600000 bc 7200 eq 0 6.5128 ms/op 4.1893 ms/op 1.55
forkChoice updateHead vc 600000 bc 64 eq 1000 11.184 ms/op 10.392 ms/op 1.08
forkChoice updateHead vc 600000 bc 64 eq 10000 11.127 ms/op 11.071 ms/op 1.01
forkChoice updateHead vc 600000 bc 64 eq 300000 21.138 ms/op 39.401 ms/op 0.54
computeDeltas 500000 validators 300 proto nodes 4.5528 ms/op 3.9374 ms/op 1.16
computeDeltas 500000 validators 1200 proto nodes 4.6677 ms/op 3.5871 ms/op 1.30
computeDeltas 500000 validators 7200 proto nodes 5.1453 ms/op 3.2344 ms/op 1.59
computeDeltas 750000 validators 300 proto nodes 7.3965 ms/op 4.7662 ms/op 1.55
computeDeltas 750000 validators 1200 proto nodes 7.4458 ms/op 4.9063 ms/op 1.52
computeDeltas 750000 validators 7200 proto nodes 7.9997 ms/op 5.0055 ms/op 1.60
computeDeltas 1400000 validators 300 proto nodes 17.816 ms/op 9.4754 ms/op 1.88
computeDeltas 1400000 validators 1200 proto nodes 15.486 ms/op 9.3464 ms/op 1.66
computeDeltas 1400000 validators 7200 proto nodes 13.767 ms/op 9.0245 ms/op 1.53
computeDeltas 2100000 validators 300 proto nodes 21.436 ms/op 13.354 ms/op 1.61
computeDeltas 2100000 validators 1200 proto nodes 21.302 ms/op 14.015 ms/op 1.52
computeDeltas 2100000 validators 7200 proto nodes 24.703 ms/op 13.923 ms/op 1.77
altair processAttestation - 250000 vs - 7PWei normalcase 3.1712 ms/op 2.6067 ms/op 1.22
altair processAttestation - 250000 vs - 7PWei worstcase 4.5548 ms/op 2.9098 ms/op 1.57
altair processAttestation - setStatus - 1/6 committees join 157.58 us/op 91.382 us/op 1.72
altair processAttestation - setStatus - 1/3 committees join 308.36 us/op 155.10 us/op 1.99
altair processAttestation - setStatus - 1/2 committees join 406.35 us/op 213.37 us/op 1.90
altair processAttestation - setStatus - 2/3 committees join 518.90 us/op 258.58 us/op 2.01
altair processAttestation - setStatus - 4/5 committees join 680.24 us/op 426.69 us/op 1.59
altair processAttestation - setStatus - 100% committees join 849.79 us/op 477.86 us/op 1.78
altair processBlock - 250000 vs - 7PWei normalcase 8.7328 ms/op 3.7279 ms/op 2.34
altair processBlock - 250000 vs - 7PWei normalcase hashState 28.739 ms/op 29.322 ms/op 0.98
altair processBlock - 250000 vs - 7PWei worstcase 46.230 ms/op 38.824 ms/op 1.19
altair processBlock - 250000 vs - 7PWei worstcase hashState 89.002 ms/op 63.643 ms/op 1.40
phase0 processBlock - 250000 vs - 7PWei normalcase 2.7020 ms/op 2.1858 ms/op 1.24
phase0 processBlock - 250000 vs - 7PWei worstcase 27.532 ms/op 26.657 ms/op 1.03
altair processEth1Data - 250000 vs - 7PWei normalcase 487.47 us/op 261.93 us/op 1.86
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 9.5610 us/op 4.6260 us/op 2.07
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 67.239 us/op 30.042 us/op 2.24
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 19.147 us/op 8.1610 us/op 2.35
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 11.753 us/op 5.3660 us/op 2.19
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 205.64 us/op 125.32 us/op 1.64
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.2314 ms/op 837.27 us/op 1.47
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.1334 ms/op 1.2457 ms/op 1.71
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.9722 ms/op 1.2107 ms/op 1.63
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 5.0902 ms/op 3.0637 ms/op 1.66
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.6846 ms/op 1.3082 ms/op 1.29
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 5.0181 ms/op 3.3498 ms/op 1.50
Tree 40 250000 create 448.59 ms/op 272.50 ms/op 1.65
Tree 40 250000 get(125000) 163.59 ns/op 122.28 ns/op 1.34
Tree 40 250000 set(125000) 1.0504 us/op 522.53 ns/op 2.01
Tree 40 250000 toArray() 24.889 ms/op 11.194 ms/op 2.22
Tree 40 250000 iterate all - toArray() + loop 23.817 ms/op 11.920 ms/op 2.00
Tree 40 250000 iterate all - get(i) 64.967 ms/op 44.349 ms/op 1.46
Array 250000 create 3.9916 ms/op 2.3675 ms/op 1.69
Array 250000 clone - spread 1.6472 ms/op 1.2220 ms/op 1.35
Array 250000 get(125000) 0.47900 ns/op 0.58300 ns/op 0.82
Array 250000 set(125000) 0.48600 ns/op 0.59000 ns/op 0.82
Array 250000 iterate all - loop 101.00 us/op 77.864 us/op 1.30
phase0 afterProcessEpoch - 250000 vs - 7PWei 107.46 ms/op 79.343 ms/op 1.35
Array.fill - length 1000000 7.8587 ms/op 2.5448 ms/op 3.09
Array push - length 1000000 35.825 ms/op 16.919 ms/op 2.12
Array.get 0.32587 ns/op 0.26616 ns/op 1.22
Uint8Array.get 0.48141 ns/op 0.34989 ns/op 1.38
phase0 beforeProcessEpoch - 250000 vs - 7PWei 29.015 ms/op 22.147 ms/op 1.31
altair processEpoch - mainnet_e81889 414.49 ms/op 333.49 ms/op 1.24
mainnet_e81889 - altair beforeProcessEpoch 41.950 ms/op 20.381 ms/op 2.06
mainnet_e81889 - altair processJustificationAndFinalization 30.650 us/op 13.123 us/op 2.34
mainnet_e81889 - altair processInactivityUpdates 10.591 ms/op 5.6160 ms/op 1.89
mainnet_e81889 - altair processRewardsAndPenalties 90.656 ms/op 46.602 ms/op 1.95
mainnet_e81889 - altair processRegistryUpdates 7.4530 us/op 3.1950 us/op 2.33
mainnet_e81889 - altair processSlashings 1.0800 us/op 906.00 ns/op 1.19
mainnet_e81889 - altair processEth1DataReset 1.0640 us/op 781.00 ns/op 1.36
mainnet_e81889 - altair processEffectiveBalanceUpdates 3.0239 ms/op 1.0523 ms/op 2.87
mainnet_e81889 - altair processSlashingsReset 7.1600 us/op 4.5710 us/op 1.57
mainnet_e81889 - altair processRandaoMixesReset 9.1400 us/op 6.5130 us/op 1.40
mainnet_e81889 - altair processHistoricalRootsUpdate 824.00 ns/op 1.2930 us/op 0.64
mainnet_e81889 - altair processParticipationFlagUpdates 2.7300 us/op 3.0950 us/op 0.88
mainnet_e81889 - altair processSyncCommitteeUpdates 560.00 ns/op 1.0450 us/op 0.54
mainnet_e81889 - altair afterProcessEpoch 112.42 ms/op 80.579 ms/op 1.40
capella processEpoch - mainnet_e217614 1.3832 s/op 1.2541 s/op 1.10
mainnet_e217614 - capella beforeProcessEpoch 114.69 ms/op 77.425 ms/op 1.48
mainnet_e217614 - capella processJustificationAndFinalization 27.166 us/op 24.038 us/op 1.13
mainnet_e217614 - capella processInactivityUpdates 19.915 ms/op 16.628 ms/op 1.20
mainnet_e217614 - capella processRewardsAndPenalties 265.49 ms/op 228.03 ms/op 1.16
mainnet_e217614 - capella processRegistryUpdates 23.588 us/op 12.621 us/op 1.87
mainnet_e217614 - capella processSlashings 623.00 ns/op 808.00 ns/op 0.77
mainnet_e217614 - capella processEth1DataReset 550.00 ns/op 869.00 ns/op 0.63
mainnet_e217614 - capella processEffectiveBalanceUpdates 16.716 ms/op 17.439 ms/op 0.96
mainnet_e217614 - capella processSlashingsReset 6.9960 us/op 2.7220 us/op 2.57
mainnet_e217614 - capella processRandaoMixesReset 7.7280 us/op 4.8510 us/op 1.59
mainnet_e217614 - capella processHistoricalRootsUpdate 1.2880 us/op 960.00 ns/op 1.34
mainnet_e217614 - capella processParticipationFlagUpdates 2.5900 us/op 2.0820 us/op 1.24
mainnet_e217614 - capella afterProcessEpoch 252.75 ms/op 199.52 ms/op 1.27
phase0 processEpoch - mainnet_e58758 415.89 ms/op 363.87 ms/op 1.14
mainnet_e58758 - phase0 beforeProcessEpoch 101.74 ms/op 101.57 ms/op 1.00
mainnet_e58758 - phase0 processJustificationAndFinalization 18.452 us/op 25.700 us/op 0.72
mainnet_e58758 - phase0 processRewardsAndPenalties 37.453 ms/op 33.643 ms/op 1.11
mainnet_e58758 - phase0 processRegistryUpdates 10.888 us/op 9.2500 us/op 1.18
mainnet_e58758 - phase0 processSlashings 426.00 ns/op 923.00 ns/op 0.46
mainnet_e58758 - phase0 processEth1DataReset 476.00 ns/op 900.00 ns/op 0.53
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.4114 ms/op 932.29 us/op 1.51
mainnet_e58758 - phase0 processSlashingsReset 5.5290 us/op 4.6520 us/op 1.19
mainnet_e58758 - phase0 processRandaoMixesReset 6.0980 us/op 6.6190 us/op 0.92
mainnet_e58758 - phase0 processHistoricalRootsUpdate 569.00 ns/op 1.3840 us/op 0.41
mainnet_e58758 - phase0 processParticipationRecordUpdates 6.1040 us/op 5.7160 us/op 1.07
mainnet_e58758 - phase0 afterProcessEpoch 91.240 ms/op 68.843 ms/op 1.33
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.6565 ms/op 1.3297 ms/op 1.25
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 5.4876 ms/op 1.7735 ms/op 3.09
altair processInactivityUpdates - 250000 normalcase 20.127 ms/op 17.135 ms/op 1.17
altair processInactivityUpdates - 250000 worstcase 17.821 ms/op 14.121 ms/op 1.26
phase0 processRegistryUpdates - 250000 normalcase 11.594 us/op 7.8540 us/op 1.48
phase0 processRegistryUpdates - 250000 badcase_full_deposits 338.82 us/op 304.69 us/op 1.11
phase0 processRegistryUpdates - 250000 worstcase 0.5 136.23 ms/op 109.94 ms/op 1.24
altair processRewardsAndPenalties - 250000 normalcase 37.966 ms/op 34.886 ms/op 1.09
altair processRewardsAndPenalties - 250000 worstcase 35.392 ms/op 39.458 ms/op 0.90
phase0 getAttestationDeltas - 250000 normalcase 12.491 ms/op 12.608 ms/op 0.99
phase0 getAttestationDeltas - 250000 worstcase 8.2718 ms/op 9.4703 ms/op 0.87
phase0 processSlashings - 250000 worstcase 128.53 us/op 109.41 us/op 1.17
altair processSyncCommitteeUpdates - 250000 136.01 ms/op 151.99 ms/op 0.89
BeaconState.hashTreeRoot - No change 245.00 ns/op 464.00 ns/op 0.53
BeaconState.hashTreeRoot - 1 full validator 145.71 us/op 77.361 us/op 1.88
BeaconState.hashTreeRoot - 32 full validator 1.2889 ms/op 829.38 us/op 1.55
BeaconState.hashTreeRoot - 512 full validator 13.312 ms/op 9.7565 ms/op 1.36
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 191.23 us/op 113.55 us/op 1.68
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.0006 ms/op 2.3560 ms/op 0.85
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 25.702 ms/op 22.902 ms/op 1.12
BeaconState.hashTreeRoot - 1 balances 95.997 us/op 115.52 us/op 0.83
BeaconState.hashTreeRoot - 32 balances 993.23 us/op 1.0087 ms/op 0.98
BeaconState.hashTreeRoot - 512 balances 13.105 ms/op 8.8718 ms/op 1.48
BeaconState.hashTreeRoot - 250000 balances 197.12 ms/op 181.64 ms/op 1.09
aggregationBits - 2048 els - zipIndexesInBitList 33.870 us/op 21.612 us/op 1.57
byteArrayEquals 32 55.799 ns/op 46.721 ns/op 1.19
Buffer.compare 32 17.735 ns/op 15.698 ns/op 1.13
byteArrayEquals 1024 1.6440 us/op 1.2908 us/op 1.27
Buffer.compare 1024 25.413 ns/op 23.808 ns/op 1.07
byteArrayEquals 16384 27.056 us/op 20.572 us/op 1.32
Buffer.compare 16384 215.21 ns/op 205.46 ns/op 1.05
byteArrayEquals 123687377 201.55 ms/op 153.00 ms/op 1.32
Buffer.compare 123687377 7.7733 ms/op 5.7950 ms/op 1.34
byteArrayEquals 32 - diff last byte 53.565 ns/op 47.689 ns/op 1.12
Buffer.compare 32 - diff last byte 17.407 ns/op 15.997 ns/op 1.09
byteArrayEquals 1024 - diff last byte 1.6276 us/op 1.2763 us/op 1.28
Buffer.compare 1024 - diff last byte 26.020 ns/op 23.363 ns/op 1.11
byteArrayEquals 16384 - diff last byte 25.817 us/op 20.119 us/op 1.28
Buffer.compare 16384 - diff last byte 208.20 ns/op 210.99 ns/op 0.99
byteArrayEquals 123687377 - diff last byte 205.04 ms/op 169.65 ms/op 1.21
Buffer.compare 123687377 - diff last byte 11.560 ms/op 8.4081 ms/op 1.37
byteArrayEquals 32 - random bytes 5.4920 ns/op 6.2710 ns/op 0.88
Buffer.compare 32 - random bytes 19.040 ns/op 16.693 ns/op 1.14
byteArrayEquals 1024 - random bytes 5.5930 ns/op 5.4450 ns/op 1.03
Buffer.compare 1024 - random bytes 18.252 ns/op 16.472 ns/op 1.11
byteArrayEquals 16384 - random bytes 5.5780 ns/op 5.1700 ns/op 1.08
Buffer.compare 16384 - random bytes 18.873 ns/op 24.636 ns/op 0.77
byteArrayEquals 123687377 - random bytes 7.0300 ns/op 12.700 ns/op 0.55
Buffer.compare 123687377 - random bytes 20.020 ns/op 24.780 ns/op 0.81
regular array get 100000 times 35.822 us/op 36.457 us/op 0.98
wrappedArray get 100000 times 37.219 us/op 35.053 us/op 1.06
arrayWithProxy get 100000 times 15.262 ms/op 14.201 ms/op 1.07
ssz.Root.equals 51.030 ns/op 50.217 ns/op 1.02
byteArrayEquals 53.591 ns/op 44.982 ns/op 1.19
Buffer.compare 13.254 ns/op 11.925 ns/op 1.11
shuffle list - 16384 els 6.9335 ms/op 6.1818 ms/op 1.12
shuffle list - 250000 els 104.85 ms/op 95.974 ms/op 1.09
processSlot - 1 slots 15.449 us/op 25.539 us/op 0.60
processSlot - 32 slots 3.4238 ms/op 4.4241 ms/op 0.77
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 47.319 ms/op 48.401 ms/op 0.98
getCommitteeAssignments - req 1 vs - 250000 vc 2.6253 ms/op 2.8399 ms/op 0.92
getCommitteeAssignments - req 100 vs - 250000 vc 4.5952 ms/op 3.8325 ms/op 1.20
getCommitteeAssignments - req 1000 vs - 250000 vc 4.7593 ms/op 4.1166 ms/op 1.16
findModifiedValidators - 10000 modified validators 482.74 ms/op 368.27 ms/op 1.31
findModifiedValidators - 1000 modified validators 457.92 ms/op 185.05 ms/op 2.47
findModifiedValidators - 100 modified validators 497.75 ms/op 157.50 ms/op 3.16
findModifiedValidators - 10 modified validators 464.50 ms/op 155.50 ms/op 2.99
findModifiedValidators - 1 modified validators 499.40 ms/op 164.46 ms/op 3.04
findModifiedValidators - no difference 502.01 ms/op 162.09 ms/op 3.10
compare ViewDUs 6.6021 s/op 3.3071 s/op 2.00
compare each validator Uint8Array 2.5286 s/op 1.7701 s/op 1.43
compare ViewDU to Uint8Array 1.8713 s/op 1.1703 s/op 1.60
migrate state 1000000 validators, 24 modified, 0 new 1.3857 s/op 856.14 ms/op 1.62
migrate state 1000000 validators, 1700 modified, 1000 new 1.4368 s/op 1.0154 s/op 1.42
migrate state 1000000 validators, 3400 modified, 2000 new 1.5387 s/op 1.1183 s/op 1.38
migrate state 1500000 validators, 24 modified, 0 new 1.0069 s/op 858.41 ms/op 1.17
migrate state 1500000 validators, 1700 modified, 1000 new 1.1818 s/op 1.0294 s/op 1.15
migrate state 1500000 validators, 3400 modified, 2000 new 1.4640 s/op 1.2878 s/op 1.14
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.9900 ns/op 6.7100 ns/op 0.74
state getBlockRootAtSlot - 250000 vs - 7PWei 626.30 ns/op 918.39 ns/op 0.68
computeProposers - vc 250000 8.1766 ms/op 7.0708 ms/op 1.16
computeEpochShuffling - vc 250000 99.552 ms/op 82.463 ms/op 1.21
getNextSyncCommittee - vc 250000 131.45 ms/op 136.61 ms/op 0.96
computeSigningRoot for AttestationData 27.155 us/op 18.798 us/op 1.44
hash AttestationData serialized data then Buffer.toString(base64) 1.7799 us/op 1.2294 us/op 1.45
toHexString serialized data 1.0392 us/op 865.34 ns/op 1.20
Buffer.toString(base64) 231.56 ns/op 150.31 ns/op 1.54
nodejs block root to RootHex using toHex 211.78 ns/op 130.30 ns/op 1.63
nodejs block root to RootHex using toRootHex 115.57 ns/op 80.894 ns/op 1.43
browser block root to RootHex using the deprecated toHexString 291.16 ns/op 214.74 ns/op 1.36
browser block root to RootHex using toHex 255.42 ns/op 171.78 ns/op 1.49
browser block root to RootHex using toRootHex 186.44 ns/op 153.82 ns/op 1.21

Please sign in to comment.