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 error handling to exchangeTransitionConfiguration #4414

Merged
merged 3 commits into from
Aug 15, 2022

Conversation

dapplion
Copy link
Contributor

Motivation

However it has some issues:

  • There is no error handling, and errors are very likely to happen here
  • Geth returns an error if there's a mismatch so the comparision code would never be reached
  • We should not polute the prepareNextSlot unnecessarily

Description

  • Add error handling to the exchangeTransitionConfiguration calls
  • Log that config is validated once per consecutive success calls
  • Move code to BeaconChain

Still I fear this will contribute to our bad error / logging UX.

  • How would this look like when the EL node is disconnected?
  • For Geth's case, do RPC errors render nice enough to print the value from Geth?

@dapplion dapplion requested a review from a team as a code owner August 15, 2022 12:16
Copy link
Contributor

@g11tech g11tech left a comment

Choose a reason for hiding this comment

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

LGTM!

@github-actions
Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: b817d4a Previous: 20edb58 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.9548 ms/op 2.3467 ms/op 0.83
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 73.670 us/op 82.711 us/op 0.89
BLS verify - blst-native 1.8550 ms/op 2.7172 ms/op 0.68
BLS verifyMultipleSignatures 3 - blst-native 3.8134 ms/op 5.5908 ms/op 0.68
BLS verifyMultipleSignatures 8 - blst-native 8.2172 ms/op 11.947 ms/op 0.69
BLS verifyMultipleSignatures 32 - blst-native 29.828 ms/op 43.367 ms/op 0.69
BLS aggregatePubkeys 32 - blst-native 39.293 us/op 59.241 us/op 0.66
BLS aggregatePubkeys 128 - blst-native 152.68 us/op 230.22 us/op 0.66
getAttestationsForBlock 161.62 ms/op 174.90 ms/op 0.92
isKnown best case - 1 super set check 428.00 ns/op 512.00 ns/op 0.84
isKnown normal case - 2 super set checks 428.00 ns/op 477.00 ns/op 0.90
isKnown worse case - 16 super set checks 414.00 ns/op 456.00 ns/op 0.91
CheckpointStateCache - add get delete 8.6270 us/op 9.4510 us/op 0.91
validate gossip signedAggregateAndProof - struct 4.2615 ms/op 5.7184 ms/op 0.75
validate gossip attestation - struct 2.0317 ms/op 2.6761 ms/op 0.76
altair verifyImport mainnet_s3766816:31 4.4981 s/op 5.7110 s/op 0.79
pickEth1Vote - no votes 2.1990 ms/op 2.2622 ms/op 0.97
pickEth1Vote - max votes 21.908 ms/op 23.302 ms/op 0.94
pickEth1Vote - Eth1Data hashTreeRoot value x2048 12.526 ms/op 15.513 ms/op 0.81
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 19.032 ms/op 19.848 ms/op 0.96
pickEth1Vote - Eth1Data fastSerialize value x2048 1.4647 ms/op 1.5506 ms/op 0.94
pickEth1Vote - Eth1Data fastSerialize tree x2048 11.596 ms/op 12.698 ms/op 0.91
bytes32 toHexString 959.00 ns/op 1.0490 us/op 0.91
bytes32 Buffer.toString(hex) 663.00 ns/op 733.00 ns/op 0.90
bytes32 Buffer.toString(hex) from Uint8Array 855.00 ns/op 935.00 ns/op 0.91
bytes32 Buffer.toString(hex) + 0x 661.00 ns/op 739.00 ns/op 0.89
Object access 1 prop 0.32300 ns/op 0.35200 ns/op 0.92
Map access 1 prop 0.29800 ns/op 0.31100 ns/op 0.96
Object get x1000 17.947 ns/op 15.060 ns/op 1.19
Map get x1000 0.99700 ns/op 1.0330 ns/op 0.97
Object set x1000 102.96 ns/op 105.15 ns/op 0.98
Map set x1000 61.088 ns/op 76.358 ns/op 0.80
Return object 10000 times 0.37300 ns/op 0.41510 ns/op 0.90
Throw Error 10000 times 5.8884 us/op 6.9526 us/op 0.85
enrSubnets - fastDeserialize 64 bits 2.4190 us/op 2.8940 us/op 0.84
enrSubnets - ssz BitVector 64 bits 670.00 ns/op 839.00 ns/op 0.80
enrSubnets - fastDeserialize 4 bits 345.00 ns/op 410.00 ns/op 0.84
enrSubnets - ssz BitVector 4 bits 666.00 ns/op 803.00 ns/op 0.83
prioritizePeers score -10:0 att 32-0.1 sync 2-0 87.533 us/op 104.70 us/op 0.84
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 129.94 us/op 156.42 us/op 0.83
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 207.85 us/op 260.90 us/op 0.80
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 395.17 us/op 575.94 us/op 0.69
prioritizePeers score 0:0 att 64-1 sync 4-1 465.79 us/op 624.34 us/op 0.75
RateTracker 1000000 limit, 1 obj count per request 189.46 ns/op 209.58 ns/op 0.90
RateTracker 1000000 limit, 2 obj count per request 144.01 ns/op 141.01 ns/op 1.02
RateTracker 1000000 limit, 4 obj count per request 120.89 ns/op 129.81 ns/op 0.93
RateTracker 1000000 limit, 8 obj count per request 110.28 ns/op 107.99 ns/op 1.02
RateTracker with prune 3.8870 us/op 4.3000 us/op 0.90
array of 16000 items push then shift 3.1653 us/op 5.1064 us/op 0.62
LinkedList of 16000 items push then shift 26.086 ns/op 32.528 ns/op 0.80
array of 16000 items push then pop 225.24 ns/op 222.69 ns/op 1.01
LinkedList of 16000 items push then pop 21.905 ns/op 25.470 ns/op 0.86
array of 24000 items push then shift 4.5631 us/op 7.9289 us/op 0.58
LinkedList of 24000 items push then shift 25.043 ns/op 30.659 ns/op 0.82
array of 24000 items push then pop 213.45 ns/op 220.28 ns/op 0.97
LinkedList of 24000 items push then pop 22.775 ns/op 24.862 ns/op 0.92
intersect bitArray bitLen 8 11.863 ns/op 14.840 ns/op 0.80
intersect array and set length 8 151.06 ns/op 170.04 ns/op 0.89
intersect bitArray bitLen 128 61.985 ns/op 66.997 ns/op 0.93
intersect array and set length 128 2.1465 us/op 2.1784 us/op 0.99
Buffer.concat 32 items 1.8360 ns/op 2.1060 ns/op 0.87
pass gossip attestations to forkchoice per slot 3.5657 ms/op 3.5148 ms/op 1.01
computeDeltas 3.9381 ms/op 4.1671 ms/op 0.95
computeProposerBoostScoreFromBalances 921.07 us/op 843.08 us/op 1.09
altair processAttestation - 250000 vs - 7PWei normalcase 3.8678 ms/op 4.5696 ms/op 0.85
altair processAttestation - 250000 vs - 7PWei worstcase 5.6786 ms/op 6.7974 ms/op 0.84
altair processAttestation - setStatus - 1/6 committees join 208.62 us/op 259.93 us/op 0.80
altair processAttestation - setStatus - 1/3 committees join 397.36 us/op 484.11 us/op 0.82
altair processAttestation - setStatus - 1/2 committees join 546.17 us/op 747.34 us/op 0.73
altair processAttestation - setStatus - 2/3 committees join 706.80 us/op 845.13 us/op 0.84
altair processAttestation - setStatus - 4/5 committees join 979.60 us/op 1.1639 ms/op 0.84
altair processAttestation - setStatus - 100% committees join 1.1597 ms/op 1.4362 ms/op 0.81
altair processBlock - 250000 vs - 7PWei normalcase 30.873 ms/op 33.667 ms/op 0.92
altair processBlock - 250000 vs - 7PWei normalcase hashState 39.470 ms/op 47.271 ms/op 0.83
altair processBlock - 250000 vs - 7PWei worstcase 85.456 ms/op 107.27 ms/op 0.80
altair processBlock - 250000 vs - 7PWei worstcase hashState 94.222 ms/op 137.55 ms/op 0.68
phase0 processBlock - 250000 vs - 7PWei normalcase 4.1312 ms/op 4.0910 ms/op 1.01
phase0 processBlock - 250000 vs - 7PWei worstcase 46.353 ms/op 63.603 ms/op 0.73
altair processEth1Data - 250000 vs - 7PWei normalcase 1.2061 ms/op 1.6777 ms/op 0.72
Tree 40 250000 create 808.75 ms/op 906.10 ms/op 0.89
Tree 40 250000 get(125000) 321.34 ns/op 323.71 ns/op 0.99
Tree 40 250000 set(125000) 2.2279 us/op 2.7891 us/op 0.80
Tree 40 250000 toArray() 34.602 ms/op 35.241 ms/op 0.98
Tree 40 250000 iterate all - toArray() + loop 34.584 ms/op 35.713 ms/op 0.97
Tree 40 250000 iterate all - get(i) 111.59 ms/op 141.43 ms/op 0.79
MutableVector 250000 create 21.407 ms/op 28.254 ms/op 0.76
MutableVector 250000 get(125000) 16.735 ns/op 14.856 ns/op 1.13
MutableVector 250000 set(125000) 543.22 ns/op 665.90 ns/op 0.82
MutableVector 250000 toArray() 6.9004 ms/op 6.4591 ms/op 1.07
MutableVector 250000 iterate all - toArray() + loop 7.0228 ms/op 6.2435 ms/op 1.12
MutableVector 250000 iterate all - get(i) 3.2848 ms/op 3.3053 ms/op 0.99
Array 250000 create 6.2501 ms/op 5.9278 ms/op 1.05
Array 250000 clone - spread 2.6420 ms/op 2.5752 ms/op 1.03
Array 250000 get(125000) 1.1250 ns/op 1.1180 ns/op 1.01
Array 250000 set(125000) 1.1460 ns/op 1.1820 ns/op 0.97
Array 250000 iterate all - loop 167.78 us/op 134.59 us/op 1.25
effectiveBalanceIncrements clone Uint8Array 300000 68.969 us/op 88.708 us/op 0.78
effectiveBalanceIncrements clone MutableVector 300000 749.00 ns/op 763.00 ns/op 0.98
effectiveBalanceIncrements rw all Uint8Array 300000 252.46 us/op 279.53 us/op 0.90
effectiveBalanceIncrements rw all MutableVector 300000 167.75 ms/op 196.14 ms/op 0.86
phase0 afterProcessEpoch - 250000 vs - 7PWei 201.57 ms/op 205.63 ms/op 0.98
phase0 beforeProcessEpoch - 250000 vs - 7PWei 154.52 ms/op 153.05 ms/op 1.01
altair processEpoch - mainnet_e81889 730.30 ms/op 772.34 ms/op 0.95
mainnet_e81889 - altair beforeProcessEpoch 220.08 ms/op 215.34 ms/op 1.02
mainnet_e81889 - altair processJustificationAndFinalization 35.288 us/op 71.825 us/op 0.49
mainnet_e81889 - altair processInactivityUpdates 11.135 ms/op 11.927 ms/op 0.93
mainnet_e81889 - altair processRewardsAndPenalties 194.17 ms/op 204.54 ms/op 0.95
mainnet_e81889 - altair processRegistryUpdates 5.7090 us/op 14.676 us/op 0.39
mainnet_e81889 - altair processSlashings 1.4700 us/op 3.7790 us/op 0.39
mainnet_e81889 - altair processEth1DataReset 1.5210 us/op 4.2520 us/op 0.36
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.8867 ms/op 2.7424 ms/op 1.05
mainnet_e81889 - altair processSlashingsReset 9.5450 us/op 33.699 us/op 0.28
mainnet_e81889 - altair processRandaoMixesReset 8.4720 us/op 29.162 us/op 0.29
mainnet_e81889 - altair processHistoricalRootsUpdate 1.4550 us/op 5.0800 us/op 0.29
mainnet_e81889 - altair processParticipationFlagUpdates 4.9260 us/op 17.300 us/op 0.28
mainnet_e81889 - altair processSyncCommitteeUpdates 730.00 ns/op 4.5930 us/op 0.16
mainnet_e81889 - altair afterProcessEpoch 194.54 ms/op 196.75 ms/op 0.99
phase0 processEpoch - mainnet_e58758 696.32 ms/op 770.65 ms/op 0.90
mainnet_e58758 - phase0 beforeProcessEpoch 285.39 ms/op 336.91 ms/op 0.85
mainnet_e58758 - phase0 processJustificationAndFinalization 34.634 us/op 65.100 us/op 0.53
mainnet_e58758 - phase0 processRewardsAndPenalties 154.09 ms/op 167.14 ms/op 0.92
mainnet_e58758 - phase0 processRegistryUpdates 16.331 us/op 36.669 us/op 0.45
mainnet_e58758 - phase0 processSlashings 1.2950 us/op 3.9490 us/op 0.33
mainnet_e58758 - phase0 processEth1DataReset 1.4920 us/op 3.5910 us/op 0.42
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.3853 ms/op 2.4801 ms/op 0.96
mainnet_e58758 - phase0 processSlashingsReset 8.3400 us/op 15.792 us/op 0.53
mainnet_e58758 - phase0 processRandaoMixesReset 9.4280 us/op 23.302 us/op 0.40
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.5180 us/op 4.1010 us/op 0.37
mainnet_e58758 - phase0 processParticipationRecordUpdates 8.9150 us/op 23.517 us/op 0.38
mainnet_e58758 - phase0 afterProcessEpoch 160.89 ms/op 171.25 ms/op 0.94
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.7247 ms/op 2.5467 ms/op 1.07
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 3.2140 ms/op 3.1456 ms/op 1.02
altair processInactivityUpdates - 250000 normalcase 60.159 ms/op 77.124 ms/op 0.78
altair processInactivityUpdates - 250000 worstcase 69.554 ms/op 71.929 ms/op 0.97
phase0 processRegistryUpdates - 250000 normalcase 12.542 us/op 34.994 us/op 0.36
phase0 processRegistryUpdates - 250000 badcase_full_deposits 490.17 us/op 492.35 us/op 1.00
phase0 processRegistryUpdates - 250000 worstcase 0.5 279.01 ms/op 301.34 ms/op 0.93
altair processRewardsAndPenalties - 250000 normalcase 165.33 ms/op 175.54 ms/op 0.94
altair processRewardsAndPenalties - 250000 worstcase 175.57 ms/op 171.64 ms/op 1.02
phase0 getAttestationDeltas - 250000 normalcase 12.514 ms/op 12.754 ms/op 0.98
phase0 getAttestationDeltas - 250000 worstcase 12.643 ms/op 14.376 ms/op 0.88
phase0 processSlashings - 250000 worstcase 5.4005 ms/op 6.4962 ms/op 0.83
altair processSyncCommitteeUpdates - 250000 277.45 ms/op 328.10 ms/op 0.85
BeaconState.hashTreeRoot - No change 483.00 ns/op 576.00 ns/op 0.84
BeaconState.hashTreeRoot - 1 full validator 55.076 us/op 73.681 us/op 0.75
BeaconState.hashTreeRoot - 32 full validator 627.33 us/op 830.66 us/op 0.76
BeaconState.hashTreeRoot - 512 full validator 8.3502 ms/op 12.295 ms/op 0.68
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 68.093 us/op 108.91 us/op 0.63
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.1048 ms/op 1.5353 ms/op 0.72
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 21.953 ms/op 19.724 ms/op 1.11
BeaconState.hashTreeRoot - 1 balances 58.770 us/op 74.699 us/op 0.79
BeaconState.hashTreeRoot - 32 balances 554.02 us/op 802.65 us/op 0.69
BeaconState.hashTreeRoot - 512 balances 6.7523 ms/op 7.5099 ms/op 0.90
BeaconState.hashTreeRoot - 250000 balances 102.72 ms/op 111.21 ms/op 0.92
aggregationBits - 2048 els - zipIndexesInBitList 28.797 us/op 27.226 us/op 1.06
regular array get 100000 times 67.409 us/op 52.717 us/op 1.28
wrappedArray get 100000 times 67.367 us/op 53.800 us/op 1.25
arrayWithProxy get 100000 times 28.919 ms/op 37.607 ms/op 0.77
ssz.Root.equals 483.00 ns/op 642.00 ns/op 0.75
byteArrayEquals 454.00 ns/op 547.00 ns/op 0.83
shuffle list - 16384 els 11.423 ms/op 11.888 ms/op 0.96
shuffle list - 250000 els 165.10 ms/op 173.51 ms/op 0.95
processSlot - 1 slots 11.256 us/op 16.497 us/op 0.68
processSlot - 32 slots 1.6817 ms/op 2.2653 ms/op 0.74
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 380.14 us/op 611.64 us/op 0.62
getCommitteeAssignments - req 1 vs - 250000 vc 5.2842 ms/op 5.6983 ms/op 0.93
getCommitteeAssignments - req 100 vs - 250000 vc 7.3152 ms/op 8.1420 ms/op 0.90
getCommitteeAssignments - req 1000 vs - 250000 vc 7.7567 ms/op 8.3962 ms/op 0.92
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 9.6900 ns/op 9.4100 ns/op 1.03
state getBlockRootAtSlot - 250000 vs - 7PWei 1.0347 us/op 1.0608 us/op 0.98
computeProposers - vc 250000 16.472 ms/op 17.940 ms/op 0.92
computeEpochShuffling - vc 250000 170.11 ms/op 170.00 ms/op 1.00
getNextSyncCommittee - vc 250000 272.82 ms/op 298.55 ms/op 0.91

by benchmarkbot/action

@wemeetagain wemeetagain merged commit 1b75fe0 into unstable Aug 15, 2022
@wemeetagain wemeetagain deleted the dapplion/exchangeTransitionConfiguration-error branch August 15, 2022 16:29
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