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

Allow genesis PoW block to reach TTD #3655

Merged
merged 1 commit into from
Jan 25, 2022
Merged

Allow genesis PoW block to reach TTD #3655

merged 1 commit into from
Jan 25, 2022

Conversation

g11tech
Copy link
Contributor

@g11tech g11tech commented Jan 22, 2022

Motivation
It was discovered that the current logic of discovering terminal block fails if the PoW chain starts from genesis > TTD as its parent doesn't exists. This was corrected as part of spec 1.1.6: ethereum/consensus-specs#2719

This PR updates the terminal block finding logic to allow accepting genesis block for TTD.

Closes #3483, Partially #3410

@codecov
Copy link

codecov bot commented Jan 22, 2022

Codecov Report

Merging #3655 (5bcbc74) into master (f9cb593) will decrease coverage by 0.00%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3655      +/-   ##
==========================================
- Coverage   37.16%   37.15%   -0.01%     
==========================================
  Files         321      321              
  Lines        8696     8698       +2     
  Branches     1348     1349       +1     
==========================================
  Hits         3232     3232              
- Misses       5319     5321       +2     
  Partials      145      145              

@codeclimate
Copy link

codeclimate bot commented Jan 22, 2022

Code Climate has analyzed commit 5bcbc74 and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

View more on Code Climate.

@g11tech g11tech linked an issue Jan 22, 2022 that may be closed by this pull request
24 tasks
@github-actions
Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 40bc4ad Previous: f9cb593 Ratio
BeaconState.hashTreeRoot - No change 630.00 ns/op 609.00 ns/op 1.03
BeaconState.hashTreeRoot - 1 full validator 157.29 us/op 159.44 us/op 0.99
BeaconState.hashTreeRoot - 32 full validator 2.4629 ms/op 2.3704 ms/op 1.04
BeaconState.hashTreeRoot - 512 full validator 30.759 ms/op 31.651 ms/op 0.97
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 158.70 us/op 175.12 us/op 0.91
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.4212 ms/op 2.4974 ms/op 0.97
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 32.932 ms/op 33.576 ms/op 0.98
BeaconState.hashTreeRoot - 1 balances 110.60 us/op 108.47 us/op 1.02
BeaconState.hashTreeRoot - 32 balances 926.74 us/op 986.89 us/op 0.94
BeaconState.hashTreeRoot - 512 balances 8.8335 ms/op 8.9634 ms/op 0.99
BeaconState.hashTreeRoot - 250000 balances 165.95 ms/op 173.64 ms/op 0.96
processSlot - 1 slots 66.644 us/op 63.504 us/op 1.05
processSlot - 32 slots 3.6631 ms/op 3.8824 ms/op 0.94
getCommitteeAssignments - req 1 vs - 250000 vc 5.1220 ms/op 4.9995 ms/op 1.02
getCommitteeAssignments - req 100 vs - 250000 vc 7.1562 ms/op 7.1395 ms/op 1.00
getCommitteeAssignments - req 1000 vs - 250000 vc 7.9865 ms/op 7.6830 ms/op 1.04
computeProposers - vc 250000 24.230 ms/op 23.805 ms/op 1.02
computeEpochShuffling - vc 250000 190.05 ms/op 192.56 ms/op 0.99
getNextSyncCommittee - vc 250000 397.12 ms/op 393.42 ms/op 1.01
altair processAttestation - 250000 vs - 7PWei normalcase 49.742 ms/op 48.600 ms/op 1.02
altair processAttestation - 250000 vs - 7PWei worstcase 51.922 ms/op 47.806 ms/op 1.09
altair processAttestation - setStatus - 1/6 committees join 13.928 ms/op 13.250 ms/op 1.05
altair processAttestation - setStatus - 1/3 committees join 30.211 ms/op 28.716 ms/op 1.05
altair processAttestation - setStatus - 1/2 committees join 41.255 ms/op 43.438 ms/op 0.95
altair processAttestation - setStatus - 2/3 committees join 56.626 ms/op 59.659 ms/op 0.95
altair processAttestation - setStatus - 4/5 committees join 68.921 ms/op 69.598 ms/op 0.99
altair processAttestation - setStatus - 100% committees join 86.830 ms/op 90.314 ms/op 0.96
altair processAttestation - updateEpochParticipants - 1/6 committees join 14.897 ms/op 14.648 ms/op 1.02
altair processAttestation - updateEpochParticipants - 1/3 committees join 30.346 ms/op 30.095 ms/op 1.01
altair processAttestation - updateEpochParticipants - 1/2 committees join 30.826 ms/op 33.499 ms/op 0.92
altair processAttestation - updateEpochParticipants - 2/3 committees join 35.750 ms/op 28.366 ms/op 1.26
altair processAttestation - updateEpochParticipants - 4/5 committees join 34.842 ms/op 29.527 ms/op 1.18
altair processAttestation - updateEpochParticipants - 100% committees join 34.615 ms/op 30.929 ms/op 1.12
altair processAttestation - updateAllStatus 25.581 ms/op 22.470 ms/op 1.14
altair processBlock - 250000 vs - 7PWei normalcase 52.736 ms/op 52.853 ms/op 1.00
altair processBlock - 250000 vs - 7PWei worstcase 142.42 ms/op 145.40 ms/op 0.98
altair processEpoch - mainnet_e81889 1.1370 s/op 1.1122 s/op 1.02
mainnet_e81889 - altair beforeProcessEpoch 401.44 ms/op 293.17 ms/op 1.37
mainnet_e81889 - altair processJustificationAndFinalization 123.70 us/op 127.37 us/op 0.97
mainnet_e81889 - altair processInactivityUpdates 17.824 ms/op 18.736 ms/op 0.95
mainnet_e81889 - altair processRewardsAndPenalties 148.72 ms/op 194.97 ms/op 0.76
mainnet_e81889 - altair processRegistryUpdates 21.358 us/op 23.212 us/op 0.92
mainnet_e81889 - altair processSlashings 6.7120 us/op 5.7900 us/op 1.16
mainnet_e81889 - altair processEth1DataReset 7.2250 us/op 6.4380 us/op 1.12
mainnet_e81889 - altair processEffectiveBalanceUpdates 12.803 ms/op 12.646 ms/op 1.01
mainnet_e81889 - altair processSlashingsReset 37.099 us/op 40.261 us/op 0.92
mainnet_e81889 - altair processRandaoMixesReset 41.432 us/op 49.903 us/op 0.83
mainnet_e81889 - altair processHistoricalRootsUpdate 8.3590 us/op 11.999 us/op 0.70
mainnet_e81889 - altair processParticipationFlagUpdates 111.14 ms/op 103.20 ms/op 1.08
mainnet_e81889 - altair processSyncCommitteeUpdates 6.2240 us/op 6.0910 us/op 1.02
mainnet_e81889 - altair afterProcessEpoch 263.95 ms/op 231.37 ms/op 1.14
altair processInactivityUpdates - 250000 normalcase 87.290 ms/op 112.81 ms/op 0.77
altair processInactivityUpdates - 250000 worstcase 72.712 ms/op 120.61 ms/op 0.60
altair processParticipationFlagUpdates - 250000 anycase 124.15 ms/op 108.71 ms/op 1.14
altair processRewardsAndPenalties - 250000 normalcase 159.45 ms/op 154.48 ms/op 1.03
altair processRewardsAndPenalties - 250000 worstcase 158.78 ms/op 148.87 ms/op 1.07
altair processSyncCommitteeUpdates - 250000 440.04 ms/op 410.66 ms/op 1.07
Tree 40 250000 create 977.33 ms/op 1.0024 s/op 0.97
Tree 40 250000 get(125000) 325.97 ns/op 340.44 ns/op 0.96
Tree 40 250000 set(125000) 2.2273 us/op 2.2930 us/op 0.97
Tree 40 250000 toArray() 55.207 ms/op 41.475 ms/op 1.33
Tree 40 250000 iterate all - toArray() + loop 43.900 ms/op 48.289 ms/op 0.91
Tree 40 250000 iterate all - get(i) 126.62 ms/op 126.88 ms/op 1.00
MutableVector 250000 create 26.392 ms/op 27.334 ms/op 0.97
MutableVector 250000 get(125000) 14.567 ns/op 14.675 ns/op 0.99
MutableVector 250000 set(125000) 628.60 ns/op 695.34 ns/op 0.90
MutableVector 250000 toArray() 8.9691 ms/op 8.8668 ms/op 1.01
MutableVector 250000 iterate all - toArray() + loop 8.5217 ms/op 8.9496 ms/op 0.95
MutableVector 250000 iterate all - get(i) 3.5609 ms/op 3.6344 ms/op 0.98
Array 250000 create 5.3733 ms/op 5.1774 ms/op 1.04
Array 250000 clone - spread 2.5487 ms/op 2.2036 ms/op 1.16
Array 250000 get(125000) 1.1410 ns/op 1.1150 ns/op 1.02
Array 250000 set(125000) 1.1380 ns/op 1.1330 ns/op 1.00
Array 250000 iterate all - loop 132.21 us/op 132.94 us/op 0.99
aggregationBits - 2048 els - readonlyValues 243.30 us/op 237.80 us/op 1.02
aggregationBits - 2048 els - zipIndexesInBitList 48.912 us/op 40.075 us/op 1.22
regular array get 100000 times 54.202 us/op 52.234 us/op 1.04
wrappedArray get 100000 times 54.159 us/op 54.583 us/op 0.99
arrayWithProxy get 100000 times 33.798 ms/op 33.350 ms/op 1.01
ssz.Root.equals 1.2950 us/op 1.1170 us/op 1.16
ssz.Root.equals with valueOf() 1.7640 us/op 1.4920 us/op 1.18
byteArrayEquals with valueOf() 1.5260 us/op 1.4010 us/op 1.09
phase0 processBlock - 250000 vs - 7PWei normalcase 13.341 ms/op 12.966 ms/op 1.03
phase0 processBlock - 250000 vs - 7PWei worstcase 96.487 ms/op 104.18 ms/op 0.93
phase0 afterProcessEpoch - 250000 vs - 7PWei 220.14 ms/op 215.66 ms/op 1.02
phase0 beforeProcessEpoch - 250000 vs - 7PWei 765.45 ms/op 750.79 ms/op 1.02
phase0 processEpoch - mainnet_e58758 1.0197 s/op 935.25 ms/op 1.09
mainnet_e58758 - phase0 beforeProcessEpoch 604.28 ms/op 525.64 ms/op 1.15
mainnet_e58758 - phase0 processJustificationAndFinalization 111.88 us/op 120.67 us/op 0.93
mainnet_e58758 - phase0 processRewardsAndPenalties 144.08 ms/op 127.90 ms/op 1.13
mainnet_e58758 - phase0 processRegistryUpdates 122.12 us/op 137.21 us/op 0.89
mainnet_e58758 - phase0 processSlashings 7.0980 us/op 8.2050 us/op 0.87
mainnet_e58758 - phase0 processEth1DataReset 6.4820 us/op 7.0950 us/op 0.91
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 10.348 ms/op 10.974 ms/op 0.94
mainnet_e58758 - phase0 processSlashingsReset 30.257 us/op 33.054 us/op 0.92
mainnet_e58758 - phase0 processRandaoMixesReset 40.743 us/op 45.157 us/op 0.90
mainnet_e58758 - phase0 processHistoricalRootsUpdate 8.0220 us/op 8.8080 us/op 0.91
mainnet_e58758 - phase0 processParticipationRecordUpdates 33.937 us/op 25.242 us/op 1.34
mainnet_e58758 - phase0 afterProcessEpoch 185.94 ms/op 189.61 ms/op 0.98
phase0 processEffectiveBalanceUpdates - 250000 normalcase 11.684 ms/op 12.409 ms/op 0.94
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.7531 s/op 1.5396 s/op 1.14
phase0 processRegistryUpdates - 250000 normalcase 93.634 us/op 92.552 us/op 1.01
phase0 processRegistryUpdates - 250000 badcase_full_deposits 4.2130 ms/op 3.8679 ms/op 1.09
phase0 processRegistryUpdates - 250000 worstcase 0.5 2.4242 s/op 2.3237 s/op 1.04
phase0 getAttestationDeltas - 250000 normalcase 36.788 ms/op 39.007 ms/op 0.94
phase0 getAttestationDeltas - 250000 worstcase 36.277 ms/op 36.754 ms/op 0.99
phase0 processSlashings - 250000 worstcase 41.140 ms/op 43.583 ms/op 0.94
shuffle list - 16384 els 13.645 ms/op 13.468 ms/op 1.01
shuffle list - 250000 els 184.18 ms/op 190.67 ms/op 0.97
getEffectiveBalances - 250000 vs - 7PWei 10.911 ms/op 11.390 ms/op 0.96
pass gossip attestations to forkchoice per slot 18.683 ms/op 17.853 ms/op 1.05
computeDeltas 3.6692 ms/op 3.7698 ms/op 0.97
computeProposerBoostScoreFromBalances 276.05 us/op 272.89 us/op 1.01
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.5848 ms/op 2.3276 ms/op 1.11
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 753.02 us/op 712.70 us/op 1.06
BLS verify - blst-native 2.0787 ms/op 2.6380 ms/op 0.79
BLS verifyMultipleSignatures 3 - blst-native 4.2350 ms/op 5.2770 ms/op 0.80
BLS verifyMultipleSignatures 8 - blst-native 9.4541 ms/op 10.713 ms/op 0.88
BLS verifyMultipleSignatures 32 - blst-native 33.548 ms/op 39.395 ms/op 0.85
BLS aggregatePubkeys 32 - blst-native 43.952 us/op 52.204 us/op 0.84
BLS aggregatePubkeys 128 - blst-native 180.61 us/op 206.41 us/op 0.88
getAttestationsForBlock 106.19 ms/op 99.368 ms/op 1.07
CheckpointStateCache - add get delete 22.181 us/op 21.242 us/op 1.04
validate gossip signedAggregateAndProof - struct 5.1964 ms/op 5.9653 ms/op 0.87
validate gossip signedAggregateAndProof - treeBacked 5.1557 ms/op 5.9978 ms/op 0.86
validate gossip attestation - struct 2.5519 ms/op 2.9106 ms/op 0.88
validate gossip attestation - treeBacked 2.5000 ms/op 2.8667 ms/op 0.87
bytes32 toHexString 1.7600 us/op 2.0270 us/op 0.87
bytes32 Buffer.toString(hex) 746.00 ns/op 710.00 ns/op 1.05
bytes32 Buffer.toString(hex) from Uint8Array 1.0480 us/op 1.0020 us/op 1.05
bytes32 Buffer.toString(hex) + 0x 787.00 ns/op 749.00 ns/op 1.05
Object access 1 prop 0.36400 ns/op 0.36800 ns/op 0.99
Map access 1 prop 0.33600 ns/op 0.31600 ns/op 1.06
Object get x1000 17.290 ns/op 15.975 ns/op 1.08
Map get x1000 0.90500 ns/op 0.94900 ns/op 0.95
Object set x1000 98.861 ns/op 103.90 ns/op 0.95
Map set x1000 69.829 ns/op 68.768 ns/op 1.02
Return object 10000 times 0.39650 ns/op 0.38690 ns/op 1.02
Throw Error 10000 times 6.5155 us/op 6.4811 us/op 1.01
enrSubnets - fastDeserialize 64 bits 1.3760 us/op 1.3970 us/op 0.98
enrSubnets - ssz BitVector 64 bits 17.922 us/op 17.354 us/op 1.03
enrSubnets - fastDeserialize 4 bits 482.00 ns/op 487.00 ns/op 0.99
enrSubnets - ssz BitVector 4 bits 3.1820 us/op 3.2940 us/op 0.97
RateTracker 1000000 limit, 1 obj count per request 182.24 ns/op 186.06 ns/op 0.98
RateTracker 1000000 limit, 2 obj count per request 134.54 ns/op 138.24 ns/op 0.97
RateTracker 1000000 limit, 4 obj count per request 109.57 ns/op 112.53 ns/op 0.97
RateTracker 1000000 limit, 8 obj count per request 99.426 ns/op 107.44 ns/op 0.93
RateTracker with prune 4.1190 us/op 4.4640 us/op 0.92

by benchmarkbot/action

@g11tech g11tech merged commit e477bb5 into master Jan 25, 2022
@g11tech g11tech deleted the g11tech/powgenesisttd branch January 25, 2022 16:41
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.

Merge spec 1.1.6
2 participants