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

Updating light client proof logic to root next sync committee in attested header #4478

Merged
merged 12 commits into from
Sep 7, 2022

Conversation

dadepo
Copy link
Contributor

@dadepo dadepo commented Aug 25, 2022

Motivation

Recent changes in the light client spec moved the root for the proof of next sync committee from active header to attested header. This PR updates lodestar implementation to align with these changes.

Description

  • Update the validation logic
  • Fix unit tests
  • Fix integration test

Closes #4426

@github-actions
Copy link
Contributor

github-actions bot commented Aug 25, 2022

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: b684af2 Previous: 3aad672 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.1334 ms/op 2.3462 ms/op 0.91
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 74.674 us/op 87.848 us/op 0.85
BLS verify - blst-native 1.8584 ms/op 2.6484 ms/op 0.70
BLS verifyMultipleSignatures 3 - blst-native 3.8054 ms/op 5.7523 ms/op 0.66
BLS verifyMultipleSignatures 8 - blst-native 8.1953 ms/op 12.307 ms/op 0.67
BLS verifyMultipleSignatures 32 - blst-native 29.720 ms/op 43.569 ms/op 0.68
BLS aggregatePubkeys 32 - blst-native 39.263 us/op 59.081 us/op 0.66
BLS aggregatePubkeys 128 - blst-native 153.61 us/op 240.51 us/op 0.64
getAttestationsForBlock 166.65 ms/op 200.14 ms/op 0.83
isKnown best case - 1 super set check 427.00 ns/op 548.00 ns/op 0.78
isKnown normal case - 2 super set checks 411.00 ns/op 545.00 ns/op 0.75
isKnown worse case - 16 super set checks 409.00 ns/op 535.00 ns/op 0.76
CheckpointStateCache - add get delete 8.4730 us/op 11.302 us/op 0.75
validate gossip signedAggregateAndProof - struct 4.2730 ms/op 6.4438 ms/op 0.66
validate gossip attestation - struct 2.0334 ms/op 2.9946 ms/op 0.68
pickEth1Vote - no votes 2.2456 ms/op 2.6499 ms/op 0.85
pickEth1Vote - max votes 19.648 ms/op 23.939 ms/op 0.82
pickEth1Vote - Eth1Data hashTreeRoot value x2048 11.103 ms/op 15.120 ms/op 0.73
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 19.660 ms/op 24.796 ms/op 0.79
pickEth1Vote - Eth1Data fastSerialize value x2048 1.5757 ms/op 1.8982 ms/op 0.83
pickEth1Vote - Eth1Data fastSerialize tree x2048 12.125 ms/op 14.435 ms/op 0.84
bytes32 toHexString 1.0330 us/op 1.3020 us/op 0.79
bytes32 Buffer.toString(hex) 706.00 ns/op 809.00 ns/op 0.87
bytes32 Buffer.toString(hex) from Uint8Array 946.00 ns/op 1.0870 us/op 0.87
bytes32 Buffer.toString(hex) + 0x 701.00 ns/op 820.00 ns/op 0.85
Object access 1 prop 0.34500 ns/op 0.46300 ns/op 0.75
Map access 1 prop 0.29000 ns/op 0.35600 ns/op 0.81
Object get x1000 17.324 ns/op 18.226 ns/op 0.95
Map get x1000 1.0880 ns/op 0.95600 ns/op 1.14
Object set x1000 117.43 ns/op 121.14 ns/op 0.97
Map set x1000 69.022 ns/op 83.517 ns/op 0.83
Return object 10000 times 0.37370 ns/op 0.43040 ns/op 0.87
Throw Error 10000 times 6.0170 us/op 8.1121 us/op 0.74
enrSubnets - fastDeserialize 64 bits 2.7010 us/op 3.2400 us/op 0.83
enrSubnets - ssz BitVector 64 bits 835.00 ns/op 904.00 ns/op 0.92
enrSubnets - fastDeserialize 4 bits 442.00 ns/op 471.00 ns/op 0.94
enrSubnets - ssz BitVector 4 bits 806.00 ns/op 866.00 ns/op 0.93
prioritizePeers score -10:0 att 32-0.1 sync 2-0 92.070 us/op 124.61 us/op 0.74
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 123.88 us/op 161.88 us/op 0.77
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 211.32 us/op 298.51 us/op 0.71
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 452.50 us/op 620.72 us/op 0.73
prioritizePeers score 0:0 att 64-1 sync 4-1 465.63 us/op 675.50 us/op 0.69
RateTracker 1000000 limit, 1 obj count per request 184.49 ns/op 218.93 ns/op 0.84
RateTracker 1000000 limit, 2 obj count per request 137.63 ns/op 164.22 ns/op 0.84
RateTracker 1000000 limit, 4 obj count per request 117.14 ns/op 140.56 ns/op 0.83
RateTracker 1000000 limit, 8 obj count per request 102.93 ns/op 128.88 ns/op 0.80
RateTracker with prune 4.5330 us/op 5.6390 us/op 0.80
array of 16000 items push then shift 3.1955 us/op 5.3161 us/op 0.60
LinkedList of 16000 items push then shift 18.578 ns/op 18.758 ns/op 0.99
array of 16000 items push then pop 246.06 ns/op 260.76 ns/op 0.94
LinkedList of 16000 items push then pop 17.752 ns/op 18.643 ns/op 0.95
array of 24000 items push then shift 4.5558 us/op 7.9655 us/op 0.57
LinkedList of 24000 items push then shift 22.130 ns/op 19.497 ns/op 1.14
array of 24000 items push then pop 213.00 ns/op 244.11 ns/op 0.87
LinkedList of 24000 items push then pop 19.773 ns/op 18.841 ns/op 1.05
intersect bitArray bitLen 8 11.483 ns/op 12.749 ns/op 0.90
intersect array and set length 8 164.31 ns/op 204.41 ns/op 0.80
intersect bitArray bitLen 128 72.034 ns/op 72.946 ns/op 0.99
intersect array and set length 128 2.1869 us/op 2.5220 us/op 0.87
Buffer.concat 32 items 2.2660 ns/op 2.3400 ns/op 0.97
pass gossip attestations to forkchoice per slot 3.2123 ms/op 3.7476 ms/op 0.86
computeDeltas 3.6184 ms/op 4.3056 ms/op 0.84
computeProposerBoostScoreFromBalances 921.18 us/op 888.23 us/op 1.04
altair processAttestation - 250000 vs - 7PWei normalcase 3.7736 ms/op 5.1228 ms/op 0.74
altair processAttestation - 250000 vs - 7PWei worstcase 5.8189 ms/op 8.1912 ms/op 0.71
altair processAttestation - setStatus - 1/6 committees join 211.43 us/op 249.40 us/op 0.85
altair processAttestation - setStatus - 1/3 committees join 403.93 us/op 465.53 us/op 0.87
altair processAttestation - setStatus - 1/2 committees join 573.54 us/op 669.47 us/op 0.86
altair processAttestation - setStatus - 2/3 committees join 725.70 us/op 887.92 us/op 0.82
altair processAttestation - setStatus - 4/5 committees join 1.0034 ms/op 1.2519 ms/op 0.80
altair processAttestation - setStatus - 100% committees join 1.1982 ms/op 1.4799 ms/op 0.81
altair processBlock - 250000 vs - 7PWei normalcase 28.624 ms/op 31.181 ms/op 0.92
altair processBlock - 250000 vs - 7PWei normalcase hashState 42.662 ms/op 44.481 ms/op 0.96
altair processBlock - 250000 vs - 7PWei worstcase 81.490 ms/op 114.81 ms/op 0.71
altair processBlock - 250000 vs - 7PWei worstcase hashState 98.482 ms/op 126.78 ms/op 0.78
phase0 processBlock - 250000 vs - 7PWei normalcase 3.7912 ms/op 4.4487 ms/op 0.85
phase0 processBlock - 250000 vs - 7PWei worstcase 46.282 ms/op 65.152 ms/op 0.71
altair processEth1Data - 250000 vs - 7PWei normalcase 807.07 us/op 1.1495 ms/op 0.70
Tree 40 250000 create 841.50 ms/op 1.0774 s/op 0.78
Tree 40 250000 get(125000) 289.53 ns/op 322.02 ns/op 0.90
Tree 40 250000 set(125000) 2.4809 us/op 3.1770 us/op 0.78
Tree 40 250000 toArray() 33.807 ms/op 33.589 ms/op 1.01
Tree 40 250000 iterate all - toArray() + loop 33.659 ms/op 35.095 ms/op 0.96
Tree 40 250000 iterate all - get(i) 110.07 ms/op 134.41 ms/op 0.82
MutableVector 250000 create 15.779 ms/op 19.654 ms/op 0.80
MutableVector 250000 get(125000) 14.786 ns/op 14.136 ns/op 1.05
MutableVector 250000 set(125000) 667.55 ns/op 917.19 ns/op 0.73
MutableVector 250000 toArray() 7.6102 ms/op 7.3868 ms/op 1.03
MutableVector 250000 iterate all - toArray() + loop 7.7707 ms/op 7.5179 ms/op 1.03
MutableVector 250000 iterate all - get(i) 3.4368 ms/op 3.6097 ms/op 0.95
Array 250000 create 7.4441 ms/op 7.3796 ms/op 1.01
Array 250000 clone - spread 2.6765 ms/op 4.7232 ms/op 0.57
Array 250000 get(125000) 1.1240 ns/op 2.0400 ns/op 0.55
Array 250000 set(125000) 1.1260 ns/op 2.0550 ns/op 0.55
Array 250000 iterate all - loop 167.87 us/op 152.16 us/op 1.10
effectiveBalanceIncrements clone Uint8Array 300000 72.711 us/op 216.70 us/op 0.34
effectiveBalanceIncrements clone MutableVector 300000 763.00 ns/op 754.00 ns/op 1.01
effectiveBalanceIncrements rw all Uint8Array 300000 252.47 us/op 294.39 us/op 0.86
effectiveBalanceIncrements rw all MutableVector 300000 181.81 ms/op 220.07 ms/op 0.83
phase0 afterProcessEpoch - 250000 vs - 7PWei 182.39 ms/op 228.25 ms/op 0.80
phase0 beforeProcessEpoch - 250000 vs - 7PWei 74.905 ms/op 74.165 ms/op 1.01
altair processEpoch - mainnet_e81889 510.98 ms/op 657.79 ms/op 0.78
mainnet_e81889 - altair beforeProcessEpoch 181.73 ms/op 145.92 ms/op 1.25
mainnet_e81889 - altair processJustificationAndFinalization 34.874 us/op 60.774 us/op 0.57
mainnet_e81889 - altair processInactivityUpdates 12.863 ms/op 11.362 ms/op 1.13
mainnet_e81889 - altair processRewardsAndPenalties 94.743 ms/op 102.96 ms/op 0.92
mainnet_e81889 - altair processRegistryUpdates 4.5460 us/op 13.718 us/op 0.33
mainnet_e81889 - altair processSlashings 835.00 ns/op 3.6610 us/op 0.23
mainnet_e81889 - altair processEth1DataReset 1.1760 us/op 3.7910 us/op 0.31
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.3206 ms/op 2.5682 ms/op 0.90
mainnet_e81889 - altair processSlashingsReset 9.8230 us/op 24.227 us/op 0.41
mainnet_e81889 - altair processRandaoMixesReset 7.4980 us/op 22.772 us/op 0.33
mainnet_e81889 - altair processHistoricalRootsUpdate 1.1640 us/op 3.9500 us/op 0.29
mainnet_e81889 - altair processParticipationFlagUpdates 4.0270 us/op 13.711 us/op 0.29
mainnet_e81889 - altair processSyncCommitteeUpdates 1.1070 us/op 3.2020 us/op 0.35
mainnet_e81889 - altair afterProcessEpoch 192.84 ms/op 230.91 ms/op 0.84
phase0 processEpoch - mainnet_e58758 535.78 ms/op 705.22 ms/op 0.76
mainnet_e58758 - phase0 beforeProcessEpoch 241.32 ms/op 242.80 ms/op 0.99
mainnet_e58758 - phase0 processJustificationAndFinalization 29.889 us/op 55.408 us/op 0.54
mainnet_e58758 - phase0 processRewardsAndPenalties 142.19 ms/op 157.48 ms/op 0.90
mainnet_e58758 - phase0 processRegistryUpdates 14.972 us/op 33.082 us/op 0.45
mainnet_e58758 - phase0 processSlashings 1.0820 us/op 2.8360 us/op 0.38
mainnet_e58758 - phase0 processEth1DataReset 1.1720 us/op 3.2260 us/op 0.36
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.5610 ms/op 2.7789 ms/op 0.92
mainnet_e58758 - phase0 processSlashingsReset 6.2440 us/op 15.029 us/op 0.42
mainnet_e58758 - phase0 processRandaoMixesReset 9.3670 us/op 20.698 us/op 0.45
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.4220 us/op 3.6630 us/op 0.39
mainnet_e58758 - phase0 processParticipationRecordUpdates 6.7290 us/op 20.141 us/op 0.33
mainnet_e58758 - phase0 afterProcessEpoch 157.78 ms/op 186.14 ms/op 0.85
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.6849 ms/op 2.5569 ms/op 1.05
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 3.5891 ms/op 2.8572 ms/op 1.26
altair processInactivityUpdates - 250000 normalcase 43.518 ms/op 51.817 ms/op 0.84
altair processInactivityUpdates - 250000 worstcase 53.644 ms/op 62.427 ms/op 0.86
phase0 processRegistryUpdates - 250000 normalcase 11.295 us/op 26.540 us/op 0.43
phase0 processRegistryUpdates - 250000 badcase_full_deposits 587.31 us/op 501.42 us/op 1.17
phase0 processRegistryUpdates - 250000 worstcase 0.5 219.59 ms/op 239.82 ms/op 0.92
altair processRewardsAndPenalties - 250000 normalcase 142.94 ms/op 157.81 ms/op 0.91
altair processRewardsAndPenalties - 250000 worstcase 88.226 ms/op 96.084 ms/op 0.92
phase0 getAttestationDeltas - 250000 normalcase 13.111 ms/op 15.377 ms/op 0.85
phase0 getAttestationDeltas - 250000 worstcase 12.655 ms/op 16.187 ms/op 0.78
phase0 processSlashings - 250000 worstcase 5.4058 ms/op 6.4892 ms/op 0.83
altair processSyncCommitteeUpdates - 250000 282.67 ms/op 343.29 ms/op 0.82
BeaconState.hashTreeRoot - No change 474.00 ns/op 610.00 ns/op 0.78
BeaconState.hashTreeRoot - 1 full validator 60.473 us/op 88.755 us/op 0.68
BeaconState.hashTreeRoot - 32 full validator 619.72 us/op 758.43 us/op 0.82
BeaconState.hashTreeRoot - 512 full validator 6.5545 ms/op 8.6807 ms/op 0.76
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 78.390 us/op 106.04 us/op 0.74
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.1817 ms/op 1.6755 ms/op 0.71
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 16.469 ms/op 25.325 ms/op 0.65
BeaconState.hashTreeRoot - 1 balances 69.049 us/op 83.771 us/op 0.82
BeaconState.hashTreeRoot - 32 balances 571.56 us/op 750.75 us/op 0.76
BeaconState.hashTreeRoot - 512 balances 5.8626 ms/op 7.5290 ms/op 0.78
BeaconState.hashTreeRoot - 250000 balances 91.241 ms/op 121.60 ms/op 0.75
aggregationBits - 2048 els - zipIndexesInBitList 36.475 us/op 45.567 us/op 0.80
regular array get 100000 times 67.446 us/op 58.649 us/op 1.15
wrappedArray get 100000 times 67.400 us/op 59.236 us/op 1.14
arrayWithProxy get 100000 times 29.077 ms/op 36.558 ms/op 0.80
ssz.Root.equals 529.00 ns/op 604.00 ns/op 0.88
byteArrayEquals 531.00 ns/op 608.00 ns/op 0.87
shuffle list - 16384 els 10.999 ms/op 13.413 ms/op 0.82
shuffle list - 250000 els 162.62 ms/op 190.99 ms/op 0.85
processSlot - 1 slots 13.192 us/op 19.333 us/op 0.68
processSlot - 32 slots 1.8327 ms/op 2.5586 ms/op 0.72
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 398.68 us/op 923.40 us/op 0.43
getCommitteeAssignments - req 1 vs - 250000 vc 5.2720 ms/op 5.7825 ms/op 0.91
getCommitteeAssignments - req 100 vs - 250000 vc 7.3094 ms/op 8.2957 ms/op 0.88
getCommitteeAssignments - req 1000 vs - 250000 vc 7.7661 ms/op 9.2120 ms/op 0.84
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 9.7600 ns/op 10.380 ns/op 0.94
state getBlockRootAtSlot - 250000 vs - 7PWei 1.1483 us/op 1.4747 us/op 0.78
computeProposers - vc 250000 16.895 ms/op 21.820 ms/op 0.77
computeEpochShuffling - vc 250000 165.29 ms/op 195.10 ms/op 0.85
getNextSyncCommittee - vc 250000 282.43 ms/op 354.82 ms/op 0.80

by benchmarkbot/action

@dadepo dadepo marked this pull request as ready for review September 1, 2022 14:40
@dadepo dadepo requested a review from a team as a code owner September 1, 2022 14:40
@philknows philknows added this to the v1.1.0 milestone Sep 2, 2022
Copy link
Member

@wemeetagain wemeetagain left a comment

Choose a reason for hiding this comment

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

LGTM

@wemeetagain wemeetagain merged commit cdac3ae into unstable Sep 7, 2022
@wemeetagain wemeetagain deleted the dadepo/update-light-clight-proof-logic branch September 7, 2022 20:48
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.

Update light client proof logic to root next sync committee in attested header
3 participants