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

Add lightclient getHeadUpdate route #3481

Merged
merged 2 commits into from
Dec 3, 2021
Merged

Conversation

dapplion
Copy link
Contributor

@dapplion dapplion commented Dec 3, 2021

Motivation

When the lightclient is done syncing, there's a delay until the first SSE event happens. Worst case this could be a 12s wait. Also this route offers an alternative if SSE are not available.

Description

  • Add lightclient getHeadUpdate route

@codeclimate
Copy link

codeclimate bot commented Dec 3, 2021

Code Climate has analyzed commit 7f20e01 and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

View more on Code Climate.

twoeths
twoeths previously approved these changes Dec 3, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2021

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 6cb57f7 Previous: 1f2fdf8 Ratio
BeaconState.hashTreeRoot - No change 710.00 ns/op 779.00 ns/op 0.91
BeaconState.hashTreeRoot - 1 full validator 112.08 us/op 95.101 us/op 1.18
BeaconState.hashTreeRoot - 32 full validator 1.4574 ms/op 1.4931 ms/op 0.98
BeaconState.hashTreeRoot - 512 full validator 16.959 ms/op 18.441 ms/op 0.92
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 100.97 us/op 99.135 us/op 1.02
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.5989 ms/op 1.5815 ms/op 1.01
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 20.266 ms/op 20.856 ms/op 0.97
BeaconState.hashTreeRoot - 1 balances 70.636 us/op 71.838 us/op 0.98
BeaconState.hashTreeRoot - 32 balances 586.30 us/op 609.23 us/op 0.96
BeaconState.hashTreeRoot - 512 balances 5.3782 ms/op 5.5959 ms/op 0.96
BeaconState.hashTreeRoot - 250000 balances 103.80 ms/op 104.25 ms/op 1.00
processSlot - 1 slots 50.905 us/op 50.985 us/op 1.00
processSlot - 32 slots 2.6461 ms/op 2.5886 ms/op 1.02
getCommitteeAssignments - req 1 vs - 250000 vc 5.3505 ms/op 5.4487 ms/op 0.98
getCommitteeAssignments - req 100 vs - 250000 vc 7.7994 ms/op 7.8893 ms/op 0.99
getCommitteeAssignments - req 1000 vs - 250000 vc 8.0796 ms/op 8.4165 ms/op 0.96
computeProposers - vc 250000 25.960 ms/op 26.837 ms/op 0.97
computeEpochShuffling - vc 250000 202.01 ms/op 209.65 ms/op 0.96
getNextSyncCommittee - vc 250000 414.71 ms/op 440.55 ms/op 0.94
altair processAttestation - 250000 vs - 7PWei normalcase 43.391 ms/op 38.903 ms/op 1.12
altair processAttestation - 250000 vs - 7PWei worstcase 51.969 ms/op 47.638 ms/op 1.09
altair processAttestation - setStatus - 1/6 committees join 11.912 ms/op 9.3804 ms/op 1.27
altair processAttestation - setStatus - 1/3 committees join 25.066 ms/op 19.671 ms/op 1.27
altair processAttestation - setStatus - 1/2 committees join 37.567 ms/op 35.119 ms/op 1.07
altair processAttestation - setStatus - 2/3 committees join 50.298 ms/op 41.433 ms/op 1.21
altair processAttestation - setStatus - 4/5 committees join 59.482 ms/op 51.082 ms/op 1.16
altair processAttestation - setStatus - 100% committees join 76.694 ms/op 67.320 ms/op 1.14
altair processAttestation - updateEpochParticipants - 1/6 committees join 13.034 ms/op 11.016 ms/op 1.18
altair processAttestation - updateEpochParticipants - 1/3 committees join 24.805 ms/op 20.473 ms/op 1.21
altair processAttestation - updateEpochParticipants - 1/2 committees join 28.195 ms/op 25.175 ms/op 1.12
altair processAttestation - updateEpochParticipants - 2/3 committees join 30.923 ms/op 27.198 ms/op 1.14
altair processAttestation - updateEpochParticipants - 4/5 committees join 37.068 ms/op 32.984 ms/op 1.12
altair processAttestation - updateEpochParticipants - 100% committees join 34.327 ms/op 29.971 ms/op 1.15
altair processAttestation - updateAllStatus 20.996 ms/op 21.606 ms/op 0.97
altair processBlock - 250000 vs - 7PWei normalcase 54.558 ms/op 49.581 ms/op 1.10
altair processBlock - 250000 vs - 7PWei worstcase 135.99 ms/op 134.41 ms/op 1.01
altair processEpoch - mainnet_e81889 1.0723 s/op 1.0930 s/op 0.98
mainnet_e81889 - altair beforeProcessEpoch 320.16 ms/op 368.86 ms/op 0.87
mainnet_e81889 - altair processJustificationAndFinalization 115.75 us/op 138.44 us/op 0.84
mainnet_e81889 - altair processInactivityUpdates 20.514 ms/op 18.057 ms/op 1.14
mainnet_e81889 - altair processRewardsAndPenalties 132.91 ms/op 120.32 ms/op 1.10
mainnet_e81889 - altair processRegistryUpdates 21.298 us/op 23.219 us/op 0.92
mainnet_e81889 - altair processSlashings 5.8060 us/op 6.9590 us/op 0.83
mainnet_e81889 - altair processEth1DataReset 6.3410 us/op 6.0890 us/op 1.04
mainnet_e81889 - altair processEffectiveBalanceUpdates 13.257 ms/op 14.411 ms/op 0.92
mainnet_e81889 - altair processSlashingsReset 35.047 us/op 34.941 us/op 1.00
mainnet_e81889 - altair processRandaoMixesReset 41.971 us/op 41.373 us/op 1.01
mainnet_e81889 - altair processHistoricalRootsUpdate 9.8120 us/op 8.3760 us/op 1.17
mainnet_e81889 - altair processParticipationFlagUpdates 171.98 ms/op 108.99 ms/op 1.58
mainnet_e81889 - altair processSyncCommitteeUpdates 5.2700 us/op 5.8890 us/op 0.89
mainnet_e81889 - altair afterProcessEpoch 243.13 ms/op 258.72 ms/op 0.94
altair processInactivityUpdates - 250000 normalcase 71.010 ms/op 71.507 ms/op 0.99
altair processInactivityUpdates - 250000 worstcase 71.838 ms/op 73.405 ms/op 0.98
altair processParticipationFlagUpdates - 250000 anycase 98.931 ms/op 115.37 ms/op 0.86
altair processRewardsAndPenalties - 250000 normalcase 118.67 ms/op 137.44 ms/op 0.86
altair processRewardsAndPenalties - 250000 worstcase 141.46 ms/op 124.19 ms/op 1.14
altair processSyncCommitteeUpdates - 250000 428.63 ms/op 466.88 ms/op 0.92
Tree 40 250000 create 552.86 ms/op 533.84 ms/op 1.04
Tree 40 250000 get(125000) 336.15 ns/op 333.83 ns/op 1.01
Tree 40 250000 set(125000) 1.8151 us/op 1.7335 us/op 1.05
Tree 40 250000 toArray() 43.191 ms/op 48.667 ms/op 0.89
Tree 40 250000 iterate all - toArray() + loop 43.744 ms/op 41.197 ms/op 1.06
Tree 40 250000 iterate all - get(i) 125.35 ms/op 131.27 ms/op 0.95
MutableVector 250000 create 25.913 ms/op 19.697 ms/op 1.32
MutableVector 250000 get(125000) 14.961 ns/op 16.010 ns/op 0.93
MutableVector 250000 set(125000) 600.20 ns/op 532.88 ns/op 1.13
MutableVector 250000 toArray() 9.0777 ms/op 8.4069 ms/op 1.08
MutableVector 250000 iterate all - toArray() + loop 9.0700 ms/op 8.6208 ms/op 1.05
MutableVector 250000 iterate all - get(i) 3.8206 ms/op 3.8389 ms/op 1.00
Array 250000 create 5.4439 ms/op 5.7680 ms/op 0.94
Array 250000 clone - spread 2.0870 ms/op 2.0633 ms/op 1.01
Array 250000 get(125000) 1.0280 ns/op 1.0060 ns/op 1.02
Array 250000 set(125000) 1.0160 ns/op 0.98000 ns/op 1.04
Array 250000 iterate all - loop 143.16 us/op 150.98 us/op 0.95
aggregationBits - 2048 els - readonlyValues 251.73 us/op 231.13 us/op 1.09
aggregationBits - 2048 els - zipIndexesInBitList 38.147 us/op 34.290 us/op 1.11
regular array get 100000 times 57.323 us/op 62.427 us/op 0.92
wrappedArray get 100000 times 55.539 us/op 62.821 us/op 0.88
arrayWithProxy get 100000 times 33.587 ms/op 34.044 ms/op 0.99
ssz.Root.equals 1.2190 us/op 1.4370 us/op 0.85
ssz.Root.equals with valueOf() 1.4700 us/op 1.4820 us/op 0.99
byteArrayEquals with valueOf() 1.4320 us/op 1.4460 us/op 0.99
phase0 processBlock - 250000 vs - 7PWei normalcase 12.431 ms/op 12.334 ms/op 1.01
phase0 processBlock - 250000 vs - 7PWei worstcase 89.962 ms/op 99.087 ms/op 0.91
phase0 afterProcessEpoch - 250000 vs - 7PWei 217.03 ms/op 237.44 ms/op 0.91
phase0 beforeProcessEpoch - 250000 vs - 7PWei 672.60 ms/op 695.42 ms/op 0.97
phase0 processEpoch - mainnet_e58758 939.33 ms/op 896.30 ms/op 1.05
mainnet_e58758 - phase0 beforeProcessEpoch 537.83 ms/op 548.02 ms/op 0.98
mainnet_e58758 - phase0 processJustificationAndFinalization 124.91 us/op 112.21 us/op 1.11
mainnet_e58758 - phase0 processRewardsAndPenalties 86.681 ms/op 123.09 ms/op 0.70
mainnet_e58758 - phase0 processRegistryUpdates 84.328 us/op 81.252 us/op 1.04
mainnet_e58758 - phase0 processSlashings 7.8080 us/op 7.4270 us/op 1.05
mainnet_e58758 - phase0 processEth1DataReset 5.1010 us/op 6.0040 us/op 0.85
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 10.886 ms/op 11.663 ms/op 0.93
mainnet_e58758 - phase0 processSlashingsReset 29.068 us/op 31.029 us/op 0.94
mainnet_e58758 - phase0 processRandaoMixesReset 39.563 us/op 38.927 us/op 1.02
mainnet_e58758 - phase0 processHistoricalRootsUpdate 7.3280 us/op 8.2000 us/op 0.89
mainnet_e58758 - phase0 processParticipationRecordUpdates 28.133 us/op 28.689 us/op 0.98
mainnet_e58758 - phase0 afterProcessEpoch 197.29 ms/op 209.40 ms/op 0.94
phase0 processEffectiveBalanceUpdates - 250000 normalcase 12.526 ms/op 12.885 ms/op 0.97
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.4591 s/op 1.3265 s/op 1.10
phase0 processRegistryUpdates - 250000 normalcase 87.038 us/op 85.354 us/op 1.02
phase0 processRegistryUpdates - 250000 badcase_full_deposits 3.5512 ms/op 3.2299 ms/op 1.10
phase0 processRegistryUpdates - 250000 worstcase 0.5 2.0221 s/op 1.8480 s/op 1.09
phase0 getAttestationDeltas - 250000 normalcase 41.312 ms/op 36.909 ms/op 1.12
phase0 getAttestationDeltas - 250000 worstcase 41.527 ms/op 37.212 ms/op 1.12
phase0 processSlashings - 250000 worstcase 44.128 ms/op 33.815 ms/op 1.30
shuffle list - 16384 els 14.610 ms/op 14.862 ms/op 0.98
shuffle list - 250000 els 197.74 ms/op 208.68 ms/op 0.95
getEffectiveBalances - 250000 vs - 7PWei 16.997 ms/op 11.739 ms/op 1.45
computeDeltas 4.0121 ms/op 3.8797 ms/op 1.03
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.2260 ms/op 2.2895 ms/op 0.97
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 814.14 us/op 770.16 us/op 1.06
BLS verify - blst-native 2.1931 ms/op 2.3054 ms/op 0.95
BLS verifyMultipleSignatures 3 - blst-native 4.5173 ms/op 4.6395 ms/op 0.97
BLS verifyMultipleSignatures 8 - blst-native 10.183 ms/op 9.9059 ms/op 1.03
BLS verifyMultipleSignatures 32 - blst-native 36.002 ms/op 36.590 ms/op 0.98
BLS aggregatePubkeys 32 - blst-native 46.381 us/op 48.784 us/op 0.95
BLS aggregatePubkeys 128 - blst-native 181.78 us/op 192.23 us/op 0.95
getAttestationsForBlock 101.59 ms/op 91.305 ms/op 1.11
CheckpointStateCache - add get delete 19.592 us/op 18.097 us/op 1.08
validate gossip signedAggregateAndProof - struct 5.5540 ms/op 5.5338 ms/op 1.00
validate gossip signedAggregateAndProof - treeBacked 5.5563 ms/op 5.4857 ms/op 1.01
validate gossip attestation - struct 2.6844 ms/op 2.6200 ms/op 1.02
validate gossip attestation - treeBacked 2.7702 ms/op 2.6078 ms/op 1.06
Object access 1 prop 0.44400 ns/op 0.37000 ns/op 1.20
Map access 1 prop 0.36600 ns/op 0.33100 ns/op 1.11
Object get x1000 17.406 ns/op 17.245 ns/op 1.01
Map get x1000 1.0290 ns/op 1.0660 ns/op 0.97
Object set x1000 124.89 ns/op 103.28 ns/op 1.21
Map set x1000 88.712 ns/op 72.431 ns/op 1.22
Return object 10000 times 0.42870 ns/op 0.44010 ns/op 0.97
Throw Error 10000 times 7.1800 us/op 7.0910 us/op 1.01

by benchmarkbot/action

@codecov
Copy link

codecov bot commented Dec 3, 2021

Codecov Report

Merging #3481 (6cb57f7) into master (b01e3de) will increase coverage by 0.06%.
The diff coverage is n/a.

❗ Current head 6cb57f7 differs from pull request most recent head 7f20e01. Consider uploading reports for the commit 7f20e01 to get more accurate results

@@            Coverage Diff             @@
##           master    #3481      +/-   ##
==========================================
+ Coverage   37.83%   37.89%   +0.06%     
==========================================
  Files         307      307              
  Lines        8095     8111      +16     
  Branches     1246     1248       +2     
==========================================
+ Hits         3063     3074      +11     
- Misses       4880     4887       +7     
+ Partials      152      150       -2     

@dapplion dapplion merged commit 22c2667 into master Dec 3, 2021
@dapplion dapplion deleted the dapplion/lc-getHeadUpdate branch December 3, 2021 12:41
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