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

Don't error on LightClientServer finalizedHeader not available #3771

Merged
merged 2 commits into from
Feb 28, 2022

Conversation

dapplion
Copy link
Contributor

Motivation

During sync finalizedHeader will not be available since the LightClientServer has never seen that block.

Description

Don't error on LightClientServer finalizedHeader not available.

If update if finalized retrieve the previously stored header from DB. Only checkpoint candidates are stored, and not all headers are guaranteed to be available

  • If finalizedHeader is available (should be most times) create a finalized update
  • If finalizedHeader is not available (happens on startup) create a non-finalized update

Closes #3495

@codecov
Copy link

codecov bot commented Feb 18, 2022

Codecov Report

Merging #3771 (9ef5e36) into master (060918e) will decrease coverage by 0.03%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3771      +/-   ##
==========================================
- Coverage   36.83%   36.79%   -0.04%     
==========================================
  Files         322      322              
  Lines        8827     8836       +9     
  Branches     1372     1375       +3     
==========================================
  Hits         3251     3251              
- Misses       5434     5443       +9     
  Partials      142      142              

@github-actions
Copy link
Contributor

github-actions bot commented Feb 18, 2022

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 39d26b6 Previous: fa5ffea Ratio
BeaconState.hashTreeRoot - No change 569.00 ns/op 552.00 ns/op 1.03
BeaconState.hashTreeRoot - 1 full validator 80.733 us/op 86.127 us/op 0.94
BeaconState.hashTreeRoot - 32 full validator 1.1538 ms/op 1.2027 ms/op 0.96
BeaconState.hashTreeRoot - 512 full validator 15.809 ms/op 16.416 ms/op 0.96
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 77.218 us/op 83.777 us/op 0.92
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.2831 ms/op 3.3360 ms/op 0.38
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 17.903 ms/op 17.063 ms/op 1.05
BeaconState.hashTreeRoot - 1 balances 59.424 us/op 56.565 us/op 1.05
BeaconState.hashTreeRoot - 32 balances 466.68 us/op 464.34 us/op 1.01
BeaconState.hashTreeRoot - 512 balances 4.8176 ms/op 4.8705 ms/op 0.99
BeaconState.hashTreeRoot - 250000 balances 103.92 ms/op 91.963 ms/op 1.13
processSlot - 1 slots 41.163 us/op 48.616 us/op 0.85
processSlot - 32 slots 1.9904 ms/op 2.1045 ms/op 0.95
getCommitteeAssignments - req 1 vs - 250000 vc 4.6456 ms/op 5.2466 ms/op 0.89
getCommitteeAssignments - req 100 vs - 250000 vc 6.4659 ms/op 7.2192 ms/op 0.90
getCommitteeAssignments - req 1000 vs - 250000 vc 6.9391 ms/op 7.6982 ms/op 0.90
computeProposers - vc 250000 19.635 ms/op 21.492 ms/op 0.91
computeEpochShuffling - vc 250000 171.68 ms/op 194.56 ms/op 0.88
getNextSyncCommittee - vc 250000 317.88 ms/op 350.55 ms/op 0.91
altair processAttestation - 250000 vs - 7PWei normalcase 31.296 ms/op 31.670 ms/op 0.99
altair processAttestation - 250000 vs - 7PWei worstcase 41.933 ms/op 35.838 ms/op 1.17
altair processAttestation - setStatus - 1/6 committees join 11.808 ms/op 11.444 ms/op 1.03
altair processAttestation - setStatus - 1/3 committees join 24.812 ms/op 23.656 ms/op 1.05
altair processAttestation - setStatus - 1/2 committees join 36.413 ms/op 38.058 ms/op 0.96
altair processAttestation - setStatus - 2/3 committees join 48.202 ms/op 45.169 ms/op 1.07
altair processAttestation - setStatus - 4/5 committees join 59.795 ms/op 54.964 ms/op 1.09
altair processAttestation - setStatus - 100% committees join 73.886 ms/op 68.460 ms/op 1.08
altair processAttestation - updateEpochParticipants - 1/6 committees join 12.981 ms/op 11.527 ms/op 1.13
altair processAttestation - updateEpochParticipants - 1/3 committees join 27.667 ms/op 24.343 ms/op 1.14
altair processAttestation - updateEpochParticipants - 1/2 committees join 23.820 ms/op 20.614 ms/op 1.16
altair processAttestation - updateEpochParticipants - 2/3 committees join 22.611 ms/op 22.155 ms/op 1.02
altair processAttestation - updateEpochParticipants - 4/5 committees join 22.915 ms/op 26.199 ms/op 0.87
altair processAttestation - updateEpochParticipants - 100% committees join 27.411 ms/op 23.744 ms/op 1.15
altair processAttestation - updateAllStatus 18.881 ms/op 19.453 ms/op 0.97
altair processBlock - 250000 vs - 7PWei normalcase 32.744 ms/op 33.707 ms/op 0.97
altair processBlock - 250000 vs - 7PWei worstcase 100.22 ms/op 112.02 ms/op 0.89
altair processEpoch - mainnet_e81889 793.25 ms/op 802.38 ms/op 0.99
mainnet_e81889 - altair beforeProcessEpoch 346.13 ms/op 295.06 ms/op 1.17
mainnet_e81889 - altair processJustificationAndFinalization 54.121 us/op 68.400 us/op 0.79
mainnet_e81889 - altair processInactivityUpdates 16.802 ms/op 18.398 ms/op 0.91
mainnet_e81889 - altair processRewardsAndPenalties 96.669 ms/op 128.57 ms/op 0.75
mainnet_e81889 - altair processRegistryUpdates 5.4990 us/op 8.7810 us/op 0.63
mainnet_e81889 - altair processSlashings 1.2620 us/op 1.2080 us/op 1.04
mainnet_e81889 - altair processEth1DataReset 1.1620 us/op 1.4100 us/op 0.82
mainnet_e81889 - altair processEffectiveBalanceUpdates 6.4013 ms/op 6.4614 ms/op 0.99
mainnet_e81889 - altair processSlashingsReset 9.8480 us/op 12.752 us/op 0.77
mainnet_e81889 - altair processRandaoMixesReset 14.212 us/op 17.754 us/op 0.80
mainnet_e81889 - altair processHistoricalRootsUpdate 1.5830 us/op 2.1580 us/op 0.73
mainnet_e81889 - altair processParticipationFlagUpdates 70.783 ms/op 70.402 ms/op 1.01
mainnet_e81889 - altair processSyncCommitteeUpdates 1.3150 us/op 1.8360 us/op 0.72
mainnet_e81889 - altair afterProcessEpoch 215.17 ms/op 249.37 ms/op 0.86
altair processInactivityUpdates - 250000 normalcase 65.912 ms/op 83.621 ms/op 0.79
altair processInactivityUpdates - 250000 worstcase 67.740 ms/op 78.453 ms/op 0.86
altair processParticipationFlagUpdates - 250000 anycase 67.420 ms/op 59.768 ms/op 1.13
altair processRewardsAndPenalties - 250000 normalcase 88.348 ms/op 89.558 ms/op 0.99
altair processRewardsAndPenalties - 250000 worstcase 81.834 ms/op 104.44 ms/op 0.78
altair processSyncCommitteeUpdates - 250000 358.38 ms/op 371.18 ms/op 0.97
Tree 40 250000 create 651.22 ms/op 732.71 ms/op 0.89
Tree 40 250000 get(125000) 293.32 ns/op 327.78 ns/op 0.89
Tree 40 250000 set(125000) 2.0764 us/op 2.2119 us/op 0.94
Tree 40 250000 toArray() 40.160 ms/op 41.021 ms/op 0.98
Tree 40 250000 iterate all - toArray() + loop 39.864 ms/op 41.470 ms/op 0.96
Tree 40 250000 iterate all - get(i) 110.05 ms/op 122.23 ms/op 0.90
MutableVector 250000 create 20.675 ms/op 20.830 ms/op 0.99
MutableVector 250000 get(125000) 11.059 ns/op 12.615 ns/op 0.88
MutableVector 250000 set(125000) 560.51 ns/op 587.52 ns/op 0.95
MutableVector 250000 toArray() 8.7711 ms/op 9.1480 ms/op 0.96
MutableVector 250000 iterate all - toArray() + loop 9.1564 ms/op 9.5230 ms/op 0.96
MutableVector 250000 iterate all - get(i) 3.1730 ms/op 3.7759 ms/op 0.84
Array 250000 create 5.8071 ms/op 5.9264 ms/op 0.98
Array 250000 clone - spread 2.2741 ms/op 2.5085 ms/op 0.91
Array 250000 get(125000) 1.0950 ns/op 1.1430 ns/op 0.96
Array 250000 set(125000) 1.1060 ns/op 1.1290 ns/op 0.98
Array 250000 iterate all - loop 167.83 us/op 169.99 us/op 0.99
effectiveBalanceIncrements clone Uint8Array 300000 79.926 us/op 68.544 us/op 1.17
effectiveBalanceIncrements clone MutableVector 300000 513.00 ns/op 507.00 ns/op 1.01
effectiveBalanceIncrements rw all Uint8Array 300000 266.44 us/op 302.25 us/op 0.88
effectiveBalanceIncrements rw all MutableVector 300000 173.37 ms/op 171.03 ms/op 1.01
aggregationBits - 2048 els - readonlyValues 166.80 us/op 176.30 us/op 0.95
aggregationBits - 2048 els - zipIndexesInBitList 32.496 us/op 33.659 us/op 0.97
regular array get 100000 times 59.547 us/op 67.428 us/op 0.88
wrappedArray get 100000 times 59.555 us/op 67.447 us/op 0.88
arrayWithProxy get 100000 times 31.532 ms/op 32.250 ms/op 0.98
ssz.Root.equals 1.0960 us/op 1.0880 us/op 1.01
ssz.Root.equals with valueOf() 1.2930 us/op 1.2830 us/op 1.01
byteArrayEquals with valueOf() 1.2640 us/op 1.2760 us/op 0.99
phase0 processBlock - 250000 vs - 7PWei normalcase 7.3480 ms/op 7.9853 ms/op 0.92
phase0 processBlock - 250000 vs - 7PWei worstcase 70.505 ms/op 73.739 ms/op 0.96
phase0 afterProcessEpoch - 250000 vs - 7PWei 198.01 ms/op 214.93 ms/op 0.92
phase0 beforeProcessEpoch - 250000 vs - 7PWei 542.78 ms/op 552.41 ms/op 0.98
phase0 processEpoch - mainnet_e58758 764.57 ms/op 790.68 ms/op 0.97
mainnet_e58758 - phase0 beforeProcessEpoch 421.44 ms/op 441.00 ms/op 0.96
mainnet_e58758 - phase0 processJustificationAndFinalization 57.374 us/op 48.994 us/op 1.17
mainnet_e58758 - phase0 processRewardsAndPenalties 110.98 ms/op 82.804 ms/op 1.34
mainnet_e58758 - phase0 processRegistryUpdates 35.872 us/op 56.268 us/op 0.64
mainnet_e58758 - phase0 processSlashings 1.0070 us/op 1.3860 us/op 0.73
mainnet_e58758 - phase0 processEth1DataReset 1.1470 us/op 1.1000 us/op 1.04
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 5.3343 ms/op 5.2621 ms/op 1.01
mainnet_e58758 - phase0 processSlashingsReset 7.6710 us/op 10.734 us/op 0.71
mainnet_e58758 - phase0 processRandaoMixesReset 11.932 us/op 18.190 us/op 0.66
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.1520 us/op 1.9920 us/op 0.58
mainnet_e58758 - phase0 processParticipationRecordUpdates 8.6320 us/op 12.451 us/op 0.69
mainnet_e58758 - phase0 afterProcessEpoch 163.16 ms/op 191.22 ms/op 0.85
phase0 processEffectiveBalanceUpdates - 250000 normalcase 6.0747 ms/op 5.9443 ms/op 1.02
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 6.2669 ms/op 6.3987 ms/op 0.98
phase0 processRegistryUpdates - 250000 normalcase 37.806 us/op 54.915 us/op 0.69
phase0 processRegistryUpdates - 250000 badcase_full_deposits 3.0772 ms/op 2.9754 ms/op 1.03
phase0 processRegistryUpdates - 250000 worstcase 0.5 1.6319 s/op 1.4902 s/op 1.10
phase0 getAttestationDeltas - 250000 normalcase 11.873 ms/op 13.064 ms/op 0.91
phase0 getAttestationDeltas - 250000 worstcase 11.993 ms/op 13.049 ms/op 0.92
phase0 processSlashings - 250000 worstcase 38.127 ms/op 34.653 ms/op 1.10
shuffle list - 16384 els 11.756 ms/op 13.596 ms/op 0.86
shuffle list - 250000 els 189.75 ms/op 194.10 ms/op 0.98
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 438.63 us/op 475.54 us/op 0.92
pass gossip attestations to forkchoice per slot 15.087 ms/op 14.498 ms/op 1.04
computeDeltas 3.4009 ms/op 3.7190 ms/op 0.91
computeProposerBoostScoreFromBalances 443.73 us/op 503.09 us/op 0.88
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.8902 ms/op 2.0103 ms/op 0.94
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 698.65 us/op 682.24 us/op 1.02
BLS verify - blst-native 1.8593 ms/op 1.8582 ms/op 1.00
BLS verifyMultipleSignatures 3 - blst-native 3.8195 ms/op 3.8160 ms/op 1.00
BLS verifyMultipleSignatures 8 - blst-native 8.2380 ms/op 8.2610 ms/op 1.00
BLS verifyMultipleSignatures 32 - blst-native 29.900 ms/op 29.863 ms/op 1.00
BLS aggregatePubkeys 32 - blst-native 40.637 us/op 40.046 us/op 1.01
BLS aggregatePubkeys 128 - blst-native 154.06 us/op 153.30 us/op 1.00
getAttestationsForBlock 61.469 ms/op 59.539 ms/op 1.03
CheckpointStateCache - add get delete 18.428 us/op 18.232 us/op 1.01
validate gossip signedAggregateAndProof - struct 4.4328 ms/op 4.4454 ms/op 1.00
validate gossip signedAggregateAndProof - treeBacked 4.4084 ms/op 4.4458 ms/op 0.99
validate gossip attestation - struct 2.1018 ms/op 2.0848 ms/op 1.01
validate gossip attestation - treeBacked 2.1037 ms/op 2.0966 ms/op 1.00
pickEth1Vote - no votes 8.7418 ms/op 8.6088 ms/op 1.02
pickEth1Vote - max votes 49.953 ms/op 50.981 ms/op 0.98
pickEth1Vote - Eth1Data hashTreeRoot value x2048 22.775 ms/op 24.928 ms/op 0.91
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 8.9548 ms/op 9.5531 ms/op 0.94
pickEth1Vote - Eth1Data fastSerialize value x2048 4.6998 ms/op 5.0742 ms/op 0.93
pickEth1Vote - Eth1Data fastSerialize tree x2048 24.339 ms/op 22.348 ms/op 1.09
bytes32 toHexString 1.7440 us/op 1.6170 us/op 1.08
bytes32 Buffer.toString(hex) 715.00 ns/op 686.00 ns/op 1.04
bytes32 Buffer.toString(hex) from Uint8Array 949.00 ns/op 929.00 ns/op 1.02
bytes32 Buffer.toString(hex) + 0x 689.00 ns/op 667.00 ns/op 1.03
Object access 1 prop 0.34400 ns/op 0.31700 ns/op 1.09
Map access 1 prop 0.29400 ns/op 0.30000 ns/op 0.98
Object get x1000 16.971 ns/op 17.091 ns/op 0.99
Map get x1000 0.97600 ns/op 0.96700 ns/op 1.01
Object set x1000 109.52 ns/op 105.11 ns/op 1.04
Map set x1000 65.370 ns/op 62.844 ns/op 1.04
Return object 10000 times 0.37480 ns/op 0.37270 ns/op 1.01
Throw Error 10000 times 5.9115 us/op 5.8808 us/op 1.01
enrSubnets - fastDeserialize 64 bits 1.2610 us/op 1.2330 us/op 1.02
enrSubnets - ssz BitVector 64 bits 16.420 us/op 16.878 us/op 0.97
enrSubnets - fastDeserialize 4 bits 463.00 ns/op 443.00 ns/op 1.05
enrSubnets - ssz BitVector 4 bits 2.8720 us/op 2.9980 us/op 0.96
RateTracker 1000000 limit, 1 obj count per request 180.21 ns/op 175.18 ns/op 1.03
RateTracker 1000000 limit, 2 obj count per request 134.55 ns/op 129.51 ns/op 1.04
RateTracker 1000000 limit, 4 obj count per request 113.25 ns/op 109.70 ns/op 1.03
RateTracker 1000000 limit, 8 obj count per request 101.29 ns/op 96.077 ns/op 1.05
RateTracker with prune 4.0780 us/op 3.7680 us/op 1.08
array of 16000 items push then shift 3.1541 us/op 3.1631 us/op 1.00
LinkedList of 16000 items push then shift 18.883 ns/op 18.166 ns/op 1.04
array of 16000 items push then pop 192.10 ns/op 206.32 ns/op 0.93
LinkedList of 16000 items push then pop 15.187 ns/op 15.885 ns/op 0.96
array of 24000 items push then shift 4.5664 us/op 4.5571 us/op 1.00
LinkedList of 24000 items push then shift 22.755 ns/op 21.313 ns/op 1.07
array of 24000 items push then pop 175.40 ns/op 187.45 ns/op 0.94
LinkedList of 24000 items push then pop 17.435 ns/op 18.120 ns/op 0.96

by benchmarkbot/action

@dapplion dapplion force-pushed the dapplion/finalizedheader-notavail branch from 52becda to 403fd4d Compare February 28, 2022 02:49
@dapplion
Copy link
Contributor Author

Tested locally against Prater and I see no more errors, logs still appear but are expected and in debug level

g11tech
g11tech previously approved these changes Feb 28, 2022
@dapplion dapplion merged commit 07fbc13 into master Feb 28, 2022
@dapplion dapplion deleted the dapplion/finalizedheader-notavail branch February 28, 2022 06:33
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.

Error: finalityHeader not available
3 participants