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: ignore discovered peers with no multiaddrs #5736

Merged
merged 2 commits into from
Jul 11, 2023

Conversation

wemeetagain
Copy link
Member

Motivation

Description

Update onDiscoveredPeer to handle the case where multiaddrs: Multiaddr[] is empty.

@wemeetagain wemeetagain requested a review from a team as a code owner July 7, 2023 13:58
@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2023

Performance Report

✔️ no performance regression detected

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: 03a7b87 Previous: b596000 Ratio
Buffer.concat 32 items 2.6510 us/op 8.1450 us/op 0.33
phase0 afterProcessEpoch - 250000 vs - 7PWei 128.54 ms/op 398.36 ms/op 0.32
Full benchmark results
Benchmark suite Current: 03a7b87 Previous: b596000 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 766.38 us/op 1.1526 ms/op 0.66
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 57.162 us/op 73.895 us/op 0.77
BLS verify - blst-native 1.2672 ms/op 1.8439 ms/op 0.69
BLS verifyMultipleSignatures 3 - blst-native 2.9599 ms/op 3.6146 ms/op 0.82
BLS verifyMultipleSignatures 8 - blst-native 5.6661 ms/op 8.0155 ms/op 0.71
BLS verifyMultipleSignatures 32 - blst-native 20.345 ms/op 27.721 ms/op 0.73
BLS aggregatePubkeys 32 - blst-native 28.055 us/op 38.211 us/op 0.73
BLS aggregatePubkeys 128 - blst-native 109.53 us/op 165.75 us/op 0.66
getAttestationsForBlock 59.595 ms/op 68.226 ms/op 0.87
isKnown best case - 1 super set check 286.00 ns/op 421.00 ns/op 0.68
isKnown normal case - 2 super set checks 259.00 ns/op 335.00 ns/op 0.77
isKnown worse case - 16 super set checks 256.00 ns/op 321.00 ns/op 0.80
CheckpointStateCache - add get delete 6.0560 us/op 6.9740 us/op 0.87
validate gossip signedAggregateAndProof - struct 2.8689 ms/op 3.5532 ms/op 0.81
validate gossip attestation - struct 1.4013 ms/op 1.8989 ms/op 0.74
pickEth1Vote - no votes 1.4733 ms/op 1.7003 ms/op 0.87
pickEth1Vote - max votes 11.194 ms/op 12.323 ms/op 0.91
pickEth1Vote - Eth1Data hashTreeRoot value x2048 9.7767 ms/op 11.923 ms/op 0.82
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 16.463 ms/op 20.135 ms/op 0.82
pickEth1Vote - Eth1Data fastSerialize value x2048 861.61 us/op 932.28 us/op 0.92
pickEth1Vote - Eth1Data fastSerialize tree x2048 5.7200 ms/op 7.0782 ms/op 0.81
bytes32 toHexString 728.00 ns/op 809.00 ns/op 0.90
bytes32 Buffer.toString(hex) 433.00 ns/op 569.00 ns/op 0.76
bytes32 Buffer.toString(hex) from Uint8Array 570.00 ns/op 833.00 ns/op 0.68
bytes32 Buffer.toString(hex) + 0x 435.00 ns/op 536.00 ns/op 0.81
Object access 1 prop 0.20100 ns/op 0.25800 ns/op 0.78
Map access 1 prop 0.16100 ns/op 0.22900 ns/op 0.70
Object get x1000 6.6550 ns/op 9.1300 ns/op 0.73
Map get x1000 0.67600 ns/op 0.91300 ns/op 0.74
Object set x1000 64.782 ns/op 92.746 ns/op 0.70
Map set x1000 54.354 ns/op 88.162 ns/op 0.62
Return object 10000 times 0.25770 ns/op 0.32200 ns/op 0.80
Throw Error 10000 times 4.3901 us/op 5.2813 us/op 0.83
fastMsgIdFn sha256 / 200 bytes 3.5760 us/op 4.3310 us/op 0.83
fastMsgIdFn h32 xxhash / 200 bytes 306.00 ns/op 359.00 ns/op 0.85
fastMsgIdFn h64 xxhash / 200 bytes 433.00 ns/op 562.00 ns/op 0.77
fastMsgIdFn sha256 / 1000 bytes 12.111 us/op 14.644 us/op 0.83
fastMsgIdFn h32 xxhash / 1000 bytes 452.00 ns/op 491.00 ns/op 0.92
fastMsgIdFn h64 xxhash / 1000 bytes 514.00 ns/op 619.00 ns/op 0.83
fastMsgIdFn sha256 / 10000 bytes 106.02 us/op 155.22 us/op 0.68
fastMsgIdFn h32 xxhash / 10000 bytes 2.0130 us/op 2.7160 us/op 0.74
fastMsgIdFn h64 xxhash / 10000 bytes 1.4580 us/op 1.9350 us/op 0.75
enrSubnets - fastDeserialize 64 bits 1.6600 us/op 2.1150 us/op 0.78
enrSubnets - ssz BitVector 64 bits 558.00 ns/op 645.00 ns/op 0.87
enrSubnets - fastDeserialize 4 bits 191.00 ns/op 248.00 ns/op 0.77
enrSubnets - ssz BitVector 4 bits 555.00 ns/op 711.00 ns/op 0.78
prioritizePeers score -10:0 att 32-0.1 sync 2-0 115.79 us/op 144.89 us/op 0.80
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 157.34 us/op 197.91 us/op 0.80
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 193.43 us/op 235.01 us/op 0.82
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 387.24 us/op 475.75 us/op 0.81
prioritizePeers score 0:0 att 64-1 sync 4-1 405.17 us/op 539.68 us/op 0.75
array of 16000 items push then shift 1.7035 us/op 2.1817 us/op 0.78
LinkedList of 16000 items push then shift 9.4180 ns/op 11.242 ns/op 0.84
array of 16000 items push then pop 96.739 ns/op 121.93 ns/op 0.79
LinkedList of 16000 items push then pop 8.7920 ns/op 9.8440 ns/op 0.89
array of 24000 items push then shift 2.4144 us/op 2.6376 us/op 0.92
LinkedList of 24000 items push then shift 9.0020 ns/op 10.934 ns/op 0.82
array of 24000 items push then pop 82.782 ns/op 110.41 ns/op 0.75
LinkedList of 24000 items push then pop 8.7320 ns/op 10.849 ns/op 0.80
intersect bitArray bitLen 8 13.506 ns/op 17.454 ns/op 0.77
intersect array and set length 8 77.965 ns/op 190.72 ns/op 0.41
intersect bitArray bitLen 128 44.622 ns/op 105.97 ns/op 0.42
intersect array and set length 128 1.0668 us/op 2.7831 us/op 0.38
Buffer.concat 32 items 2.6510 us/op 8.1450 us/op 0.33
Uint8Array.set 32 items 2.4370 us/op 3.7280 us/op 0.65
transfer serialized Status (84 B) 2.0870 us/op 2.8310 us/op 0.74
copy serialized Status (84 B) 1.7320 us/op 3.2370 us/op 0.54
transfer serialized SignedVoluntaryExit (112 B) 2.1670 us/op 3.3250 us/op 0.65
copy serialized SignedVoluntaryExit (112 B) 1.7720 us/op 2.9450 us/op 0.60
transfer serialized ProposerSlashing (416 B) 2.6670 us/op 3.0950 us/op 0.86
copy serialized ProposerSlashing (416 B) 2.7780 us/op 3.8470 us/op 0.72
transfer serialized Attestation (485 B) 3.3410 us/op 3.9360 us/op 0.85
copy serialized Attestation (485 B) 2.9680 us/op 3.8780 us/op 0.77
transfer serialized AttesterSlashing (33232 B) 2.7470 us/op 3.4230 us/op 0.80
copy serialized AttesterSlashing (33232 B) 5.8510 us/op 7.8670 us/op 0.74
transfer serialized Small SignedBeaconBlock (128000 B) 2.6740 us/op 3.6160 us/op 0.74
copy serialized Small SignedBeaconBlock (128000 B) 13.360 us/op 16.040 us/op 0.83
transfer serialized Avg SignedBeaconBlock (200000 B) 2.8800 us/op 3.7690 us/op 0.76
copy serialized Avg SignedBeaconBlock (200000 B) 41.709 us/op 25.852 us/op 1.61
transfer serialized BlobsSidecar (524380 B) 3.1190 us/op 4.3450 us/op 0.72
copy serialized BlobsSidecar (524380 B) 186.90 us/op 189.26 us/op 0.99
transfer serialized Big SignedBeaconBlock (1000000 B) 3.2940 us/op 4.2360 us/op 0.78
copy serialized Big SignedBeaconBlock (1000000 B) 134.98 us/op 353.99 us/op 0.38
pass gossip attestations to forkchoice per slot 2.6261 ms/op 4.0119 ms/op 0.65
forkChoice updateHead vc 100000 bc 64 eq 0 2.0778 ms/op 3.0658 ms/op 0.68
forkChoice updateHead vc 600000 bc 64 eq 0 15.729 ms/op 18.479 ms/op 0.85
forkChoice updateHead vc 1000000 bc 64 eq 0 24.040 ms/op 27.301 ms/op 0.88
forkChoice updateHead vc 600000 bc 320 eq 0 17.134 ms/op 24.663 ms/op 0.69
forkChoice updateHead vc 600000 bc 1200 eq 0 89.357 ms/op 129.05 ms/op 0.69
forkChoice updateHead vc 600000 bc 64 eq 1000 20.184 ms/op 32.972 ms/op 0.61
forkChoice updateHead vc 600000 bc 64 eq 10000 24.907 ms/op 37.379 ms/op 0.67
forkChoice updateHead vc 600000 bc 64 eq 300000 34.848 ms/op 48.399 ms/op 0.72
computeDeltas 3.2813 ms/op 5.0119 ms/op 0.65
computeProposerBoostScoreFromBalances 1.8447 ms/op 2.4674 ms/op 0.75
altair processAttestation - 250000 vs - 7PWei normalcase 3.1847 ms/op 4.6568 ms/op 0.68
altair processAttestation - 250000 vs - 7PWei worstcase 4.3302 ms/op 4.2379 ms/op 1.02
altair processAttestation - setStatus - 1/6 committees join 146.22 us/op 280.73 us/op 0.52
altair processAttestation - setStatus - 1/3 committees join 306.85 us/op 343.53 us/op 0.89
altair processAttestation - setStatus - 1/2 committees join 383.79 us/op 596.83 us/op 0.64
altair processAttestation - setStatus - 2/3 committees join 471.41 us/op 579.48 us/op 0.81
altair processAttestation - setStatus - 4/5 committees join 681.92 us/op 876.79 us/op 0.78
altair processAttestation - setStatus - 100% committees join 807.95 us/op 1.0465 ms/op 0.77
altair processBlock - 250000 vs - 7PWei normalcase 19.565 ms/op 19.440 ms/op 1.01
altair processBlock - 250000 vs - 7PWei normalcase hashState 29.603 ms/op 29.372 ms/op 1.01
altair processBlock - 250000 vs - 7PWei worstcase 53.769 ms/op 54.246 ms/op 0.99
altair processBlock - 250000 vs - 7PWei worstcase hashState 79.608 ms/op 83.777 ms/op 0.95
phase0 processBlock - 250000 vs - 7PWei normalcase 3.0956 ms/op 2.5536 ms/op 1.21
phase0 processBlock - 250000 vs - 7PWei worstcase 34.620 ms/op 36.858 ms/op 0.94
altair processEth1Data - 250000 vs - 7PWei normalcase 662.17 us/op 954.82 us/op 0.69
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 15.370 us/op 15.423 us/op 1.00
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 38.500 us/op 21.981 us/op 1.75
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 16.948 us/op 9.6010 us/op 1.77
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 14.878 us/op 8.3890 us/op 1.77
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 143.49 us/op 89.455 us/op 1.60
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 940.16 us/op 879.23 us/op 1.07
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.1247 ms/op 957.66 us/op 1.17
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.1892 ms/op 1.2539 ms/op 0.95
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.5191 ms/op 2.8429 ms/op 1.24
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.7247 ms/op 1.8353 ms/op 0.94
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 5.5173 ms/op 4.5445 ms/op 1.21
Tree 40 250000 create 745.46 ms/op 404.98 ms/op 1.84
Tree 40 250000 get(125000) 203.70 ns/op 252.80 ns/op 0.81
Tree 40 250000 set(125000) 2.7728 us/op 1.4974 us/op 1.85
Tree 40 250000 toArray() 36.992 ms/op 29.472 ms/op 1.26
Tree 40 250000 iterate all - toArray() + loop 29.953 ms/op 27.424 ms/op 1.09
Tree 40 250000 iterate all - get(i) 92.008 ms/op 176.80 ms/op 0.52
MutableVector 250000 create 13.794 ms/op 29.108 ms/op 0.47
MutableVector 250000 get(125000) 6.9650 ns/op 19.226 ns/op 0.36
MutableVector 250000 set(125000) 743.47 ns/op 987.73 ns/op 0.75
MutableVector 250000 toArray() 5.8841 ms/op 9.4689 ms/op 0.62
MutableVector 250000 iterate all - toArray() + loop 4.9634 ms/op 10.996 ms/op 0.45
MutableVector 250000 iterate all - get(i) 1.6821 ms/op 4.1675 ms/op 0.40
Array 250000 create 4.5376 ms/op 7.6638 ms/op 0.59
Array 250000 clone - spread 2.2991 ms/op 4.6270 ms/op 0.50
Array 250000 get(125000) 1.4390 ns/op 2.7510 ns/op 0.52
Array 250000 set(125000) 1.5420 ns/op 3.1330 ns/op 0.49
Array 250000 iterate all - loop 109.73 us/op 387.32 us/op 0.28
effectiveBalanceIncrements clone Uint8Array 300000 67.024 us/op 88.330 us/op 0.76
effectiveBalanceIncrements clone MutableVector 300000 657.00 ns/op 2.2620 us/op 0.29
effectiveBalanceIncrements rw all Uint8Array 300000 192.83 us/op 626.46 us/op 0.31
effectiveBalanceIncrements rw all MutableVector 300000 178.04 ms/op 379.29 ms/op 0.47
phase0 afterProcessEpoch - 250000 vs - 7PWei 128.54 ms/op 398.36 ms/op 0.32
phase0 beforeProcessEpoch - 250000 vs - 7PWei 52.462 ms/op 103.61 ms/op 0.51
altair processEpoch - mainnet_e81889 402.40 ms/op 1.1152 s/op 0.36
mainnet_e81889 - altair beforeProcessEpoch 90.200 ms/op 150.54 ms/op 0.60
mainnet_e81889 - altair processJustificationAndFinalization 36.319 us/op 88.001 us/op 0.41
mainnet_e81889 - altair processInactivityUpdates 8.1603 ms/op 24.265 ms/op 0.34
mainnet_e81889 - altair processRewardsAndPenalties 89.365 ms/op 194.79 ms/op 0.46
mainnet_e81889 - altair processRegistryUpdates 7.3620 us/op 16.757 us/op 0.44
mainnet_e81889 - altair processSlashings 1.8990 us/op 4.0330 us/op 0.47
mainnet_e81889 - altair processEth1DataReset 1.4070 us/op 3.7150 us/op 0.38
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.6045 ms/op 6.0694 ms/op 0.26
mainnet_e81889 - altair processSlashingsReset 6.2260 us/op 26.547 us/op 0.23
mainnet_e81889 - altair processRandaoMixesReset 10.941 us/op 27.332 us/op 0.40
mainnet_e81889 - altair processHistoricalRootsUpdate 1.1260 us/op 5.8100 us/op 0.19
mainnet_e81889 - altair processParticipationFlagUpdates 4.0630 us/op 16.909 us/op 0.24
mainnet_e81889 - altair processSyncCommitteeUpdates 1.6920 us/op 2.7580 us/op 0.61
mainnet_e81889 - altair afterProcessEpoch 136.27 ms/op 440.32 ms/op 0.31
phase0 processEpoch - mainnet_e58758 632.23 ms/op 1.0608 s/op 0.60
mainnet_e58758 - phase0 beforeProcessEpoch 281.55 ms/op 369.28 ms/op 0.76
mainnet_e58758 - phase0 processJustificationAndFinalization 39.103 us/op 68.821 us/op 0.57
mainnet_e58758 - phase0 processRewardsAndPenalties 103.18 ms/op 149.42 ms/op 0.69
mainnet_e58758 - phase0 processRegistryUpdates 24.942 us/op 38.714 us/op 0.64
mainnet_e58758 - phase0 processSlashings 1.8400 us/op 3.3430 us/op 0.55
mainnet_e58758 - phase0 processEth1DataReset 1.9710 us/op 3.8140 us/op 0.52
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.4033 ms/op 4.4152 ms/op 0.54
mainnet_e58758 - phase0 processSlashingsReset 12.445 us/op 20.045 us/op 0.62
mainnet_e58758 - phase0 processRandaoMixesReset 15.006 us/op 29.052 us/op 0.52
mainnet_e58758 - phase0 processHistoricalRootsUpdate 2.3900 us/op 4.1090 us/op 0.58
mainnet_e58758 - phase0 processParticipationRecordUpdates 14.389 us/op 23.286 us/op 0.62
mainnet_e58758 - phase0 afterProcessEpoch 130.87 ms/op 295.62 ms/op 0.44
phase0 processEffectiveBalanceUpdates - 250000 normalcase 3.0598 ms/op 6.0535 ms/op 0.51
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 4.2639 ms/op 7.0621 ms/op 0.60
altair processInactivityUpdates - 250000 normalcase 64.209 ms/op 69.253 ms/op 0.93
altair processInactivityUpdates - 250000 worstcase 63.391 ms/op 77.260 ms/op 0.82
phase0 processRegistryUpdates - 250000 normalcase 19.847 us/op 45.532 us/op 0.44
phase0 processRegistryUpdates - 250000 badcase_full_deposits 555.64 us/op 1.0022 ms/op 0.55
phase0 processRegistryUpdates - 250000 worstcase 0.5 244.48 ms/op 363.81 ms/op 0.67
altair processRewardsAndPenalties - 250000 normalcase 119.32 ms/op 143.49 ms/op 0.83
altair processRewardsAndPenalties - 250000 worstcase 115.67 ms/op 137.05 ms/op 0.84
phase0 getAttestationDeltas - 250000 normalcase 14.122 ms/op 21.842 ms/op 0.65
phase0 getAttestationDeltas - 250000 worstcase 12.207 ms/op 18.316 ms/op 0.67
phase0 processSlashings - 250000 worstcase 4.8475 ms/op 11.244 ms/op 0.43
altair processSyncCommitteeUpdates - 250000 219.66 ms/op 404.34 ms/op 0.54
BeaconState.hashTreeRoot - No change 351.00 ns/op 754.00 ns/op 0.47
BeaconState.hashTreeRoot - 1 full validator 71.016 us/op 159.29 us/op 0.45
BeaconState.hashTreeRoot - 32 full validator 840.94 us/op 1.0598 ms/op 0.79
BeaconState.hashTreeRoot - 512 full validator 9.9662 ms/op 13.699 ms/op 0.73
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 100.87 us/op 171.28 us/op 0.59
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.6590 ms/op 2.3610 ms/op 0.70
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 16.633 ms/op 27.838 ms/op 0.60
BeaconState.hashTreeRoot - 1 balances 61.742 us/op 92.886 us/op 0.66
BeaconState.hashTreeRoot - 32 balances 796.45 us/op 803.28 us/op 0.99
BeaconState.hashTreeRoot - 512 balances 7.3296 ms/op 6.8920 ms/op 1.06
BeaconState.hashTreeRoot - 250000 balances 115.20 ms/op 105.11 ms/op 1.10
aggregationBits - 2048 els - zipIndexesInBitList 35.538 us/op 25.770 us/op 1.38
regular array get 100000 times 37.554 us/op 44.511 us/op 0.84
wrappedArray get 100000 times 51.017 us/op 44.552 us/op 1.15
arrayWithProxy get 100000 times 25.796 ms/op 27.492 ms/op 0.94
ssz.Root.equals 720.00 ns/op 992.00 ns/op 0.73
byteArrayEquals 662.00 ns/op 982.00 ns/op 0.67
shuffle list - 16384 els 8.3389 ms/op 10.418 ms/op 0.80
shuffle list - 250000 els 149.89 ms/op 139.13 ms/op 1.08
processSlot - 1 slots 12.050 us/op 14.253 us/op 0.85
processSlot - 32 slots 2.5050 ms/op 1.9421 ms/op 1.29
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 57.649 ms/op 38.521 ms/op 1.50
getCommitteeAssignments - req 1 vs - 250000 vc 3.7274 ms/op 3.8026 ms/op 0.98
getCommitteeAssignments - req 100 vs - 250000 vc 5.1687 ms/op 5.4455 ms/op 0.95
getCommitteeAssignments - req 1000 vs - 250000 vc 7.7581 ms/op 5.6618 ms/op 1.37
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 10.860 ns/op 6.0100 ns/op 1.81
state getBlockRootAtSlot - 250000 vs - 7PWei 1.4202 us/op 1.0835 us/op 1.31
computeProposers - vc 250000 14.117 ms/op 14.102 ms/op 1.00
computeEpochShuffling - vc 250000 125.47 ms/op 128.02 ms/op 0.98
getNextSyncCommittee - vc 250000 222.79 ms/op 215.23 ms/op 1.04
computeSigningRoot for AttestationData 18.726 us/op 17.449 us/op 1.07
hash AttestationData serialized data then Buffer.toString(base64) 2.7207 us/op 2.9183 us/op 0.93
toHexString serialized data 1.3601 us/op 1.4274 us/op 0.95
Buffer.toString(base64) 377.64 ns/op 451.98 ns/op 0.84

by benchmarkbot/action

@nflaig
Copy link
Member

nflaig commented Jul 8, 2023

Getting another but similar error running this branch

TypeError: Cannot read properties of undefined (reading 'length')
    at Libp2pNode.PeerDiscovery.onDiscoveredPeer (file:///home/devops/goerli/lodestar/packages/beacon-node/src/network/peers/discover.ts:277:20)
    at Libp2pNode.[nodejs.internal.kHybridDispatch] (node:internal/event_target:762:20)
    at Libp2pNode.dispatchEvent (node:internal/event_target:704:26)
    at Libp2pNode.dispatchEvent (file:///home/devops/goerli/lodestar/node_modules/@libp2p/interfaces/src/events.ts:64:26)
    at Libp2pNode.safeDispatchEvent (file:///home/devops/goerli/lodestar/node_modules/@libp2p/interfaces/src/events.ts:79:17)
    at EventEmitter.<anonymous> (file:///home/devops/goerli/lodestar/node_modules/libp2p/src/libp2p.ts:102:14)
    at EventEmitter.[nodejs.internal.kHybridDispatch] (node:internal/event_target:762:20)
    at EventEmitter.dispatchEvent (node:internal/event_target:704:26)
    at EventEmitter.dispatchEvent (file:///home/devops/goerli/lodestar/node_modules/@libp2p/interfaces/src/events.ts:64:26)
    at EventEmitter.Libp2pNode.events.dispatchEvent (file:///home/devops/goerli/lodestar/node_modules/libp2p/src/libp2p.ts:65:30) Cannot read properties of undefined (reading 'length')

There is also a max listeners warning, could be related

(node:593428) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 31 finish listeners added to [ConsoleDynamicLevel]. Use emitter.setMaxListeners() to increase limit

matthewkeil
matthewkeil previously approved these changes Jul 9, 2023
Copy link
Member

@matthewkeil matthewkeil left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

twoeths
twoeths previously approved these changes Jul 10, 2023
*/
private onDiscoveredPeer = (evt: CustomEvent<PeerInfo>): void => {
const {id, multiaddrs} = evt.detail;

// libp2p may send us PeerInfos without multiaddrs
if (multiaddrs.length === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

with this error Cannot read properties of undefined (reading '0') we need to handle undefined multiaddrs too

Suggested change
if (multiaddrs.length === 0) {
if (!multiaddrs || multiaddrs.length === 0) {

@wemeetagain wemeetagain dismissed stale reviews from twoeths and matthewkeil via 4d934be July 10, 2023 14:35
@philknows philknows added this to the v1.10.0 milestone Jul 11, 2023
Copy link
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

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

Looks good now, no more errors

@wemeetagain wemeetagain merged commit 91e2e65 into unstable Jul 11, 2023
@wemeetagain wemeetagain deleted the cayman/fix-uncaught-exception branch July 11, 2023 14:27
@wemeetagain
Copy link
Member Author

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

Uncaught exception: Cannot read properties of undefined (reading '0')
5 participants