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

Offset sync period by ALTAIR_FORK_EPOCH #3477

Merged
merged 4 commits into from
Dec 3, 2021
Merged

Conversation

dapplion
Copy link
Contributor

@dapplion dapplion commented Dec 3, 2021

Motivation

The first sync period for networks with ALTAIR_FORK_EPOCH >> 0 should be sync period 0.

Description

  • When the sync period is used as a value for indexing, offset by ALTAIR_FORK_EPOCH
  • When the sync period is used purely for comparison, don't offset by ALTAIR_FORK_EPOCH

@codeclimate
Copy link

codeclimate bot commented Dec 3, 2021

Code Climate has analyzed commit 4196cd3 and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 2

View more on Code Climate.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2021

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 8797552 Previous: b01e3de Ratio
BeaconState.hashTreeRoot - No change 599.00 ns/op 623.00 ns/op 0.96
BeaconState.hashTreeRoot - 1 full validator 75.921 us/op 86.477 us/op 0.88
BeaconState.hashTreeRoot - 32 full validator 1.0626 ms/op 1.3448 ms/op 0.79
BeaconState.hashTreeRoot - 512 full validator 13.547 ms/op 15.416 ms/op 0.88
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 74.742 us/op 85.864 us/op 0.87
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.2714 ms/op 1.3922 ms/op 0.91
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 16.834 ms/op 18.698 ms/op 0.90
BeaconState.hashTreeRoot - 1 balances 57.462 us/op 61.899 us/op 0.93
BeaconState.hashTreeRoot - 32 balances 472.45 us/op 548.84 us/op 0.86
BeaconState.hashTreeRoot - 512 balances 4.3915 ms/op 5.4372 ms/op 0.81
BeaconState.hashTreeRoot - 250000 balances 80.563 ms/op 96.780 ms/op 0.83
processSlot - 1 slots 37.659 us/op 36.192 us/op 1.04
processSlot - 32 slots 1.9604 ms/op 2.2134 ms/op 0.89
getCommitteeAssignments - req 1 vs - 250000 vc 5.3225 ms/op 5.4792 ms/op 0.97
getCommitteeAssignments - req 100 vs - 250000 vc 7.4039 ms/op 8.3636 ms/op 0.89
getCommitteeAssignments - req 1000 vs - 250000 vc 7.9270 ms/op 8.5312 ms/op 0.93
computeProposers - vc 250000 20.014 ms/op 22.625 ms/op 0.88
computeEpochShuffling - vc 250000 180.23 ms/op 215.97 ms/op 0.83
getNextSyncCommittee - vc 250000 323.19 ms/op 371.21 ms/op 0.87
altair processAttestation - 250000 vs - 7PWei normalcase 33.412 ms/op 32.153 ms/op 1.04
altair processAttestation - 250000 vs - 7PWei worstcase 40.164 ms/op 38.072 ms/op 1.05
altair processAttestation - setStatus - 1/6 committees join 9.3075 ms/op 8.7614 ms/op 1.06
altair processAttestation - setStatus - 1/3 committees join 18.141 ms/op 17.752 ms/op 1.02
altair processAttestation - setStatus - 1/2 committees join 27.556 ms/op 28.076 ms/op 0.98
altair processAttestation - setStatus - 2/3 committees join 42.291 ms/op 36.912 ms/op 1.15
altair processAttestation - setStatus - 4/5 committees join 43.316 ms/op 45.149 ms/op 0.96
altair processAttestation - setStatus - 100% committees join 52.351 ms/op 56.486 ms/op 0.93
altair processAttestation - updateEpochParticipants - 1/6 committees join 8.3539 ms/op 9.5227 ms/op 0.88
altair processAttestation - updateEpochParticipants - 1/3 committees join 17.442 ms/op 19.172 ms/op 0.91
altair processAttestation - updateEpochParticipants - 1/2 committees join 59.666 ms/op 20.157 ms/op 2.96
altair processAttestation - updateEpochParticipants - 2/3 committees join 22.465 ms/op 21.092 ms/op 1.07
altair processAttestation - updateEpochParticipants - 4/5 committees join 22.781 ms/op 22.736 ms/op 1.00
altair processAttestation - updateEpochParticipants - 100% committees join 26.262 ms/op 27.208 ms/op 0.97
altair processAttestation - updateAllStatus 17.915 ms/op 17.201 ms/op 1.04
altair processBlock - 250000 vs - 7PWei normalcase 37.539 ms/op 37.427 ms/op 1.00
altair processBlock - 250000 vs - 7PWei worstcase 104.42 ms/op 108.83 ms/op 0.96
altair processEpoch - mainnet_e81889 922.05 ms/op 892.80 ms/op 1.03
mainnet_e81889 - altair beforeProcessEpoch 261.25 ms/op 221.92 ms/op 1.18
mainnet_e81889 - altair processJustificationAndFinalization 47.941 us/op 48.145 us/op 1.00
mainnet_e81889 - altair processInactivityUpdates 18.167 ms/op 14.837 ms/op 1.22
mainnet_e81889 - altair processRewardsAndPenalties 113.57 ms/op 98.772 ms/op 1.15
mainnet_e81889 - altair processRegistryUpdates 6.6270 us/op 4.3630 us/op 1.52
mainnet_e81889 - altair processSlashings 1.8980 us/op 844.00 ns/op 2.25
mainnet_e81889 - altair processEth1DataReset 1.9560 us/op 731.00 ns/op 2.68
mainnet_e81889 - altair processEffectiveBalanceUpdates 11.381 ms/op 10.675 ms/op 1.07
mainnet_e81889 - altair processSlashingsReset 10.497 us/op 5.9290 us/op 1.77
mainnet_e81889 - altair processRandaoMixesReset 13.450 us/op 8.8280 us/op 1.52
mainnet_e81889 - altair processHistoricalRootsUpdate 1.8890 us/op 948.00 ns/op 1.99
mainnet_e81889 - altair processParticipationFlagUpdates 145.47 ms/op 129.27 ms/op 1.13
mainnet_e81889 - altair processSyncCommitteeUpdates 1.7060 us/op 791.00 ns/op 2.16
mainnet_e81889 - altair afterProcessEpoch 217.98 ms/op 239.22 ms/op 0.91
altair processInactivityUpdates - 250000 normalcase 57.883 ms/op 63.562 ms/op 0.91
altair processInactivityUpdates - 250000 worstcase 57.988 ms/op 64.420 ms/op 0.90
altair processParticipationFlagUpdates - 250000 anycase 85.454 ms/op 74.173 ms/op 1.15
altair processRewardsAndPenalties - 250000 normalcase 113.81 ms/op 97.932 ms/op 1.16
altair processRewardsAndPenalties - 250000 worstcase 128.18 ms/op 87.845 ms/op 1.46
altair processSyncCommitteeUpdates - 250000 348.68 ms/op 386.73 ms/op 0.90
Tree 40 250000 create 484.85 ms/op 443.69 ms/op 1.09
Tree 40 250000 get(125000) 325.95 ns/op 258.61 ns/op 1.26
Tree 40 250000 set(125000) 1.4072 us/op 1.4004 us/op 1.00
Tree 40 250000 toArray() 37.116 ms/op 33.872 ms/op 1.10
Tree 40 250000 iterate all - toArray() + loop 38.279 ms/op 34.169 ms/op 1.12
Tree 40 250000 iterate all - get(i) 121.15 ms/op 115.81 ms/op 1.05
MutableVector 250000 create 23.945 ms/op 18.303 ms/op 1.31
MutableVector 250000 get(125000) 13.576 ns/op 11.591 ns/op 1.17
MutableVector 250000 set(125000) 504.92 ns/op 457.72 ns/op 1.10
MutableVector 250000 toArray() 8.5725 ms/op 8.6767 ms/op 0.99
MutableVector 250000 iterate all - toArray() + loop 8.9928 ms/op 9.0350 ms/op 1.00
MutableVector 250000 iterate all - get(i) 3.4296 ms/op 3.3524 ms/op 1.02
Array 250000 create 4.7513 ms/op 4.9192 ms/op 0.97
Array 250000 clone - spread 2.1098 ms/op 1.9503 ms/op 1.08
Array 250000 get(125000) 1.0210 ns/op 1.0980 ns/op 0.93
Array 250000 set(125000) 0.99300 ns/op 1.1160 ns/op 0.89
Array 250000 iterate all - loop 168.28 us/op 151.28 us/op 1.11
aggregationBits - 2048 els - readonlyValues 231.44 us/op 196.22 us/op 1.18
aggregationBits - 2048 els - zipIndexesInBitList 37.247 us/op 38.208 us/op 0.97
regular array get 100000 times 67.398 us/op 60.578 us/op 1.11
wrappedArray get 100000 times 67.404 us/op 60.680 us/op 1.11
arrayWithProxy get 100000 times 29.257 ms/op 31.424 ms/op 0.93
ssz.Root.equals 1.0940 us/op 1.3110 us/op 0.83
ssz.Root.equals with valueOf() 1.3490 us/op 1.7280 us/op 0.78
byteArrayEquals with valueOf() 1.2850 us/op 1.6090 us/op 0.80
phase0 processBlock - 250000 vs - 7PWei normalcase 10.930 ms/op 9.7244 ms/op 1.12
phase0 processBlock - 250000 vs - 7PWei worstcase 74.759 ms/op 76.451 ms/op 0.98
phase0 afterProcessEpoch - 250000 vs - 7PWei 205.75 ms/op 242.89 ms/op 0.85
phase0 beforeProcessEpoch - 250000 vs - 7PWei 567.35 ms/op 457.05 ms/op 1.24
phase0 processEpoch - mainnet_e58758 751.02 ms/op 689.35 ms/op 1.09
mainnet_e58758 - phase0 beforeProcessEpoch 448.48 ms/op 369.39 ms/op 1.21
mainnet_e58758 - phase0 processJustificationAndFinalization 58.866 us/op 46.098 us/op 1.28
mainnet_e58758 - phase0 processRewardsAndPenalties 77.764 ms/op 85.457 ms/op 0.91
mainnet_e58758 - phase0 processRegistryUpdates 37.181 us/op 27.524 us/op 1.35
mainnet_e58758 - phase0 processSlashings 3.1200 us/op 915.00 ns/op 3.41
mainnet_e58758 - phase0 processEth1DataReset 2.2510 us/op 871.00 ns/op 2.58
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 10.231 ms/op 8.7556 ms/op 1.17
mainnet_e58758 - phase0 processSlashingsReset 12.106 us/op 5.3670 us/op 2.26
mainnet_e58758 - phase0 processRandaoMixesReset 17.379 us/op 7.8680 us/op 2.21
mainnet_e58758 - phase0 processHistoricalRootsUpdate 3.9960 us/op 1.0170 us/op 3.93
mainnet_e58758 - phase0 processParticipationRecordUpdates 15.896 us/op 6.3900 us/op 2.49
mainnet_e58758 - phase0 afterProcessEpoch 181.36 ms/op 195.60 ms/op 0.93
phase0 processEffectiveBalanceUpdates - 250000 normalcase 11.676 ms/op 10.250 ms/op 1.14
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.1451 s/op 1.0664 s/op 1.07
phase0 processRegistryUpdates - 250000 normalcase 36.184 us/op 27.419 us/op 1.32
phase0 processRegistryUpdates - 250000 badcase_full_deposits 2.7246 ms/op 2.6509 ms/op 1.03
phase0 processRegistryUpdates - 250000 worstcase 0.5 1.4367 s/op 1.4342 s/op 1.00
phase0 getAttestationDeltas - 250000 normalcase 36.146 ms/op 38.659 ms/op 0.94
phase0 getAttestationDeltas - 250000 worstcase 46.577 ms/op 38.761 ms/op 1.20
phase0 processSlashings - 250000 worstcase 31.675 ms/op 31.418 ms/op 1.01
shuffle list - 16384 els 12.597 ms/op 14.208 ms/op 0.89
shuffle list - 250000 els 181.33 ms/op 200.09 ms/op 0.91
getEffectiveBalances - 250000 vs - 7PWei 13.571 ms/op 16.341 ms/op 0.83
computeDeltas 3.5432 ms/op 3.3253 ms/op 1.07
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.6697 ms/op 2.0936 ms/op 1.28
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 691.29 us/op 608.96 us/op 1.14
BLS verify - blst-native 1.8608 ms/op 2.1807 ms/op 0.85
BLS verifyMultipleSignatures 3 - blst-native 3.8179 ms/op 4.5103 ms/op 0.85
BLS verifyMultipleSignatures 8 - blst-native 8.2252 ms/op 9.7527 ms/op 0.84
BLS verifyMultipleSignatures 32 - blst-native 29.857 ms/op 35.397 ms/op 0.84
BLS aggregatePubkeys 32 - blst-native 39.480 us/op 46.770 us/op 0.84
BLS aggregatePubkeys 128 - blst-native 153.59 us/op 182.42 us/op 0.84
getAttestationsForBlock 76.704 ms/op 66.541 ms/op 1.15
CheckpointStateCache - add get delete 15.877 us/op 14.720 us/op 1.08
validate gossip signedAggregateAndProof - struct 4.4438 ms/op 5.2192 ms/op 0.85
validate gossip signedAggregateAndProof - treeBacked 4.4254 ms/op 5.2416 ms/op 0.84
validate gossip attestation - struct 2.0920 ms/op 2.4494 ms/op 0.85
validate gossip attestation - treeBacked 2.1166 ms/op 2.4618 ms/op 0.86
Object access 1 prop 0.35200 ns/op 0.34700 ns/op 1.01
Map access 1 prop 0.28300 ns/op 0.30300 ns/op 0.93
Object get x1000 18.329 ns/op 11.376 ns/op 1.61
Map get x1000 0.98200 ns/op 0.93300 ns/op 1.05
Object set x1000 121.11 ns/op 74.460 ns/op 1.63
Map set x1000 71.152 ns/op 49.109 ns/op 1.45
Return object 10000 times 0.37050 ns/op 0.43800 ns/op 0.85
Throw Error 10000 times 5.8570 us/op 5.9587 us/op 0.98

by benchmarkbot/action

@codecov
Copy link

codecov bot commented Dec 3, 2021

Codecov Report

Merging #3477 (4196cd3) into master (a540693) will increase coverage by 0.03%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3477      +/-   ##
==========================================
+ Coverage   37.83%   37.86%   +0.03%     
==========================================
  Files         307      307              
  Lines        8094     8098       +4     
  Branches     1246     1246              
==========================================
+ Hits         3062     3066       +4     
  Misses       4880     4880              
  Partials      152      152              

@dapplion dapplion merged commit 1f2fdf8 into master Dec 3, 2021
@dapplion dapplion deleted the dapplion/sync-period-offset branch December 3, 2021 11:03
@etan-status
Copy link
Contributor

This PR seems incorrect. ALTAIR does not necessarily start on a sync committee period boundary, making the initial sync committee period shorter than the remaining ones.

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.

None yet

3 participants