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

Revert "Lodestar gossip queues to wrap processRpcMessage() (#3554)" #3745

Merged
merged 1 commit into from
Feb 12, 2022

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Feb 11, 2022

This reverts commit fcbc459.

Motivation

This reverts #3554. For our gossip queues, we wrapped processRpcMessage() instead of validate() because we found that getMsgId() is not cheap (it also uncompresses the message), it may be called and the message is still dropped in the end.

The down side is that we have different copies of same message in our queue, this leads to queue.jobs.shift() functions is called too much, see #3732

With new gossipsub v0.12, we use fast_msg_id function so it resolves the original concerns of #3554

Description

Closes #3691 , #3749

@codecov
Copy link

codecov bot commented Feb 11, 2022

Codecov Report

Merging #3745 (8d54a70) into master (1c86d16) will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3745      +/-   ##
==========================================
+ Coverage   37.07%   37.08%   +0.01%     
==========================================
  Files         319      319              
  Lines        8715     8709       -6     
  Branches     1356     1354       -2     
==========================================
- Hits         3231     3230       -1     
+ Misses       5342     5337       -5     
  Partials      142      142              

@github-actions
Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: feacff8 Previous: 1c86d16 Ratio
BeaconState.hashTreeRoot - No change 486.00 ns/op 546.00 ns/op 0.89
BeaconState.hashTreeRoot - 1 full validator 116.67 us/op 125.90 us/op 0.93
BeaconState.hashTreeRoot - 32 full validator 1.7103 ms/op 1.8860 ms/op 0.91
BeaconState.hashTreeRoot - 512 full validator 23.066 ms/op 24.359 ms/op 0.95
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 110.02 us/op 123.37 us/op 0.89
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.8577 ms/op 2.0019 ms/op 0.93
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 25.046 ms/op 26.002 ms/op 0.96
BeaconState.hashTreeRoot - 1 balances 81.318 us/op 90.503 us/op 0.90
BeaconState.hashTreeRoot - 32 balances 685.29 us/op 757.82 us/op 0.90
BeaconState.hashTreeRoot - 512 balances 7.2300 ms/op 7.2279 ms/op 1.00
BeaconState.hashTreeRoot - 250000 balances 131.08 ms/op 130.03 ms/op 1.01
processSlot - 1 slots 43.384 us/op 44.616 us/op 0.97
processSlot - 32 slots 2.6401 ms/op 2.8076 ms/op 0.94
getCommitteeAssignments - req 1 vs - 250000 vc 4.7307 ms/op 5.3146 ms/op 0.89
getCommitteeAssignments - req 100 vs - 250000 vc 6.6284 ms/op 7.3899 ms/op 0.90
getCommitteeAssignments - req 1000 vs - 250000 vc 7.1411 ms/op 7.9322 ms/op 0.90
computeProposers - vc 250000 18.963 ms/op 19.698 ms/op 0.96
computeEpochShuffling - vc 250000 167.51 ms/op 182.62 ms/op 0.92
getNextSyncCommittee - vc 250000 308.63 ms/op 325.03 ms/op 0.95
altair processAttestation - 250000 vs - 7PWei normalcase 34.277 ms/op 34.540 ms/op 0.99
altair processAttestation - 250000 vs - 7PWei worstcase 36.069 ms/op 31.908 ms/op 1.13
altair processAttestation - setStatus - 1/6 committees join 11.416 ms/op 9.9794 ms/op 1.14
altair processAttestation - setStatus - 1/3 committees join 23.094 ms/op 21.166 ms/op 1.09
altair processAttestation - setStatus - 1/2 committees join 34.080 ms/op 33.818 ms/op 1.01
altair processAttestation - setStatus - 2/3 committees join 45.705 ms/op 43.317 ms/op 1.06
altair processAttestation - setStatus - 4/5 committees join 55.302 ms/op 48.608 ms/op 1.14
altair processAttestation - setStatus - 100% committees join 68.240 ms/op 62.949 ms/op 1.08
altair processAttestation - updateEpochParticipants - 1/6 committees join 11.594 ms/op 12.305 ms/op 0.94
altair processAttestation - updateEpochParticipants - 1/3 committees join 25.074 ms/op 21.080 ms/op 1.19
altair processAttestation - updateEpochParticipants - 1/2 committees join 17.088 ms/op 23.382 ms/op 0.73
altair processAttestation - updateEpochParticipants - 2/3 committees join 23.708 ms/op 21.451 ms/op 1.11
altair processAttestation - updateEpochParticipants - 4/5 committees join 21.277 ms/op 26.521 ms/op 0.80
altair processAttestation - updateEpochParticipants - 100% committees join 23.208 ms/op 23.520 ms/op 0.99
altair processAttestation - updateAllStatus 19.807 ms/op 18.991 ms/op 1.04
altair processBlock - 250000 vs - 7PWei normalcase 30.242 ms/op 37.809 ms/op 0.80
altair processBlock - 250000 vs - 7PWei worstcase 93.041 ms/op 101.13 ms/op 0.92
altair processEpoch - mainnet_e81889 930.93 ms/op 1.0309 s/op 0.90
mainnet_e81889 - altair beforeProcessEpoch 323.17 ms/op 257.55 ms/op 1.25
mainnet_e81889 - altair processJustificationAndFinalization 58.743 us/op 109.47 us/op 0.54
mainnet_e81889 - altair processInactivityUpdates 16.442 ms/op 18.026 ms/op 0.91
mainnet_e81889 - altair processRewardsAndPenalties 199.80 ms/op 249.45 ms/op 0.80
mainnet_e81889 - altair processRegistryUpdates 7.7510 us/op 11.891 us/op 0.65
mainnet_e81889 - altair processSlashings 1.8550 us/op 2.1860 us/op 0.85
mainnet_e81889 - altair processEth1DataReset 1.7270 us/op 1.9930 us/op 0.87
mainnet_e81889 - altair processEffectiveBalanceUpdates 5.7848 ms/op 6.9254 ms/op 0.84
mainnet_e81889 - altair processSlashingsReset 11.214 us/op 17.165 us/op 0.65
mainnet_e81889 - altair processRandaoMixesReset 17.491 us/op 23.890 us/op 0.73
mainnet_e81889 - altair processHistoricalRootsUpdate 2.1360 us/op 2.6860 us/op 0.80
mainnet_e81889 - altair processParticipationFlagUpdates 66.393 ms/op 80.880 ms/op 0.82
mainnet_e81889 - altair processSyncCommitteeUpdates 2.0800 us/op 3.2010 us/op 0.65
mainnet_e81889 - altair afterProcessEpoch 225.43 ms/op 212.87 ms/op 1.06
altair processInactivityUpdates - 250000 normalcase 69.588 ms/op 69.503 ms/op 1.00
altair processInactivityUpdates - 250000 worstcase 79.965 ms/op 65.883 ms/op 1.21
altair processParticipationFlagUpdates - 250000 anycase 64.464 ms/op 58.356 ms/op 1.10
altair processRewardsAndPenalties - 250000 normalcase 183.71 ms/op 203.00 ms/op 0.90
altair processRewardsAndPenalties - 250000 worstcase 204.98 ms/op 199.81 ms/op 1.03
altair processSyncCommitteeUpdates - 250000 326.18 ms/op 362.16 ms/op 0.90
Tree 40 250000 create 609.44 ms/op 790.11 ms/op 0.77
Tree 40 250000 get(125000) 297.76 ns/op 677.71 ns/op 0.44
Tree 40 250000 set(125000) 1.9314 us/op 1.7446 us/op 1.11
Tree 40 250000 toArray() 37.232 ms/op 42.081 ms/op 0.88
Tree 40 250000 iterate all - toArray() + loop 36.854 ms/op 35.520 ms/op 1.04
Tree 40 250000 iterate all - get(i) 107.97 ms/op 116.18 ms/op 0.93
MutableVector 250000 create 22.168 ms/op 23.278 ms/op 0.95
MutableVector 250000 get(125000) 11.528 ns/op 13.023 ns/op 0.89
MutableVector 250000 set(125000) 466.27 ns/op 460.02 ns/op 1.01
MutableVector 250000 toArray() 8.0419 ms/op 8.1762 ms/op 0.98
MutableVector 250000 iterate all - toArray() + loop 9.0236 ms/op 8.4657 ms/op 1.07
MutableVector 250000 iterate all - get(i) 3.7715 ms/op 3.7827 ms/op 1.00
Array 250000 create 5.6827 ms/op 4.7328 ms/op 1.20
Array 250000 clone - spread 2.0524 ms/op 2.1680 ms/op 0.95
Array 250000 get(125000) 0.96900 ns/op 1.0250 ns/op 0.95
Array 250000 set(125000) 0.95600 ns/op 1.0270 ns/op 0.93
Array 250000 iterate all - loop 148.07 us/op 167.79 us/op 0.88
effectiveBalanceIncrements clone Uint8Array 300000 70.677 us/op 60.551 us/op 1.17
effectiveBalanceIncrements clone MutableVector 300000 625.00 ns/op 517.00 ns/op 1.21
effectiveBalanceIncrements rw all Uint8Array 300000 266.27 us/op 301.74 us/op 0.88
effectiveBalanceIncrements rw all MutableVector 300000 172.74 ms/op 145.61 ms/op 1.19
aggregationBits - 2048 els - readonlyValues 187.27 us/op 170.52 us/op 1.10
aggregationBits - 2048 els - zipIndexesInBitList 34.495 us/op 30.606 us/op 1.13
regular array get 100000 times 67.405 us/op 67.398 us/op 1.00
wrappedArray get 100000 times 67.462 us/op 67.395 us/op 1.00
arrayWithProxy get 100000 times 28.437 ms/op 36.661 ms/op 0.78
ssz.Root.equals 1.0690 us/op 1.1490 us/op 0.93
ssz.Root.equals with valueOf() 1.2860 us/op 1.1690 us/op 1.10
byteArrayEquals with valueOf() 1.2400 us/op 1.1220 us/op 1.11
phase0 processBlock - 250000 vs - 7PWei normalcase 7.5519 ms/op 7.2172 ms/op 1.05
phase0 processBlock - 250000 vs - 7PWei worstcase 69.402 ms/op 68.358 ms/op 1.02
phase0 afterProcessEpoch - 250000 vs - 7PWei 189.64 ms/op 200.05 ms/op 0.95
phase0 beforeProcessEpoch - 250000 vs - 7PWei 528.33 ms/op 511.15 ms/op 1.03
phase0 processEpoch - mainnet_e58758 794.19 ms/op 859.91 ms/op 0.92
mainnet_e58758 - phase0 beforeProcessEpoch 418.74 ms/op 441.03 ms/op 0.95
mainnet_e58758 - phase0 processJustificationAndFinalization 76.853 us/op 115.77 us/op 0.66
mainnet_e58758 - phase0 processRewardsAndPenalties 145.71 ms/op 125.21 ms/op 1.16
mainnet_e58758 - phase0 processRegistryUpdates 35.705 us/op 68.795 us/op 0.52
mainnet_e58758 - phase0 processSlashings 1.9750 us/op 2.8130 us/op 0.70
mainnet_e58758 - phase0 processEth1DataReset 1.9500 us/op 2.3990 us/op 0.81
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 4.8115 ms/op 5.8373 ms/op 0.82
mainnet_e58758 - phase0 processSlashingsReset 12.960 us/op 15.125 us/op 0.86
mainnet_e58758 - phase0 processRandaoMixesReset 11.693 us/op 23.558 us/op 0.50
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.7950 us/op 2.8540 us/op 0.63
mainnet_e58758 - phase0 processParticipationRecordUpdates 11.202 us/op 17.035 us/op 0.66
mainnet_e58758 - phase0 afterProcessEpoch 164.40 ms/op 176.26 ms/op 0.93
phase0 processEffectiveBalanceUpdates - 250000 normalcase 5.4806 ms/op 6.6660 ms/op 0.82
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 5.7693 ms/op 6.8130 ms/op 0.85
phase0 processRegistryUpdates - 250000 normalcase 50.211 us/op 74.282 us/op 0.68
phase0 processRegistryUpdates - 250000 badcase_full_deposits 2.5833 ms/op 2.9238 ms/op 0.88
phase0 processRegistryUpdates - 250000 worstcase 0.5 1.6100 s/op 1.6282 s/op 0.99
phase0 getAttestationDeltas - 250000 normalcase 60.868 ms/op 67.509 ms/op 0.90
phase0 getAttestationDeltas - 250000 worstcase 61.505 ms/op 68.122 ms/op 0.90
phase0 processSlashings - 250000 worstcase 30.910 ms/op 30.077 ms/op 1.03
shuffle list - 16384 els 12.968 ms/op 13.429 ms/op 0.97
shuffle list - 250000 els 185.54 ms/op 179.68 ms/op 1.03
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 424.66 us/op 453.89 us/op 0.94
pass gossip attestations to forkchoice per slot 17.545 ms/op 14.784 ms/op 1.19
computeDeltas 2.9573 ms/op 3.3758 ms/op 0.88
computeProposerBoostScoreFromBalances 443.90 us/op 503.31 us/op 0.88
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.8539 ms/op 1.9772 ms/op 0.94
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 632.34 us/op 669.39 us/op 0.94
BLS verify - blst-native 1.6427 ms/op 1.8633 ms/op 0.88
BLS verifyMultipleSignatures 3 - blst-native 3.3743 ms/op 3.8235 ms/op 0.88
BLS verifyMultipleSignatures 8 - blst-native 7.2622 ms/op 8.2465 ms/op 0.88
BLS verifyMultipleSignatures 32 - blst-native 26.354 ms/op 29.929 ms/op 0.88
BLS aggregatePubkeys 32 - blst-native 35.401 us/op 39.909 us/op 0.89
BLS aggregatePubkeys 128 - blst-native 136.14 us/op 152.77 us/op 0.89
getAttestationsForBlock 55.893 ms/op 59.652 ms/op 0.94
CheckpointStateCache - add get delete 17.151 us/op 16.853 us/op 1.02
validate gossip signedAggregateAndProof - struct 4.4686 ms/op 4.4586 ms/op 1.00
validate gossip signedAggregateAndProof - treeBacked 4.4114 ms/op 4.4120 ms/op 1.00
validate gossip attestation - struct 2.0834 ms/op 2.0967 ms/op 0.99
validate gossip attestation - treeBacked 2.1138 ms/op 2.0987 ms/op 1.01
pickEth1Vote - no votes 8.1104 ms/op 8.0227 ms/op 1.01
pickEth1Vote - max votes 46.278 ms/op 45.283 ms/op 1.02
pickEth1Vote - Eth1Data hashTreeRoot value x2048 22.517 ms/op 24.352 ms/op 0.92
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 8.7832 ms/op 8.9805 ms/op 0.98
pickEth1Vote - Eth1Data fastSerialize value x2048 4.4951 ms/op 4.8580 ms/op 0.93
pickEth1Vote - Eth1Data fastSerialize tree x2048 20.711 ms/op 21.357 ms/op 0.97
bytes32 toHexString 1.4210 us/op 1.5320 us/op 0.93
bytes32 Buffer.toString(hex) 580.00 ns/op 685.00 ns/op 0.85
bytes32 Buffer.toString(hex) from Uint8Array 727.00 ns/op 838.00 ns/op 0.87
bytes32 Buffer.toString(hex) + 0x 592.00 ns/op 681.00 ns/op 0.87
Object access 1 prop 0.27300 ns/op 0.30200 ns/op 0.90
Map access 1 prop 0.24700 ns/op 0.27800 ns/op 0.89
Object get x1000 15.864 ns/op 18.140 ns/op 0.87
Map get x1000 0.92800 ns/op 0.99800 ns/op 0.93
Object set x1000 100.02 ns/op 104.86 ns/op 0.95
Map set x1000 54.831 ns/op 60.723 ns/op 0.90
Return object 10000 times 0.32970 ns/op 0.37160 ns/op 0.89
Throw Error 10000 times 5.0600 us/op 5.8865 us/op 0.86
enrSubnets - fastDeserialize 64 bits 1.2510 us/op 1.1610 us/op 1.08
enrSubnets - ssz BitVector 64 bits 14.839 us/op 15.937 us/op 0.93
enrSubnets - fastDeserialize 4 bits 384.00 ns/op 430.00 ns/op 0.89
enrSubnets - ssz BitVector 4 bits 2.6320 us/op 2.8800 us/op 0.91
RateTracker 1000000 limit, 1 obj count per request 158.07 ns/op 171.43 ns/op 0.92
RateTracker 1000000 limit, 2 obj count per request 117.31 ns/op 126.87 ns/op 0.92
RateTracker 1000000 limit, 4 obj count per request 97.380 ns/op 104.57 ns/op 0.93
RateTracker 1000000 limit, 8 obj count per request 87.661 ns/op 93.291 ns/op 0.94
RateTracker with prune 3.4800 us/op 3.3920 us/op 1.03

by benchmarkbot/action

@philknows philknows mentioned this pull request Feb 11, 2022
@wemeetagain wemeetagain merged commit c6fe430 into master Feb 12, 2022
@wemeetagain wemeetagain deleted the tuyen/revert-wrapping-processRpcMessage branch February 12, 2022 15:42
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.

Gossip metrics report > 1 block processed per slot
3 participants