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 processRewardsAndPenaltiesAllForks #3709

Merged
merged 1 commit into from
Feb 7, 2022

Conversation

dapplion
Copy link
Contributor

@dapplion dapplion commented Feb 7, 2022

Motivation

De-duplicate code in processRewardsAndPenalties phase0 + altair

Description

  • Add processRewardsAndPenaltiesAllForks in a similar pattern to other epoch process functions

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2022

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 9123e96 Previous: 96b5959 Ratio
BeaconState.hashTreeRoot - No change 651.00 ns/op 555.00 ns/op 1.17
BeaconState.hashTreeRoot - 1 full validator 165.09 us/op 124.57 us/op 1.33
BeaconState.hashTreeRoot - 32 full validator 2.4686 ms/op 1.8875 ms/op 1.31
BeaconState.hashTreeRoot - 512 full validator 31.957 ms/op 24.561 ms/op 1.30
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 164.15 us/op 120.80 us/op 1.36
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.5654 ms/op 2.0240 ms/op 1.27
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 33.628 ms/op 26.769 ms/op 1.26
BeaconState.hashTreeRoot - 1 balances 109.75 us/op 81.140 us/op 1.35
BeaconState.hashTreeRoot - 32 balances 919.37 us/op 754.58 us/op 1.22
BeaconState.hashTreeRoot - 512 balances 8.7974 ms/op 7.2181 ms/op 1.22
BeaconState.hashTreeRoot - 250000 balances 181.95 ms/op 131.57 ms/op 1.38
processSlot - 1 slots 74.224 us/op 47.191 us/op 1.57
processSlot - 32 slots 3.8683 ms/op 2.8462 ms/op 1.36
getCommitteeAssignments - req 1 vs - 250000 vc 5.2919 ms/op 5.2440 ms/op 1.01
getCommitteeAssignments - req 100 vs - 250000 vc 7.4172 ms/op 7.3125 ms/op 1.01
getCommitteeAssignments - req 1000 vs - 250000 vc 7.9174 ms/op 7.7520 ms/op 1.02
computeProposers - vc 250000 25.095 ms/op 20.683 ms/op 1.21
computeEpochShuffling - vc 250000 200.17 ms/op 187.10 ms/op 1.07
getNextSyncCommittee - vc 250000 423.84 ms/op 335.13 ms/op 1.26
altair processAttestation - 250000 vs - 7PWei normalcase 52.067 ms/op 40.601 ms/op 1.28
altair processAttestation - 250000 vs - 7PWei worstcase 55.621 ms/op 40.524 ms/op 1.37
altair processAttestation - setStatus - 1/6 committees join 17.417 ms/op 9.5366 ms/op 1.83
altair processAttestation - setStatus - 1/3 committees join 34.741 ms/op 19.574 ms/op 1.77
altair processAttestation - setStatus - 1/2 committees join 50.330 ms/op 31.106 ms/op 1.62
altair processAttestation - setStatus - 2/3 committees join 68.640 ms/op 42.018 ms/op 1.63
altair processAttestation - setStatus - 4/5 committees join 91.685 ms/op 50.300 ms/op 1.82
altair processAttestation - setStatus - 100% committees join 94.668 ms/op 63.630 ms/op 1.49
altair processAttestation - updateEpochParticipants - 1/6 committees join 20.898 ms/op 10.699 ms/op 1.95
altair processAttestation - updateEpochParticipants - 1/3 committees join 33.245 ms/op 22.956 ms/op 1.45
altair processAttestation - updateEpochParticipants - 1/2 committees join 32.169 ms/op 26.641 ms/op 1.21
altair processAttestation - updateEpochParticipants - 2/3 committees join 46.059 ms/op 32.856 ms/op 1.40
altair processAttestation - updateEpochParticipants - 4/5 committees join 39.816 ms/op 28.805 ms/op 1.38
altair processAttestation - updateEpochParticipants - 100% committees join 42.069 ms/op 29.933 ms/op 1.41
altair processAttestation - updateAllStatus 28.277 ms/op 21.896 ms/op 1.29
altair processBlock - 250000 vs - 7PWei normalcase 57.706 ms/op 43.303 ms/op 1.33
altair processBlock - 250000 vs - 7PWei worstcase 155.68 ms/op 133.29 ms/op 1.17
altair processEpoch - mainnet_e81889 1.3928 s/op 1.1202 s/op 1.24
mainnet_e81889 - altair beforeProcessEpoch 362.45 ms/op 264.92 ms/op 1.37
mainnet_e81889 - altair processJustificationAndFinalization 138.90 us/op 82.634 us/op 1.68
mainnet_e81889 - altair processInactivityUpdates 21.247 ms/op 17.700 ms/op 1.20
mainnet_e81889 - altair processRewardsAndPenalties 301.16 ms/op 295.49 ms/op 1.02
mainnet_e81889 - altair processRegistryUpdates 22.208 us/op 5.3240 us/op 4.17
mainnet_e81889 - altair processSlashings 6.5460 us/op 1000.0 ns/op 6.55
mainnet_e81889 - altair processEth1DataReset 6.5540 us/op 971.00 ns/op 6.75
mainnet_e81889 - altair processEffectiveBalanceUpdates 14.323 ms/op 11.259 ms/op 1.27
mainnet_e81889 - altair processSlashingsReset 38.114 us/op 8.4090 us/op 4.53
mainnet_e81889 - altair processRandaoMixesReset 46.831 us/op 11.451 us/op 4.09
mainnet_e81889 - altair processHistoricalRootsUpdate 9.5110 us/op 1.1800 us/op 8.06
mainnet_e81889 - altair processParticipationFlagUpdates 196.94 ms/op 98.737 ms/op 1.99
mainnet_e81889 - altair processSyncCommitteeUpdates 5.5150 us/op 1.0450 us/op 5.28
mainnet_e81889 - altair afterProcessEpoch 247.41 ms/op 222.27 ms/op 1.11
altair processInactivityUpdates - 250000 normalcase 94.579 ms/op 65.184 ms/op 1.45
altair processInactivityUpdates - 250000 worstcase 96.892 ms/op 65.948 ms/op 1.47
altair processParticipationFlagUpdates - 250000 anycase 116.68 ms/op 90.651 ms/op 1.29
altair processRewardsAndPenalties - 250000 normalcase 267.31 ms/op 204.30 ms/op 1.31
altair processRewardsAndPenalties - 250000 worstcase 303.71 ms/op 210.46 ms/op 1.44
altair processSyncCommitteeUpdates - 250000 457.56 ms/op 351.38 ms/op 1.30
Tree 40 250000 create 1.1238 s/op 625.19 ms/op 1.80
Tree 40 250000 get(125000) 354.50 ns/op 330.15 ns/op 1.07
Tree 40 250000 set(125000) 3.7568 us/op 2.0091 us/op 1.87
Tree 40 250000 toArray() 62.700 ms/op 37.840 ms/op 1.66
Tree 40 250000 iterate all - toArray() + loop 50.658 ms/op 43.895 ms/op 1.15
Tree 40 250000 iterate all - get(i) 140.58 ms/op 118.82 ms/op 1.18
MutableVector 250000 create 33.659 ms/op 24.348 ms/op 1.38
MutableVector 250000 get(125000) 16.412 ns/op 14.275 ns/op 1.15
MutableVector 250000 set(125000) 1.0287 us/op 463.19 ns/op 2.22
MutableVector 250000 toArray() 11.274 ms/op 8.3513 ms/op 1.35
MutableVector 250000 iterate all - toArray() + loop 11.434 ms/op 8.6331 ms/op 1.32
MutableVector 250000 iterate all - get(i) 3.8542 ms/op 3.4170 ms/op 1.13
Array 250000 create 7.2423 ms/op 5.1920 ms/op 1.39
Array 250000 clone - spread 2.9202 ms/op 2.3633 ms/op 1.24
Array 250000 get(125000) 1.3630 ns/op 1.0730 ns/op 1.27
Array 250000 set(125000) 1.3260 ns/op 1.0720 ns/op 1.24
Array 250000 iterate all - loop 147.87 us/op 167.76 us/op 0.88
aggregationBits - 2048 els - readonlyValues 307.08 us/op 239.71 us/op 1.28
aggregationBits - 2048 els - zipIndexesInBitList 58.798 us/op 48.066 us/op 1.22
regular array get 100000 times 58.589 us/op 67.367 us/op 0.87
wrappedArray get 100000 times 59.921 us/op 67.643 us/op 0.89
arrayWithProxy get 100000 times 34.738 ms/op 28.329 ms/op 1.23
ssz.Root.equals 1.3780 us/op 1.0970 us/op 1.26
ssz.Root.equals with valueOf() 2.1980 us/op 1.3730 us/op 1.60
byteArrayEquals with valueOf() 1.9440 us/op 1.3580 us/op 1.43
phase0 processBlock - 250000 vs - 7PWei normalcase 15.445 ms/op 10.437 ms/op 1.48
phase0 processBlock - 250000 vs - 7PWei worstcase 104.52 ms/op 76.017 ms/op 1.37
phase0 afterProcessEpoch - 250000 vs - 7PWei 244.92 ms/op 208.10 ms/op 1.18
phase0 beforeProcessEpoch - 250000 vs - 7PWei 865.28 ms/op 561.90 ms/op 1.54
phase0 processEpoch - mainnet_e58758 1.1675 s/op 799.88 ms/op 1.46
mainnet_e58758 - phase0 beforeProcessEpoch 677.27 ms/op 403.59 ms/op 1.68
mainnet_e58758 - phase0 processJustificationAndFinalization 119.41 us/op 115.61 us/op 1.03
mainnet_e58758 - phase0 processRewardsAndPenalties 209.24 ms/op 128.45 ms/op 1.63
mainnet_e58758 - phase0 processRegistryUpdates 90.260 us/op 35.191 us/op 2.56
mainnet_e58758 - phase0 processSlashings 6.7700 us/op 2.1370 us/op 3.17
mainnet_e58758 - phase0 processEth1DataReset 5.9240 us/op 1.7380 us/op 3.41
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 11.797 ms/op 9.4213 ms/op 1.25
mainnet_e58758 - phase0 processSlashingsReset 33.711 us/op 12.898 us/op 2.61
mainnet_e58758 - phase0 processRandaoMixesReset 44.724 us/op 17.375 us/op 2.57
mainnet_e58758 - phase0 processHistoricalRootsUpdate 8.9800 us/op 2.3700 us/op 3.79
mainnet_e58758 - phase0 processParticipationRecordUpdates 29.493 us/op 11.914 us/op 2.48
mainnet_e58758 - phase0 afterProcessEpoch 222.24 ms/op 181.17 ms/op 1.23
phase0 processEffectiveBalanceUpdates - 250000 normalcase 14.295 ms/op 11.095 ms/op 1.29
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.1764 s/op 1.2614 s/op 1.73
phase0 processRegistryUpdates - 250000 normalcase 92.687 us/op 34.608 us/op 2.68
phase0 processRegistryUpdates - 250000 badcase_full_deposits 4.9072 ms/op 2.7335 ms/op 1.80
phase0 processRegistryUpdates - 250000 worstcase 0.5 2.9974 s/op 1.6341 s/op 1.83
phase0 getAttestationDeltas - 250000 normalcase 96.242 ms/op 73.224 ms/op 1.31
phase0 getAttestationDeltas - 250000 worstcase 106.76 ms/op 73.905 ms/op 1.44
phase0 processSlashings - 250000 worstcase 52.728 ms/op 34.740 ms/op 1.52
shuffle list - 16384 els 14.799 ms/op 12.867 ms/op 1.15
shuffle list - 250000 els 202.28 ms/op 184.90 ms/op 1.09
getEffectiveBalances - 250000 vs - 7PWei 14.295 ms/op 9.7904 ms/op 1.46
pass gossip attestations to forkchoice per slot 20.610 ms/op 14.615 ms/op 1.41
computeDeltas 3.5588 ms/op 3.4202 ms/op 1.04
computeProposerBoostScoreFromBalances 292.71 us/op 337.19 us/op 0.87
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 3.1432 ms/op 2.0190 ms/op 1.56
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 819.58 us/op 699.61 us/op 1.17
BLS verify - blst-native 2.2250 ms/op 1.8608 ms/op 1.20
BLS verifyMultipleSignatures 3 - blst-native 4.6074 ms/op 3.8258 ms/op 1.20
BLS verifyMultipleSignatures 8 - blst-native 10.229 ms/op 8.2476 ms/op 1.24
BLS verifyMultipleSignatures 32 - blst-native 36.453 ms/op 29.916 ms/op 1.22
BLS aggregatePubkeys 32 - blst-native 48.084 us/op 40.355 us/op 1.19
BLS aggregatePubkeys 128 - blst-native 188.13 us/op 154.20 us/op 1.22
getAttestationsForBlock 114.72 ms/op 78.124 ms/op 1.47
CheckpointStateCache - add get delete 25.116 us/op 18.041 us/op 1.39
validate gossip signedAggregateAndProof - struct 5.4081 ms/op 4.4636 ms/op 1.21
validate gossip signedAggregateAndProof - treeBacked 5.3324 ms/op 4.4019 ms/op 1.21
validate gossip attestation - struct 2.5180 ms/op 2.0994 ms/op 1.20
validate gossip attestation - treeBacked 2.6401 ms/op 2.1004 ms/op 1.26
bytes32 toHexString 2.3450 us/op 1.5660 us/op 1.50
bytes32 Buffer.toString(hex) 835.00 ns/op 649.00 ns/op 1.29
bytes32 Buffer.toString(hex) from Uint8Array 1.0800 us/op 936.00 ns/op 1.15
bytes32 Buffer.toString(hex) + 0x 835.00 ns/op 655.00 ns/op 1.27
Object access 1 prop 0.42600 ns/op 0.30700 ns/op 1.39
Map access 1 prop 0.33300 ns/op 0.28000 ns/op 1.19
Object get x1000 16.902 ns/op 22.944 ns/op 0.74
Map get x1000 0.92800 ns/op 1.0070 ns/op 0.92
Object set x1000 123.21 ns/op 105.74 ns/op 1.17
Map set x1000 86.016 ns/op 59.527 ns/op 1.44
Return object 10000 times 0.43420 ns/op 0.36480 ns/op 1.19
Throw Error 10000 times 6.9730 us/op 5.9147 us/op 1.18
enrSubnets - fastDeserialize 64 bits 1.7170 us/op 1.1460 us/op 1.50
enrSubnets - ssz BitVector 64 bits 18.976 us/op 16.350 us/op 1.16
enrSubnets - fastDeserialize 4 bits 548.00 ns/op 400.00 ns/op 1.37
enrSubnets - ssz BitVector 4 bits 3.3740 us/op 2.9360 us/op 1.15
RateTracker 1000000 limit, 1 obj count per request 210.18 ns/op 173.28 ns/op 1.21
RateTracker 1000000 limit, 2 obj count per request 159.43 ns/op 128.22 ns/op 1.24
RateTracker 1000000 limit, 4 obj count per request 130.48 ns/op 105.75 ns/op 1.23
RateTracker 1000000 limit, 8 obj count per request 120.45 ns/op 94.497 ns/op 1.27
RateTracker with prune 5.7370 us/op 3.4770 us/op 1.65

by benchmarkbot/action

@dapplion dapplion force-pushed the dapplion/processRewardsAndPenaltiesAllForks branch from e8aad07 to 67d95af Compare February 7, 2022 05:21
@codecov
Copy link

codecov bot commented Feb 7, 2022

Codecov Report

Merging #3709 (67d95af) into master (96b5959) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #3709   +/-   ##
=======================================
  Coverage   37.17%   37.17%           
=======================================
  Files         322      322           
  Lines        8723     8723           
  Branches     1350     1350           
=======================================
  Hits         3243     3243           
  Misses       5338     5338           
  Partials      142      142           

@twoeths twoeths merged commit 7f37195 into master Feb 7, 2022
@twoeths twoeths deleted the dapplion/processRewardsAndPenaltiesAllForks branch February 7, 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.

2 participants