Skip to content

add eslint rule to help with import order - #3790

Closed
dadepo wants to merge 3 commits into
masterfrom
dadepo/es-lint-import
Closed

add eslint rule to help with import order#3790
dadepo wants to merge 3 commits into
masterfrom
dadepo/es-lint-import

Conversation

@dadepo

@dadepo dadepo commented Feb 25, 2022

Copy link
Copy Markdown
Contributor

Motivation

In a previous PR it was pointed out that the preferred order for imports should be:

  1. Non-chainsafe modules
  2. @ chainsafe modules
  3. Local paths

This PR enforces this via eslint to make it more applicable. It also updates existing import to adhere with the import rule

@github-actions

github-actions Bot commented Feb 25, 2022

Copy link
Copy Markdown
Contributor

Performance Report

鉁旓笍 no performance regression detected

Full benchmark results
Benchmark suite Current: 26a1471 Previous: a222e42 Ratio
BeaconState.hashTreeRoot - No change 616.00 ns/op 635.00 ns/op 0.97
BeaconState.hashTreeRoot - 1 full validator 132.98 us/op 164.82 us/op 0.81
BeaconState.hashTreeRoot - 32 full validator 2.0913 ms/op 2.4429 ms/op 0.86
BeaconState.hashTreeRoot - 512 full validator 27.395 ms/op 33.121 ms/op 0.83
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 139.21 us/op 168.85 us/op 0.82
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.4977 ms/op 2.8833 ms/op 0.87
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 30.477 ms/op 35.029 ms/op 0.87
BeaconState.hashTreeRoot - 1 balances 102.55 us/op 114.06 us/op 0.90
BeaconState.hashTreeRoot - 32 balances 850.85 us/op 952.03 us/op 0.89
BeaconState.hashTreeRoot - 512 balances 8.1820 ms/op 9.1126 ms/op 0.90
BeaconState.hashTreeRoot - 250000 balances 173.80 ms/op 174.74 ms/op 0.99
processSlot - 1 slots 59.171 us/op 73.279 us/op 0.81
processSlot - 32 slots 3.2066 ms/op 3.9761 ms/op 0.81
getCommitteeAssignments - req 1 vs - 250000 vc 6.0011 ms/op 5.3792 ms/op 1.12
getCommitteeAssignments - req 100 vs - 250000 vc 8.2330 ms/op 7.7328 ms/op 1.06
getCommitteeAssignments - req 1000 vs - 250000 vc 8.5285 ms/op 8.9325 ms/op 0.95
computeProposers - vc 250000 23.056 ms/op 28.462 ms/op 0.81
computeEpochShuffling - vc 250000 208.31 ms/op 214.59 ms/op 0.97
getNextSyncCommittee - vc 250000 383.70 ms/op 465.50 ms/op 0.82
altair processAttestation - 250000 vs - 7PWei normalcase 40.413 ms/op 45.107 ms/op 0.90
altair processAttestation - 250000 vs - 7PWei worstcase 38.934 ms/op 44.384 ms/op 0.88
altair processAttestation - setStatus - 1/6 committees join 12.665 ms/op 15.744 ms/op 0.80
altair processAttestation - setStatus - 1/3 committees join 25.627 ms/op 32.068 ms/op 0.80
altair processAttestation - setStatus - 1/2 committees join 39.490 ms/op 47.967 ms/op 0.82
altair processAttestation - setStatus - 2/3 committees join 53.252 ms/op 63.298 ms/op 0.84
altair processAttestation - setStatus - 4/5 committees join 61.451 ms/op 75.258 ms/op 0.82
altair processAttestation - setStatus - 100% committees join 80.530 ms/op 90.781 ms/op 0.89
altair processAttestation - updateEpochParticipants - 1/6 committees join 11.002 ms/op 15.811 ms/op 0.70
altair processAttestation - updateEpochParticipants - 1/3 committees join 23.376 ms/op 32.745 ms/op 0.71
altair processAttestation - updateEpochParticipants - 1/2 committees join 21.738 ms/op 23.451 ms/op 0.93
altair processAttestation - updateEpochParticipants - 2/3 committees join 22.956 ms/op 24.696 ms/op 0.93
altair processAttestation - updateEpochParticipants - 4/5 committees join 24.520 ms/op 25.829 ms/op 0.95
altair processAttestation - updateEpochParticipants - 100% committees join 29.233 ms/op 28.431 ms/op 1.03
altair processAttestation - updateAllStatus 20.250 ms/op 20.442 ms/op 0.99
altair processBlock - 250000 vs - 7PWei normalcase 35.446 ms/op 38.019 ms/op 0.93
altair processBlock - 250000 vs - 7PWei worstcase 112.71 ms/op 127.67 ms/op 0.88
altair processEpoch - mainnet_e81889 815.89 ms/op 934.12 ms/op 0.87
mainnet_e81889 - altair beforeProcessEpoch 304.59 ms/op 389.18 ms/op 0.78
mainnet_e81889 - altair processJustificationAndFinalization 89.734 us/op 126.22 us/op 0.71
mainnet_e81889 - altair processInactivityUpdates 19.399 ms/op 20.124 ms/op 0.96
mainnet_e81889 - altair processRewardsAndPenalties 124.60 ms/op 114.41 ms/op 1.09
mainnet_e81889 - altair processRegistryUpdates 11.410 us/op 22.946 us/op 0.50
mainnet_e81889 - altair processSlashings 3.5440 us/op 6.6390 us/op 0.53
mainnet_e81889 - altair processEth1DataReset 3.0140 us/op 6.0790 us/op 0.50
mainnet_e81889 - altair processEffectiveBalanceUpdates 6.8621 ms/op 7.8439 ms/op 0.87
mainnet_e81889 - altair processSlashingsReset 20.066 us/op 34.158 us/op 0.59
mainnet_e81889 - altair processRandaoMixesReset 24.928 us/op 45.448 us/op 0.55
mainnet_e81889 - altair processHistoricalRootsUpdate 4.8120 us/op 8.5790 us/op 0.56
mainnet_e81889 - altair processParticipationFlagUpdates 87.162 ms/op 92.676 ms/op 0.94
mainnet_e81889 - altair processSyncCommitteeUpdates 3.6460 us/op 7.2570 us/op 0.50
mainnet_e81889 - altair afterProcessEpoch 250.31 ms/op 255.63 ms/op 0.98
altair processInactivityUpdates - 250000 normalcase 76.925 ms/op 90.199 ms/op 0.85
altair processInactivityUpdates - 250000 worstcase 83.763 ms/op 98.479 ms/op 0.85
altair processParticipationFlagUpdates - 250000 anycase 65.860 ms/op 75.601 ms/op 0.87
altair processRewardsAndPenalties - 250000 normalcase 117.30 ms/op 102.83 ms/op 1.14
altair processRewardsAndPenalties - 250000 worstcase 87.074 ms/op 120.37 ms/op 0.72
altair processSyncCommitteeUpdates - 250000 378.54 ms/op 455.81 ms/op 0.83
Tree 40 250000 create 646.25 ms/op 921.46 ms/op 0.70
Tree 40 250000 get(125000) 340.58 ns/op 353.15 ns/op 0.96
Tree 40 250000 set(125000) 2.0564 us/op 3.1146 us/op 0.66
Tree 40 250000 toArray() 40.858 ms/op 54.203 ms/op 0.75
Tree 40 250000 iterate all - toArray() + loop 40.235 ms/op 48.140 ms/op 0.84
Tree 40 250000 iterate all - get(i) 125.12 ms/op 138.37 ms/op 0.90
MutableVector 250000 create 24.869 ms/op 21.288 ms/op 1.17
MutableVector 250000 get(125000) 13.063 ns/op 17.657 ns/op 0.74
MutableVector 250000 set(125000) 490.43 ns/op 673.36 ns/op 0.73
MutableVector 250000 toArray() 8.9800 ms/op 9.8059 ms/op 0.92
MutableVector 250000 iterate all - toArray() + loop 9.2731 ms/op 10.014 ms/op 0.93
MutableVector 250000 iterate all - get(i) 3.4434 ms/op 3.6650 ms/op 0.94
Array 250000 create 5.9017 ms/op 5.6774 ms/op 1.04
Array 250000 clone - spread 2.2412 ms/op 2.2052 ms/op 1.02
Array 250000 get(125000) 1.1300 ns/op 1.1260 ns/op 1.00
Array 250000 set(125000) 1.0900 ns/op 1.1090 ns/op 0.98
Array 250000 iterate all - loop 178.13 us/op 148.23 us/op 1.20
effectiveBalanceIncrements clone Uint8Array 300000 75.191 us/op 237.35 us/op 0.32
effectiveBalanceIncrements clone MutableVector 300000 576.00 ns/op 564.00 ns/op 1.02
effectiveBalanceIncrements rw all Uint8Array 300000 332.80 us/op 203.47 us/op 1.64
effectiveBalanceIncrements rw all MutableVector 300000 173.64 ms/op 218.67 ms/op 0.79
aggregationBits - 2048 els - readonlyValues 189.87 us/op 217.69 us/op 0.87
aggregationBits - 2048 els - zipIndexesInBitList 32.548 us/op 40.280 us/op 0.81
regular array get 100000 times 72.902 us/op 59.636 us/op 1.22
wrappedArray get 100000 times 72.766 us/op 59.417 us/op 1.22
arrayWithProxy get 100000 times 34.916 ms/op 44.821 ms/op 0.78
ssz.Root.equals 1.1630 us/op 1.2770 us/op 0.91
ssz.Root.equals with valueOf() 1.3660 us/op 1.4120 us/op 0.97
byteArrayEquals with valueOf() 1.2550 us/op 1.3990 us/op 0.90
phase0 processBlock - 250000 vs - 7PWei normalcase 8.2723 ms/op 10.526 ms/op 0.79
phase0 processBlock - 250000 vs - 7PWei worstcase 77.014 ms/op 90.445 ms/op 0.85
phase0 afterProcessEpoch - 250000 vs - 7PWei 221.43 ms/op 221.89 ms/op 1.00
phase0 beforeProcessEpoch - 250000 vs - 7PWei 549.80 ms/op 690.97 ms/op 0.80
phase0 processEpoch - mainnet_e58758 802.42 ms/op 923.46 ms/op 0.87
mainnet_e58758 - phase0 beforeProcessEpoch 444.20 ms/op 532.15 ms/op 0.83
mainnet_e58758 - phase0 processJustificationAndFinalization 80.447 us/op 111.25 us/op 0.72
mainnet_e58758 - phase0 processRewardsAndPenalties 98.534 ms/op 126.45 ms/op 0.78
mainnet_e58758 - phase0 processRegistryUpdates 54.294 us/op 85.017 us/op 0.64
mainnet_e58758 - phase0 processSlashings 4.2230 us/op 6.2920 us/op 0.67
mainnet_e58758 - phase0 processEth1DataReset 2.7410 us/op 5.8190 us/op 0.47
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 5.7570 ms/op 5.8145 ms/op 0.99
mainnet_e58758 - phase0 processSlashingsReset 17.148 us/op 29.945 us/op 0.57
mainnet_e58758 - phase0 processRandaoMixesReset 20.944 us/op 35.006 us/op 0.60
mainnet_e58758 - phase0 processHistoricalRootsUpdate 3.6500 us/op 8.1600 us/op 0.45
mainnet_e58758 - phase0 processParticipationRecordUpdates 12.330 us/op 30.727 us/op 0.40
mainnet_e58758 - phase0 afterProcessEpoch 192.10 ms/op 193.39 ms/op 0.99
phase0 processEffectiveBalanceUpdates - 250000 normalcase 7.0225 ms/op 6.7626 ms/op 1.04
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 7.1716 ms/op 7.2546 ms/op 0.99
phase0 processRegistryUpdates - 250000 normalcase 40.752 us/op 93.540 us/op 0.44
phase0 processRegistryUpdates - 250000 badcase_full_deposits 3.0129 ms/op 4.2855 ms/op 0.70
phase0 processRegistryUpdates - 250000 worstcase 0.5 1.6006 s/op 2.4120 s/op 0.66
phase0 getAttestationDeltas - 250000 normalcase 13.737 ms/op 14.599 ms/op 0.94
phase0 getAttestationDeltas - 250000 worstcase 13.505 ms/op 15.045 ms/op 0.90
phase0 processSlashings - 250000 worstcase 32.782 ms/op 39.444 ms/op 0.83
shuffle list - 16384 els 13.990 ms/op 14.739 ms/op 0.95
shuffle list - 250000 els 194.75 ms/op 198.61 ms/op 0.98
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 491.48 us/op 1.0953 ms/op 0.45
pass gossip attestations to forkchoice per slot 15.327 ms/op 23.791 ms/op 0.64
computeDeltas 3.8466 ms/op 4.0943 ms/op 0.94
computeProposerBoostScoreFromBalances 526.97 us/op 475.67 us/op 1.11
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.2369 ms/op 2.1018 ms/op 1.06
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 680.92 us/op 736.86 us/op 0.92
BLS verify - blst-native 2.0532 ms/op 2.1888 ms/op 0.94
BLS verifyMultipleSignatures 3 - blst-native 4.3680 ms/op 4.5778 ms/op 0.95
BLS verifyMultipleSignatures 8 - blst-native 8.8991 ms/op 9.5036 ms/op 0.94
BLS verifyMultipleSignatures 32 - blst-native 33.283 ms/op 34.415 ms/op 0.97
BLS aggregatePubkeys 32 - blst-native 45.209 us/op 48.322 us/op 0.94
BLS aggregatePubkeys 128 - blst-native 169.66 us/op 184.63 us/op 0.92
getAttestationsForBlock 72.384 ms/op 67.911 ms/op 1.07
CheckpointStateCache - add get delete 19.873 us/op 21.609 us/op 0.92
validate gossip signedAggregateAndProof - struct 4.8377 ms/op 5.2597 ms/op 0.92
validate gossip signedAggregateAndProof - treeBacked 4.9616 ms/op 5.0580 ms/op 0.98
validate gossip attestation - struct 2.2567 ms/op 2.4447 ms/op 0.92
validate gossip attestation - treeBacked 2.2839 ms/op 2.4215 ms/op 0.94
pickEth1Vote - no votes 10.530 ms/op 9.7080 ms/op 1.08
pickEth1Vote - max votes 51.263 ms/op 60.912 ms/op 0.84
pickEth1Vote - Eth1Data hashTreeRoot value x2048 27.313 ms/op 28.530 ms/op 0.96
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 10.402 ms/op 11.210 ms/op 0.93
pickEth1Vote - Eth1Data fastSerialize value x2048 5.4382 ms/op 5.8430 ms/op 0.93
pickEth1Vote - Eth1Data fastSerialize tree x2048 25.373 ms/op 35.271 ms/op 0.72
bytes32 toHexString 1.9360 us/op 2.0050 us/op 0.97
bytes32 Buffer.toString(hex) 821.00 ns/op 812.00 ns/op 1.01
bytes32 Buffer.toString(hex) from Uint8Array 1.0680 us/op 1.0740 us/op 0.99
bytes32 Buffer.toString(hex) + 0x 825.00 ns/op 793.00 ns/op 1.04
Object access 1 prop 0.41100 ns/op 0.38800 ns/op 1.06
Map access 1 prop 0.33200 ns/op 0.32900 ns/op 1.01
Object get x1000 19.228 ns/op 16.495 ns/op 1.17
Map get x1000 1.0920 ns/op 0.94700 ns/op 1.15
Object set x1000 114.71 ns/op 115.15 ns/op 1.00
Map set x1000 73.221 ns/op 72.667 ns/op 1.01
Return object 10000 times 0.40920 ns/op 0.40230 ns/op 1.02
Throw Error 10000 times 6.3376 us/op 6.4981 us/op 0.98
enrSubnets - fastDeserialize 64 bits 1.4730 us/op 1.3320 us/op 1.11
enrSubnets - ssz BitVector 64 bits 18.470 us/op 17.914 us/op 1.03
enrSubnets - fastDeserialize 4 bits 533.00 ns/op 483.00 ns/op 1.10
enrSubnets - ssz BitVector 4 bits 3.3030 us/op 3.0100 us/op 1.10
RateTracker 1000000 limit, 1 obj count per request 202.70 ns/op 209.33 ns/op 0.97
RateTracker 1000000 limit, 2 obj count per request 153.64 ns/op 148.58 ns/op 1.03
RateTracker 1000000 limit, 4 obj count per request 126.65 ns/op 119.02 ns/op 1.06
RateTracker 1000000 limit, 8 obj count per request 114.96 ns/op 112.94 ns/op 1.02
RateTracker with prune 4.7240 us/op 4.8280 us/op 0.98
array of 16000 items push then shift 3.5399 us/op 5.0791 us/op 0.70
LinkedList of 16000 items push then shift 18.009 ns/op 18.203 ns/op 0.99
array of 16000 items push then pop 237.80 ns/op 229.63 ns/op 1.04
LinkedList of 16000 items push then pop 16.970 ns/op 17.423 ns/op 0.97
array of 24000 items push then shift 5.1471 us/op 7.6547 us/op 0.67
LinkedList of 24000 items push then shift 21.552 ns/op 18.509 ns/op 1.16
array of 24000 items push then pop 220.65 ns/op 218.63 ns/op 1.01
LinkedList of 24000 items push then pop 18.360 ns/op 16.304 ns/op 1.13

by benchmarkbot/action

@codecov

codecov Bot commented Feb 25, 2022

Copy link
Copy Markdown

Codecov Report

Merging #3790 (363af0d) into master (a222e42) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #3790   +/-   ##
=======================================
  Coverage   36.77%   36.77%           
=======================================
  Files         322      322           
  Lines        8812     8812           
  Branches     1371     1371           
=======================================
  Hits         3241     3241           
  Misses       5429     5429           
  Partials      142      142           

@dadepo

dadepo commented Feb 25, 2022

Copy link
Copy Markdown
Contributor Author

As agreed during the planning meeting, please wait till the ssz refactor is merged before merging this.
Edit: Converted to draft to make it more obvious it should not be merged yet

@dadepo
dadepo marked this pull request as draft March 1, 2022 09:35

@dapplion dapplion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Blocking to after merging #3760

@dadepo

dadepo commented Apr 5, 2022

Copy link
Copy Markdown
Contributor Author

Easier to branch from master again and apply the eslint fix (as it has been done here #3885), rather than trying to fix this merge conflict. Hence closing this issue.

@dadepo dadepo closed this Apr 5, 2022
@dapplion

dapplion commented Apr 5, 2022

Copy link
Copy Markdown
Contributor

Easier to branch from master again and apply the eslint fix (as it has been done here, rather than trying to fix this merge conflict. Hence closing this issue.

For new PRs you can still force reset a branch at a different point to persist the PR since it's attempting the same thing

@dapplion
dapplion deleted the dadepo/es-lint-import branch August 6, 2022 08:13
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.

3 participants