Skip to content

Use number flags in MutableVector particiption #3722

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

Merged
merged 3 commits into from
Feb 8, 2022

Conversation

dapplion
Copy link
Contributor

@dapplion dapplion commented Feb 7, 2022

Motivation

When switching to the new version of SSZ participation will be tracked exclusively as numbers. This PR incorporates the required changes by switching the participation MutableVector from a status object to number flags

Description

  • Use number flags in MutableVector particiption

@codecov
Copy link

codecov bot commented Feb 7, 2022

Codecov Report

Merging #3722 (48c6dbd) into master (40c8ff5) will decrease coverage by 0.10%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3722      +/-   ##
==========================================
- Coverage   37.07%   36.96%   -0.11%     
==========================================
  Files         320      320              
  Lines        8731     8786      +55     
  Branches     1358     1378      +20     
==========================================
+ Hits         3237     3248      +11     
- Misses       5352     5396      +44     
  Partials      142      142              

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2022

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 11efa2e Previous: e4edcba Ratio
BeaconState.hashTreeRoot - No change 550.00 ns/op 690.00 ns/op 0.80
BeaconState.hashTreeRoot - 1 full validator 113.51 us/op 175.98 us/op 0.65
BeaconState.hashTreeRoot - 32 full validator 1.7419 ms/op 2.6229 ms/op 0.66
BeaconState.hashTreeRoot - 512 full validator 23.339 ms/op 34.560 ms/op 0.68
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 114.51 us/op 175.64 us/op 0.65
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.8857 ms/op 2.7751 ms/op 0.68
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 25.663 ms/op 37.085 ms/op 0.69
BeaconState.hashTreeRoot - 1 balances 81.676 us/op 117.73 us/op 0.69
BeaconState.hashTreeRoot - 32 balances 649.59 us/op 1.0424 ms/op 0.62
BeaconState.hashTreeRoot - 512 balances 6.7878 ms/op 9.8198 ms/op 0.69
BeaconState.hashTreeRoot - 250000 balances 126.57 ms/op 188.43 ms/op 0.67
processSlot - 1 slots 69.341 us/op 121.38 us/op 0.57
processSlot - 32 slots 2.6038 ms/op 3.9477 ms/op 0.66
getCommitteeAssignments - req 1 vs - 250000 vc 4.6978 ms/op 5.8116 ms/op 0.81
getCommitteeAssignments - req 100 vs - 250000 vc 6.5506 ms/op 8.1625 ms/op 0.80
getCommitteeAssignments - req 1000 vs - 250000 vc 6.9057 ms/op 8.8490 ms/op 0.78
computeProposers - vc 250000 18.987 ms/op 26.047 ms/op 0.73
computeEpochShuffling - vc 250000 164.18 ms/op 207.53 ms/op 0.79
getNextSyncCommittee - vc 250000 346.59 ms/op 424.64 ms/op 0.82
altair processAttestation - 250000 vs - 7PWei normalcase 33.889 ms/op 49.886 ms/op 0.68
altair processAttestation - 250000 vs - 7PWei worstcase 34.669 ms/op 51.276 ms/op 0.68
altair processAttestation - setStatus - 1/6 committees join 11.131 ms/op 15.194 ms/op 0.73
altair processAttestation - setStatus - 1/3 committees join 23.539 ms/op 30.922 ms/op 0.76
altair processAttestation - setStatus - 1/2 committees join 37.575 ms/op 46.930 ms/op 0.80
altair processAttestation - setStatus - 2/3 committees join 48.406 ms/op 61.385 ms/op 0.79
altair processAttestation - setStatus - 4/5 committees join 57.901 ms/op 73.339 ms/op 0.79
altair processAttestation - setStatus - 100% committees join 72.406 ms/op 93.804 ms/op 0.77
altair processAttestation - updateEpochParticipants - 1/6 committees join 12.249 ms/op 15.634 ms/op 0.78
altair processAttestation - updateEpochParticipants - 1/3 committees join 28.075 ms/op 35.487 ms/op 0.79
altair processAttestation - updateEpochParticipants - 1/2 committees join 19.544 ms/op 30.007 ms/op 0.65
altair processAttestation - updateEpochParticipants - 2/3 committees join 25.383 ms/op 32.137 ms/op 0.79
altair processAttestation - updateEpochParticipants - 4/5 committees join 21.968 ms/op 42.849 ms/op 0.51
altair processAttestation - updateEpochParticipants - 100% committees join 27.774 ms/op 35.203 ms/op 0.79
altair processAttestation - updateAllStatus 18.521 ms/op 25.533 ms/op 0.73
altair processBlock - 250000 vs - 7PWei normalcase 32.251 ms/op 49.125 ms/op 0.66
altair processBlock - 250000 vs - 7PWei worstcase 98.811 ms/op 143.84 ms/op 0.69
altair processEpoch - mainnet_e81889 964.68 ms/op 1.3598 s/op 0.71
mainnet_e81889 - altair beforeProcessEpoch 279.53 ms/op 335.37 ms/op 0.83
mainnet_e81889 - altair processJustificationAndFinalization 47.090 us/op 119.86 us/op 0.39
mainnet_e81889 - altair processInactivityUpdates 16.531 ms/op 20.627 ms/op 0.80
mainnet_e81889 - altair processRewardsAndPenalties 211.47 ms/op 286.43 ms/op 0.74
mainnet_e81889 - altair processRegistryUpdates 5.7980 us/op 20.745 us/op 0.28
mainnet_e81889 - altair processSlashings 1.2100 us/op 5.8310 us/op 0.21
mainnet_e81889 - altair processEth1DataReset 1.0930 us/op 6.2020 us/op 0.18
mainnet_e81889 - altair processEffectiveBalanceUpdates 5.9654 ms/op 7.7101 ms/op 0.77
mainnet_e81889 - altair processSlashingsReset 9.5470 us/op 34.844 us/op 0.27
mainnet_e81889 - altair processRandaoMixesReset 12.977 us/op 42.611 us/op 0.30
mainnet_e81889 - altair processHistoricalRootsUpdate 1.6210 us/op 8.7560 us/op 0.19
mainnet_e81889 - altair processParticipationFlagUpdates 68.574 ms/op 190.09 ms/op 0.36
mainnet_e81889 - altair processSyncCommitteeUpdates 1.2840 us/op 5.3760 us/op 0.24
mainnet_e81889 - altair afterProcessEpoch 196.64 ms/op 259.17 ms/op 0.76
altair processInactivityUpdates - 250000 normalcase 71.032 ms/op 80.958 ms/op 0.88
altair processInactivityUpdates - 250000 worstcase 75.876 ms/op 82.649 ms/op 0.92
altair processParticipationFlagUpdates - 250000 anycase 56.507 ms/op 107.06 ms/op 0.53
altair processRewardsAndPenalties - 250000 normalcase 190.19 ms/op 264.98 ms/op 0.72
altair processRewardsAndPenalties - 250000 worstcase 185.78 ms/op 298.29 ms/op 0.62
altair processSyncCommitteeUpdates - 250000 381.50 ms/op 465.72 ms/op 0.82
Tree 40 250000 create 875.96 ms/op 863.30 ms/op 1.01
Tree 40 250000 get(125000) 295.54 ns/op 372.63 ns/op 0.79
Tree 40 250000 set(125000) 1.9341 us/op 2.9270 us/op 0.66
Tree 40 250000 toArray() 37.522 ms/op 53.341 ms/op 0.70
Tree 40 250000 iterate all - toArray() + loop 43.678 ms/op 57.396 ms/op 0.76
Tree 40 250000 iterate all - get(i) 108.23 ms/op 161.87 ms/op 0.67
MutableVector 250000 create 20.367 ms/op 30.450 ms/op 0.67
MutableVector 250000 get(125000) 11.641 ns/op 16.612 ns/op 0.70
MutableVector 250000 set(125000) 490.67 ns/op 753.49 ns/op 0.65
MutableVector 250000 toArray() 8.2094 ms/op 10.347 ms/op 0.79
MutableVector 250000 iterate all - toArray() + loop 8.1715 ms/op 10.672 ms/op 0.77
MutableVector 250000 iterate all - get(i) 3.3397 ms/op 3.9114 ms/op 0.85
Array 250000 create 6.3571 ms/op 6.1151 ms/op 1.04
Array 250000 clone - spread 1.6509 ms/op 2.6220 ms/op 0.63
Array 250000 get(125000) 0.79300 ns/op 1.2920 ns/op 0.61
Array 250000 set(125000) 0.78800 ns/op 1.2620 ns/op 0.62
Array 250000 iterate all - loop 148.10 us/op 152.50 us/op 0.97
effectiveBalanceIncrements clone Uint8Array 300000 68.681 us/op 145.74 us/op 0.47
effectiveBalanceIncrements clone MutableVector 300000 470.00 ns/op 650.00 ns/op 0.72
effectiveBalanceIncrements rw all Uint8Array 300000 266.43 us/op 207.57 us/op 1.28
effectiveBalanceIncrements rw all MutableVector 300000 183.54 ms/op 206.65 ms/op 0.89
aggregationBits - 2048 els - readonlyValues 168.69 us/op 217.86 us/op 0.77
aggregationBits - 2048 els - zipIndexesInBitList 35.162 us/op 38.511 us/op 0.91
regular array get 100000 times 59.493 us/op 61.743 us/op 0.96
wrappedArray get 100000 times 59.432 us/op 60.976 us/op 0.97
arrayWithProxy get 100000 times 25.365 ms/op 48.554 ms/op 0.52
ssz.Root.equals 943.00 ns/op 38.107 us/op 0.02
ssz.Root.equals with valueOf() 1.1990 us/op 1.7470 us/op 0.69
byteArrayEquals with valueOf() 1.1980 us/op 1.4920 us/op 0.80
phase0 processBlock - 250000 vs - 7PWei normalcase 7.4336 ms/op 10.648 ms/op 0.70
phase0 processBlock - 250000 vs - 7PWei worstcase 70.904 ms/op 99.090 ms/op 0.72
phase0 afterProcessEpoch - 250000 vs - 7PWei 188.65 ms/op 242.77 ms/op 0.78
phase0 beforeProcessEpoch - 250000 vs - 7PWei 539.82 ms/op 714.87 ms/op 0.76
phase0 processEpoch - mainnet_e58758 770.81 ms/op 1.1404 s/op 0.68
mainnet_e58758 - phase0 beforeProcessEpoch 475.27 ms/op 564.55 ms/op 0.84
mainnet_e58758 - phase0 processJustificationAndFinalization 46.317 us/op 118.47 us/op 0.39
mainnet_e58758 - phase0 processRewardsAndPenalties 144.57 ms/op 191.02 ms/op 0.76
mainnet_e58758 - phase0 processRegistryUpdates 34.131 us/op 83.873 us/op 0.41
mainnet_e58758 - phase0 processSlashings 1.0390 us/op 7.2360 us/op 0.14
mainnet_e58758 - phase0 processEth1DataReset 1.4760 us/op 5.5190 us/op 0.27
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 4.9319 ms/op 6.4735 ms/op 0.76
mainnet_e58758 - phase0 processSlashingsReset 8.0610 us/op 29.067 us/op 0.28
mainnet_e58758 - phase0 processRandaoMixesReset 11.868 us/op 38.645 us/op 0.31
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.6370 us/op 7.4510 us/op 0.22
mainnet_e58758 - phase0 processParticipationRecordUpdates 8.3510 us/op 27.640 us/op 0.30
mainnet_e58758 - phase0 afterProcessEpoch 167.92 ms/op 216.12 ms/op 0.78
phase0 processEffectiveBalanceUpdates - 250000 normalcase 5.6781 ms/op 7.6034 ms/op 0.75
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 6.0011 ms/op 7.9714 ms/op 0.75
phase0 processRegistryUpdates - 250000 normalcase 35.780 us/op 87.087 us/op 0.41
phase0 processRegistryUpdates - 250000 badcase_full_deposits 2.8365 ms/op 4.2101 ms/op 0.67
phase0 processRegistryUpdates - 250000 worstcase 0.5 1.8403 s/op 2.6482 s/op 0.69
phase0 getAttestationDeltas - 250000 normalcase 59.416 ms/op 87.650 ms/op 0.68
phase0 getAttestationDeltas - 250000 worstcase 68.946 ms/op 88.238 ms/op 0.78
phase0 processSlashings - 250000 worstcase 34.906 ms/op 40.560 ms/op 0.86
shuffle list - 16384 els 11.373 ms/op 15.519 ms/op 0.73
shuffle list - 250000 els 162.65 ms/op 215.20 ms/op 0.76
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 383.18 us/op 578.17 us/op 0.66
pass gossip attestations to forkchoice per slot 15.662 ms/op 21.264 ms/op 0.74
computeDeltas 3.8502 ms/op 3.7618 ms/op 1.02
computeProposerBoostScoreFromBalances 443.66 us/op 530.24 us/op 0.84
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.4020 ms/op 2.4787 ms/op 0.97
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 653.28 us/op 802.85 us/op 0.81
BLS verify - blst-native 1.6391 ms/op 2.3749 ms/op 0.69
BLS verifyMultipleSignatures 3 - blst-native 3.3777 ms/op 4.8799 ms/op 0.69
BLS verifyMultipleSignatures 8 - blst-native 7.2512 ms/op 10.508 ms/op 0.69
BLS verifyMultipleSignatures 32 - blst-native 26.388 ms/op 38.483 ms/op 0.69
BLS aggregatePubkeys 32 - blst-native 35.179 us/op 50.588 us/op 0.70
BLS aggregatePubkeys 128 - blst-native 135.68 us/op 198.68 us/op 0.68
getAttestationsForBlock 64.452 ms/op 105.44 ms/op 0.61
CheckpointStateCache - add get delete 17.398 us/op 23.852 us/op 0.73
validate gossip signedAggregateAndProof - struct 3.9437 ms/op 5.7612 ms/op 0.68
validate gossip signedAggregateAndProof - treeBacked 3.9488 ms/op 5.6249 ms/op 0.70
validate gossip attestation - struct 1.8493 ms/op 2.6815 ms/op 0.69
validate gossip attestation - treeBacked 1.8616 ms/op 2.6814 ms/op 0.69
pickEth1Vote - no votes 9.2168 ms/op 10.498 ms/op 0.88
pickEth1Vote - max votes 49.540 ms/op 58.287 ms/op 0.85
pickEth1Vote - Eth1Data hashTreeRoot value x2048 22.919 ms/op 33.042 ms/op 0.69
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 8.8569 ms/op 11.462 ms/op 0.77
pickEth1Vote - Eth1Data fastSerialize value x2048 5.0108 ms/op 5.9430 ms/op 0.84
pickEth1Vote - Eth1Data fastSerialize tree x2048 22.113 ms/op 27.646 ms/op 0.80
bytes32 toHexString 1.6530 us/op 1.9570 us/op 0.84
bytes32 Buffer.toString(hex) 635.00 ns/op 831.00 ns/op 0.76
bytes32 Buffer.toString(hex) from Uint8Array 860.00 ns/op 1.1240 us/op 0.77
bytes32 Buffer.toString(hex) + 0x 639.00 ns/op 864.00 ns/op 0.74
Object access 1 prop 0.30000 ns/op 0.42100 ns/op 0.71
Map access 1 prop 0.25000 ns/op 0.36000 ns/op 0.69
Object get x1000 15.879 ns/op 18.695 ns/op 0.85
Map get x1000 0.84400 ns/op 1.1080 ns/op 0.76
Object set x1000 105.06 ns/op 111.30 ns/op 0.94
Map set x1000 63.786 ns/op 77.064 ns/op 0.83
Return object 10000 times 0.33270 ns/op 0.45330 ns/op 0.73
Throw Error 10000 times 5.2434 us/op 7.4858 us/op 0.70
enrSubnets - fastDeserialize 64 bits 1.1910 us/op 1.5080 us/op 0.79
enrSubnets - ssz BitVector 64 bits 15.019 us/op 19.788 us/op 0.76
enrSubnets - fastDeserialize 4 bits 409.00 ns/op 545.00 ns/op 0.75
enrSubnets - ssz BitVector 4 bits 2.6460 us/op 3.6190 us/op 0.73
RateTracker 1000000 limit, 1 obj count per request 167.92 ns/op 210.21 ns/op 0.80
RateTracker 1000000 limit, 2 obj count per request 126.21 ns/op 155.21 ns/op 0.81
RateTracker 1000000 limit, 4 obj count per request 106.74 ns/op 128.08 ns/op 0.83
RateTracker 1000000 limit, 8 obj count per request 96.103 ns/op 114.08 ns/op 0.84
RateTracker with prune 4.0320 us/op 4.8560 us/op 0.83

by benchmarkbot/action

@dapplion dapplion force-pushed the dapplion/participation-flag branch from 78bb000 to 44c7a68 Compare February 7, 2022 17:09
@twoeths
Copy link
Contributor

twoeths commented Feb 8, 2022

@dapplion file conflict

@dapplion dapplion merged commit d702222 into master Feb 8, 2022
@dapplion dapplion deleted the dapplion/participation-flag branch February 8, 2022 11:18
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.

2 participants