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: make the network listener more stable #5962

Closed
wants to merge 2 commits into from

Conversation

nazarhussain
Copy link
Contributor

Motivation

Make the network listener more stable.

Description

  • When network listener stops it should have a room to start again
  • With current configuration, it trigger start/stop based on one value which makes it brittle and can raise some edge cases.

Steps to test or reproduce

Run all tests.

@github-actions
Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 58b717a Previous: 8794025 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 541.24 us/op 365.74 us/op 1.48
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 87.885 us/op 47.477 us/op 1.85
BLS verify - blst-native 1.1601 ms/op 1.1504 ms/op 1.01
BLS verifyMultipleSignatures 3 - blst-native 2.4710 ms/op 2.4725 ms/op 1.00
BLS verifyMultipleSignatures 8 - blst-native 5.4824 ms/op 5.4949 ms/op 1.00
BLS verifyMultipleSignatures 32 - blst-native 20.167 ms/op 20.071 ms/op 1.00
BLS verifyMultipleSignatures 64 - blst-native 39.302 ms/op 40.182 ms/op 0.98
BLS verifyMultipleSignatures 128 - blst-native 78.741 ms/op 79.033 ms/op 1.00
BLS deserializing 10000 signatures 797.60 ms/op 842.26 ms/op 0.95
BLS deserializing 100000 signatures 8.5180 s/op 8.5035 s/op 1.00
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.2074 ms/op 1.1783 ms/op 1.02
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.3568 ms/op 1.3914 ms/op 0.98
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.1434 ms/op 2.2468 ms/op 0.95
BLS verifyMultipleSignatures - same message - 64 - blst-native 3.1444 ms/op 3.1446 ms/op 1.00
BLS verifyMultipleSignatures - same message - 128 - blst-native 5.2472 ms/op 5.1688 ms/op 1.02
BLS aggregatePubkeys 32 - blst-native 24.507 us/op 24.614 us/op 1.00
BLS aggregatePubkeys 128 - blst-native 94.223 us/op 92.046 us/op 1.02
getAttestationsForBlock 41.113 ms/op 42.385 ms/op 0.97
isKnown best case - 1 super set check 619.00 ns/op 455.00 ns/op 1.36
isKnown normal case - 2 super set checks 602.00 ns/op 467.00 ns/op 1.29
isKnown worse case - 16 super set checks 625.00 ns/op 440.00 ns/op 1.42
CheckpointStateCache - add get delete 4.2920 us/op 4.2110 us/op 1.02
validate api signedAggregateAndProof - struct 2.5019 ms/op 2.5964 ms/op 0.96
validate gossip signedAggregateAndProof - struct 2.4686 ms/op 2.4986 ms/op 0.99
validate gossip attestation - vc 640000 1.2112 ms/op 1.2197 ms/op 0.99
batch validate gossip attestation - vc 640000 - chunk 32 156.01 us/op 155.48 us/op 1.00
batch validate gossip attestation - vc 640000 - chunk 64 141.25 us/op 143.82 us/op 0.98
batch validate gossip attestation - vc 640000 - chunk 128 124.43 us/op 137.83 us/op 0.90
batch validate gossip attestation - vc 640000 - chunk 256 116.41 us/op 133.38 us/op 0.87
pickEth1Vote - no votes 1.0453 ms/op 1.2477 ms/op 0.84
pickEth1Vote - max votes 10.199 ms/op 7.3695 ms/op 1.38
pickEth1Vote - Eth1Data hashTreeRoot value x2048 15.639 ms/op 15.770 ms/op 0.99
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 29.761 ms/op 20.851 ms/op 1.43
pickEth1Vote - Eth1Data fastSerialize value x2048 420.45 us/op 559.73 us/op 0.75
pickEth1Vote - Eth1Data fastSerialize tree x2048 7.9174 ms/op 9.5260 ms/op 0.83
bytes32 toHexString 441.00 ns/op 722.00 ns/op 0.61
bytes32 Buffer.toString(hex) 309.00 ns/op 253.00 ns/op 1.22
bytes32 Buffer.toString(hex) from Uint8Array 474.00 ns/op 322.00 ns/op 1.47
bytes32 Buffer.toString(hex) + 0x 319.00 ns/op 216.00 ns/op 1.48
Object access 1 prop 0.19400 ns/op 0.11300 ns/op 1.72
Map access 1 prop 0.19200 ns/op 0.10700 ns/op 1.79
Object get x1000 5.8320 ns/op 6.3530 ns/op 0.92
Map get x1000 0.52100 ns/op 0.66200 ns/op 0.79
Object set x1000 27.847 ns/op 45.556 ns/op 0.61
Map set x1000 16.363 ns/op 25.707 ns/op 0.64
Return object 10000 times 0.23630 ns/op 0.29130 ns/op 0.81
Throw Error 10000 times 3.0969 us/op 4.0110 us/op 0.77
fastMsgIdFn sha256 / 200 bytes 2.0240 us/op 2.2040 us/op 0.92
fastMsgIdFn h32 xxhash / 200 bytes 301.00 ns/op 279.00 ns/op 1.08
fastMsgIdFn h64 xxhash / 200 bytes 352.00 ns/op 366.00 ns/op 0.96
fastMsgIdFn sha256 / 1000 bytes 6.5050 us/op 10.079 us/op 0.65
fastMsgIdFn h32 xxhash / 1000 bytes 460.00 ns/op 512.00 ns/op 0.90
fastMsgIdFn h64 xxhash / 1000 bytes 433.00 ns/op 414.00 ns/op 1.05
fastMsgIdFn sha256 / 10000 bytes 55.156 us/op 73.434 us/op 0.75
fastMsgIdFn h32 xxhash / 10000 bytes 1.8540 us/op 2.0090 us/op 0.92
fastMsgIdFn h64 xxhash / 10000 bytes 1.2520 us/op 1.3640 us/op 0.92
send data - 1000 256B messages 13.838 ms/op 14.850 ms/op 0.93
send data - 1000 512B messages 17.643 ms/op 21.482 ms/op 0.82
send data - 1000 1024B messages 27.112 ms/op 32.201 ms/op 0.84
send data - 1000 1200B messages 19.750 ms/op 29.985 ms/op 0.66
send data - 1000 2048B messages 31.072 ms/op 36.655 ms/op 0.85
send data - 1000 4096B messages 26.850 ms/op 32.916 ms/op 0.82
send data - 1000 16384B messages 54.822 ms/op 75.600 ms/op 0.73
send data - 1000 65536B messages 202.14 ms/op 259.96 ms/op 0.78
enrSubnets - fastDeserialize 64 bits 984.00 ns/op 1.2010 us/op 0.82
enrSubnets - ssz BitVector 64 bits 478.00 ns/op 620.00 ns/op 0.77
enrSubnets - fastDeserialize 4 bits 218.00 ns/op 169.00 ns/op 1.29
enrSubnets - ssz BitVector 4 bits 477.00 ns/op 544.00 ns/op 0.88
prioritizePeers score -10:0 att 32-0.1 sync 2-0 89.840 us/op 104.51 us/op 0.86
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 110.20 us/op 152.34 us/op 0.72
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 131.22 us/op 186.40 us/op 0.70
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 249.03 us/op 298.39 us/op 0.83
prioritizePeers score 0:0 att 64-1 sync 4-1 268.41 us/op 369.06 us/op 0.73
array of 16000 items push then shift 1.3577 us/op 1.6448 us/op 0.83
LinkedList of 16000 items push then shift 7.3900 ns/op 10.424 ns/op 0.71
array of 16000 items push then pop 98.397 ns/op 129.74 ns/op 0.76
LinkedList of 16000 items push then pop 6.4330 ns/op 9.2720 ns/op 0.69
array of 24000 items push then shift 2.0142 us/op 2.4241 us/op 0.83
LinkedList of 24000 items push then shift 7.2110 ns/op 8.9760 ns/op 0.80
array of 24000 items push then pop 116.57 ns/op 156.66 ns/op 0.74
LinkedList of 24000 items push then pop 6.1680 ns/op 10.223 ns/op 0.60
intersect bitArray bitLen 8 5.6340 ns/op 5.5340 ns/op 1.02
intersect array and set length 8 59.523 ns/op 72.821 ns/op 0.82
intersect bitArray bitLen 128 26.683 ns/op 34.422 ns/op 0.78
intersect array and set length 128 742.07 ns/op 801.32 ns/op 0.93
bitArray.getTrueBitIndexes() bitLen 128 1.7100 us/op 1.6020 us/op 1.07
bitArray.getTrueBitIndexes() bitLen 248 2.5480 us/op 2.7770 us/op 0.92
bitArray.getTrueBitIndexes() bitLen 512 4.7110 us/op 6.2760 us/op 0.75
Buffer.concat 32 items 977.00 ns/op 1.3810 us/op 0.71
Uint8Array.set 32 items 2.5800 us/op 2.4480 us/op 1.05
Set add up to 64 items then delete first 1.7936 us/op 2.3965 us/op 0.75
OrderedSet add up to 64 items then delete first 2.6507 us/op 2.8312 us/op 0.94
Set add up to 64 items then delete last 1.9860 us/op 2.6223 us/op 0.76
OrderedSet add up to 64 items then delete last 2.9647 us/op 4.0205 us/op 0.74
Set add up to 64 items then delete middle 1.9768 us/op 2.4242 us/op 0.82
OrderedSet add up to 64 items then delete middle 4.2330 us/op 5.2633 us/op 0.80
Set add up to 128 items then delete first 3.9091 us/op 4.8101 us/op 0.81
OrderedSet add up to 128 items then delete first 6.1917 us/op 8.0105 us/op 0.77
Set add up to 128 items then delete last 3.7942 us/op 4.9004 us/op 0.77
OrderedSet add up to 128 items then delete last 5.7272 us/op 10.036 us/op 0.57
Set add up to 128 items then delete middle 3.7795 us/op 5.0029 us/op 0.76
OrderedSet add up to 128 items then delete middle 10.889 us/op 13.609 us/op 0.80
Set add up to 256 items then delete first 7.7102 us/op 11.397 us/op 0.68
OrderedSet add up to 256 items then delete first 12.310 us/op 16.452 us/op 0.75
Set add up to 256 items then delete last 7.5591 us/op 9.7477 us/op 0.78
OrderedSet add up to 256 items then delete last 11.536 us/op 15.112 us/op 0.76
Set add up to 256 items then delete middle 7.6767 us/op 12.106 us/op 0.63
OrderedSet add up to 256 items then delete middle 32.792 us/op 36.715 us/op 0.89
transfer serialized Status (84 B) 1.4250 us/op 1.7050 us/op 0.84
copy serialized Status (84 B) 1.2870 us/op 1.7260 us/op 0.75
transfer serialized SignedVoluntaryExit (112 B) 1.5020 us/op 1.9940 us/op 0.75
copy serialized SignedVoluntaryExit (112 B) 1.2710 us/op 1.6230 us/op 0.78
transfer serialized ProposerSlashing (416 B) 1.5950 us/op 3.3430 us/op 0.48
copy serialized ProposerSlashing (416 B) 1.6620 us/op 3.6770 us/op 0.45
transfer serialized Attestation (485 B) 2.3360 us/op 3.5310 us/op 0.66
copy serialized Attestation (485 B) 2.5870 us/op 3.7080 us/op 0.70
transfer serialized AttesterSlashing (33232 B) 2.5490 us/op 3.5120 us/op 0.73
copy serialized AttesterSlashing (33232 B) 6.1830 us/op 8.7800 us/op 0.70
transfer serialized Small SignedBeaconBlock (128000 B) 2.4940 us/op 3.0540 us/op 0.82
copy serialized Small SignedBeaconBlock (128000 B) 14.185 us/op 22.781 us/op 0.62
transfer serialized Avg SignedBeaconBlock (200000 B) 2.5030 us/op 3.2380 us/op 0.77
copy serialized Avg SignedBeaconBlock (200000 B) 21.740 us/op 33.105 us/op 0.66
transfer serialized BlobsSidecar (524380 B) 2.8760 us/op 3.6210 us/op 0.79
copy serialized BlobsSidecar (524380 B) 66.357 us/op 104.16 us/op 0.64
transfer serialized Big SignedBeaconBlock (1000000 B) 2.8950 us/op 4.0530 us/op 0.71
copy serialized Big SignedBeaconBlock (1000000 B) 147.27 us/op 197.74 us/op 0.74
pass gossip attestations to forkchoice per slot 2.5862 ms/op 2.7890 ms/op 0.93
forkChoice updateHead vc 100000 bc 64 eq 0 577.82 us/op 692.79 us/op 0.83
forkChoice updateHead vc 600000 bc 64 eq 0 2.7872 ms/op 3.2875 ms/op 0.85
forkChoice updateHead vc 1000000 bc 64 eq 0 4.4916 ms/op 5.7268 ms/op 0.78
forkChoice updateHead vc 600000 bc 320 eq 0 2.6747 ms/op 2.9925 ms/op 0.89
forkChoice updateHead vc 600000 bc 1200 eq 0 2.9351 ms/op 3.4406 ms/op 0.85
forkChoice updateHead vc 600000 bc 7200 eq 0 4.1402 ms/op 4.6665 ms/op 0.89
forkChoice updateHead vc 600000 bc 64 eq 1000 10.206 ms/op 11.384 ms/op 0.90
forkChoice updateHead vc 600000 bc 64 eq 10000 10.026 ms/op 10.988 ms/op 0.91
forkChoice updateHead vc 600000 bc 64 eq 300000 12.061 ms/op 32.064 ms/op 0.38
computeDeltas 500000 validators 300 proto nodes 2.9955 ms/op 3.1427 ms/op 0.95
computeDeltas 500000 validators 1200 proto nodes 3.0123 ms/op 2.9488 ms/op 1.02
computeDeltas 500000 validators 7200 proto nodes 2.9717 ms/op 2.9376 ms/op 1.01
computeDeltas 750000 validators 300 proto nodes 4.5036 ms/op 4.3989 ms/op 1.02
computeDeltas 750000 validators 1200 proto nodes 4.4214 ms/op 4.5411 ms/op 0.97
computeDeltas 750000 validators 7200 proto nodes 4.5184 ms/op 4.3696 ms/op 1.03
computeDeltas 1400000 validators 300 proto nodes 8.5281 ms/op 8.4551 ms/op 1.01
computeDeltas 1400000 validators 1200 proto nodes 8.5501 ms/op 8.4631 ms/op 1.01
computeDeltas 1400000 validators 7200 proto nodes 9.0477 ms/op 8.5060 ms/op 1.06
computeDeltas 2100000 validators 300 proto nodes 13.472 ms/op 13.527 ms/op 1.00
computeDeltas 2100000 validators 1200 proto nodes 13.286 ms/op 13.194 ms/op 1.01
computeDeltas 2100000 validators 7200 proto nodes 12.947 ms/op 13.245 ms/op 0.98
computeProposerBoostScoreFromBalances 500000 validators 2.7680 ms/op 2.9024 ms/op 0.95
computeProposerBoostScoreFromBalances 750000 validators 2.7734 ms/op 2.9302 ms/op 0.95
computeProposerBoostScoreFromBalances 1400000 validators 2.7112 ms/op 2.8790 ms/op 0.94
computeProposerBoostScoreFromBalances 2100000 validators 2.7925 ms/op 2.8178 ms/op 0.99
altair processAttestation - 250000 vs - 7PWei normalcase 1.5011 ms/op 1.6226 ms/op 0.93
altair processAttestation - 250000 vs - 7PWei worstcase 2.1794 ms/op 2.1287 ms/op 1.02
altair processAttestation - setStatus - 1/6 committees join 99.154 us/op 71.074 us/op 1.40
altair processAttestation - setStatus - 1/3 committees join 196.56 us/op 161.22 us/op 1.22
altair processAttestation - setStatus - 1/2 committees join 272.77 us/op 218.54 us/op 1.25
altair processAttestation - setStatus - 2/3 committees join 350.74 us/op 316.67 us/op 1.11
altair processAttestation - setStatus - 4/5 committees join 494.08 us/op 436.99 us/op 1.13
altair processAttestation - setStatus - 100% committees join 559.09 us/op 534.13 us/op 1.05
altair processBlock - 250000 vs - 7PWei normalcase 5.7061 ms/op 6.5380 ms/op 0.87
altair processBlock - 250000 vs - 7PWei normalcase hashState 24.100 ms/op 25.967 ms/op 0.93
altair processBlock - 250000 vs - 7PWei worstcase 32.915 ms/op 32.283 ms/op 1.02
altair processBlock - 250000 vs - 7PWei worstcase hashState 81.722 ms/op 78.207 ms/op 1.04
phase0 processBlock - 250000 vs - 7PWei normalcase 2.4400 ms/op 2.0638 ms/op 1.18
phase0 processBlock - 250000 vs - 7PWei worstcase 27.143 ms/op 26.133 ms/op 1.04
altair processEth1Data - 250000 vs - 7PWei normalcase 327.97 us/op 312.05 us/op 1.05
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 10.790 us/op 3.8900 us/op 2.77
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 29.560 us/op 45.523 us/op 0.65
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 13.292 us/op 12.686 us/op 1.05
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 9.4170 us/op 3.6020 us/op 2.61
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 173.25 us/op 100.12 us/op 1.73
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 992.37 us/op 1.0526 ms/op 0.94
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.4149 ms/op 1.1783 ms/op 1.20
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.4329 ms/op 1.0683 ms/op 1.34
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 2.5863 ms/op 3.1840 ms/op 0.81
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.5129 ms/op 2.1599 ms/op 0.70
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.1245 ms/op 5.4796 ms/op 0.75
Tree 40 250000 create 244.53 ms/op 263.11 ms/op 0.93
Tree 40 250000 get(125000) 109.94 ns/op 121.61 ns/op 0.90
Tree 40 250000 set(125000) 741.21 ns/op 757.15 ns/op 0.98
Tree 40 250000 toArray() 16.776 ms/op 20.525 ms/op 0.82
Tree 40 250000 iterate all - toArray() + loop 19.726 ms/op 12.604 ms/op 1.56
Tree 40 250000 iterate all - get(i) 43.740 ms/op 44.833 ms/op 0.98
MutableVector 250000 create 10.684 ms/op 8.0640 ms/op 1.32
MutableVector 250000 get(125000) 5.9530 ns/op 5.6530 ns/op 1.05
MutableVector 250000 set(125000) 176.65 ns/op 192.38 ns/op 0.92
MutableVector 250000 toArray() 2.3520 ms/op 2.9554 ms/op 0.80
MutableVector 250000 iterate all - toArray() + loop 2.7763 ms/op 3.5157 ms/op 0.79
MutableVector 250000 iterate all - get(i) 1.2840 ms/op 1.3440 ms/op 0.96
Array 250000 create 2.2156 ms/op 2.6090 ms/op 0.85
Array 250000 clone - spread 899.60 us/op 871.37 us/op 1.03
Array 250000 get(125000) 0.52800 ns/op 0.44700 ns/op 1.18
Array 250000 set(125000) 0.57900 ns/op 0.51300 ns/op 1.13
Array 250000 iterate all - loop 73.589 us/op 78.890 us/op 0.93
effectiveBalanceIncrements clone Uint8Array 300000 17.558 us/op 22.709 us/op 0.77
effectiveBalanceIncrements clone MutableVector 300000 306.00 ns/op 241.00 ns/op 1.27
effectiveBalanceIncrements rw all Uint8Array 300000 162.77 us/op 175.21 us/op 0.93
effectiveBalanceIncrements rw all MutableVector 300000 60.139 ms/op 59.715 ms/op 1.01
phase0 afterProcessEpoch - 250000 vs - 7PWei 72.395 ms/op 78.950 ms/op 0.92
phase0 beforeProcessEpoch - 250000 vs - 7PWei 24.882 ms/op 35.147 ms/op 0.71
altair processEpoch - mainnet_e81889 456.03 ms/op 328.48 ms/op 1.39
mainnet_e81889 - altair beforeProcessEpoch 56.945 ms/op 52.113 ms/op 1.09
mainnet_e81889 - altair processJustificationAndFinalization 10.984 us/op 8.9760 us/op 1.22
mainnet_e81889 - altair processInactivityUpdates 6.2900 ms/op 4.7779 ms/op 1.32
mainnet_e81889 - altair processRewardsAndPenalties 57.306 ms/op 53.941 ms/op 1.06
mainnet_e81889 - altair processRegistryUpdates 1.9530 us/op 1.3390 us/op 1.46
mainnet_e81889 - altair processSlashings 503.00 ns/op 274.00 ns/op 1.84
mainnet_e81889 - altair processEth1DataReset 602.00 ns/op 321.00 ns/op 1.88
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.4787 ms/op 950.11 us/op 1.56
mainnet_e81889 - altair processSlashingsReset 2.1870 us/op 1.9180 us/op 1.14
mainnet_e81889 - altair processRandaoMixesReset 3.1020 us/op 1.9510 us/op 1.59
mainnet_e81889 - altair processHistoricalRootsUpdate 715.00 ns/op 330.00 ns/op 2.17
mainnet_e81889 - altair processParticipationFlagUpdates 1.4000 us/op 699.00 ns/op 2.00
mainnet_e81889 - altair processSyncCommitteeUpdates 452.00 ns/op 240.00 ns/op 1.88
mainnet_e81889 - altair afterProcessEpoch 84.393 ms/op 81.248 ms/op 1.04
capella processEpoch - mainnet_e217614 1.3091 s/op 1.0364 s/op 1.26
mainnet_e217614 - capella beforeProcessEpoch 254.07 ms/op 182.22 ms/op 1.39
mainnet_e217614 - capella processJustificationAndFinalization 17.449 us/op 17.214 us/op 1.01
mainnet_e217614 - capella processInactivityUpdates 18.247 ms/op 21.708 ms/op 0.84
mainnet_e217614 - capella processRewardsAndPenalties 244.18 ms/op 230.32 ms/op 1.06
mainnet_e217614 - capella processRegistryUpdates 17.431 us/op 11.114 us/op 1.57
mainnet_e217614 - capella processSlashings 522.00 ns/op 252.00 ns/op 2.07
mainnet_e217614 - capella processEth1DataReset 535.00 ns/op 268.00 ns/op 2.00
mainnet_e217614 - capella processEffectiveBalanceUpdates 2.9792 ms/op 3.0883 ms/op 0.96
mainnet_e217614 - capella processSlashingsReset 1.1580 us/op 1.7880 us/op 0.65
mainnet_e217614 - capella processRandaoMixesReset 2.9260 us/op 1.8540 us/op 1.58
mainnet_e217614 - capella processHistoricalRootsUpdate 552.00 ns/op 472.00 ns/op 1.17
mainnet_e217614 - capella processParticipationFlagUpdates 2.1310 us/op 954.00 ns/op 2.23
mainnet_e217614 - capella afterProcessEpoch 208.81 ms/op 211.48 ms/op 0.99
phase0 processEpoch - mainnet_e58758 412.25 ms/op 346.05 ms/op 1.19
mainnet_e58758 - phase0 beforeProcessEpoch 112.55 ms/op 89.205 ms/op 1.26
mainnet_e58758 - phase0 processJustificationAndFinalization 11.827 us/op 9.0390 us/op 1.31
mainnet_e58758 - phase0 processRewardsAndPenalties 48.791 ms/op 44.801 ms/op 1.09
mainnet_e58758 - phase0 processRegistryUpdates 8.7360 us/op 10.616 us/op 0.82
mainnet_e58758 - phase0 processSlashings 551.00 ns/op 223.00 ns/op 2.47
mainnet_e58758 - phase0 processEth1DataReset 703.00 ns/op 308.00 ns/op 2.28
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 790.92 us/op 788.57 us/op 1.00
mainnet_e58758 - phase0 processSlashingsReset 3.0310 us/op 1.9370 us/op 1.56
mainnet_e58758 - phase0 processRandaoMixesReset 5.8330 us/op 5.0230 us/op 1.16
mainnet_e58758 - phase0 processHistoricalRootsUpdate 586.00 ns/op 949.00 ns/op 0.62
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.3420 us/op 4.6240 us/op 0.94
mainnet_e58758 - phase0 afterProcessEpoch 69.382 ms/op 72.504 ms/op 0.96
phase0 processEffectiveBalanceUpdates - 250000 normalcase 932.62 us/op 975.23 us/op 0.96
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.4647 ms/op 1.2011 ms/op 1.22
altair processInactivityUpdates - 250000 normalcase 16.376 ms/op 17.065 ms/op 0.96
altair processInactivityUpdates - 250000 worstcase 14.720 ms/op 18.772 ms/op 0.78
phase0 processRegistryUpdates - 250000 normalcase 12.442 us/op 7.5540 us/op 1.65
phase0 processRegistryUpdates - 250000 badcase_full_deposits 360.73 us/op 416.13 us/op 0.87
phase0 processRegistryUpdates - 250000 worstcase 0.5 112.66 ms/op 113.28 ms/op 0.99
altair processRewardsAndPenalties - 250000 normalcase 53.081 ms/op 61.774 ms/op 0.86
altair processRewardsAndPenalties - 250000 worstcase 61.707 ms/op 59.383 ms/op 1.04
phase0 getAttestationDeltas - 250000 normalcase 5.6366 ms/op 6.2303 ms/op 0.90
phase0 getAttestationDeltas - 250000 worstcase 5.2067 ms/op 5.4224 ms/op 0.96
phase0 processSlashings - 250000 worstcase 1.5600 ms/op 1.9295 ms/op 0.81
altair processSyncCommitteeUpdates - 250000 109.54 ms/op 126.66 ms/op 0.86
BeaconState.hashTreeRoot - No change 345.00 ns/op 257.00 ns/op 1.34
BeaconState.hashTreeRoot - 1 full validator 132.73 us/op 131.97 us/op 1.01
BeaconState.hashTreeRoot - 32 full validator 1.3376 ms/op 1.2326 ms/op 1.09
BeaconState.hashTreeRoot - 512 full validator 15.326 ms/op 17.181 ms/op 0.89
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 155.55 us/op 152.54 us/op 1.02
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.9908 ms/op 2.7516 ms/op 0.72
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 27.070 ms/op 32.068 ms/op 0.84
BeaconState.hashTreeRoot - 1 balances 137.86 us/op 108.62 us/op 1.27
BeaconState.hashTreeRoot - 32 balances 1.5236 ms/op 1.3728 ms/op 1.11
BeaconState.hashTreeRoot - 512 balances 12.133 ms/op 13.085 ms/op 0.93
BeaconState.hashTreeRoot - 250000 balances 162.32 ms/op 198.43 ms/op 0.82
aggregationBits - 2048 els - zipIndexesInBitList 9.2460 us/op 13.335 us/op 0.69
regular array get 100000 times 31.615 us/op 30.976 us/op 1.02
wrappedArray get 100000 times 31.210 us/op 30.933 us/op 1.01
arrayWithProxy get 100000 times 10.497 ms/op 10.588 ms/op 0.99
ssz.Root.equals 238.00 ns/op 187.00 ns/op 1.27
byteArrayEquals 237.00 ns/op 172.00 ns/op 1.38
shuffle list - 16384 els 4.7025 ms/op 5.3144 ms/op 0.88
shuffle list - 250000 els 68.440 ms/op 72.114 ms/op 0.95
processSlot - 1 slots 13.528 us/op 17.168 us/op 0.79
processSlot - 32 slots 2.8094 ms/op 2.9879 ms/op 0.94
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 47.818 ms/op 46.808 ms/op 1.02
getCommitteeAssignments - req 1 vs - 250000 vc 2.3317 ms/op 2.2408 ms/op 1.04
getCommitteeAssignments - req 100 vs - 250000 vc 3.5211 ms/op 3.3803 ms/op 1.04
getCommitteeAssignments - req 1000 vs - 250000 vc 3.7704 ms/op 3.6684 ms/op 1.03
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.7700 ns/op 4.1600 ns/op 1.15
state getBlockRootAtSlot - 250000 vs - 7PWei 368.68 ns/op 652.38 ns/op 0.57
computeProposers - vc 250000 5.7623 ms/op 5.8666 ms/op 0.98
computeEpochShuffling - vc 250000 71.266 ms/op 70.900 ms/op 1.01
getNextSyncCommittee - vc 250000 99.688 ms/op 106.48 ms/op 0.94
computeSigningRoot for AttestationData 16.368 us/op 22.805 us/op 0.72
hash AttestationData serialized data then Buffer.toString(base64) 1.2854 us/op 1.2797 us/op 1.00
toHexString serialized data 831.29 ns/op 784.86 ns/op 1.06
Buffer.toString(base64) 150.28 ns/op 153.68 ns/op 0.98

by benchmarkbot/action

@dapplion
Copy link
Contributor

can raise some edge cases.

Can you explain this edge cases in more detail? Also please elaborate a bit more on why this config is brittle

@nazarhussain
Copy link
Contributor Author

If set the value to 5 the server will stop listening on 5 connections and start listening back on 4. This feels like a boolean condition, rather than a range.

The edge case I m referring to is if one connection is made and one connection is dropped simultaneously. So the moment listener stopped and listener started again. I opened a PR in libp2p to fix that edge case, which was causing the listener to keep listening even libp2p is stopped. This would not have triggered if we have reasonable range difference between start and close limit.

// Instead, we stop listening when the number of connections is below the target peers
// given that target peers and max peers have a reasonable gap between them and
// target peers are always less than the max peers
listenBelow: networkOpts.targetPeers ?? -Infinity,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this value need to default to -Infinity or 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe both can work as connection count never gonna be below zero. But with the consistent approach of positive Infinity, I suggest to use the negative Infinity.

Copy link
Member

Choose a reason for hiding this comment

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

-Infinity is dangerous because it means that once closeAbove is hit, the listener will never turn back on and we won't ever get inbound connections.

@wemeetagain
Copy link
Member

If set the value to 5 the server will stop listening on 5 connections and start listening back on 4. This feels like a boolean condition, rather than a range.

That was the intended behavior of setting both values high.
If we have maxPeers, we don't want to listen for more connections.
If we have less than maxPeers, we want to listen for more connections.

I don't think that is brittle, and if it is, we just need to fix the underlying implementation.

That said, its worth thinking about what kind of connection behavior we want, and viewing this PR on its own merits.

@nazarhussain
Copy link
Contributor Author

As the underlying issue is addressed by libp2p/js-libp2p#2058, so closing this PR.

@nazarhussain nazarhussain deleted the nh/network-options branch September 20, 2023 17:16
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.

3 participants