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: light-client start should never block #6619

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

jeluard
Copy link
Contributor

@jeluard jeluard commented Apr 2, 2024

Motivation

light-client start should never block.

Description

Currently, calling light-client start twice in a row will wait forever.

const client = ...
await client.start();
await client.start(); // Never returns

Simplify the wait logic by leveraging the fact that runLoop already awaits for started state.

@jeluard jeluard requested a review from a team as a code owner April 2, 2024 07:26
@jeluard jeluard changed the title fix: LC start should never block Light Client start should never block Apr 2, 2024
@jeluard jeluard changed the title Light Client start should never block fix: Light Client start should never block Apr 2, 2024
@jeluard jeluard changed the title fix: Light Client start should never block fix: light-client start should never block Apr 2, 2024
Copy link

codecov bot commented Apr 2, 2024

Codecov Report

Merging #6619 (cf47a84) into unstable (ecc8f8b) will decrease coverage by 0.01%.
Report is 5 commits behind head on unstable.
The diff coverage is n/a.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #6619      +/-   ##
============================================
- Coverage     61.61%   61.60%   -0.01%     
============================================
  Files           556      556              
  Lines         58566    58569       +3     
  Branches       1859     1859              
============================================
  Hits          36084    36084              
- Misses        22441    22444       +3     
  Partials         41       41              

Copy link
Contributor

github-actions bot commented Apr 2, 2024

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 742a5f4 Previous: b927126 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 787.69 us/op 746.16 us/op 1.06
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 104.06 us/op 82.938 us/op 1.25
BLS verify - blst-native 1.3173 ms/op 1.3167 ms/op 1.00
BLS verifyMultipleSignatures 3 - blst-native 2.7567 ms/op 2.7428 ms/op 1.01
BLS verifyMultipleSignatures 8 - blst-native 6.0815 ms/op 6.0236 ms/op 1.01
BLS verifyMultipleSignatures 32 - blst-native 21.851 ms/op 21.933 ms/op 1.00
BLS verifyMultipleSignatures 64 - blst-native 43.244 ms/op 42.800 ms/op 1.01
BLS verifyMultipleSignatures 128 - blst-native 85.876 ms/op 84.724 ms/op 1.01
BLS deserializing 10000 signatures 885.85 ms/op 891.81 ms/op 0.99
BLS deserializing 100000 signatures 9.5457 s/op 9.3272 s/op 1.02
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.3518 ms/op 1.3504 ms/op 1.00
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.5288 ms/op 1.6624 ms/op 0.92
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.8687 ms/op 2.9099 ms/op 0.99
BLS verifyMultipleSignatures - same message - 64 - blst-native 4.3617 ms/op 4.3984 ms/op 0.99
BLS verifyMultipleSignatures - same message - 128 - blst-native 8.6950 ms/op 5.6452 ms/op 1.54
BLS aggregatePubkeys 32 - blst-native 28.508 us/op 25.474 us/op 1.12
BLS aggregatePubkeys 128 - blst-native 104.27 us/op 99.560 us/op 1.05
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 70.139 ms/op 64.445 ms/op 1.09
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 63.296 ms/op 59.517 ms/op 1.06
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 37.081 ms/op 33.529 ms/op 1.11
getSlashingsAndExits - default max 280.96 us/op 170.45 us/op 1.65
getSlashingsAndExits - 2k 538.09 us/op 361.42 us/op 1.49
proposeBlockBody type=full, size=empty 6.5674 ms/op 5.4600 ms/op 1.20
isKnown best case - 1 super set check 561.00 ns/op 318.00 ns/op 1.76
isKnown normal case - 2 super set checks 566.00 ns/op 302.00 ns/op 1.87
isKnown worse case - 16 super set checks 533.00 ns/op 297.00 ns/op 1.79
InMemoryCheckpointStateCache - add get delete 7.8080 us/op 5.6420 us/op 1.38
validate api signedAggregateAndProof - struct 2.8156 ms/op 2.6920 ms/op 1.05
validate gossip signedAggregateAndProof - struct 2.8122 ms/op 2.6945 ms/op 1.04
validate gossip attestation - vc 640000 1.3886 ms/op 1.3508 ms/op 1.03
batch validate gossip attestation - vc 640000 - chunk 32 173.54 us/op 160.88 us/op 1.08
batch validate gossip attestation - vc 640000 - chunk 64 167.43 us/op 138.17 us/op 1.21
batch validate gossip attestation - vc 640000 - chunk 128 154.45 us/op 134.17 us/op 1.15
batch validate gossip attestation - vc 640000 - chunk 256 146.68 us/op 127.13 us/op 1.15
pickEth1Vote - no votes 1.5256 ms/op 1.2161 ms/op 1.25
pickEth1Vote - max votes 11.827 ms/op 9.7627 ms/op 1.21
pickEth1Vote - Eth1Data hashTreeRoot value x2048 21.048 ms/op 19.760 ms/op 1.07
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 33.225 ms/op 26.662 ms/op 1.25
pickEth1Vote - Eth1Data fastSerialize value x2048 821.22 us/op 627.96 us/op 1.31
pickEth1Vote - Eth1Data fastSerialize tree x2048 6.2583 ms/op 6.9190 ms/op 0.90
bytes32 toHexString 818.00 ns/op 482.00 ns/op 1.70
bytes32 Buffer.toString(hex) 314.00 ns/op 281.00 ns/op 1.12
bytes32 Buffer.toString(hex) from Uint8Array 589.00 ns/op 433.00 ns/op 1.36
bytes32 Buffer.toString(hex) + 0x 332.00 ns/op 282.00 ns/op 1.18
Object access 1 prop 0.21700 ns/op 0.15800 ns/op 1.37
Map access 1 prop 0.16700 ns/op 0.15000 ns/op 1.11
Object get x1000 7.5190 ns/op 7.4480 ns/op 1.01
Map get x1000 0.84100 ns/op 0.72700 ns/op 1.16
Object set x1000 69.886 ns/op 49.344 ns/op 1.42
Map set x1000 53.252 ns/op 38.235 ns/op 1.39
Return object 10000 times 0.27390 ns/op 0.23010 ns/op 1.19
Throw Error 10000 times 3.9908 us/op 3.7494 us/op 1.06
fastMsgIdFn sha256 / 200 bytes 3.3840 us/op 3.1820 us/op 1.06
fastMsgIdFn h32 xxhash / 200 bytes 376.00 ns/op 271.00 ns/op 1.39
fastMsgIdFn h64 xxhash / 200 bytes 418.00 ns/op 331.00 ns/op 1.26
fastMsgIdFn sha256 / 1000 bytes 11.647 us/op 11.042 us/op 1.05
fastMsgIdFn h32 xxhash / 1000 bytes 497.00 ns/op 395.00 ns/op 1.26
fastMsgIdFn h64 xxhash / 1000 bytes 484.00 ns/op 411.00 ns/op 1.18
fastMsgIdFn sha256 / 10000 bytes 107.31 us/op 101.27 us/op 1.06
fastMsgIdFn h32 xxhash / 10000 bytes 2.0770 us/op 1.8630 us/op 1.11
fastMsgIdFn h64 xxhash / 10000 bytes 1.4390 us/op 1.2920 us/op 1.11
send data - 1000 256B messages 22.744 ms/op 17.954 ms/op 1.27
send data - 1000 512B messages 30.103 ms/op 26.717 ms/op 1.13
send data - 1000 1024B messages 48.246 ms/op 39.587 ms/op 1.22
send data - 1000 1200B messages 44.192 ms/op 36.930 ms/op 1.20
send data - 1000 2048B messages 52.297 ms/op 47.829 ms/op 1.09
send data - 1000 4096B messages 55.984 ms/op 42.385 ms/op 1.32
send data - 1000 16384B messages 126.92 ms/op 120.51 ms/op 1.05
send data - 1000 65536B messages 632.82 ms/op 498.15 ms/op 1.27
enrSubnets - fastDeserialize 64 bits 2.8170 us/op 1.2420 us/op 2.27
enrSubnets - ssz BitVector 64 bits 912.00 ns/op 424.00 ns/op 2.15
enrSubnets - fastDeserialize 4 bits 340.00 ns/op 169.00 ns/op 2.01
enrSubnets - ssz BitVector 4 bits 788.00 ns/op 423.00 ns/op 1.86
prioritizePeers score -10:0 att 32-0.1 sync 2-0 176.87 us/op 97.998 us/op 1.80
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 214.72 us/op 122.71 us/op 1.75
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 253.75 us/op 157.61 us/op 1.61
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 494.41 us/op 284.17 us/op 1.74
prioritizePeers score 0:0 att 64-1 sync 4-1 471.65 us/op 332.47 us/op 1.42
array of 16000 items push then shift 2.6556 us/op 1.5892 us/op 1.67
LinkedList of 16000 items push then shift 12.748 ns/op 8.8170 ns/op 1.45
array of 16000 items push then pop 124.42 ns/op 72.087 ns/op 1.73
LinkedList of 16000 items push then pop 9.2810 ns/op 8.5880 ns/op 1.08
array of 24000 items push then shift 2.4891 us/op 2.3439 us/op 1.06
LinkedList of 24000 items push then shift 9.5130 ns/op 8.7820 ns/op 1.08
array of 24000 items push then pop 170.50 ns/op 93.628 ns/op 1.82
LinkedList of 24000 items push then pop 9.5080 ns/op 8.5240 ns/op 1.12
intersect bitArray bitLen 8 6.6020 ns/op 5.6710 ns/op 1.16
intersect array and set length 8 93.447 ns/op 60.939 ns/op 1.53
intersect bitArray bitLen 128 38.731 ns/op 34.964 ns/op 1.11
intersect array and set length 128 1.0987 us/op 840.44 ns/op 1.31
bitArray.getTrueBitIndexes() bitLen 128 1.9960 us/op 1.4450 us/op 1.38
bitArray.getTrueBitIndexes() bitLen 248 3.2420 us/op 2.3910 us/op 1.36
bitArray.getTrueBitIndexes() bitLen 512 5.9580 us/op 4.6250 us/op 1.29
Buffer.concat 32 items 1.0790 us/op 948.00 ns/op 1.14
Uint8Array.set 32 items 1.9380 us/op 1.7160 us/op 1.13
Set add up to 64 items then delete first 4.4242 us/op 4.2488 us/op 1.04
OrderedSet add up to 64 items then delete first 6.9843 us/op 5.3595 us/op 1.30
Set add up to 64 items then delete last 5.4564 us/op 4.6781 us/op 1.17
OrderedSet add up to 64 items then delete last 7.3896 us/op 5.6851 us/op 1.30
Set add up to 64 items then delete middle 5.7794 us/op 4.5097 us/op 1.28
OrderedSet add up to 64 items then delete middle 7.8943 us/op 6.9076 us/op 1.14
Set add up to 128 items then delete first 10.975 us/op 9.1695 us/op 1.20
OrderedSet add up to 128 items then delete first 14.121 us/op 12.042 us/op 1.17
Set add up to 128 items then delete last 10.098 us/op 8.9951 us/op 1.12
OrderedSet add up to 128 items then delete last 13.005 us/op 11.271 us/op 1.15
Set add up to 128 items then delete middle 10.060 us/op 8.9620 us/op 1.12
OrderedSet add up to 128 items then delete middle 18.295 us/op 16.697 us/op 1.10
Set add up to 256 items then delete first 21.000 us/op 18.227 us/op 1.15
OrderedSet add up to 256 items then delete first 29.113 us/op 24.440 us/op 1.19
Set add up to 256 items then delete last 20.649 us/op 17.864 us/op 1.16
OrderedSet add up to 256 items then delete last 27.859 us/op 22.913 us/op 1.22
Set add up to 256 items then delete middle 20.773 us/op 17.942 us/op 1.16
OrderedSet add up to 256 items then delete middle 52.567 us/op 44.101 us/op 1.19
transfer serialized Status (84 B) 1.9960 us/op 1.5920 us/op 1.25
copy serialized Status (84 B) 1.4370 us/op 1.2060 us/op 1.19
transfer serialized SignedVoluntaryExit (112 B) 2.0640 us/op 1.7090 us/op 1.21
copy serialized SignedVoluntaryExit (112 B) 1.5140 us/op 1.2700 us/op 1.19
transfer serialized ProposerSlashing (416 B) 3.3610 us/op 2.9700 us/op 1.13
copy serialized ProposerSlashing (416 B) 3.1600 us/op 2.8160 us/op 1.12
transfer serialized Attestation (485 B) 2.6190 us/op 3.1510 us/op 0.83
copy serialized Attestation (485 B) 2.1570 us/op 2.8430 us/op 0.76
transfer serialized AttesterSlashing (33232 B) 2.1400 us/op 2.9720 us/op 0.72
copy serialized AttesterSlashing (33232 B) 7.3200 us/op 6.3490 us/op 1.15
transfer serialized Small SignedBeaconBlock (128000 B) 2.6180 us/op 3.1160 us/op 0.84
copy serialized Small SignedBeaconBlock (128000 B) 17.841 us/op 14.703 us/op 1.21
transfer serialized Avg SignedBeaconBlock (200000 B) 2.9510 us/op 3.2880 us/op 0.90
copy serialized Avg SignedBeaconBlock (200000 B) 26.196 us/op 21.563 us/op 1.21
transfer serialized BlobsSidecar (524380 B) 3.1620 us/op 2.7540 us/op 1.15
copy serialized BlobsSidecar (524380 B) 142.95 us/op 91.368 us/op 1.56
transfer serialized Big SignedBeaconBlock (1000000 B) 3.2570 us/op 3.0770 us/op 1.06
copy serialized Big SignedBeaconBlock (1000000 B) 171.47 us/op 171.28 us/op 1.00
pass gossip attestations to forkchoice per slot 3.8935 ms/op 3.8061 ms/op 1.02
forkChoice updateHead vc 100000 bc 64 eq 0 695.92 us/op 678.15 us/op 1.03
forkChoice updateHead vc 600000 bc 64 eq 0 4.4036 ms/op 4.0888 ms/op 1.08
forkChoice updateHead vc 1000000 bc 64 eq 0 7.1408 ms/op 6.7928 ms/op 1.05
forkChoice updateHead vc 600000 bc 320 eq 0 4.2167 ms/op 4.1785 ms/op 1.01
forkChoice updateHead vc 600000 bc 1200 eq 0 4.4933 ms/op 4.9989 ms/op 0.90
forkChoice updateHead vc 600000 bc 7200 eq 0 5.9376 ms/op 5.2454 ms/op 1.13
forkChoice updateHead vc 600000 bc 64 eq 1000 11.668 ms/op 11.009 ms/op 1.06
forkChoice updateHead vc 600000 bc 64 eq 10000 13.790 ms/op 11.782 ms/op 1.17
forkChoice updateHead vc 600000 bc 64 eq 300000 18.734 ms/op 15.482 ms/op 1.21
computeDeltas 500000 validators 300 proto nodes 6.7879 ms/op 6.6025 ms/op 1.03
computeDeltas 500000 validators 1200 proto nodes 6.7192 ms/op 6.5884 ms/op 1.02
computeDeltas 500000 validators 7200 proto nodes 6.4354 ms/op 6.3943 ms/op 1.01
computeDeltas 750000 validators 300 proto nodes 9.9052 ms/op 9.3147 ms/op 1.06
computeDeltas 750000 validators 1200 proto nodes 9.6323 ms/op 9.6019 ms/op 1.00
computeDeltas 750000 validators 7200 proto nodes 9.7294 ms/op 9.7684 ms/op 1.00
computeDeltas 1400000 validators 300 proto nodes 18.257 ms/op 18.825 ms/op 0.97
computeDeltas 1400000 validators 1200 proto nodes 18.551 ms/op 18.663 ms/op 0.99
computeDeltas 1400000 validators 7200 proto nodes 19.176 ms/op 18.637 ms/op 1.03
computeDeltas 2100000 validators 300 proto nodes 28.124 ms/op 28.271 ms/op 0.99
computeDeltas 2100000 validators 1200 proto nodes 28.444 ms/op 27.211 ms/op 1.05
computeDeltas 2100000 validators 7200 proto nodes 26.975 ms/op 27.647 ms/op 0.98
altair processAttestation - 250000 vs - 7PWei normalcase 2.3751 ms/op 2.2402 ms/op 1.06
altair processAttestation - 250000 vs - 7PWei worstcase 3.2903 ms/op 3.2846 ms/op 1.00
altair processAttestation - setStatus - 1/6 committees join 181.55 us/op 179.05 us/op 1.01
altair processAttestation - setStatus - 1/3 committees join 351.35 us/op 340.96 us/op 1.03
altair processAttestation - setStatus - 1/2 committees join 483.74 us/op 466.15 us/op 1.04
altair processAttestation - setStatus - 2/3 committees join 638.43 us/op 585.54 us/op 1.09
altair processAttestation - setStatus - 4/5 committees join 831.17 us/op 768.76 us/op 1.08
altair processAttestation - setStatus - 100% committees join 975.62 us/op 904.38 us/op 1.08
altair processBlock - 250000 vs - 7PWei normalcase 9.1363 ms/op 7.6998 ms/op 1.19
altair processBlock - 250000 vs - 7PWei normalcase hashState 36.113 ms/op 35.632 ms/op 1.01
altair processBlock - 250000 vs - 7PWei worstcase 44.933 ms/op 44.635 ms/op 1.01
altair processBlock - 250000 vs - 7PWei worstcase hashState 97.717 ms/op 92.852 ms/op 1.05
phase0 processBlock - 250000 vs - 7PWei normalcase 2.7296 ms/op 2.3542 ms/op 1.16
phase0 processBlock - 250000 vs - 7PWei worstcase 29.012 ms/op 30.861 ms/op 0.94
altair processEth1Data - 250000 vs - 7PWei normalcase 565.39 us/op 462.41 us/op 1.22
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 14.296 us/op 11.489 us/op 1.24
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 84.507 us/op 55.537 us/op 1.52
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 13.932 us/op 15.577 us/op 0.89
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 12.100 us/op 13.789 us/op 0.88
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 207.64 us/op 176.99 us/op 1.17
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.3672 ms/op 1.0503 ms/op 1.30
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.7744 ms/op 1.4648 ms/op 1.21
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.7939 ms/op 1.4525 ms/op 1.23
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.4023 ms/op 3.2546 ms/op 1.05
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.7674 ms/op 2.3086 ms/op 1.20
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 5.0371 ms/op 5.0436 ms/op 1.00
Tree 40 250000 create 338.02 ms/op 378.14 ms/op 0.89
Tree 40 250000 get(125000) 192.69 ns/op 211.14 ns/op 0.91
Tree 40 250000 set(125000) 974.47 ns/op 1.1499 us/op 0.85
Tree 40 250000 toArray() 19.692 ms/op 23.051 ms/op 0.85
Tree 40 250000 iterate all - toArray() + loop 19.581 ms/op 20.210 ms/op 0.97
Tree 40 250000 iterate all - get(i) 68.151 ms/op 67.273 ms/op 1.01
MutableVector 250000 create 14.435 ms/op 14.231 ms/op 1.01
MutableVector 250000 get(125000) 6.5680 ns/op 6.6210 ns/op 0.99
MutableVector 250000 set(125000) 273.05 ns/op 263.63 ns/op 1.04
MutableVector 250000 toArray() 3.5136 ms/op 3.6236 ms/op 0.97
MutableVector 250000 iterate all - toArray() + loop 3.6420 ms/op 3.8578 ms/op 0.94
MutableVector 250000 iterate all - get(i) 1.5150 ms/op 1.5453 ms/op 0.98
Array 250000 create 2.8495 ms/op 3.0619 ms/op 0.93
Array 250000 clone - spread 1.3519 ms/op 1.2986 ms/op 1.04
Array 250000 get(125000) 1.1560 ns/op 1.0320 ns/op 1.12
Array 250000 set(125000) 4.1930 ns/op 4.1680 ns/op 1.01
Array 250000 iterate all - loop 173.37 us/op 167.96 us/op 1.03
effectiveBalanceIncrements clone Uint8Array 300000 33.415 us/op 30.724 us/op 1.09
effectiveBalanceIncrements clone MutableVector 300000 404.00 ns/op 358.00 ns/op 1.13
effectiveBalanceIncrements rw all Uint8Array 300000 198.41 us/op 200.16 us/op 0.99
effectiveBalanceIncrements rw all MutableVector 300000 92.035 ms/op 82.503 ms/op 1.12
phase0 afterProcessEpoch - 250000 vs - 7PWei 114.40 ms/op 114.92 ms/op 1.00
phase0 beforeProcessEpoch - 250000 vs - 7PWei 55.280 ms/op 54.087 ms/op 1.02
altair processEpoch - mainnet_e81889 483.90 ms/op 482.21 ms/op 1.00
mainnet_e81889 - altair beforeProcessEpoch 84.806 ms/op 80.381 ms/op 1.06
mainnet_e81889 - altair processJustificationAndFinalization 16.197 us/op 13.798 us/op 1.17
mainnet_e81889 - altair processInactivityUpdates 6.4197 ms/op 6.2022 ms/op 1.04
mainnet_e81889 - altair processRewardsAndPenalties 57.526 ms/op 54.002 ms/op 1.07
mainnet_e81889 - altair processRegistryUpdates 3.3500 us/op 2.3270 us/op 1.44
mainnet_e81889 - altair processSlashings 755.00 ns/op 456.00 ns/op 1.66
mainnet_e81889 - altair processEth1DataReset 582.00 ns/op 581.00 ns/op 1.00
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.3523 ms/op 1.3252 ms/op 1.02
mainnet_e81889 - altair processSlashingsReset 4.0670 us/op 3.5930 us/op 1.13
mainnet_e81889 - altair processRandaoMixesReset 4.5950 us/op 4.3410 us/op 1.06
mainnet_e81889 - altair processHistoricalRootsUpdate 939.00 ns/op 739.00 ns/op 1.27
mainnet_e81889 - altair processParticipationFlagUpdates 3.9670 us/op 1.8740 us/op 2.12
mainnet_e81889 - altair processSyncCommitteeUpdates 1.6660 us/op 804.00 ns/op 2.07
mainnet_e81889 - altair afterProcessEpoch 131.08 ms/op 121.29 ms/op 1.08
capella processEpoch - mainnet_e217614 2.5851 s/op 2.0062 s/op 1.29
mainnet_e217614 - capella beforeProcessEpoch 558.79 ms/op 455.57 ms/op 1.23
mainnet_e217614 - capella processJustificationAndFinalization 21.571 us/op 14.657 us/op 1.47
mainnet_e217614 - capella processInactivityUpdates 23.668 ms/op 21.120 ms/op 1.12
mainnet_e217614 - capella processRewardsAndPenalties 667.45 ms/op 509.32 ms/op 1.31
mainnet_e217614 - capella processRegistryUpdates 26.631 us/op 21.247 us/op 1.25
mainnet_e217614 - capella processSlashings 977.00 ns/op 528.00 ns/op 1.85
mainnet_e217614 - capella processEth1DataReset 1.3570 us/op 401.00 ns/op 3.38
mainnet_e217614 - capella processEffectiveBalanceUpdates 5.3406 ms/op 4.6061 ms/op 1.16
mainnet_e217614 - capella processSlashingsReset 8.4990 us/op 3.5480 us/op 2.40
mainnet_e217614 - capella processRandaoMixesReset 10.555 us/op 4.3320 us/op 2.44
mainnet_e217614 - capella processHistoricalRootsUpdate 993.00 ns/op 764.00 ns/op 1.30
mainnet_e217614 - capella processParticipationFlagUpdates 2.7140 us/op 1.6840 us/op 1.61
mainnet_e217614 - capella afterProcessEpoch 328.23 ms/op 358.13 ms/op 0.92
phase0 processEpoch - mainnet_e58758 482.33 ms/op 476.10 ms/op 1.01
mainnet_e58758 - phase0 beforeProcessEpoch 149.65 ms/op 152.05 ms/op 0.98
mainnet_e58758 - phase0 processJustificationAndFinalization 23.061 us/op 16.996 us/op 1.36
mainnet_e58758 - phase0 processRewardsAndPenalties 68.435 ms/op 60.212 ms/op 1.14
mainnet_e58758 - phase0 processRegistryUpdates 12.551 us/op 9.5570 us/op 1.31
mainnet_e58758 - phase0 processSlashings 731.00 ns/op 575.00 ns/op 1.27
mainnet_e58758 - phase0 processEth1DataReset 450.00 ns/op 638.00 ns/op 0.71
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.1278 ms/op 1.1345 ms/op 0.99
mainnet_e58758 - phase0 processSlashingsReset 3.3360 us/op 3.2320 us/op 1.03
mainnet_e58758 - phase0 processRandaoMixesReset 3.9000 us/op 3.7630 us/op 1.04
mainnet_e58758 - phase0 processHistoricalRootsUpdate 727.00 ns/op 424.00 ns/op 1.71
mainnet_e58758 - phase0 processParticipationRecordUpdates 3.4410 us/op 3.9260 us/op 0.88
mainnet_e58758 - phase0 afterProcessEpoch 105.05 ms/op 102.76 ms/op 1.02
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.4703 ms/op 1.3562 ms/op 1.08
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.4613 ms/op 1.6256 ms/op 0.90
altair processInactivityUpdates - 250000 normalcase 30.030 ms/op 31.108 ms/op 0.97
altair processInactivityUpdates - 250000 worstcase 26.506 ms/op 26.984 ms/op 0.98
phase0 processRegistryUpdates - 250000 normalcase 13.102 us/op 11.228 us/op 1.17
phase0 processRegistryUpdates - 250000 badcase_full_deposits 458.94 us/op 364.26 us/op 1.26
phase0 processRegistryUpdates - 250000 worstcase 0.5 145.78 ms/op 143.49 ms/op 1.02
altair processRewardsAndPenalties - 250000 normalcase 68.764 ms/op 78.742 ms/op 0.87
altair processRewardsAndPenalties - 250000 worstcase 72.452 ms/op 58.036 ms/op 1.25
phase0 getAttestationDeltas - 250000 normalcase 10.553 ms/op 11.604 ms/op 0.91
phase0 getAttestationDeltas - 250000 worstcase 10.935 ms/op 9.1605 ms/op 1.19
phase0 processSlashings - 250000 worstcase 110.72 us/op 80.766 us/op 1.37
altair processSyncCommitteeUpdates - 250000 161.88 ms/op 166.95 ms/op 0.97
BeaconState.hashTreeRoot - No change 383.00 ns/op 363.00 ns/op 1.06
BeaconState.hashTreeRoot - 1 full validator 143.19 us/op 155.85 us/op 0.92
BeaconState.hashTreeRoot - 32 full validator 1.3244 ms/op 1.6770 ms/op 0.79
BeaconState.hashTreeRoot - 512 full validator 16.945 ms/op 17.944 ms/op 0.94
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 192.89 us/op 190.38 us/op 1.01
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.7948 ms/op 2.3793 ms/op 1.17
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 28.284 ms/op 26.543 ms/op 1.07
BeaconState.hashTreeRoot - 1 balances 112.59 us/op 119.27 us/op 0.94
BeaconState.hashTreeRoot - 32 balances 1.0976 ms/op 1.0144 ms/op 1.08
BeaconState.hashTreeRoot - 512 balances 12.338 ms/op 11.046 ms/op 1.12
BeaconState.hashTreeRoot - 250000 balances 212.31 ms/op 220.85 ms/op 0.96
aggregationBits - 2048 els - zipIndexesInBitList 34.232 us/op 30.473 us/op 1.12
byteArrayEquals 32 75.609 ns/op 77.418 ns/op 0.98
Buffer.compare 32 55.436 ns/op 58.061 ns/op 0.95
byteArrayEquals 1024 2.0437 us/op 2.1017 us/op 0.97
Buffer.compare 1024 69.864 ns/op 74.455 ns/op 0.94
byteArrayEquals 16384 32.553 us/op 33.495 us/op 0.97
Buffer.compare 16384 261.80 ns/op 277.12 ns/op 0.94
byteArrayEquals 123687377 285.81 ms/op 250.84 ms/op 1.14
Buffer.compare 123687377 10.116 ms/op 7.0127 ms/op 1.44
byteArrayEquals 32 - diff last byte 86.855 ns/op 76.415 ns/op 1.14
Buffer.compare 32 - diff last byte 65.108 ns/op 59.046 ns/op 1.10
byteArrayEquals 1024 - diff last byte 2.2025 us/op 2.0522 us/op 1.07
Buffer.compare 1024 - diff last byte 85.910 ns/op 72.286 ns/op 1.19
byteArrayEquals 16384 - diff last byte 37.383 us/op 32.871 us/op 1.14
Buffer.compare 16384 - diff last byte 282.40 ns/op 279.53 ns/op 1.01
byteArrayEquals 123687377 - diff last byte 264.77 ms/op 251.33 ms/op 1.05
Buffer.compare 123687377 - diff last byte 7.7755 ms/op 8.0308 ms/op 0.97
byteArrayEquals 32 - random bytes 6.1870 ns/op 6.3190 ns/op 0.98
Buffer.compare 32 - random bytes 61.835 ns/op 63.881 ns/op 0.97
byteArrayEquals 1024 - random bytes 5.3590 ns/op 5.9490 ns/op 0.90
Buffer.compare 1024 - random bytes 61.405 ns/op 62.940 ns/op 0.98
byteArrayEquals 16384 - random bytes 5.6070 ns/op 5.9380 ns/op 0.94
Buffer.compare 16384 - random bytes 61.604 ns/op 63.529 ns/op 0.97
byteArrayEquals 123687377 - random bytes 8.7100 ns/op 9.0200 ns/op 0.97
Buffer.compare 123687377 - random bytes 66.770 ns/op 74.510 ns/op 0.90
regular array get 100000 times 45.076 us/op 46.927 us/op 0.96
wrappedArray get 100000 times 45.264 us/op 47.061 us/op 0.96
arrayWithProxy get 100000 times 14.200 ms/op 15.009 ms/op 0.95
ssz.Root.equals 56.724 ns/op 59.082 ns/op 0.96
byteArrayEquals 54.559 ns/op 55.373 ns/op 0.99
Buffer.compare 12.360 ns/op 11.514 ns/op 1.07
shuffle list - 16384 els 8.6278 ms/op 9.2678 ms/op 0.93
shuffle list - 250000 els 127.24 ms/op 131.61 ms/op 0.97
processSlot - 1 slots 15.717 us/op 18.506 us/op 0.85
processSlot - 32 slots 3.0322 ms/op 3.1559 ms/op 0.96
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 58.329 ms/op 62.721 ms/op 0.93
getCommitteeAssignments - req 1 vs - 250000 vc 2.7221 ms/op 2.7216 ms/op 1.00
getCommitteeAssignments - req 100 vs - 250000 vc 3.9647 ms/op 3.9036 ms/op 1.02
getCommitteeAssignments - req 1000 vs - 250000 vc 4.2781 ms/op 4.2851 ms/op 1.00
findModifiedValidators - 10000 modified validators 418.95 ms/op 359.39 ms/op 1.17
findModifiedValidators - 1000 modified validators 249.11 ms/op 202.47 ms/op 1.23
findModifiedValidators - 100 modified validators 248.51 ms/op 198.03 ms/op 1.25
findModifiedValidators - 10 modified validators 204.88 ms/op 190.04 ms/op 1.08
findModifiedValidators - 1 modified validators 252.63 ms/op 178.94 ms/op 1.41
findModifiedValidators - no difference 272.60 ms/op 194.95 ms/op 1.40
compare ViewDUs 7.0406 s/op 4.3179 s/op 1.63
compare each validator Uint8Array 2.7578 s/op 1.7396 s/op 1.59
compare ViewDU to Uint8Array 1.6158 s/op 1.1060 s/op 1.46
migrate state 1000000 validators, 24 modified, 0 new 905.44 ms/op 760.65 ms/op 1.19
migrate state 1000000 validators, 1700 modified, 1000 new 1.1048 s/op 1.0850 s/op 1.02
migrate state 1000000 validators, 3400 modified, 2000 new 1.4492 s/op 1.3540 s/op 1.07
migrate state 1500000 validators, 24 modified, 0 new 960.15 ms/op 755.06 ms/op 1.27
migrate state 1500000 validators, 1700 modified, 1000 new 1.1708 s/op 1.0200 s/op 1.15
migrate state 1500000 validators, 3400 modified, 2000 new 1.5632 s/op 1.2765 s/op 1.22
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.2700 ns/op 4.2000 ns/op 1.25
state getBlockRootAtSlot - 250000 vs - 7PWei 1.0413 us/op 513.72 ns/op 2.03
computeProposers - vc 250000 11.709 ms/op 8.9530 ms/op 1.31
computeEpochShuffling - vc 250000 135.00 ms/op 126.19 ms/op 1.07
getNextSyncCommittee - vc 250000 187.93 ms/op 149.99 ms/op 1.25
computeSigningRoot for AttestationData 30.534 us/op 21.902 us/op 1.39
hash AttestationData serialized data then Buffer.toString(base64) 2.4294 us/op 2.2795 us/op 1.07
toHexString serialized data 1.3326 us/op 1.0498 us/op 1.27
Buffer.toString(base64) 257.15 ns/op 211.97 ns/op 1.21

by benchmarkbot/action

void this.runLoop();

return startPromise;
return this.runLoop();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem I see in this approach is that normally user will use await client.start(), that will block the event loop forever.

The syntax void this.runLoop() is a way to put the run loop in the background so the await client.start() does not block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, so I guess the previous approach made more sense.

Copy link
Member

@nflaig nflaig Apr 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just check if light client is already started and return right away when start() is called? The second start call should be a no-op

@nazarhussain nazarhussain merged commit 2f8fbb0 into unstable Apr 3, 2024
20 checks passed
@nazarhussain nazarhussain deleted the jeluard/fix-lc-start branch April 3, 2024 07:35
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.18.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.

4 participants