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

Log bad PeerId format #4479

Merged
merged 3 commits into from
Sep 1, 2022
Merged

Log bad PeerId format #4479

merged 3 commits into from
Sep 1, 2022

Conversation

dapplion
Copy link
Contributor

Motivation

Description

Wrap conversion and log error in case it's invalid

@wemeetagain maybe in #4246 there was a mix of different encodings used? Is it possible to commit to use PeerId or PeerIdStr everywhere?

@wemeetagain
Copy link
Member

Is it possible to commit to use PeerId or PeerIdStr everywhere?

at least for now, libp2p plans to use PeerId objects (although i'm still an advocate for libp2p/js-libp2p#680)

I'd still recommend we use PeerIdStr everywhere in lodestar .
Else we'd need to convert all Map<PeerIdStr, T> to PeerMap

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2022

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 5311d27 Previous: 3df538d Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.6927 ms/op 2.3254 ms/op 1.16
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 99.890 us/op 73.174 us/op 1.37
BLS verify - blst-native 3.0005 ms/op 2.1662 ms/op 1.39
BLS verifyMultipleSignatures 3 - blst-native 6.0115 ms/op 4.4745 ms/op 1.34
BLS verifyMultipleSignatures 8 - blst-native 13.278 ms/op 9.6756 ms/op 1.37
BLS verifyMultipleSignatures 32 - blst-native 49.073 ms/op 35.182 ms/op 1.39
BLS aggregatePubkeys 32 - blst-native 64.517 us/op 46.797 us/op 1.38
BLS aggregatePubkeys 128 - blst-native 262.80 us/op 181.98 us/op 1.44
getAttestationsForBlock 234.06 ms/op 157.88 ms/op 1.48
isKnown best case - 1 super set check 635.00 ns/op 474.00 ns/op 1.34
isKnown normal case - 2 super set checks 618.00 ns/op 464.00 ns/op 1.33
isKnown worse case - 16 super set checks 634.00 ns/op 465.00 ns/op 1.36
CheckpointStateCache - add get delete 13.017 us/op 9.1110 us/op 1.43
validate gossip signedAggregateAndProof - struct 7.6797 ms/op 5.0096 ms/op 1.53
validate gossip attestation - struct 3.4931 ms/op 2.3628 ms/op 1.48
pickEth1Vote - no votes 2.8421 ms/op 2.1492 ms/op 1.32
pickEth1Vote - max votes 27.089 ms/op 18.749 ms/op 1.44
pickEth1Vote - Eth1Data hashTreeRoot value x2048 16.634 ms/op 12.799 ms/op 1.30
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 28.789 ms/op 20.859 ms/op 1.38
pickEth1Vote - Eth1Data fastSerialize value x2048 2.0734 ms/op 1.4653 ms/op 1.41
pickEth1Vote - Eth1Data fastSerialize tree x2048 16.043 ms/op 13.096 ms/op 1.23
bytes32 toHexString 1.5170 us/op 970.00 ns/op 1.56
bytes32 Buffer.toString(hex) 949.00 ns/op 753.00 ns/op 1.26
bytes32 Buffer.toString(hex) from Uint8Array 1.3080 us/op 1.0700 us/op 1.22
bytes32 Buffer.toString(hex) + 0x 1.1420 us/op 806.00 ns/op 1.42
Object access 1 prop 0.52500 ns/op 0.37500 ns/op 1.40
Map access 1 prop 0.38600 ns/op 0.31700 ns/op 1.22
Object get x1000 18.574 ns/op 10.873 ns/op 1.71
Map get x1000 1.1130 ns/op 1.0740 ns/op 1.04
Object set x1000 136.46 ns/op 74.172 ns/op 1.84
Map set x1000 94.608 ns/op 49.391 ns/op 1.92
Return object 10000 times 0.48000 ns/op 0.43950 ns/op 1.09
Throw Error 10000 times 9.6887 us/op 6.1830 us/op 1.57
enrSubnets - fastDeserialize 64 bits 3.8100 us/op 2.6800 us/op 1.42
enrSubnets - ssz BitVector 64 bits 1.0180 us/op 845.00 ns/op 1.20
enrSubnets - fastDeserialize 4 bits 570.00 ns/op 400.00 ns/op 1.43
enrSubnets - ssz BitVector 4 bits 1.0110 us/op 864.00 ns/op 1.17
prioritizePeers score -10:0 att 32-0.1 sync 2-0 131.13 us/op 87.453 us/op 1.50
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 194.79 us/op 115.42 us/op 1.69
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 340.76 us/op 204.98 us/op 1.66
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 628.04 us/op 400.30 us/op 1.57
prioritizePeers score 0:0 att 64-1 sync 4-1 737.50 us/op 406.60 us/op 1.81
RateTracker 1000000 limit, 1 obj count per request 243.97 ns/op 187.98 ns/op 1.30
RateTracker 1000000 limit, 2 obj count per request 186.70 ns/op 139.70 ns/op 1.34
RateTracker 1000000 limit, 4 obj count per request 158.97 ns/op 110.90 ns/op 1.43
RateTracker 1000000 limit, 8 obj count per request 142.45 ns/op 99.271 ns/op 1.43
RateTracker with prune 6.8400 us/op 4.0930 us/op 1.67
array of 16000 items push then shift 5.7605 us/op 51.592 us/op 0.11
LinkedList of 16000 items push then shift 21.725 ns/op 12.744 ns/op 1.70
array of 16000 items push then pop 285.97 ns/op 210.90 ns/op 1.36
LinkedList of 16000 items push then pop 20.776 ns/op 12.094 ns/op 1.72
array of 24000 items push then shift 8.9354 us/op 77.359 us/op 0.12
LinkedList of 24000 items push then shift 23.518 ns/op 13.406 ns/op 1.75
array of 24000 items push then pop 271.36 ns/op 198.29 ns/op 1.37
LinkedList of 24000 items push then pop 20.003 ns/op 12.090 ns/op 1.65
intersect bitArray bitLen 8 14.261 ns/op 10.704 ns/op 1.33
intersect array and set length 8 242.32 ns/op 136.07 ns/op 1.78
intersect bitArray bitLen 128 79.218 ns/op 57.986 ns/op 1.37
intersect array and set length 128 2.7778 us/op 1.8311 us/op 1.52
Buffer.concat 32 items 2.6910 ns/op 2.2040 ns/op 1.22
pass gossip attestations to forkchoice per slot 4.8292 ms/op 5.1048 ms/op 0.95
computeDeltas 5.0467 ms/op 3.3568 ms/op 1.50
computeProposerBoostScoreFromBalances 1.0286 ms/op 805.29 us/op 1.28
altair processAttestation - 250000 vs - 7PWei normalcase 5.7936 ms/op 3.5134 ms/op 1.65
altair processAttestation - 250000 vs - 7PWei worstcase 8.7691 ms/op 6.0635 ms/op 1.45
altair processAttestation - setStatus - 1/6 committees join 306.01 us/op 183.15 us/op 1.67
altair processAttestation - setStatus - 1/3 committees join 567.82 us/op 364.16 us/op 1.56
altair processAttestation - setStatus - 1/2 committees join 815.44 us/op 515.33 us/op 1.58
altair processAttestation - setStatus - 2/3 committees join 1.1225 ms/op 670.66 us/op 1.67
altair processAttestation - setStatus - 4/5 committees join 1.4857 ms/op 941.23 us/op 1.58
altair processAttestation - setStatus - 100% committees join 1.8146 ms/op 1.1349 ms/op 1.60
altair processBlock - 250000 vs - 7PWei normalcase 36.488 ms/op 26.601 ms/op 1.37
altair processBlock - 250000 vs - 7PWei normalcase hashState 49.529 ms/op 37.086 ms/op 1.34
altair processBlock - 250000 vs - 7PWei worstcase 137.56 ms/op 81.482 ms/op 1.69
altair processBlock - 250000 vs - 7PWei worstcase hashState 145.55 ms/op 102.52 ms/op 1.42
phase0 processBlock - 250000 vs - 7PWei normalcase 5.5582 ms/op 3.3494 ms/op 1.66
phase0 processBlock - 250000 vs - 7PWei worstcase 79.147 ms/op 51.557 ms/op 1.54
altair processEth1Data - 250000 vs - 7PWei normalcase 1.4139 ms/op 752.57 us/op 1.88
Tree 40 250000 create 1.2875 s/op 623.71 ms/op 2.06
Tree 40 250000 get(125000) 375.26 ns/op 233.66 ns/op 1.61
Tree 40 250000 set(125000) 3.7324 us/op 2.1130 us/op 1.77
Tree 40 250000 toArray() 42.498 ms/op 27.364 ms/op 1.55
Tree 40 250000 iterate all - toArray() + loop 41.509 ms/op 27.802 ms/op 1.49
Tree 40 250000 iterate all - get(i) 157.58 ms/op 110.01 ms/op 1.43
MutableVector 250000 create 20.518 ms/op 12.846 ms/op 1.60
MutableVector 250000 get(125000) 17.173 ns/op 10.961 ns/op 1.57
MutableVector 250000 set(125000) 1.0807 us/op 493.71 ns/op 2.19
MutableVector 250000 toArray() 8.7917 ms/op 5.9499 ms/op 1.48
MutableVector 250000 iterate all - toArray() + loop 9.0012 ms/op 6.0239 ms/op 1.49
MutableVector 250000 iterate all - get(i) 4.1258 ms/op 2.6091 ms/op 1.58
Array 250000 create 8.5104 ms/op 6.0848 ms/op 1.40
Array 250000 clone - spread 5.3199 ms/op 3.1027 ms/op 1.71
Array 250000 get(125000) 2.1360 ns/op 1.4620 ns/op 1.46
Array 250000 set(125000) 2.2740 ns/op 1.5530 ns/op 1.46
Array 250000 iterate all - loop 175.53 us/op 154.69 us/op 1.13
effectiveBalanceIncrements clone Uint8Array 300000 460.41 us/op 60.209 us/op 7.65
effectiveBalanceIncrements clone MutableVector 300000 1.0190 us/op 994.00 ns/op 1.03
effectiveBalanceIncrements rw all Uint8Array 300000 358.28 us/op 247.43 us/op 1.45
effectiveBalanceIncrements rw all MutableVector 300000 260.62 ms/op 203.63 ms/op 1.28
phase0 afterProcessEpoch - 250000 vs - 7PWei 253.05 ms/op 191.77 ms/op 1.32
phase0 beforeProcessEpoch - 250000 vs - 7PWei 87.334 ms/op 82.335 ms/op 1.06
altair processEpoch - mainnet_e81889 763.12 ms/op 551.22 ms/op 1.38
mainnet_e81889 - altair beforeProcessEpoch 170.26 ms/op 114.44 ms/op 1.49
mainnet_e81889 - altair processJustificationAndFinalization 72.574 us/op 18.085 us/op 4.01
mainnet_e81889 - altair processInactivityUpdates 13.227 ms/op 8.9763 ms/op 1.47
mainnet_e81889 - altair processRewardsAndPenalties 118.39 ms/op 121.69 ms/op 0.97
mainnet_e81889 - altair processRegistryUpdates 15.324 us/op 2.8330 us/op 5.41
mainnet_e81889 - altair processSlashings 4.4340 us/op 559.00 ns/op 7.93
mainnet_e81889 - altair processEth1DataReset 4.6250 us/op 601.00 ns/op 7.70
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.8250 ms/op 1.9977 ms/op 1.41
mainnet_e81889 - altair processSlashingsReset 23.195 us/op 5.2820 us/op 4.39
mainnet_e81889 - altair processRandaoMixesReset 27.441 us/op 4.2990 us/op 6.38
mainnet_e81889 - altair processHistoricalRootsUpdate 4.6590 us/op 598.00 ns/op 7.79
mainnet_e81889 - altair processParticipationFlagUpdates 17.008 us/op 2.6860 us/op 6.33
mainnet_e81889 - altair processSyncCommitteeUpdates 3.5680 us/op 601.00 ns/op 5.94
mainnet_e81889 - altair afterProcessEpoch 252.52 ms/op 200.93 ms/op 1.26
phase0 processEpoch - mainnet_e58758 739.21 ms/op 489.17 ms/op 1.51
mainnet_e58758 - phase0 beforeProcessEpoch 337.62 ms/op 184.98 ms/op 1.83
mainnet_e58758 - phase0 processJustificationAndFinalization 68.171 us/op 16.159 us/op 4.22
mainnet_e58758 - phase0 processRewardsAndPenalties 177.16 ms/op 110.64 ms/op 1.60
mainnet_e58758 - phase0 processRegistryUpdates 37.352 us/op 7.9980 us/op 4.67
mainnet_e58758 - phase0 processSlashings 3.4490 us/op 597.00 ns/op 5.78
mainnet_e58758 - phase0 processEth1DataReset 4.3990 us/op 583.00 ns/op 7.55
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.6970 ms/op 2.0815 ms/op 1.30
mainnet_e58758 - phase0 processSlashingsReset 19.201 us/op 4.2900 us/op 4.48
mainnet_e58758 - phase0 processRandaoMixesReset 26.452 us/op 4.9240 us/op 5.37
mainnet_e58758 - phase0 processHistoricalRootsUpdate 4.6210 us/op 696.00 ns/op 6.64
mainnet_e58758 - phase0 processParticipationRecordUpdates 25.157 us/op 3.5030 us/op 7.18
mainnet_e58758 - phase0 afterProcessEpoch 208.41 ms/op 165.37 ms/op 1.26
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.9892 ms/op 1.9489 ms/op 1.53
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 3.1729 ms/op 2.2424 ms/op 1.41
altair processInactivityUpdates - 250000 normalcase 58.334 ms/op 40.353 ms/op 1.45
altair processInactivityUpdates - 250000 worstcase 73.695 ms/op 33.496 ms/op 2.20
phase0 processRegistryUpdates - 250000 normalcase 34.884 us/op 6.1230 us/op 5.70
phase0 processRegistryUpdates - 250000 badcase_full_deposits 642.52 us/op 381.77 us/op 1.68
phase0 processRegistryUpdates - 250000 worstcase 0.5 285.99 ms/op 167.72 ms/op 1.71
altair processRewardsAndPenalties - 250000 normalcase 168.01 ms/op 76.865 ms/op 2.19
altair processRewardsAndPenalties - 250000 worstcase 110.16 ms/op 109.75 ms/op 1.00
phase0 getAttestationDeltas - 250000 normalcase 18.040 ms/op 13.735 ms/op 1.31
phase0 getAttestationDeltas - 250000 worstcase 18.183 ms/op 13.696 ms/op 1.33
phase0 processSlashings - 250000 worstcase 7.3373 ms/op 5.4966 ms/op 1.33
altair processSyncCommitteeUpdates - 250000 410.83 ms/op 304.35 ms/op 1.35
BeaconState.hashTreeRoot - No change 788.00 ns/op 550.00 ns/op 1.43
BeaconState.hashTreeRoot - 1 full validator 96.477 us/op 68.381 us/op 1.41
BeaconState.hashTreeRoot - 32 full validator 952.90 us/op 705.36 us/op 1.35
BeaconState.hashTreeRoot - 512 full validator 9.6906 ms/op 8.0869 ms/op 1.20
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 127.55 us/op 90.007 us/op 1.42
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.9636 ms/op 1.3041 ms/op 1.51
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 22.972 ms/op 18.048 ms/op 1.27
BeaconState.hashTreeRoot - 1 balances 95.872 us/op 71.041 us/op 1.35
BeaconState.hashTreeRoot - 32 balances 831.66 us/op 643.66 us/op 1.29
BeaconState.hashTreeRoot - 512 balances 8.8065 ms/op 7.0653 ms/op 1.25
BeaconState.hashTreeRoot - 250000 balances 141.52 ms/op 102.66 ms/op 1.38
aggregationBits - 2048 els - zipIndexesInBitList 42.331 us/op 32.292 us/op 1.31
regular array get 100000 times 72.106 us/op 65.075 us/op 1.11
wrappedArray get 100000 times 72.165 us/op 61.455 us/op 1.17
arrayWithProxy get 100000 times 41.372 ms/op 28.574 ms/op 1.45
ssz.Root.equals 707.00 ns/op 522.00 ns/op 1.35
byteArrayEquals 674.00 ns/op 511.00 ns/op 1.32
shuffle list - 16384 els 15.168 ms/op 11.347 ms/op 1.34
shuffle list - 250000 els 209.02 ms/op 171.55 ms/op 1.22
processSlot - 1 slots 21.549 us/op 14.006 us/op 1.54
processSlot - 32 slots 2.9632 ms/op 2.0405 ms/op 1.45
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 640.96 us/op 388.87 us/op 1.65
getCommitteeAssignments - req 1 vs - 250000 vc 6.4497 ms/op 5.3851 ms/op 1.20
getCommitteeAssignments - req 100 vs - 250000 vc 9.3231 ms/op 7.8548 ms/op 1.19
getCommitteeAssignments - req 1000 vs - 250000 vc 9.9266 ms/op 8.4313 ms/op 1.18
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 12.280 ns/op 7.8700 ns/op 1.56
state getBlockRootAtSlot - 250000 vs - 7PWei 1.4825 us/op 1.1527 us/op 1.29
computeProposers - vc 250000 23.878 ms/op 17.914 ms/op 1.33
computeEpochShuffling - vc 250000 220.22 ms/op 173.64 ms/op 1.27
getNextSyncCommittee - vc 250000 415.33 ms/op 303.56 ms/op 1.37

by benchmarkbot/action

@wemeetagain wemeetagain enabled auto-merge (squash) September 1, 2022 16:41
@wemeetagain wemeetagain merged commit 1b0844c into unstable Sep 1, 2022
@wemeetagain wemeetagain deleted the dapplion/peer-id-format branch September 1, 2022 17:01
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.

None yet

2 participants