Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid leaky event handler in waitForCheckpointState #6096

Merged
merged 2 commits into from
Nov 9, 2023

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Nov 8, 2023

Motivation

There are multiple issues with waitForCheckpointState:

  • Consumer may keep the checkpoint state which cause memory issue
  • It uses eventEmitter.on instead of eventEmitter.once
  • Code is complex with timer

Description

Rewrite the above function based on the above points. Thanks @nazarhussain @wemeetagain ❤️

could resolve #6063

@twoeths twoeths requested a review from a team as a code owner November 8, 2023 07:51
Copy link
Contributor

github-actions bot commented Nov 8, 2023

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 97522d5 Previous: d3f40d2 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 569.12 us/op 888.11 us/op 0.64
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 105.93 us/op 84.837 us/op 1.25
BLS verify - blst-native 1.3099 ms/op 1.3413 ms/op 0.98
BLS verifyMultipleSignatures 3 - blst-native 2.7593 ms/op 2.8239 ms/op 0.98
BLS verifyMultipleSignatures 8 - blst-native 6.0588 ms/op 6.2079 ms/op 0.98
BLS verifyMultipleSignatures 32 - blst-native 22.225 ms/op 22.236 ms/op 1.00
BLS verifyMultipleSignatures 64 - blst-native 43.515 ms/op 43.796 ms/op 0.99
BLS verifyMultipleSignatures 128 - blst-native 86.603 ms/op 86.654 ms/op 1.00
BLS deserializing 10000 signatures 904.95 ms/op 914.53 ms/op 0.99
BLS deserializing 100000 signatures 9.3053 s/op 9.2262 s/op 1.01
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.6184 ms/op 1.3390 ms/op 1.21
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.7960 ms/op 1.5834 ms/op 1.13
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.9839 ms/op 2.6769 ms/op 1.11
BLS verifyMultipleSignatures - same message - 64 - blst-native 4.5509 ms/op 3.4768 ms/op 1.31
BLS verifyMultipleSignatures - same message - 128 - blst-native 7.8101 ms/op 5.6357 ms/op 1.39
BLS aggregatePubkeys 32 - blst-native 27.085 us/op 26.011 us/op 1.04
BLS aggregatePubkeys 128 - blst-native 106.47 us/op 101.19 us/op 1.05
getAttestationsForBlock 64.208 ms/op 41.427 ms/op 1.55
isKnown best case - 1 super set check 757.00 ns/op 306.00 ns/op 2.47
isKnown normal case - 2 super set checks 797.00 ns/op 300.00 ns/op 2.66
isKnown worse case - 16 super set checks 770.00 ns/op 299.00 ns/op 2.58
CheckpointStateCache - add get delete 7.5020 us/op 5.3830 us/op 1.39
validate api signedAggregateAndProof - struct 3.0628 ms/op 2.8629 ms/op 1.07
validate gossip signedAggregateAndProof - struct 2.9925 ms/op 2.8252 ms/op 1.06
validate gossip attestation - vc 640000 1.4282 ms/op 1.3917 ms/op 1.03
batch validate gossip attestation - vc 640000 - chunk 32 182.65 us/op 166.03 us/op 1.10
batch validate gossip attestation - vc 640000 - chunk 64 163.43 us/op 142.28 us/op 1.15
batch validate gossip attestation - vc 640000 - chunk 128 155.41 us/op 132.10 us/op 1.18
batch validate gossip attestation - vc 640000 - chunk 256 138.19 us/op 133.22 us/op 1.04
pickEth1Vote - no votes 1.4031 ms/op 1.3213 ms/op 1.06
pickEth1Vote - max votes 13.433 ms/op 9.2465 ms/op 1.45
pickEth1Vote - Eth1Data hashTreeRoot value x2048 18.312 ms/op 19.025 ms/op 0.96
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 32.757 ms/op 34.116 ms/op 0.96
pickEth1Vote - Eth1Data fastSerialize value x2048 769.49 us/op 685.59 us/op 1.12
pickEth1Vote - Eth1Data fastSerialize tree x2048 7.2874 ms/op 8.6556 ms/op 0.84
bytes32 toHexString 659.00 ns/op 569.00 ns/op 1.16
bytes32 Buffer.toString(hex) 322.00 ns/op 312.00 ns/op 1.03
bytes32 Buffer.toString(hex) from Uint8Array 534.00 ns/op 479.00 ns/op 1.11
bytes32 Buffer.toString(hex) + 0x 315.00 ns/op 306.00 ns/op 1.03
Object access 1 prop 0.19300 ns/op 0.17800 ns/op 1.08
Map access 1 prop 0.15800 ns/op 0.15300 ns/op 1.03
Object get x1000 7.2850 ns/op 8.0460 ns/op 0.91
Map get x1000 0.61600 ns/op 0.63200 ns/op 0.97
Object set x1000 62.946 ns/op 54.977 ns/op 1.14
Map set x1000 50.183 ns/op 42.354 ns/op 1.18
Return object 10000 times 0.24750 ns/op 0.25450 ns/op 0.97
Throw Error 10000 times 4.0027 us/op 4.0492 us/op 0.99
fastMsgIdFn sha256 / 200 bytes 3.4050 us/op 3.4600 us/op 0.98
fastMsgIdFn h32 xxhash / 200 bytes 349.00 ns/op 301.00 ns/op 1.16
fastMsgIdFn h64 xxhash / 200 bytes 381.00 ns/op 354.00 ns/op 1.08
fastMsgIdFn sha256 / 1000 bytes 11.904 us/op 12.129 us/op 0.98
fastMsgIdFn h32 xxhash / 1000 bytes 481.00 ns/op 462.00 ns/op 1.04
fastMsgIdFn h64 xxhash / 1000 bytes 458.00 ns/op 440.00 ns/op 1.04
fastMsgIdFn sha256 / 10000 bytes 104.04 us/op 108.15 us/op 0.96
fastMsgIdFn h32 xxhash / 10000 bytes 2.0240 us/op 2.0600 us/op 0.98
fastMsgIdFn h64 xxhash / 10000 bytes 1.3580 us/op 1.4120 us/op 0.96
send data - 1000 256B messages 21.581 ms/op 21.946 ms/op 0.98
send data - 1000 512B messages 29.598 ms/op 29.604 ms/op 1.00
send data - 1000 1024B messages 44.776 ms/op 43.501 ms/op 1.03
send data - 1000 1200B messages 43.637 ms/op 34.678 ms/op 1.26
send data - 1000 2048B messages 41.610 ms/op 44.499 ms/op 0.94
send data - 1000 4096B messages 45.522 ms/op 28.028 ms/op 1.62
send data - 1000 16384B messages 108.70 ms/op 104.54 ms/op 1.04
send data - 1000 65536B messages 456.72 ms/op 437.17 ms/op 1.04
enrSubnets - fastDeserialize 64 bits 1.4240 us/op 1.2980 us/op 1.10
enrSubnets - ssz BitVector 64 bits 520.00 ns/op 444.00 ns/op 1.17
enrSubnets - fastDeserialize 4 bits 230.00 ns/op 174.00 ns/op 1.32
enrSubnets - ssz BitVector 4 bits 534.00 ns/op 428.00 ns/op 1.25
prioritizePeers score -10:0 att 32-0.1 sync 2-0 121.45 us/op 113.55 us/op 1.07
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 147.94 us/op 143.95 us/op 1.03
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 192.80 us/op 181.27 us/op 1.06
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 324.69 us/op 350.58 us/op 0.93
prioritizePeers score 0:0 att 64-1 sync 4-1 382.45 us/op 394.53 us/op 0.97
array of 16000 items push then shift 1.6471 us/op 1.7079 us/op 0.96
LinkedList of 16000 items push then shift 9.2370 ns/op 9.7420 ns/op 0.95
array of 16000 items push then pop 103.69 ns/op 104.90 ns/op 0.99
LinkedList of 16000 items push then pop 9.0580 ns/op 9.3660 ns/op 0.97
array of 24000 items push then shift 2.5044 us/op 2.6884 us/op 0.93
LinkedList of 24000 items push then shift 9.8360 ns/op 9.8340 ns/op 1.00
array of 24000 items push then pop 148.65 ns/op 156.99 ns/op 0.95
LinkedList of 24000 items push then pop 8.9080 ns/op 10.085 ns/op 0.88
intersect bitArray bitLen 8 6.9360 ns/op 7.6410 ns/op 0.91
intersect array and set length 8 67.986 ns/op 86.982 ns/op 0.78
intersect bitArray bitLen 128 31.789 ns/op 33.916 ns/op 0.94
intersect array and set length 128 1.0021 us/op 899.84 ns/op 1.11
bitArray.getTrueBitIndexes() bitLen 128 1.8270 us/op 1.7650 us/op 1.04
bitArray.getTrueBitIndexes() bitLen 248 3.0490 us/op 2.8670 us/op 1.06
bitArray.getTrueBitIndexes() bitLen 512 6.0280 us/op 6.5840 us/op 0.92
Buffer.concat 32 items 1.0050 us/op 1.1170 us/op 0.90
Uint8Array.set 32 items 1.8920 us/op 1.9340 us/op 0.98
Set add up to 64 items then delete first 4.8469 us/op 4.9385 us/op 0.98
OrderedSet add up to 64 items then delete first 6.5046 us/op 6.9598 us/op 0.93
Set add up to 64 items then delete last 5.3540 us/op 5.3711 us/op 1.00
OrderedSet add up to 64 items then delete last 6.8388 us/op 6.9731 us/op 0.98
Set add up to 64 items then delete middle 5.2852 us/op 5.4592 us/op 0.97
OrderedSet add up to 64 items then delete middle 8.2422 us/op 8.3203 us/op 0.99
Set add up to 128 items then delete first 10.650 us/op 11.094 us/op 0.96
OrderedSet add up to 128 items then delete first 14.044 us/op 13.448 us/op 1.04
Set add up to 128 items then delete last 10.309 us/op 10.408 us/op 0.99
OrderedSet add up to 128 items then delete last 13.182 us/op 13.416 us/op 0.98
Set add up to 128 items then delete middle 10.017 us/op 10.725 us/op 0.93
OrderedSet add up to 128 items then delete middle 18.593 us/op 20.172 us/op 0.92
Set add up to 256 items then delete first 20.682 us/op 21.342 us/op 0.97
OrderedSet add up to 256 items then delete first 29.602 us/op 27.010 us/op 1.10
Set add up to 256 items then delete last 20.247 us/op 20.433 us/op 0.99
OrderedSet add up to 256 items then delete last 27.639 us/op 27.570 us/op 1.00
Set add up to 256 items then delete middle 20.476 us/op 21.577 us/op 0.95
OrderedSet add up to 256 items then delete middle 50.837 us/op 53.045 us/op 0.96
transfer serialized Status (84 B) 2.0480 us/op 1.9630 us/op 1.04
copy serialized Status (84 B) 1.7020 us/op 1.7470 us/op 0.97
transfer serialized SignedVoluntaryExit (112 B) 2.2440 us/op 2.0830 us/op 1.08
copy serialized SignedVoluntaryExit (112 B) 1.7300 us/op 1.8020 us/op 0.96
transfer serialized ProposerSlashing (416 B) 2.6640 us/op 2.4990 us/op 1.07
copy serialized ProposerSlashing (416 B) 2.4260 us/op 2.7060 us/op 0.90
transfer serialized Attestation (485 B) 2.4560 us/op 2.3590 us/op 1.04
copy serialized Attestation (485 B) 2.5750 us/op 2.4850 us/op 1.04
transfer serialized AttesterSlashing (33232 B) 3.0470 us/op 2.4300 us/op 1.25
copy serialized AttesterSlashing (33232 B) 8.1250 us/op 8.9020 us/op 0.91
transfer serialized Small SignedBeaconBlock (128000 B) 3.6980 us/op 2.9260 us/op 1.26
copy serialized Small SignedBeaconBlock (128000 B) 23.530 us/op 21.546 us/op 1.09
transfer serialized Avg SignedBeaconBlock (200000 B) 4.1500 us/op 4.1050 us/op 1.01
copy serialized Avg SignedBeaconBlock (200000 B) 29.941 us/op 27.564 us/op 1.09
transfer serialized BlobsSidecar (524380 B) 4.1270 us/op 3.9960 us/op 1.03
copy serialized BlobsSidecar (524380 B) 106.95 us/op 105.74 us/op 1.01
transfer serialized Big SignedBeaconBlock (1000000 B) 4.2100 us/op 3.9370 us/op 1.07
copy serialized Big SignedBeaconBlock (1000000 B) 196.95 us/op 208.95 us/op 0.94
pass gossip attestations to forkchoice per slot 4.3172 ms/op 4.5569 ms/op 0.95
forkChoice updateHead vc 100000 bc 64 eq 0 683.67 us/op 726.46 us/op 0.94
forkChoice updateHead vc 600000 bc 64 eq 0 6.9472 ms/op 5.6835 ms/op 1.22
forkChoice updateHead vc 1000000 bc 64 eq 0 7.4019 ms/op 7.6388 ms/op 0.97
forkChoice updateHead vc 600000 bc 320 eq 0 4.3940 ms/op 4.3885 ms/op 1.00
forkChoice updateHead vc 600000 bc 1200 eq 0 4.3984 ms/op 4.5517 ms/op 0.97
forkChoice updateHead vc 600000 bc 7200 eq 0 6.2013 ms/op 5.4937 ms/op 1.13
forkChoice updateHead vc 600000 bc 64 eq 1000 11.403 ms/op 11.988 ms/op 0.95
forkChoice updateHead vc 600000 bc 64 eq 10000 12.560 ms/op 12.766 ms/op 0.98
forkChoice updateHead vc 600000 bc 64 eq 300000 18.287 ms/op 18.523 ms/op 0.99
computeDeltas 500000 validators 300 proto nodes 6.7035 ms/op 7.0595 ms/op 0.95
computeDeltas 500000 validators 1200 proto nodes 6.6802 ms/op 6.7841 ms/op 0.98
computeDeltas 500000 validators 7200 proto nodes 6.7817 ms/op 6.8859 ms/op 0.98
computeDeltas 750000 validators 300 proto nodes 10.113 ms/op 10.063 ms/op 1.00
computeDeltas 750000 validators 1200 proto nodes 10.130 ms/op 9.9386 ms/op 1.02
computeDeltas 750000 validators 7200 proto nodes 10.340 ms/op 9.9707 ms/op 1.04
computeDeltas 1400000 validators 300 proto nodes 19.360 ms/op 18.386 ms/op 1.05
computeDeltas 1400000 validators 1200 proto nodes 19.821 ms/op 18.455 ms/op 1.07
computeDeltas 1400000 validators 7200 proto nodes 20.318 ms/op 18.407 ms/op 1.10
computeDeltas 2100000 validators 300 proto nodes 29.494 ms/op 28.204 ms/op 1.05
computeDeltas 2100000 validators 1200 proto nodes 27.880 ms/op 28.930 ms/op 0.96
computeDeltas 2100000 validators 7200 proto nodes 29.106 ms/op 28.102 ms/op 1.04
computeProposerBoostScoreFromBalances 500000 validators 3.4199 ms/op 3.3113 ms/op 1.03
computeProposerBoostScoreFromBalances 750000 validators 3.5375 ms/op 3.2806 ms/op 1.08
computeProposerBoostScoreFromBalances 1400000 validators 3.5682 ms/op 3.1573 ms/op 1.13
computeProposerBoostScoreFromBalances 2100000 validators 3.3960 ms/op 3.1522 ms/op 1.08
altair processAttestation - 250000 vs - 7PWei normalcase 3.1613 ms/op 2.3229 ms/op 1.36
altair processAttestation - 250000 vs - 7PWei worstcase 4.3727 ms/op 3.2123 ms/op 1.36
altair processAttestation - setStatus - 1/6 committees join 154.86 us/op 179.16 us/op 0.86
altair processAttestation - setStatus - 1/3 committees join 297.70 us/op 339.82 us/op 0.88
altair processAttestation - setStatus - 1/2 committees join 395.69 us/op 471.04 us/op 0.84
altair processAttestation - setStatus - 2/3 committees join 514.24 us/op 601.67 us/op 0.85
altair processAttestation - setStatus - 4/5 committees join 673.74 us/op 820.71 us/op 0.82
altair processAttestation - setStatus - 100% committees join 808.30 us/op 932.07 us/op 0.87
altair processBlock - 250000 vs - 7PWei normalcase 10.938 ms/op 10.958 ms/op 1.00
altair processBlock - 250000 vs - 7PWei normalcase hashState 40.908 ms/op 36.657 ms/op 1.12
altair processBlock - 250000 vs - 7PWei worstcase 47.026 ms/op 38.883 ms/op 1.21
altair processBlock - 250000 vs - 7PWei worstcase hashState 105.87 ms/op 99.961 ms/op 1.06
phase0 processBlock - 250000 vs - 7PWei normalcase 4.2834 ms/op 3.6589 ms/op 1.17
phase0 processBlock - 250000 vs - 7PWei worstcase 35.127 ms/op 33.045 ms/op 1.06
altair processEth1Data - 250000 vs - 7PWei normalcase 753.03 us/op 639.75 us/op 1.18
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 14.069 us/op 18.541 us/op 0.76
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 80.402 us/op 105.37 us/op 0.76
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 28.903 us/op 28.853 us/op 1.00
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 19.601 us/op 20.805 us/op 0.94
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 178.35 us/op 270.36 us/op 0.66
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.4982 ms/op 2.1662 ms/op 0.69
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.8219 ms/op 2.8398 ms/op 0.64
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.7010 ms/op 2.3337 ms/op 0.73
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.0464 ms/op 4.0779 ms/op 0.99
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.7614 ms/op 2.2554 ms/op 1.22
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 6.6546 ms/op 5.2375 ms/op 1.27
Tree 40 250000 create 517.30 ms/op 367.45 ms/op 1.41
Tree 40 250000 get(125000) 211.42 ns/op 193.20 ns/op 1.09
Tree 40 250000 set(125000) 1.1568 us/op 946.68 ns/op 1.22
Tree 40 250000 toArray() 23.649 ms/op 17.531 ms/op 1.35
Tree 40 250000 iterate all - toArray() + loop 23.104 ms/op 17.715 ms/op 1.30
Tree 40 250000 iterate all - get(i) 75.077 ms/op 65.169 ms/op 1.15
MutableVector 250000 create 11.264 ms/op 19.264 ms/op 0.58
MutableVector 250000 get(125000) 6.6640 ns/op 6.4170 ns/op 1.04
MutableVector 250000 set(125000) 383.50 ns/op 250.94 ns/op 1.53
MutableVector 250000 toArray() 4.6136 ms/op 2.6152 ms/op 1.76
MutableVector 250000 iterate all - toArray() + loop 5.3501 ms/op 3.1334 ms/op 1.71
MutableVector 250000 iterate all - get(i) 1.5483 ms/op 1.5240 ms/op 1.02
Array 250000 create 4.4680 ms/op 2.7189 ms/op 1.64
Array 250000 clone - spread 1.3582 ms/op 1.1953 ms/op 1.14
Array 250000 get(125000) 0.72100 ns/op 0.57900 ns/op 1.25
Array 250000 set(125000) 0.74800 ns/op 0.65300 ns/op 1.15
Array 250000 iterate all - loop 113.60 us/op 80.926 us/op 1.40
effectiveBalanceIncrements clone Uint8Array 300000 57.799 us/op 28.516 us/op 2.03
effectiveBalanceIncrements clone MutableVector 300000 424.00 ns/op 351.00 ns/op 1.21
effectiveBalanceIncrements rw all Uint8Array 300000 187.39 us/op 176.24 us/op 1.06
effectiveBalanceIncrements rw all MutableVector 300000 135.65 ms/op 81.851 ms/op 1.66
phase0 afterProcessEpoch - 250000 vs - 7PWei 118.46 ms/op 111.61 ms/op 1.06
phase0 beforeProcessEpoch - 250000 vs - 7PWei 51.610 ms/op 54.891 ms/op 0.94
altair processEpoch - mainnet_e81889 526.09 ms/op 522.50 ms/op 1.01
mainnet_e81889 - altair beforeProcessEpoch 87.845 ms/op 81.278 ms/op 1.08
mainnet_e81889 - altair processJustificationAndFinalization 31.690 us/op 20.459 us/op 1.55
mainnet_e81889 - altair processInactivityUpdates 7.1551 ms/op 5.3360 ms/op 1.34
mainnet_e81889 - altair processRewardsAndPenalties 59.132 ms/op 73.515 ms/op 0.80
mainnet_e81889 - altair processRegistryUpdates 3.3390 us/op 4.3880 us/op 0.76
mainnet_e81889 - altair processSlashings 535.00 ns/op 744.00 ns/op 0.72
mainnet_e81889 - altair processEth1DataReset 823.00 ns/op 943.00 ns/op 0.87
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.4300 ms/op 2.3765 ms/op 0.60
mainnet_e81889 - altair processSlashingsReset 5.5750 us/op 6.3490 us/op 0.88
mainnet_e81889 - altair processRandaoMixesReset 9.1970 us/op 6.6950 us/op 1.37
mainnet_e81889 - altair processHistoricalRootsUpdate 1.4200 us/op 821.00 ns/op 1.73
mainnet_e81889 - altair processParticipationFlagUpdates 2.9030 us/op 2.0640 us/op 1.41
mainnet_e81889 - altair processSyncCommitteeUpdates 1.0910 us/op 942.00 ns/op 1.16
mainnet_e81889 - altair afterProcessEpoch 125.90 ms/op 120.15 ms/op 1.05
capella processEpoch - mainnet_e217614 2.3224 s/op 2.2823 s/op 1.02
mainnet_e217614 - capella beforeProcessEpoch 518.40 ms/op 447.96 ms/op 1.16
mainnet_e217614 - capella processJustificationAndFinalization 24.938 us/op 19.744 us/op 1.26
mainnet_e217614 - capella processInactivityUpdates 20.983 ms/op 20.978 ms/op 1.00
mainnet_e217614 - capella processRewardsAndPenalties 638.40 ms/op 568.16 ms/op 1.12
mainnet_e217614 - capella processRegistryUpdates 61.033 us/op 34.205 us/op 1.78
mainnet_e217614 - capella processSlashings 1.5770 us/op 904.00 ns/op 1.74
mainnet_e217614 - capella processEth1DataReset 1.6560 us/op 1.1130 us/op 1.49
mainnet_e217614 - capella processEffectiveBalanceUpdates 4.3199 ms/op 3.9441 ms/op 1.10
mainnet_e217614 - capella processSlashingsReset 7.5740 us/op 3.9010 us/op 1.94
mainnet_e217614 - capella processRandaoMixesReset 11.695 us/op 8.5360 us/op 1.37
mainnet_e217614 - capella processHistoricalRootsUpdate 1.4890 us/op 1.0490 us/op 1.42
mainnet_e217614 - capella processParticipationFlagUpdates 3.0030 us/op 3.7280 us/op 0.81
mainnet_e217614 - capella afterProcessEpoch 339.05 ms/op 327.76 ms/op 1.03
phase0 processEpoch - mainnet_e58758 488.95 ms/op 524.55 ms/op 0.93
mainnet_e58758 - phase0 beforeProcessEpoch 150.48 ms/op 133.36 ms/op 1.13
mainnet_e58758 - phase0 processJustificationAndFinalization 21.884 us/op 24.420 us/op 0.90
mainnet_e58758 - phase0 processRewardsAndPenalties 66.471 ms/op 81.781 ms/op 0.81
mainnet_e58758 - phase0 processRegistryUpdates 11.499 us/op 11.687 us/op 0.98
mainnet_e58758 - phase0 processSlashings 562.00 ns/op 626.00 ns/op 0.90
mainnet_e58758 - phase0 processEth1DataReset 644.00 ns/op 559.00 ns/op 1.15
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.0696 ms/op 1.5314 ms/op 0.70
mainnet_e58758 - phase0 processSlashingsReset 4.4090 us/op 3.6440 us/op 1.21
mainnet_e58758 - phase0 processRandaoMixesReset 9.6850 us/op 6.7930 us/op 1.43
mainnet_e58758 - phase0 processHistoricalRootsUpdate 871.00 ns/op 704.00 ns/op 1.24
mainnet_e58758 - phase0 processParticipationRecordUpdates 5.3650 us/op 6.3490 us/op 0.85
mainnet_e58758 - phase0 afterProcessEpoch 103.75 ms/op 103.45 ms/op 1.00
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.3417 ms/op 1.2005 ms/op 1.12
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.9811 ms/op 1.3685 ms/op 1.45
altair processInactivityUpdates - 250000 normalcase 36.034 ms/op 27.394 ms/op 1.32
altair processInactivityUpdates - 250000 worstcase 30.674 ms/op 30.060 ms/op 1.02
phase0 processRegistryUpdates - 250000 normalcase 18.602 us/op 13.654 us/op 1.36
phase0 processRegistryUpdates - 250000 badcase_full_deposits 446.66 us/op 635.46 us/op 0.70
phase0 processRegistryUpdates - 250000 worstcase 0.5 162.19 ms/op 152.75 ms/op 1.06
altair processRewardsAndPenalties - 250000 normalcase 79.672 ms/op 89.272 ms/op 0.89
altair processRewardsAndPenalties - 250000 worstcase 91.018 ms/op 83.597 ms/op 1.09
phase0 getAttestationDeltas - 250000 normalcase 12.110 ms/op 8.0838 ms/op 1.50
phase0 getAttestationDeltas - 250000 worstcase 11.540 ms/op 8.0002 ms/op 1.44
phase0 processSlashings - 250000 worstcase 2.9064 ms/op 2.3320 ms/op 1.25
altair processSyncCommitteeUpdates - 250000 187.42 ms/op 150.88 ms/op 1.24
BeaconState.hashTreeRoot - No change 306.00 ns/op 258.00 ns/op 1.19
BeaconState.hashTreeRoot - 1 full validator 267.11 us/op 166.94 us/op 1.60
BeaconState.hashTreeRoot - 32 full validator 2.0784 ms/op 1.6287 ms/op 1.28
BeaconState.hashTreeRoot - 512 full validator 18.985 ms/op 17.214 ms/op 1.10
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 206.55 us/op 198.48 us/op 1.04
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 3.4773 ms/op 2.3406 ms/op 1.49
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 31.929 ms/op 35.306 ms/op 0.90
BeaconState.hashTreeRoot - 1 balances 188.17 us/op 170.80 us/op 1.10
BeaconState.hashTreeRoot - 32 balances 1.5977 ms/op 1.6229 ms/op 0.98
BeaconState.hashTreeRoot - 512 balances 15.032 ms/op 14.964 ms/op 1.00
BeaconState.hashTreeRoot - 250000 balances 230.59 ms/op 227.20 ms/op 1.01
aggregationBits - 2048 els - zipIndexesInBitList 33.284 us/op 16.274 us/op 2.05
byteArrayEquals 32 55.141 ns/op 50.409 ns/op 1.09
Buffer.compare 32 58.926 ns/op 56.151 ns/op 1.05
byteArrayEquals 1024 1.5364 us/op 1.4647 us/op 1.05
Buffer.compare 1024 72.201 ns/op 72.335 ns/op 1.00
byteArrayEquals 16384 24.268 us/op 23.306 us/op 1.04
Buffer.compare 16384 274.15 ns/op 272.73 ns/op 1.01
byteArrayEquals 123687377 192.95 ms/op 176.97 ms/op 1.09
Buffer.compare 123687377 10.373 ms/op 6.0607 ms/op 1.71
byteArrayEquals 32 - diff last byte 54.598 ns/op 49.493 ns/op 1.10
Buffer.compare 32 - diff last byte 62.635 ns/op 62.239 ns/op 1.01
byteArrayEquals 1024 - diff last byte 1.5871 us/op 1.4811 us/op 1.07
Buffer.compare 1024 - diff last byte 77.030 ns/op 72.134 ns/op 1.07
byteArrayEquals 16384 - diff last byte 24.873 us/op 23.595 us/op 1.05
Buffer.compare 16384 - diff last byte 284.42 ns/op 247.62 ns/op 1.15
byteArrayEquals 123687377 - diff last byte 199.46 ms/op 182.26 ms/op 1.09
Buffer.compare 123687377 - diff last byte 11.559 ms/op 7.4971 ms/op 1.54
byteArrayEquals 32 - random bytes 7.7510 ns/op 6.3240 ns/op 1.23
Buffer.compare 32 - random bytes 67.235 ns/op 64.871 ns/op 1.04
byteArrayEquals 1024 - random bytes 7.3100 ns/op 6.3200 ns/op 1.16
Buffer.compare 1024 - random bytes 62.102 ns/op 64.284 ns/op 0.97
byteArrayEquals 16384 - random bytes 7.2180 ns/op 6.1530 ns/op 1.17
Buffer.compare 16384 - random bytes 62.824 ns/op 61.665 ns/op 1.02
byteArrayEquals 123687377 - random bytes 18.060 ns/op 9.0400 ns/op 2.00
Buffer.compare 123687377 - random bytes 79.680 ns/op 65.930 ns/op 1.21
regular array get 100000 times 36.850 us/op 33.816 us/op 1.09
wrappedArray get 100000 times 37.118 us/op 33.601 us/op 1.10
arrayWithProxy get 100000 times 14.328 ms/op 16.170 ms/op 0.89
ssz.Root.equals 54.316 ns/op 52.017 ns/op 1.04
byteArrayEquals 52.017 ns/op 50.436 ns/op 1.03
Buffer.compare 14.399 ns/op 11.038 ns/op 1.30
shuffle list - 16384 els 7.5973 ms/op 7.0388 ms/op 1.08
shuffle list - 250000 els 104.69 ms/op 103.30 ms/op 1.01
processSlot - 1 slots 16.322 us/op 20.488 us/op 0.80
processSlot - 32 slots 3.5389 ms/op 3.9780 ms/op 0.89
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 63.900 ms/op 61.266 ms/op 1.04
getCommitteeAssignments - req 1 vs - 250000 vc 2.5565 ms/op 2.4876 ms/op 1.03
getCommitteeAssignments - req 100 vs - 250000 vc 3.7683 ms/op 3.6838 ms/op 1.02
getCommitteeAssignments - req 1000 vs - 250000 vc 4.1754 ms/op 4.0098 ms/op 1.04
findModifiedValidators - 10000 modified validators 565.17 ms/op 559.36 ms/op 1.01
findModifiedValidators - 1000 modified validators 471.04 ms/op 437.74 ms/op 1.08
findModifiedValidators - 100 modified validators 437.32 ms/op 401.00 ms/op 1.09
findModifiedValidators - 10 modified validators 436.20 ms/op 408.45 ms/op 1.07
findModifiedValidators - 1 modified validators 415.42 ms/op 401.34 ms/op 1.04
findModifiedValidators - no difference 442.90 ms/op 389.69 ms/op 1.14
compare ViewDUs 4.7501 s/op 4.9036 s/op 0.97
compare each validator Uint8Array 1.5662 s/op 1.9838 s/op 0.79
compare ViewDU to Uint8Array 1.3410 s/op 1.1152 s/op 1.20
migrate state 1000000 validators, 24 modified, 0 new 810.56 ms/op 865.57 ms/op 0.94
migrate state 1000000 validators, 1700 modified, 1000 new 1.1177 s/op 1.1869 s/op 0.94
migrate state 1000000 validators, 3400 modified, 2000 new 1.3940 s/op 1.4395 s/op 0.97
migrate state 1500000 validators, 24 modified, 0 new 838.15 ms/op 892.99 ms/op 0.94
migrate state 1500000 validators, 1700 modified, 1000 new 1.1764 s/op 1.1574 s/op 1.02
migrate state 1500000 validators, 3400 modified, 2000 new 1.4592 s/op 1.4923 s/op 0.98
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.0000 ns/op 4.1300 ns/op 1.21
state getBlockRootAtSlot - 250000 vs - 7PWei 922.65 ns/op 973.62 ns/op 0.95
computeProposers - vc 250000 10.888 ms/op 10.233 ms/op 1.06
computeEpochShuffling - vc 250000 107.17 ms/op 106.83 ms/op 1.00
getNextSyncCommittee - vc 250000 170.34 ms/op 153.23 ms/op 1.11
computeSigningRoot for AttestationData 29.134 us/op 26.409 us/op 1.10
hash AttestationData serialized data then Buffer.toString(base64) 2.5058 us/op 2.3777 us/op 1.05
toHexString serialized data 1.5122 us/op 1.0784 us/op 1.40
Buffer.toString(base64) 272.27 ns/op 220.30 ns/op 1.24

by benchmarkbot/action

@wemeetagain wemeetagain changed the title fix: do not consume checkpoint state in waitForCheckpointState fix: avoid leaking event handler in waitForCheckpointState Nov 8, 2023
@wemeetagain wemeetagain changed the title fix: avoid leaking event handler in waitForCheckpointState fix: avoid leaky event handler in waitForCheckpointState Nov 8, 2023
@twoeths twoeths merged commit 37cf9dd into unstable Nov 9, 2023
16 checks passed
@twoeths twoeths deleted the tuyen/fix_waitForCheckpointState branch November 9, 2023 06:33
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.13.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[mainnet] Epoch Transition time spiked
2 participants