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 LC header validations #5246

Merged
merged 1 commit into from
Mar 9, 2023
Merged

Add LC header validations #5246

merged 1 commit into from
Mar 9, 2023

Conversation

g11tech
Copy link
Contributor

@g11tech g11tech commented Mar 8, 2023

Add LC header validations
addresses point 3 on

@g11tech g11tech requested a review from a team as a code owner March 8, 2023 06:43
@g11tech g11tech mentioned this pull request Mar 8, 2023
4 tasks
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: bcea6de Previous: eb4b43d Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 785.86 us/op 1.3231 ms/op 0.59
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 44.372 us/op 86.676 us/op 0.51
BLS verify - blst-native 1.1485 ms/op 1.6193 ms/op 0.71
BLS verifyMultipleSignatures 3 - blst-native 2.3367 ms/op 3.3725 ms/op 0.69
BLS verifyMultipleSignatures 8 - blst-native 5.0244 ms/op 7.3870 ms/op 0.68
BLS verifyMultipleSignatures 32 - blst-native 18.766 ms/op 26.943 ms/op 0.70
BLS aggregatePubkeys 32 - blst-native 25.179 us/op 36.516 us/op 0.69
BLS aggregatePubkeys 128 - blst-native 98.470 us/op 140.22 us/op 0.70
getAttestationsForBlock 50.528 ms/op 96.511 ms/op 0.52
isKnown best case - 1 super set check 259.00 ns/op 314.00 ns/op 0.82
isKnown normal case - 2 super set checks 255.00 ns/op 283.00 ns/op 0.90
isKnown worse case - 16 super set checks 251.00 ns/op 282.00 ns/op 0.89
CheckpointStateCache - add get delete 4.9390 us/op 6.5550 us/op 0.75
validate gossip signedAggregateAndProof - struct 2.7235 ms/op 3.1817 ms/op 0.86
validate gossip attestation - struct 1.3011 ms/op 1.5505 ms/op 0.84
pickEth1Vote - no votes 1.2255 ms/op 1.5388 ms/op 0.80
pickEth1Vote - max votes 10.731 ms/op 14.830 ms/op 0.72
pickEth1Vote - Eth1Data hashTreeRoot value x2048 8.8043 ms/op 11.080 ms/op 0.79
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 14.174 ms/op 23.908 ms/op 0.59
pickEth1Vote - Eth1Data fastSerialize value x2048 630.28 us/op 1.4113 ms/op 0.45
pickEth1Vote - Eth1Data fastSerialize tree x2048 7.8218 ms/op 6.8851 ms/op 1.14
bytes32 toHexString 469.00 ns/op 808.00 ns/op 0.58
bytes32 Buffer.toString(hex) 351.00 ns/op 510.00 ns/op 0.69
bytes32 Buffer.toString(hex) from Uint8Array 533.00 ns/op 723.00 ns/op 0.74
bytes32 Buffer.toString(hex) + 0x 339.00 ns/op 485.00 ns/op 0.70
Object access 1 prop 0.16200 ns/op 0.22200 ns/op 0.73
Map access 1 prop 0.15700 ns/op 0.18700 ns/op 0.84
Object get x1000 6.3940 ns/op 7.8830 ns/op 0.81
Map get x1000 0.59000 ns/op 0.70700 ns/op 0.83
Object set x1000 49.990 ns/op 80.513 ns/op 0.62
Map set x1000 41.920 ns/op 63.047 ns/op 0.66
Return object 10000 times 0.22810 ns/op 0.29450 ns/op 0.77
Throw Error 10000 times 4.0625 us/op 5.1821 us/op 0.78
fastMsgIdFn sha256 / 200 bytes 3.3340 us/op 4.1500 us/op 0.80
fastMsgIdFn h32 xxhash / 200 bytes 278.00 ns/op 392.00 ns/op 0.71
fastMsgIdFn h64 xxhash / 200 bytes 373.00 ns/op 568.00 ns/op 0.66
fastMsgIdFn sha256 / 1000 bytes 11.304 us/op 14.079 us/op 0.80
fastMsgIdFn h32 xxhash / 1000 bytes 395.00 ns/op 530.00 ns/op 0.75
fastMsgIdFn h64 xxhash / 1000 bytes 440.00 ns/op 635.00 ns/op 0.69
fastMsgIdFn sha256 / 10000 bytes 100.84 us/op 122.83 us/op 0.82
fastMsgIdFn h32 xxhash / 10000 bytes 1.8310 us/op 2.2630 us/op 0.81
fastMsgIdFn h64 xxhash / 10000 bytes 1.2830 us/op 1.6910 us/op 0.76
enrSubnets - fastDeserialize 64 bits 1.2360 us/op 1.9330 us/op 0.64
enrSubnets - ssz BitVector 64 bits 466.00 ns/op 682.00 ns/op 0.68
enrSubnets - fastDeserialize 4 bits 166.00 ns/op 234.00 ns/op 0.71
enrSubnets - ssz BitVector 4 bits 469.00 ns/op 725.00 ns/op 0.65
prioritizePeers score -10:0 att 32-0.1 sync 2-0 105.30 us/op 158.87 us/op 0.66
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 130.61 us/op 183.41 us/op 0.71
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 164.88 us/op 257.03 us/op 0.64
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 296.08 us/op 431.93 us/op 0.69
prioritizePeers score 0:0 att 64-1 sync 4-1 353.16 us/op 566.41 us/op 0.62
array of 16000 items push then shift 1.5645 us/op 1.9727 us/op 0.79
LinkedList of 16000 items push then shift 8.6070 ns/op 10.673 ns/op 0.81
array of 16000 items push then pop 83.229 ns/op 143.20 ns/op 0.58
LinkedList of 16000 items push then pop 8.3950 ns/op 10.670 ns/op 0.79
array of 24000 items push then shift 2.3346 us/op 3.1713 us/op 0.74
LinkedList of 24000 items push then shift 8.5800 ns/op 13.615 ns/op 0.63
array of 24000 items push then pop 77.616 ns/op 110.62 ns/op 0.70
LinkedList of 24000 items push then pop 8.3610 ns/op 12.610 ns/op 0.66
intersect bitArray bitLen 8 12.968 ns/op 16.363 ns/op 0.79
intersect array and set length 8 73.043 ns/op 120.08 ns/op 0.61
intersect bitArray bitLen 128 43.210 ns/op 51.383 ns/op 0.84
intersect array and set length 128 1.0114 us/op 1.4992 us/op 0.67
Buffer.concat 32 items 2.5590 us/op 3.6670 us/op 0.70
Uint8Array.set 32 items 2.4640 us/op 3.5340 us/op 0.70
pass gossip attestations to forkchoice per slot 2.1966 ms/op 2.8243 ms/op 0.78
computeDeltas 3.2810 ms/op 3.5812 ms/op 0.92
computeProposerBoostScoreFromBalances 1.7497 ms/op 1.8543 ms/op 0.94
altair processAttestation - 250000 vs - 7PWei normalcase 2.1141 ms/op 2.1653 ms/op 0.98
altair processAttestation - 250000 vs - 7PWei worstcase 3.2820 ms/op 3.2469 ms/op 1.01
altair processAttestation - setStatus - 1/6 committees join 137.63 us/op 140.94 us/op 0.98
altair processAttestation - setStatus - 1/3 committees join 274.39 us/op 267.92 us/op 1.02
altair processAttestation - setStatus - 1/2 committees join 369.39 us/op 367.19 us/op 1.01
altair processAttestation - setStatus - 2/3 committees join 459.40 us/op 462.40 us/op 0.99
altair processAttestation - setStatus - 4/5 committees join 648.06 us/op 658.41 us/op 0.98
altair processAttestation - setStatus - 100% committees join 750.50 us/op 762.26 us/op 0.98
altair processBlock - 250000 vs - 7PWei normalcase 21.092 ms/op 18.263 ms/op 1.15
altair processBlock - 250000 vs - 7PWei normalcase hashState 26.060 ms/op 26.264 ms/op 0.99
altair processBlock - 250000 vs - 7PWei worstcase 54.391 ms/op 50.930 ms/op 1.07
altair processBlock - 250000 vs - 7PWei worstcase hashState 67.665 ms/op 66.208 ms/op 1.02
phase0 processBlock - 250000 vs - 7PWei normalcase 1.9845 ms/op 1.9924 ms/op 1.00
phase0 processBlock - 250000 vs - 7PWei worstcase 27.938 ms/op 27.633 ms/op 1.01
altair processEth1Data - 250000 vs - 7PWei normalcase 473.88 us/op 466.12 us/op 1.02
vc - 250000 eb 1 eth1 1 we 0 wn 0 - smpl 15 7.6140 us/op 6.8050 us/op 1.12
vc - 250000 eb 0.95 eth1 0.1 we 0.05 wn 0 - smpl 219 20.295 us/op 20.715 us/op 0.98
vc - 250000 eb 0.95 eth1 0.3 we 0.05 wn 0 - smpl 42 9.2690 us/op 9.7420 us/op 0.95
vc - 250000 eb 0.95 eth1 0.7 we 0.05 wn 0 - smpl 18 7.1270 us/op 6.4460 us/op 1.11
vc - 250000 eb 0.1 eth1 0.1 we 0 wn 0 - smpl 1020 79.018 us/op 75.686 us/op 1.04
vc - 250000 eb 0.03 eth1 0.03 we 0 wn 0 - smpl 11777 596.74 us/op 637.85 us/op 0.94
vc - 250000 eb 0.01 eth1 0.01 we 0 wn 0 - smpl 16384 913.82 us/op 907.34 us/op 1.01
vc - 250000 eb 0 eth1 0 we 0 wn 0 - smpl 16384 907.25 us/op 855.50 us/op 1.06
vc - 250000 eb 0 eth1 0 we 0 wn 0 nocache - smpl 16384 2.2117 ms/op 2.4399 ms/op 0.91
vc - 250000 eb 0 eth1 1 we 0 wn 0 - smpl 16384 1.4384 ms/op 1.5381 ms/op 0.94
vc - 250000 eb 0 eth1 1 we 0 wn 0 nocache - smpl 16384 3.5627 ms/op 3.8750 ms/op 0.92
Tree 40 250000 create 307.48 ms/op 297.76 ms/op 1.03
Tree 40 250000 get(125000) 179.50 ns/op 182.55 ns/op 0.98
Tree 40 250000 set(125000) 858.29 ns/op 882.49 ns/op 0.97
Tree 40 250000 toArray() 16.369 ms/op 17.173 ms/op 0.95
Tree 40 250000 iterate all - toArray() + loop 16.583 ms/op 17.494 ms/op 0.95
Tree 40 250000 iterate all - get(i) 64.842 ms/op 69.283 ms/op 0.94
MutableVector 250000 create 9.6800 ms/op 10.576 ms/op 0.92
MutableVector 250000 get(125000) 6.1650 ns/op 6.5910 ns/op 0.94
MutableVector 250000 set(125000) 257.80 ns/op 285.99 ns/op 0.90
MutableVector 250000 toArray() 2.9475 ms/op 2.9693 ms/op 0.99
MutableVector 250000 iterate all - toArray() + loop 2.7655 ms/op 3.5651 ms/op 0.78
MutableVector 250000 iterate all - get(i) 1.5111 ms/op 1.5821 ms/op 0.96
Array 250000 create 2.4338 ms/op 2.7594 ms/op 0.88
Array 250000 clone - spread 1.0554 ms/op 1.1141 ms/op 0.95
Array 250000 get(125000) 0.53600 ns/op 0.52600 ns/op 1.02
Array 250000 set(125000) 0.61200 ns/op 0.61400 ns/op 1.00
Array 250000 iterate all - loop 106.61 us/op 84.092 us/op 1.27
effectiveBalanceIncrements clone Uint8Array 300000 22.893 us/op 24.249 us/op 0.94
effectiveBalanceIncrements clone MutableVector 300000 330.00 ns/op 326.00 ns/op 1.01
effectiveBalanceIncrements rw all Uint8Array 300000 166.22 us/op 170.33 us/op 0.98
effectiveBalanceIncrements rw all MutableVector 300000 75.918 ms/op 78.056 ms/op 0.97
phase0 afterProcessEpoch - 250000 vs - 7PWei 109.87 ms/op 112.79 ms/op 0.97
phase0 beforeProcessEpoch - 250000 vs - 7PWei 40.100 ms/op 42.541 ms/op 0.94
altair processEpoch - mainnet_e81889 301.17 ms/op 325.50 ms/op 0.93
mainnet_e81889 - altair beforeProcessEpoch 47.564 ms/op 65.470 ms/op 0.73
mainnet_e81889 - altair processJustificationAndFinalization 16.034 us/op 19.268 us/op 0.83
mainnet_e81889 - altair processInactivityUpdates 5.3515 ms/op 5.7039 ms/op 0.94
mainnet_e81889 - altair processRewardsAndPenalties 65.167 ms/op 56.384 ms/op 1.16
mainnet_e81889 - altair processRegistryUpdates 2.7900 us/op 2.7460 us/op 1.02
mainnet_e81889 - altair processSlashings 470.00 ns/op 492.00 ns/op 0.96
mainnet_e81889 - altair processEth1DataReset 560.00 ns/op 500.00 ns/op 1.12
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.2029 ms/op 1.2648 ms/op 0.95
mainnet_e81889 - altair processSlashingsReset 5.6860 us/op 5.2220 us/op 1.09
mainnet_e81889 - altair processRandaoMixesReset 6.4440 us/op 5.6010 us/op 1.15
mainnet_e81889 - altair processHistoricalRootsUpdate 728.00 ns/op 596.00 ns/op 1.22
mainnet_e81889 - altair processParticipationFlagUpdates 4.1400 us/op 5.8910 us/op 0.70
mainnet_e81889 - altair processSyncCommitteeUpdates 999.00 ns/op 642.00 ns/op 1.56
mainnet_e81889 - altair afterProcessEpoch 124.71 ms/op 129.97 ms/op 0.96
phase0 processEpoch - mainnet_e58758 353.19 ms/op 372.17 ms/op 0.95
mainnet_e58758 - phase0 beforeProcessEpoch 130.76 ms/op 144.00 ms/op 0.91
mainnet_e58758 - phase0 processJustificationAndFinalization 17.775 us/op 20.446 us/op 0.87
mainnet_e58758 - phase0 processRewardsAndPenalties 63.580 ms/op 69.661 ms/op 0.91
mainnet_e58758 - phase0 processRegistryUpdates 7.7730 us/op 8.5120 us/op 0.91
mainnet_e58758 - phase0 processSlashings 469.00 ns/op 579.00 ns/op 0.81
mainnet_e58758 - phase0 processEth1DataReset 446.00 ns/op 956.00 ns/op 0.47
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 939.13 us/op 1.1016 ms/op 0.85
mainnet_e58758 - phase0 processSlashingsReset 3.6010 us/op 5.0280 us/op 0.72
mainnet_e58758 - phase0 processRandaoMixesReset 4.7390 us/op 4.7510 us/op 1.00
mainnet_e58758 - phase0 processHistoricalRootsUpdate 618.00 ns/op 868.00 ns/op 0.71
mainnet_e58758 - phase0 processParticipationRecordUpdates 3.6810 us/op 3.9500 us/op 0.93
mainnet_e58758 - phase0 afterProcessEpoch 94.913 ms/op 100.88 ms/op 0.94
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.2378 ms/op 1.2829 ms/op 0.96
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.7508 ms/op 1.5231 ms/op 1.15
altair processInactivityUpdates - 250000 normalcase 26.866 ms/op 26.807 ms/op 1.00
altair processInactivityUpdates - 250000 worstcase 27.674 ms/op 26.338 ms/op 1.05
phase0 processRegistryUpdates - 250000 normalcase 6.6430 us/op 6.4350 us/op 1.03
phase0 processRegistryUpdates - 250000 badcase_full_deposits 220.77 us/op 273.69 us/op 0.81
phase0 processRegistryUpdates - 250000 worstcase 0.5 109.74 ms/op 124.60 ms/op 0.88
altair processRewardsAndPenalties - 250000 normalcase 66.632 ms/op 64.192 ms/op 1.04
altair processRewardsAndPenalties - 250000 worstcase 70.189 ms/op 67.359 ms/op 1.04
phase0 getAttestationDeltas - 250000 normalcase 6.4139 ms/op 6.5411 ms/op 0.98
phase0 getAttestationDeltas - 250000 worstcase 6.3289 ms/op 6.4722 ms/op 0.98
phase0 processSlashings - 250000 worstcase 3.3299 ms/op 3.6031 ms/op 0.92
altair processSyncCommitteeUpdates - 250000 176.01 ms/op 177.35 ms/op 0.99
BeaconState.hashTreeRoot - No change 255.00 ns/op 340.00 ns/op 0.75
BeaconState.hashTreeRoot - 1 full validator 52.305 us/op 51.361 us/op 1.02
BeaconState.hashTreeRoot - 32 full validator 579.47 us/op 537.27 us/op 1.08
BeaconState.hashTreeRoot - 512 full validator 4.9484 ms/op 5.4570 ms/op 0.91
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 61.163 us/op 62.348 us/op 0.98
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 886.62 us/op 961.43 us/op 0.92
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 11.816 ms/op 11.711 ms/op 1.01
BeaconState.hashTreeRoot - 1 balances 47.933 us/op 50.945 us/op 0.94
BeaconState.hashTreeRoot - 32 balances 458.57 us/op 454.19 us/op 1.01
BeaconState.hashTreeRoot - 512 balances 4.4496 ms/op 4.3831 ms/op 1.02
BeaconState.hashTreeRoot - 250000 balances 76.917 ms/op 73.776 ms/op 1.04
aggregationBits - 2048 els - zipIndexesInBitList 15.209 us/op 15.560 us/op 0.98
regular array get 100000 times 32.642 us/op 33.245 us/op 0.98
wrappedArray get 100000 times 41.482 us/op 42.223 us/op 0.98
arrayWithProxy get 100000 times 16.339 ms/op 16.356 ms/op 1.00
ssz.Root.equals 513.00 ns/op 556.00 ns/op 0.92
byteArrayEquals 513.00 ns/op 550.00 ns/op 0.93
shuffle list - 16384 els 6.4976 ms/op 7.0134 ms/op 0.93
shuffle list - 250000 els 95.073 ms/op 102.40 ms/op 0.93
processSlot - 1 slots 8.2910 us/op 8.5980 us/op 0.96
processSlot - 32 slots 1.2821 ms/op 1.3517 ms/op 0.95
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 186.29 us/op 197.23 us/op 0.94
getCommitteeAssignments - req 1 vs - 250000 vc 2.8898 ms/op 2.9461 ms/op 0.98
getCommitteeAssignments - req 100 vs - 250000 vc 4.1021 ms/op 4.1647 ms/op 0.98
getCommitteeAssignments - req 1000 vs - 250000 vc 4.4227 ms/op 4.4917 ms/op 0.98
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.3100 ns/op 4.9000 ns/op 0.88
state getBlockRootAtSlot - 250000 vs - 7PWei 837.09 ns/op 759.72 ns/op 1.10
computeProposers - vc 250000 10.320 ms/op 11.402 ms/op 0.91
computeEpochShuffling - vc 250000 100.29 ms/op 103.51 ms/op 0.97
getNextSyncCommittee - vc 250000 169.36 ms/op 179.27 ms/op 0.94

by benchmarkbot/action

@g11tech g11tech enabled auto-merge (squash) March 8, 2023 07:18
@g11tech g11tech merged commit 4d89a0e into unstable Mar 9, 2023
@g11tech g11tech deleted the g11tech/lc-header branch March 9, 2023 02:38
@philknows philknows added this to the v1.7.0 milestone Mar 23, 2023
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.7.0 🎉

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.

4 participants