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

fix: fix eslint for import/no-extraneous-dependencies #5752

Merged
merged 11 commits into from
Jul 12, 2023

Conversation

nazarhussain
Copy link
Contributor

@nazarhussain nazarhussain commented Jul 12, 2023

Motivation

All the packages should have valid dependencies.

Description

  • Fix the eslint rule import/no-extraneous-dependencies which was not effective for mono-repo packages.
  • Fix the package dependencies
  • Update the linting dependencies setup to work with latest Typescript
  • Fix all fixable linting errors
  • Fix few useable linting warnings.

Steps to test or reproduce

Run all tests

NOTE: Would be better to review by commit.

@nazarhussain nazarhussain requested a review from a team as a code owner July 12, 2023 16:32
@nazarhussain nazarhussain self-assigned this Jul 12, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jul 12, 2023

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 71c4f97 Previous: cf659f4 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 541.64 us/op 493.53 us/op 1.10
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 47.299 us/op 44.946 us/op 1.05
BLS verify - blst-native 1.2442 ms/op 1.2133 ms/op 1.03
BLS verifyMultipleSignatures 3 - blst-native 2.5196 ms/op 2.5901 ms/op 0.97
BLS verifyMultipleSignatures 8 - blst-native 5.4021 ms/op 5.3893 ms/op 1.00
BLS verifyMultipleSignatures 32 - blst-native 19.511 ms/op 19.156 ms/op 1.02
BLS aggregatePubkeys 32 - blst-native 25.587 us/op 25.732 us/op 0.99
BLS aggregatePubkeys 128 - blst-native 99.855 us/op 100.42 us/op 0.99
getAttestationsForBlock 53.335 ms/op 59.970 ms/op 0.89
isKnown best case - 1 super set check 250.00 ns/op 257.00 ns/op 0.97
isKnown normal case - 2 super set checks 245.00 ns/op 255.00 ns/op 0.96
isKnown worse case - 16 super set checks 244.00 ns/op 250.00 ns/op 0.98
CheckpointStateCache - add get delete 5.0810 us/op 5.6860 us/op 0.89
validate gossip signedAggregateAndProof - struct 2.7856 ms/op 2.8087 ms/op 0.99
validate gossip attestation - struct 1.3249 ms/op 1.3361 ms/op 0.99
pickEth1Vote - no votes 1.2866 ms/op 1.3552 ms/op 0.95
pickEth1Vote - max votes 9.8350 ms/op 9.8748 ms/op 1.00
pickEth1Vote - Eth1Data hashTreeRoot value x2048 8.5046 ms/op 9.0585 ms/op 0.94
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 15.886 ms/op 16.387 ms/op 0.97
pickEth1Vote - Eth1Data fastSerialize value x2048 738.93 us/op 738.99 us/op 1.00
pickEth1Vote - Eth1Data fastSerialize tree x2048 5.0584 ms/op 7.3969 ms/op 0.68
bytes32 toHexString 544.00 ns/op 536.00 ns/op 1.01
bytes32 Buffer.toString(hex) 414.00 ns/op 366.00 ns/op 1.13
bytes32 Buffer.toString(hex) from Uint8Array 599.00 ns/op 582.00 ns/op 1.03
bytes32 Buffer.toString(hex) + 0x 384.00 ns/op 370.00 ns/op 1.04
Object access 1 prop 0.18100 ns/op 0.18500 ns/op 0.98
Map access 1 prop 0.17300 ns/op 0.15900 ns/op 1.09
Object get x1000 7.0100 ns/op 6.5860 ns/op 1.06
Map get x1000 0.70600 ns/op 0.63100 ns/op 1.12
Object set x1000 61.027 ns/op 54.618 ns/op 1.12
Map set x1000 49.344 ns/op 43.671 ns/op 1.13
Return object 10000 times 0.25470 ns/op 0.24080 ns/op 1.06
Throw Error 10000 times 4.3664 us/op 4.2157 us/op 1.04
fastMsgIdFn sha256 / 200 bytes 3.5450 us/op 3.5620 us/op 1.00
fastMsgIdFn h32 xxhash / 200 bytes 313.00 ns/op 301.00 ns/op 1.04
fastMsgIdFn h64 xxhash / 200 bytes 461.00 ns/op 423.00 ns/op 1.09
fastMsgIdFn sha256 / 1000 bytes 12.012 us/op 11.781 us/op 1.02
fastMsgIdFn h32 xxhash / 1000 bytes 460.00 ns/op 423.00 ns/op 1.09
fastMsgIdFn h64 xxhash / 1000 bytes 543.00 ns/op 500.00 ns/op 1.09
fastMsgIdFn sha256 / 10000 bytes 106.42 us/op 105.01 us/op 1.01
fastMsgIdFn h32 xxhash / 10000 bytes 1.9860 us/op 1.9770 us/op 1.00
fastMsgIdFn h64 xxhash / 10000 bytes 1.3770 us/op 1.3400 us/op 1.03
enrSubnets - fastDeserialize 64 bits 1.3630 us/op 1.3540 us/op 1.01
enrSubnets - ssz BitVector 64 bits 567.00 ns/op 512.00 ns/op 1.11
enrSubnets - fastDeserialize 4 bits 202.00 ns/op 177.00 ns/op 1.14
enrSubnets - ssz BitVector 4 bits 558.00 ns/op 555.00 ns/op 1.01
prioritizePeers score -10:0 att 32-0.1 sync 2-0 122.53 us/op 108.02 us/op 1.13
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 151.99 us/op 150.16 us/op 1.01
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 197.37 us/op 173.01 us/op 1.14
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 347.80 us/op 349.70 us/op 0.99
prioritizePeers score 0:0 att 64-1 sync 4-1 445.33 us/op 429.49 us/op 1.04
array of 16000 items push then shift 1.6911 us/op 1.7046 us/op 0.99
LinkedList of 16000 items push then shift 9.3610 ns/op 9.2790 ns/op 1.01
array of 16000 items push then pop 120.74 ns/op 114.22 ns/op 1.06
LinkedList of 16000 items push then pop 9.0820 ns/op 9.0380 ns/op 1.00
array of 24000 items push then shift 2.6167 us/op 2.4856 us/op 1.05
LinkedList of 24000 items push then shift 9.3730 ns/op 9.4050 ns/op 1.00
array of 24000 items push then pop 82.762 ns/op 91.802 ns/op 0.90
LinkedList of 24000 items push then pop 9.1740 ns/op 9.2040 ns/op 1.00
intersect bitArray bitLen 8 13.662 ns/op 13.709 ns/op 1.00
intersect array and set length 8 86.088 ns/op 83.668 ns/op 1.03
intersect bitArray bitLen 128 45.729 ns/op 44.896 ns/op 1.02
intersect array and set length 128 1.2634 us/op 1.1188 us/op 1.13
Buffer.concat 32 items 3.0760 us/op 2.7560 us/op 1.12
Uint8Array.set 32 items 3.1640 us/op 2.2860 us/op 1.38
transfer serialized Status (84 B) 2.3400 us/op 2.0750 us/op 1.13
copy serialized Status (84 B) 2.0080 us/op 1.6960 us/op 1.18
transfer serialized SignedVoluntaryExit (112 B) 2.4180 us/op 2.1410 us/op 1.13
copy serialized SignedVoluntaryExit (112 B) 2.1070 us/op 1.8700 us/op 1.13
transfer serialized ProposerSlashing (416 B) 3.2100 us/op 3.4040 us/op 0.94
copy serialized ProposerSlashing (416 B) 3.3960 us/op 3.3630 us/op 1.01
transfer serialized Attestation (485 B) 3.4920 us/op 3.4820 us/op 1.00
copy serialized Attestation (485 B) 3.3770 us/op 3.3520 us/op 1.01
transfer serialized AttesterSlashing (33232 B) 3.2340 us/op 3.2510 us/op 0.99
copy serialized AttesterSlashing (33232 B) 8.5280 us/op 7.9570 us/op 1.07
transfer serialized Small SignedBeaconBlock (128000 B) 2.9590 us/op 2.9510 us/op 1.00
copy serialized Small SignedBeaconBlock (128000 B) 22.876 us/op 22.815 us/op 1.00
transfer serialized Avg SignedBeaconBlock (200000 B) 3.7060 us/op 3.7910 us/op 0.98
copy serialized Avg SignedBeaconBlock (200000 B) 31.549 us/op 91.709 us/op 0.34
transfer serialized BlobsSidecar (524380 B) 4.2060 us/op 4.4570 us/op 0.94
copy serialized BlobsSidecar (524380 B) 194.01 us/op 170.34 us/op 1.14
transfer serialized Big SignedBeaconBlock (1000000 B) 3.6570 us/op 4.2860 us/op 0.85
copy serialized Big SignedBeaconBlock (1000000 B) 275.46 us/op 385.79 us/op 0.71
pass gossip attestations to forkchoice per slot 2.9391 ms/op 2.7499 ms/op 1.07
forkChoice updateHead vc 100000 bc 64 eq 0 2.1238 ms/op 2.1240 ms/op 1.00
forkChoice updateHead vc 600000 bc 64 eq 0 12.479 ms/op 11.664 ms/op 1.07
forkChoice updateHead vc 1000000 bc 64 eq 0 24.268 ms/op 22.672 ms/op 1.07
forkChoice updateHead vc 600000 bc 320 eq 0 17.702 ms/op 17.900 ms/op 0.99
forkChoice updateHead vc 600000 bc 1200 eq 0 88.069 ms/op 89.452 ms/op 0.98
forkChoice updateHead vc 600000 bc 64 eq 1000 21.603 ms/op 21.726 ms/op 0.99
forkChoice updateHead vc 600000 bc 64 eq 10000 23.547 ms/op 23.683 ms/op 0.99
forkChoice updateHead vc 600000 bc 64 eq 300000 51.090 ms/op 35.410 ms/op 1.44
computeDeltas 3.6009 ms/op 3.2127 ms/op 1.12
computeProposerBoostScoreFromBalances 1.9346 ms/op 1.8440 ms/op 1.05
altair processAttestation - 250000 vs - 7PWei normalcase 3.5006 ms/op 3.5925 ms/op 0.97
altair processAttestation - 250000 vs - 7PWei worstcase 6.3590 ms/op 5.8822 ms/op 1.08
altair processAttestation - setStatus - 1/6 committees join 185.66 us/op 151.78 us/op 1.22
altair processAttestation - setStatus - 1/3 committees join 320.63 us/op 306.82 us/op 1.05
altair processAttestation - setStatus - 1/2 committees join 420.25 us/op 431.85 us/op 0.97
altair processAttestation - setStatus - 2/3 committees join 493.17 us/op 538.83 us/op 0.92
altair processAttestation - setStatus - 4/5 committees join 773.27 us/op 772.22 us/op 1.00
altair processAttestation - setStatus - 100% committees join 855.84 us/op 923.00 us/op 0.93
altair processBlock - 250000 vs - 7PWei normalcase 20.410 ms/op 21.826 ms/op 0.94
altair processBlock - 250000 vs - 7PWei normalcase hashState 33.574 ms/op 31.554 ms/op 1.06
altair processBlock - 250000 vs - 7PWei worstcase 54.662 ms/op 63.785 ms/op 0.86
altair processBlock - 250000 vs - 7PWei worstcase hashState 81.586 ms/op 84.166 ms/op 0.97
phase0 processBlock - 250000 vs - 7PWei normalcase 2.7642 ms/op 2.9108 ms/op 0.95
phase0 processBlock - 250000 vs - 7PWei worstcase 36.702 ms/op 34.147 ms/op 1.07
altair processEth1Data - 250000 vs - 7PWei normalcase 1.0539 ms/op 678.91 us/op 1.55
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 16.938 us/op 10.649 us/op 1.59
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 38.796 us/op 32.785 us/op 1.18
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 18.090 us/op 13.288 us/op 1.36
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 15.685 us/op 12.960 us/op 1.21
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 137.43 us/op 117.50 us/op 1.17
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 879.98 us/op 742.00 us/op 1.19
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.1128 ms/op 1.0017 ms/op 1.11
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.0407 ms/op 932.28 us/op 1.12
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.9736 ms/op 2.8237 ms/op 1.41
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.7120 ms/op 1.9189 ms/op 0.89
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.6533 ms/op 5.4681 ms/op 0.85
Tree 40 250000 create 526.52 ms/op 602.80 ms/op 0.87
Tree 40 250000 get(125000) 204.35 ns/op 203.32 ns/op 1.01
Tree 40 250000 set(125000) 1.8225 us/op 1.1858 us/op 1.54
Tree 40 250000 toArray() 28.568 ms/op 24.676 ms/op 1.16
Tree 40 250000 iterate all - toArray() + loop 27.805 ms/op 27.961 ms/op 0.99
Tree 40 250000 iterate all - get(i) 88.487 ms/op 84.330 ms/op 1.05
MutableVector 250000 create 12.107 ms/op 12.648 ms/op 0.96
MutableVector 250000 get(125000) 6.7970 ns/op 7.1010 ns/op 0.96
MutableVector 250000 set(125000) 287.50 ns/op 539.88 ns/op 0.53
MutableVector 250000 toArray() 3.1607 ms/op 4.5208 ms/op 0.70
MutableVector 250000 iterate all - toArray() + loop 3.3782 ms/op 4.5055 ms/op 0.75
MutableVector 250000 iterate all - get(i) 1.5935 ms/op 1.5892 ms/op 1.00
Array 250000 create 3.2158 ms/op 3.9541 ms/op 0.81
Array 250000 clone - spread 1.2975 ms/op 1.4653 ms/op 0.89
Array 250000 get(125000) 0.66300 ns/op 0.71200 ns/op 0.93
Array 250000 set(125000) 0.72100 ns/op 0.78300 ns/op 0.92
Array 250000 iterate all - loop 110.96 us/op 107.56 us/op 1.03
effectiveBalanceIncrements clone Uint8Array 300000 46.048 us/op 67.092 us/op 0.69
effectiveBalanceIncrements clone MutableVector 300000 373.00 ns/op 408.00 ns/op 0.91
effectiveBalanceIncrements rw all Uint8Array 300000 182.58 us/op 174.68 us/op 1.05
effectiveBalanceIncrements rw all MutableVector 300000 100.84 ms/op 114.07 ms/op 0.88
phase0 afterProcessEpoch - 250000 vs - 7PWei 122.14 ms/op 121.57 ms/op 1.00
phase0 beforeProcessEpoch - 250000 vs - 7PWei 38.358 ms/op 50.217 ms/op 0.76
altair processEpoch - mainnet_e81889 360.57 ms/op 379.96 ms/op 0.95
mainnet_e81889 - altair beforeProcessEpoch 98.802 ms/op 80.262 ms/op 1.23
mainnet_e81889 - altair processJustificationAndFinalization 21.093 us/op 21.916 us/op 0.96
mainnet_e81889 - altair processInactivityUpdates 7.1051 ms/op 7.4447 ms/op 0.95
mainnet_e81889 - altair processRewardsAndPenalties 61.573 ms/op 83.817 ms/op 0.73
mainnet_e81889 - altair processRegistryUpdates 4.9160 us/op 4.4590 us/op 1.10
mainnet_e81889 - altair processSlashings 691.00 ns/op 849.00 ns/op 0.81
mainnet_e81889 - altair processEth1DataReset 937.00 ns/op 857.00 ns/op 1.09
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.2815 ms/op 2.5864 ms/op 0.50
mainnet_e81889 - altair processSlashingsReset 5.9490 us/op 5.9820 us/op 0.99
mainnet_e81889 - altair processRandaoMixesReset 7.6760 us/op 7.4920 us/op 1.02
mainnet_e81889 - altair processHistoricalRootsUpdate 1.2900 us/op 1.2160 us/op 1.06
mainnet_e81889 - altair processParticipationFlagUpdates 5.6040 us/op 4.8110 us/op 1.16
mainnet_e81889 - altair processSyncCommitteeUpdates 1.5750 us/op 1.5020 us/op 1.05
mainnet_e81889 - altair afterProcessEpoch 138.00 ms/op 134.34 ms/op 1.03
phase0 processEpoch - mainnet_e58758 418.41 ms/op 407.07 ms/op 1.03
mainnet_e58758 - phase0 beforeProcessEpoch 186.46 ms/op 149.29 ms/op 1.25
mainnet_e58758 - phase0 processJustificationAndFinalization 32.289 us/op 20.093 us/op 1.61
mainnet_e58758 - phase0 processRewardsAndPenalties 76.551 ms/op 68.292 ms/op 1.12
mainnet_e58758 - phase0 processRegistryUpdates 13.983 us/op 8.7710 us/op 1.59
mainnet_e58758 - phase0 processSlashings 1.4210 us/op 969.00 ns/op 1.47
mainnet_e58758 - phase0 processEth1DataReset 1.2000 us/op 865.00 ns/op 1.39
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.4340 ms/op 1.4155 ms/op 1.01
mainnet_e58758 - phase0 processSlashingsReset 6.4550 us/op 6.4340 us/op 1.00
mainnet_e58758 - phase0 processRandaoMixesReset 7.7520 us/op 6.4930 us/op 1.19
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.8040 us/op 1.3570 us/op 1.33
mainnet_e58758 - phase0 processParticipationRecordUpdates 7.4710 us/op 5.9830 us/op 1.25
mainnet_e58758 - phase0 afterProcessEpoch 110.86 ms/op 104.26 ms/op 1.06
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.8524 ms/op 1.3185 ms/op 1.40
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.9501 ms/op 1.5913 ms/op 1.23
altair processInactivityUpdates - 250000 normalcase 33.257 ms/op 25.751 ms/op 1.29
altair processInactivityUpdates - 250000 worstcase 36.558 ms/op 24.300 ms/op 1.50
phase0 processRegistryUpdates - 250000 normalcase 12.833 us/op 9.6100 us/op 1.34
phase0 processRegistryUpdates - 250000 badcase_full_deposits 302.99 us/op 365.88 us/op 0.83
phase0 processRegistryUpdates - 250000 worstcase 0.5 183.75 ms/op 139.39 ms/op 1.32
altair processRewardsAndPenalties - 250000 normalcase 82.741 ms/op 68.782 ms/op 1.20
altair processRewardsAndPenalties - 250000 worstcase 94.775 ms/op 72.309 ms/op 1.31
phase0 getAttestationDeltas - 250000 normalcase 12.164 ms/op 7.3477 ms/op 1.66
phase0 getAttestationDeltas - 250000 worstcase 11.668 ms/op 8.5751 ms/op 1.36
phase0 processSlashings - 250000 worstcase 5.2319 ms/op 3.6969 ms/op 1.42
altair processSyncCommitteeUpdates - 250000 235.40 ms/op 186.51 ms/op 1.26
BeaconState.hashTreeRoot - No change 392.00 ns/op 265.00 ns/op 1.48
BeaconState.hashTreeRoot - 1 full validator 65.847 us/op 54.224 us/op 1.21
BeaconState.hashTreeRoot - 32 full validator 726.93 us/op 536.95 us/op 1.35
BeaconState.hashTreeRoot - 512 full validator 6.9957 ms/op 5.6595 ms/op 1.24
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 79.912 us/op 64.708 us/op 1.23
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.0842 ms/op 990.89 us/op 1.09
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 17.104 ms/op 12.357 ms/op 1.38
BeaconState.hashTreeRoot - 1 balances 60.692 us/op 52.099 us/op 1.16
BeaconState.hashTreeRoot - 32 balances 511.86 us/op 467.16 us/op 1.10
BeaconState.hashTreeRoot - 512 balances 7.6014 ms/op 4.8829 ms/op 1.56
BeaconState.hashTreeRoot - 250000 balances 84.632 ms/op 82.453 ms/op 1.03
aggregationBits - 2048 els - zipIndexesInBitList 28.399 us/op 18.282 us/op 1.55
regular array get 100000 times 46.519 us/op 43.748 us/op 1.06
wrappedArray get 100000 times 45.411 us/op 38.121 us/op 1.19
arrayWithProxy get 100000 times 18.932 ms/op 15.259 ms/op 1.24
ssz.Root.equals 649.00 ns/op 584.00 ns/op 1.11
byteArrayEquals 639.00 ns/op 578.00 ns/op 1.11
shuffle list - 16384 els 7.8425 ms/op 7.0972 ms/op 1.11
shuffle list - 250000 els 114.72 ms/op 103.35 ms/op 1.11
processSlot - 1 slots 11.686 us/op 9.6010 us/op 1.22
processSlot - 32 slots 1.5901 ms/op 1.4253 ms/op 1.12
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 40.238 ms/op 37.148 ms/op 1.08
getCommitteeAssignments - req 1 vs - 250000 vc 3.0090 ms/op 2.9729 ms/op 1.01
getCommitteeAssignments - req 100 vs - 250000 vc 4.2324 ms/op 4.2080 ms/op 1.01
getCommitteeAssignments - req 1000 vs - 250000 vc 4.6322 ms/op 4.7065 ms/op 0.98
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.2900 ns/op 5.1900 ns/op 1.02
state getBlockRootAtSlot - 250000 vs - 7PWei 1.0646 us/op 803.06 ns/op 1.33
computeProposers - vc 250000 11.255 ms/op 11.269 ms/op 1.00
computeEpochShuffling - vc 250000 104.55 ms/op 105.96 ms/op 0.99
getNextSyncCommittee - vc 250000 188.74 ms/op 184.75 ms/op 1.02
computeSigningRoot for AttestationData 14.855 us/op 14.484 us/op 1.03
hash AttestationData serialized data then Buffer.toString(base64) 2.5842 us/op 2.5658 us/op 1.01
toHexString serialized data 1.2141 us/op 1.2241 us/op 0.99
Buffer.toString(base64) 351.38 ns/op 362.40 ns/op 0.97

by benchmarkbot/action

Copy link
Member

@matthewkeil matthewkeil left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

Just leaving at note for meta searches. There were 4 strict null checks that were explicitly converted to if (x !== null) or vice versa for positive case.

@matthewkeil matthewkeil merged commit 5fa2c88 into unstable Jul 12, 2023
@matthewkeil matthewkeil deleted the nh/update-lint branch July 12, 2023 23:06
Copy link
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

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

Looks good to me, just few remarks.

We should try to fix all those relative imports, they are easy to find now searching for import/no-relative-packages and reusable test utils can be moved to @lodestar/test-utils.

@@ -152,7 +156,6 @@ module.exports = {
semi: "off",
},
settings: {
"import/internal-regex": "^@chainsafe/",
Copy link
Member

Choose a reason for hiding this comment

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

why was this removed? should add some context in the PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

First it was contextually not correct. Secondly it was making the mono-repo packages as external.

import {BeaconConfig} from "@lodestar/config";
import {LoggerNode} from "@lodestar/logger/node";
import type {LoggerNode} from "@lodestar/logger/node";
Copy link
Member

Choose a reason for hiding this comment

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

@lodestar/logger is a dependency of beacon-node, what is the reason for adding explicit type only import?

Copy link
Member

Choose a reason for hiding this comment

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

On 2nd thought, maybe it makes sense. The only reason the beacon-node packages requires @lodestar/logger as dependency is because the workers need to initialize their own instance using getNodeLogger. I don't think this can be solved though as it will not be possible to inject the logger to the worker process.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For type only import, it was changed before I realized that worker are requiring getNodeLogger.

@@ -1,5 +1,6 @@
import {itBench} from "@dapplion/benchmark";
import {PointFormat} from "@chainsafe/bls/types";
// eslint-disable-next-line import/no-relative-packages
import {generatePerfTestCachedStatePhase0, numValidators} from "../../../../../../state-transition/test/perf/util.js";
Copy link
Member

Choose a reason for hiding this comment

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

I feel like we should get rid of those cross-package relative imports. Those functions could be moved to @lodestar/test-utils and then imported from there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we can do that and @lodestar/test-utils will be helpful in this context.

@wemeetagain
Copy link
Member

🎉 This PR is included in v1.10.0 🎉

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.

4 participants