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

style: enable all biomejs recommended rules #7153

Merged
merged 41 commits into from
Oct 14, 2024
Merged

Conversation

nazarhussain
Copy link
Contributor

Motivation

Make sure all recommended rules from biomejs are enabled.

Description

  • Enable all recommended rules
  • If some recommended rule is disabled, explain with proper reason

@nazarhussain nazarhussain requested a review from a team as a code owner October 11, 2024 17:25
@nazarhussain nazarhussain self-assigned this Oct 11, 2024
@nazarhussain
Copy link
Contributor Author

Would be much easier to review commit by commit.

Copy link
Contributor

github-actions bot commented Oct 11, 2024

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 2158fb2 Previous: b5c6043 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 3.0960 ms/op 2.1134 ms/op 1.46
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 82.118 us/op 43.426 us/op 1.89
BLS verify - blst 1.1050 ms/op 856.17 us/op 1.29
BLS verifyMultipleSignatures 3 - blst 1.6660 ms/op 1.3907 ms/op 1.20
BLS verifyMultipleSignatures 8 - blst 2.2337 ms/op 1.8964 ms/op 1.18
BLS verifyMultipleSignatures 32 - blst 7.4995 ms/op 5.1597 ms/op 1.45
BLS verifyMultipleSignatures 64 - blst 12.651 ms/op 9.2719 ms/op 1.36
BLS verifyMultipleSignatures 128 - blst 21.636 ms/op 17.045 ms/op 1.27
BLS deserializing 10000 signatures 822.66 ms/op 646.77 ms/op 1.27
BLS deserializing 100000 signatures 8.0524 s/op 6.5070 s/op 1.24
BLS verifyMultipleSignatures - same message - 3 - blst 1.1359 ms/op 901.24 us/op 1.26
BLS verifyMultipleSignatures - same message - 8 - blst 1.3102 ms/op 1.1752 ms/op 1.11
BLS verifyMultipleSignatures - same message - 32 - blst 2.1887 ms/op 1.7144 ms/op 1.28
BLS verifyMultipleSignatures - same message - 64 - blst 3.3558 ms/op 2.5355 ms/op 1.32
BLS verifyMultipleSignatures - same message - 128 - blst 5.0888 ms/op 4.1673 ms/op 1.22
BLS aggregatePubkeys 32 - blst 22.056 us/op 18.658 us/op 1.18
BLS aggregatePubkeys 128 - blst 75.222 us/op 63.845 us/op 1.18
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 80.866 ms/op 78.337 ms/op 1.03
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 59.565 ms/op 56.727 ms/op 1.05
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 48.894 ms/op 42.294 ms/op 1.16
getSlashingsAndExits - default max 110.51 us/op 83.455 us/op 1.32
getSlashingsAndExits - 2k 329.21 us/op 302.13 us/op 1.09
proposeBlockBody type=full, size=empty 6.9109 ms/op 5.4004 ms/op 1.28
isKnown best case - 1 super set check 321.00 ns/op 527.00 ns/op 0.61
isKnown normal case - 2 super set checks 336.00 ns/op 495.00 ns/op 0.68
isKnown worse case - 16 super set checks 335.00 ns/op 487.00 ns/op 0.69
InMemoryCheckpointStateCache - add get delete 3.6790 us/op 4.3360 us/op 0.85
updateUnfinalizedPubkeys - updating 10 pubkeys 1.2824 ms/op 1.5292 ms/op 0.84
updateUnfinalizedPubkeys - updating 100 pubkeys 4.0499 ms/op 3.6881 ms/op 1.10
updateUnfinalizedPubkeys - updating 1000 pubkeys 56.672 ms/op 45.704 ms/op 1.24
validate api signedAggregateAndProof - struct 1.5116 ms/op 1.6650 ms/op 0.91
validate gossip signedAggregateAndProof - struct 1.4854 ms/op 1.8856 ms/op 0.79
batch validate gossip attestation - vc 640000 - chunk 32 140.92 us/op 127.66 us/op 1.10
batch validate gossip attestation - vc 640000 - chunk 64 128.57 us/op 113.47 us/op 1.13
batch validate gossip attestation - vc 640000 - chunk 128 113.09 us/op 109.39 us/op 1.03
batch validate gossip attestation - vc 640000 - chunk 256 116.27 us/op 109.50 us/op 1.06
pickEth1Vote - no votes 1.1604 ms/op 1.1342 ms/op 1.02
pickEth1Vote - max votes 6.9422 ms/op 7.3612 ms/op 0.94
pickEth1Vote - Eth1Data hashTreeRoot value x2048 13.760 ms/op 15.077 ms/op 0.91
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 20.692 ms/op 16.435 ms/op 1.26
pickEth1Vote - Eth1Data fastSerialize value x2048 538.38 us/op 400.31 us/op 1.34
pickEth1Vote - Eth1Data fastSerialize tree x2048 2.6084 ms/op 1.9917 ms/op 1.31
bytes32 toHexString 539.00 ns/op 606.00 ns/op 0.89
bytes32 Buffer.toString(hex) 308.00 ns/op 453.00 ns/op 0.68
bytes32 Buffer.toString(hex) from Uint8Array 433.00 ns/op 628.00 ns/op 0.69
bytes32 Buffer.toString(hex) + 0x 293.00 ns/op 520.00 ns/op 0.56
Object access 1 prop 0.18100 ns/op 0.40800 ns/op 0.44
Map access 1 prop 0.16100 ns/op 0.35000 ns/op 0.46
Object get x1000 6.5320 ns/op 5.3370 ns/op 1.22
Map get x1000 7.3070 ns/op 6.2060 ns/op 1.18
Object set x1000 52.725 ns/op 26.451 ns/op 1.99
Map set x1000 37.378 ns/op 20.083 ns/op 1.86
Return object 10000 times 0.33600 ns/op 0.30750 ns/op 1.09
Throw Error 10000 times 3.8266 us/op 2.8855 us/op 1.33
toHex 192.61 ns/op 119.06 ns/op 1.62
Buffer.from 189.94 ns/op 107.45 ns/op 1.77
shared Buffer 134.65 ns/op 75.933 ns/op 1.77
fastMsgIdFn sha256 / 200 bytes 2.9430 us/op 2.0780 us/op 1.42
fastMsgIdFn h32 xxhash / 200 bytes 375.00 ns/op 446.00 ns/op 0.84
fastMsgIdFn h64 xxhash / 200 bytes 344.00 ns/op 464.00 ns/op 0.74
fastMsgIdFn sha256 / 1000 bytes 10.649 us/op 6.0570 us/op 1.76
fastMsgIdFn h32 xxhash / 1000 bytes 576.00 ns/op 588.00 ns/op 0.98
fastMsgIdFn h64 xxhash / 1000 bytes 452.00 ns/op 524.00 ns/op 0.86
fastMsgIdFn sha256 / 10000 bytes 83.810 us/op 49.936 us/op 1.68
fastMsgIdFn h32 xxhash / 10000 bytes 2.2550 us/op 1.9510 us/op 1.16
fastMsgIdFn h64 xxhash / 10000 bytes 1.5230 us/op 1.3360 us/op 1.14
send data - 1000 256B messages 17.756 ms/op 9.6668 ms/op 1.84
send data - 1000 512B messages 21.522 ms/op 16.625 ms/op 1.29
send data - 1000 1024B messages 32.445 ms/op 25.218 ms/op 1.29
send data - 1000 1200B messages 31.281 ms/op 25.679 ms/op 1.22
send data - 1000 2048B messages 36.874 ms/op 29.306 ms/op 1.26
send data - 1000 4096B messages 35.206 ms/op 29.018 ms/op 1.21
send data - 1000 16384B messages 83.615 ms/op 69.019 ms/op 1.21
send data - 1000 65536B messages 222.04 ms/op 262.31 ms/op 0.85
enrSubnets - fastDeserialize 64 bits 1.2210 us/op 1.3510 us/op 0.90
enrSubnets - ssz BitVector 64 bits 406.00 ns/op 652.00 ns/op 0.62
enrSubnets - fastDeserialize 4 bits 172.00 ns/op 379.00 ns/op 0.45
enrSubnets - ssz BitVector 4 bits 413.00 ns/op 640.00 ns/op 0.65
prioritizePeers score -10:0 att 32-0.1 sync 2-0 182.20 us/op 141.98 us/op 1.28
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 195.60 us/op 160.99 us/op 1.22
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 379.09 us/op 363.04 us/op 1.04
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 513.60 us/op 418.10 us/op 1.23
prioritizePeers score 0:0 att 64-1 sync 4-1 814.69 us/op 658.34 us/op 1.24
array of 16000 items push then shift 1.7495 us/op 1.2756 us/op 1.37
LinkedList of 16000 items push then shift 7.4330 ns/op 7.6820 ns/op 0.97
array of 16000 items push then pop 136.84 ns/op 112.91 ns/op 1.21
LinkedList of 16000 items push then pop 7.2770 ns/op 6.2490 ns/op 1.16
array of 24000 items push then shift 2.6055 us/op 1.8187 us/op 1.43
LinkedList of 24000 items push then shift 8.9350 ns/op 7.0450 ns/op 1.27
array of 24000 items push then pop 199.01 ns/op 133.36 ns/op 1.49
LinkedList of 24000 items push then pop 7.9770 ns/op 6.0900 ns/op 1.31
intersect bitArray bitLen 8 6.9180 ns/op 5.2320 ns/op 1.32
intersect array and set length 8 52.797 ns/op 39.707 ns/op 1.33
intersect bitArray bitLen 128 33.305 ns/op 26.854 ns/op 1.24
intersect array and set length 128 835.55 ns/op 583.56 ns/op 1.43
bitArray.getTrueBitIndexes() bitLen 128 2.0790 us/op 1.8580 us/op 1.12
bitArray.getTrueBitIndexes() bitLen 248 3.8800 us/op 2.8870 us/op 1.34
bitArray.getTrueBitIndexes() bitLen 512 10.105 us/op 6.6740 us/op 1.51
Buffer.concat 32 items 951.00 ns/op 1.0170 us/op 0.94
Uint8Array.set 32 items 1.7350 us/op 1.8690 us/op 0.93
Buffer.copy 1.7990 us/op 1.9920 us/op 0.90
Uint8Array.set - with subarray 2.8970 us/op 2.5120 us/op 1.15
Uint8Array.set - without subarray 1.6480 us/op 1.7350 us/op 0.95
getUint32 - dataview 255.00 ns/op 415.00 ns/op 0.61
getUint32 - manual 204.00 ns/op 341.00 ns/op 0.60
Set add up to 64 items then delete first 2.8354 us/op 1.8070 us/op 1.57
OrderedSet add up to 64 items then delete first 4.4143 us/op 2.7863 us/op 1.58
Set add up to 64 items then delete last 3.3335 us/op 2.1063 us/op 1.58
OrderedSet add up to 64 items then delete last 4.5804 us/op 3.1997 us/op 1.43
Set add up to 64 items then delete middle 2.9764 us/op 2.1085 us/op 1.41
OrderedSet add up to 64 items then delete middle 6.2168 us/op 4.5922 us/op 1.35
Set add up to 128 items then delete first 5.9835 us/op 4.0035 us/op 1.49
OrderedSet add up to 128 items then delete first 8.6094 us/op 5.9973 us/op 1.44
Set add up to 128 items then delete last 5.8583 us/op 3.9959 us/op 1.47
OrderedSet add up to 128 items then delete last 9.0579 us/op 6.1664 us/op 1.47
Set add up to 128 items then delete middle 5.9399 us/op 4.0030 us/op 1.48
OrderedSet add up to 128 items then delete middle 15.951 us/op 12.094 us/op 1.32
Set add up to 256 items then delete first 13.009 us/op 7.8165 us/op 1.66
OrderedSet add up to 256 items then delete first 17.737 us/op 11.787 us/op 1.50
Set add up to 256 items then delete last 11.854 us/op 7.7855 us/op 1.52
OrderedSet add up to 256 items then delete last 19.561 us/op 12.302 us/op 1.59
Set add up to 256 items then delete middle 11.798 us/op 7.7204 us/op 1.53
OrderedSet add up to 256 items then delete middle 45.228 us/op 35.114 us/op 1.29
transfer serialized Status (84 B) 1.3720 us/op 1.3850 us/op 0.99
copy serialized Status (84 B) 1.2370 us/op 1.2770 us/op 0.97
transfer serialized SignedVoluntaryExit (112 B) 1.6640 us/op 1.5140 us/op 1.10
copy serialized SignedVoluntaryExit (112 B) 1.3260 us/op 1.2170 us/op 1.09
transfer serialized ProposerSlashing (416 B) 1.8780 us/op 1.4940 us/op 1.26
copy serialized ProposerSlashing (416 B) 1.7770 us/op 1.3090 us/op 1.36
transfer serialized Attestation (485 B) 1.9090 us/op 1.5540 us/op 1.23
copy serialized Attestation (485 B) 1.8160 us/op 1.3190 us/op 1.38
transfer serialized AttesterSlashing (33232 B) 1.9850 us/op 1.6800 us/op 1.18
copy serialized AttesterSlashing (33232 B) 6.2300 us/op 3.4020 us/op 1.83
transfer serialized Small SignedBeaconBlock (128000 B) 2.6510 us/op 2.1110 us/op 1.26
copy serialized Small SignedBeaconBlock (128000 B) 20.159 us/op 8.4090 us/op 2.40
transfer serialized Avg SignedBeaconBlock (200000 B) 3.2340 us/op 2.2120 us/op 1.46
copy serialized Avg SignedBeaconBlock (200000 B) 29.849 us/op 12.129 us/op 2.46
transfer serialized BlobsSidecar (524380 B) 3.4030 us/op 2.5020 us/op 1.36
copy serialized BlobsSidecar (524380 B) 94.950 us/op 108.37 us/op 0.88
transfer serialized Big SignedBeaconBlock (1000000 B) 3.1510 us/op 2.6570 us/op 1.19
copy serialized Big SignedBeaconBlock (1000000 B) 199.14 us/op 129.82 us/op 1.53
pass gossip attestations to forkchoice per slot 3.1807 ms/op 2.4857 ms/op 1.28
forkChoice updateHead vc 100000 bc 64 eq 0 502.71 us/op 383.82 us/op 1.31
forkChoice updateHead vc 600000 bc 64 eq 0 3.5148 ms/op 2.4210 ms/op 1.45
forkChoice updateHead vc 1000000 bc 64 eq 0 5.3164 ms/op 4.0121 ms/op 1.33
forkChoice updateHead vc 600000 bc 320 eq 0 3.2547 ms/op 2.4147 ms/op 1.35
forkChoice updateHead vc 600000 bc 1200 eq 0 3.1774 ms/op 2.4575 ms/op 1.29
forkChoice updateHead vc 600000 bc 7200 eq 0 4.5025 ms/op 2.6809 ms/op 1.68
forkChoice updateHead vc 600000 bc 64 eq 1000 11.073 ms/op 9.4712 ms/op 1.17
forkChoice updateHead vc 600000 bc 64 eq 10000 11.653 ms/op 9.3815 ms/op 1.24
forkChoice updateHead vc 600000 bc 64 eq 300000 17.819 ms/op 11.499 ms/op 1.55
computeDeltas 500000 validators 300 proto nodes 4.5253 ms/op 3.3221 ms/op 1.36
computeDeltas 500000 validators 1200 proto nodes 4.4763 ms/op 3.2830 ms/op 1.36
computeDeltas 500000 validators 7200 proto nodes 4.6555 ms/op 3.3878 ms/op 1.37
computeDeltas 750000 validators 300 proto nodes 6.9933 ms/op 5.2092 ms/op 1.34
computeDeltas 750000 validators 1200 proto nodes 6.9860 ms/op 5.0857 ms/op 1.37
computeDeltas 750000 validators 7200 proto nodes 6.7902 ms/op 5.1312 ms/op 1.32
computeDeltas 1400000 validators 300 proto nodes 12.666 ms/op 9.5544 ms/op 1.33
computeDeltas 1400000 validators 1200 proto nodes 12.577 ms/op 9.6314 ms/op 1.31
computeDeltas 1400000 validators 7200 proto nodes 12.576 ms/op 9.3147 ms/op 1.35
computeDeltas 2100000 validators 300 proto nodes 19.403 ms/op 14.199 ms/op 1.37
computeDeltas 2100000 validators 1200 proto nodes 18.991 ms/op 14.459 ms/op 1.31
computeDeltas 2100000 validators 7200 proto nodes 19.084 ms/op 14.792 ms/op 1.29
altair processAttestation - 250000 vs - 7PWei normalcase 1.9836 ms/op 2.5703 ms/op 0.77
altair processAttestation - 250000 vs - 7PWei worstcase 3.1128 ms/op 2.9797 ms/op 1.04
altair processAttestation - setStatus - 1/6 committees join 101.73 us/op 111.69 us/op 0.91
altair processAttestation - setStatus - 1/3 committees join 191.19 us/op 226.70 us/op 0.84
altair processAttestation - setStatus - 1/2 committees join 276.42 us/op 323.77 us/op 0.85
altair processAttestation - setStatus - 2/3 committees join 383.93 us/op 368.96 us/op 1.04
altair processAttestation - setStatus - 4/5 committees join 565.14 us/op 517.42 us/op 1.09
altair processAttestation - setStatus - 100% committees join 595.76 us/op 681.05 us/op 0.87
altair processBlock - 250000 vs - 7PWei normalcase 8.0447 ms/op 6.7502 ms/op 1.19
altair processBlock - 250000 vs - 7PWei normalcase hashState 27.056 ms/op 29.095 ms/op 0.93
altair processBlock - 250000 vs - 7PWei worstcase 41.723 ms/op 43.077 ms/op 0.97
altair processBlock - 250000 vs - 7PWei worstcase hashState 76.725 ms/op 69.059 ms/op 1.11
phase0 processBlock - 250000 vs - 7PWei normalcase 2.4629 ms/op 2.1185 ms/op 1.16
phase0 processBlock - 250000 vs - 7PWei worstcase 23.786 ms/op 26.259 ms/op 0.91
altair processEth1Data - 250000 vs - 7PWei normalcase 393.78 us/op 256.08 us/op 1.54
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 5.6470 us/op 6.3570 us/op 0.89
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 39.837 us/op 37.870 us/op 1.05
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 10.211 us/op 12.150 us/op 0.84
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 6.9790 us/op 6.3860 us/op 1.09
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 180.14 us/op 121.88 us/op 1.48
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.9972 ms/op 984.98 us/op 2.03
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.1904 ms/op 1.2370 ms/op 1.77
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.8795 ms/op 1.2674 ms/op 2.27
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.8048 ms/op 3.2510 ms/op 1.17
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.4462 ms/op 1.2717 ms/op 1.92
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.8480 ms/op 3.2695 ms/op 1.18
Tree 40 250000 create 227.61 ms/op 235.40 ms/op 0.97
Tree 40 250000 get(125000) 157.07 ns/op 124.51 ns/op 1.26
Tree 40 250000 set(125000) 661.09 ns/op 560.72 ns/op 1.18
Tree 40 250000 toArray() 15.938 ms/op 17.687 ms/op 0.90
Tree 40 250000 iterate all - toArray() + loop 16.142 ms/op 19.722 ms/op 0.82
Tree 40 250000 iterate all - get(i) 55.392 ms/op 51.172 ms/op 1.08
Array 250000 create 2.9187 ms/op 2.8091 ms/op 1.04
Array 250000 clone - spread 1.5080 ms/op 1.2611 ms/op 1.20
Array 250000 get(125000) 0.41700 ns/op 0.59400 ns/op 0.70
Array 250000 set(125000) 0.42300 ns/op 0.59800 ns/op 0.71
Array 250000 iterate all - loop 107.84 us/op 78.668 us/op 1.37
phase0 afterProcessEpoch - 250000 vs - 7PWei 50.464 ms/op 44.411 ms/op 1.14
Array.fill - length 1000000 3.6699 ms/op 2.6307 ms/op 1.40
Array push - length 1000000 12.290 ms/op 16.653 ms/op 0.74
Array.get 0.28728 ns/op 0.26512 ns/op 1.08
Uint8Array.get 0.45323 ns/op 0.33752 ns/op 1.34
phase0 beforeProcessEpoch - 250000 vs - 7PWei 17.761 ms/op 18.276 ms/op 0.97
altair processEpoch - mainnet_e81889 320.13 ms/op 290.02 ms/op 1.10
mainnet_e81889 - altair beforeProcessEpoch 20.162 ms/op 18.096 ms/op 1.11
mainnet_e81889 - altair processJustificationAndFinalization 17.845 us/op 12.313 us/op 1.45
mainnet_e81889 - altair processInactivityUpdates 6.0562 ms/op 4.5053 ms/op 1.34
mainnet_e81889 - altair processRewardsAndPenalties 57.241 ms/op 46.609 ms/op 1.23
mainnet_e81889 - altair processRegistryUpdates 2.7480 us/op 2.8530 us/op 0.96
mainnet_e81889 - altair processSlashings 723.00 ns/op 1.0500 us/op 0.69
mainnet_e81889 - altair processEth1DataReset 508.00 ns/op 881.00 ns/op 0.58
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.7125 ms/op 1.5274 ms/op 1.78
mainnet_e81889 - altair processSlashingsReset 3.1440 us/op 3.7740 us/op 0.83
mainnet_e81889 - altair processRandaoMixesReset 6.3800 us/op 3.6960 us/op 1.73
mainnet_e81889 - altair processHistoricalRootsUpdate 790.00 ns/op 2.0340 us/op 0.39
mainnet_e81889 - altair processParticipationFlagUpdates 2.8570 us/op 3.3400 us/op 0.86
mainnet_e81889 - altair processSyncCommitteeUpdates 763.00 ns/op 862.00 ns/op 0.89
mainnet_e81889 - altair afterProcessEpoch 55.110 ms/op 44.257 ms/op 1.25
capella processEpoch - mainnet_e217614 1.2123 s/op 1.1290 s/op 1.07
mainnet_e217614 - capella beforeProcessEpoch 85.570 ms/op 78.069 ms/op 1.10
mainnet_e217614 - capella processJustificationAndFinalization 19.582 us/op 19.650 us/op 1.00
mainnet_e217614 - capella processInactivityUpdates 21.034 ms/op 16.325 ms/op 1.29
mainnet_e217614 - capella processRewardsAndPenalties 252.22 ms/op 247.96 ms/op 1.02
mainnet_e217614 - capella processRegistryUpdates 15.305 us/op 15.419 us/op 0.99
mainnet_e217614 - capella processSlashings 804.00 ns/op 1.4140 us/op 0.57
mainnet_e217614 - capella processEth1DataReset 326.00 ns/op 1.0200 us/op 0.32
mainnet_e217614 - capella processEffectiveBalanceUpdates 17.206 ms/op 25.988 ms/op 0.66
mainnet_e217614 - capella processSlashingsReset 3.6250 us/op 6.8180 us/op 0.53
mainnet_e217614 - capella processRandaoMixesReset 4.1990 us/op 13.551 us/op 0.31
mainnet_e217614 - capella processHistoricalRootsUpdate 2.0140 us/op 1.2420 us/op 1.62
mainnet_e217614 - capella processParticipationFlagUpdates 2.4840 us/op 3.7520 us/op 0.66
mainnet_e217614 - capella afterProcessEpoch 138.57 ms/op 109.51 ms/op 1.27
phase0 processEpoch - mainnet_e58758 401.05 ms/op 315.76 ms/op 1.27
mainnet_e58758 - phase0 beforeProcessEpoch 99.114 ms/op 85.940 ms/op 1.15
mainnet_e58758 - phase0 processJustificationAndFinalization 19.744 us/op 14.877 us/op 1.33
mainnet_e58758 - phase0 processRewardsAndPenalties 33.944 ms/op 33.471 ms/op 1.01
mainnet_e58758 - phase0 processRegistryUpdates 8.1020 us/op 7.9320 us/op 1.02
mainnet_e58758 - phase0 processSlashings 333.00 ns/op 811.00 ns/op 0.41
mainnet_e58758 - phase0 processEth1DataReset 302.00 ns/op 732.00 ns/op 0.41
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.9977 ms/op 1.4785 ms/op 1.35
mainnet_e58758 - phase0 processSlashingsReset 4.7720 us/op 3.3440 us/op 1.43
mainnet_e58758 - phase0 processRandaoMixesReset 5.2930 us/op 3.2480 us/op 1.63
mainnet_e58758 - phase0 processHistoricalRootsUpdate 316.00 ns/op 694.00 ns/op 0.46
mainnet_e58758 - phase0 processParticipationRecordUpdates 3.3220 us/op 4.9960 us/op 0.66
mainnet_e58758 - phase0 afterProcessEpoch 48.510 ms/op 37.553 ms/op 1.29
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.9260 ms/op 1.0623 ms/op 1.81
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.4471 ms/op 1.5953 ms/op 1.53
altair processInactivityUpdates - 250000 normalcase 20.223 ms/op 14.818 ms/op 1.36
altair processInactivityUpdates - 250000 worstcase 20.822 ms/op 18.253 ms/op 1.14
phase0 processRegistryUpdates - 250000 normalcase 7.7340 us/op 6.1920 us/op 1.25
phase0 processRegistryUpdates - 250000 badcase_full_deposits 323.84 us/op 341.89 us/op 0.95
phase0 processRegistryUpdates - 250000 worstcase 0.5 137.16 ms/op 129.08 ms/op 1.06
altair processRewardsAndPenalties - 250000 normalcase 43.400 ms/op 39.862 ms/op 1.09
altair processRewardsAndPenalties - 250000 worstcase 48.659 ms/op 38.182 ms/op 1.27
phase0 getAttestationDeltas - 250000 normalcase 8.6749 ms/op 6.7609 ms/op 1.28
phase0 getAttestationDeltas - 250000 worstcase 8.3085 ms/op 7.2189 ms/op 1.15
phase0 processSlashings - 250000 worstcase 100.66 us/op 84.840 us/op 1.19
altair processSyncCommitteeUpdates - 250000 136.58 ms/op 102.72 ms/op 1.33
BeaconState.hashTreeRoot - No change 244.00 ns/op 450.00 ns/op 0.54
BeaconState.hashTreeRoot - 1 full validator 142.57 us/op 128.47 us/op 1.11
BeaconState.hashTreeRoot - 32 full validator 1.1748 ms/op 1.0085 ms/op 1.16
BeaconState.hashTreeRoot - 512 full validator 10.447 ms/op 8.2629 ms/op 1.26
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 120.20 us/op 92.569 us/op 1.30
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.7221 ms/op 1.1843 ms/op 1.45
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 21.247 ms/op 15.395 ms/op 1.38
BeaconState.hashTreeRoot - 1 balances 101.88 us/op 72.228 us/op 1.41
BeaconState.hashTreeRoot - 32 balances 785.10 us/op 818.68 us/op 0.96
BeaconState.hashTreeRoot - 512 balances 7.5462 ms/op 6.3654 ms/op 1.19
BeaconState.hashTreeRoot - 250000 balances 164.09 ms/op 160.97 ms/op 1.02
aggregationBits - 2048 els - zipIndexesInBitList 29.483 us/op 26.269 us/op 1.12
byteArrayEquals 32 59.714 ns/op 47.965 ns/op 1.24
Buffer.compare 32 19.206 ns/op 15.291 ns/op 1.26
byteArrayEquals 1024 1.6940 us/op 1.2521 us/op 1.35
Buffer.compare 1024 27.020 ns/op 23.558 ns/op 1.15
byteArrayEquals 16384 28.000 us/op 19.999 us/op 1.40
Buffer.compare 16384 241.84 ns/op 201.06 ns/op 1.20
byteArrayEquals 123687377 202.69 ms/op 152.43 ms/op 1.33
Buffer.compare 123687377 7.8058 ms/op 4.5633 ms/op 1.71
byteArrayEquals 32 - diff last byte 56.428 ns/op 47.692 ns/op 1.18
Buffer.compare 32 - diff last byte 18.298 ns/op 16.464 ns/op 1.11
byteArrayEquals 1024 - diff last byte 1.6754 us/op 1.2924 us/op 1.30
Buffer.compare 1024 - diff last byte 26.887 ns/op 25.341 ns/op 1.06
byteArrayEquals 16384 - diff last byte 26.682 us/op 20.424 us/op 1.31
Buffer.compare 16384 - diff last byte 217.47 ns/op 169.95 ns/op 1.28
byteArrayEquals 123687377 - diff last byte 209.27 ms/op 153.17 ms/op 1.37
Buffer.compare 123687377 - diff last byte 7.7733 ms/op 4.7227 ms/op 1.65
byteArrayEquals 32 - random bytes 5.8540 ns/op 5.1430 ns/op 1.14
Buffer.compare 32 - random bytes 19.442 ns/op 16.681 ns/op 1.17
byteArrayEquals 1024 - random bytes 5.7020 ns/op 4.9600 ns/op 1.15
Buffer.compare 1024 - random bytes 19.228 ns/op 17.108 ns/op 1.12
byteArrayEquals 16384 - random bytes 5.5520 ns/op 4.9120 ns/op 1.13
Buffer.compare 16384 - random bytes 18.774 ns/op 16.902 ns/op 1.11
byteArrayEquals 123687377 - random bytes 6.7800 ns/op 7.8000 ns/op 0.87
Buffer.compare 123687377 - random bytes 20.420 ns/op 20.070 ns/op 1.02
regular array get 100000 times 35.480 us/op 31.344 us/op 1.13
wrappedArray get 100000 times 43.166 us/op 31.294 us/op 1.38
arrayWithProxy get 100000 times 14.910 ms/op 9.8863 ms/op 1.51
ssz.Root.equals 49.207 ns/op 45.056 ns/op 1.09
byteArrayEquals 48.455 ns/op 44.622 ns/op 1.09
Buffer.compare 11.178 ns/op 9.9710 ns/op 1.12
processSlot - 1 slots 12.869 us/op 13.771 us/op 0.93
processSlot - 32 slots 2.9214 ms/op 3.1286 ms/op 0.93
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 36.839 ms/op 41.239 ms/op 0.89
getCommitteeAssignments - req 1 vs - 250000 vc 2.1916 ms/op 1.7365 ms/op 1.26
getCommitteeAssignments - req 100 vs - 250000 vc 4.4088 ms/op 3.4130 ms/op 1.29
getCommitteeAssignments - req 1000 vs - 250000 vc 4.7066 ms/op 3.8045 ms/op 1.24
findModifiedValidators - 10000 modified validators 280.92 ms/op 218.82 ms/op 1.28
findModifiedValidators - 1000 modified validators 199.31 ms/op 149.31 ms/op 1.33
findModifiedValidators - 100 modified validators 210.30 ms/op 144.59 ms/op 1.45
findModifiedValidators - 10 modified validators 194.31 ms/op 141.62 ms/op 1.37
findModifiedValidators - 1 modified validators 213.48 ms/op 119.58 ms/op 1.79
findModifiedValidators - no difference 206.08 ms/op 140.73 ms/op 1.46
compare ViewDUs 3.6017 s/op 3.1828 s/op 1.13
compare each validator Uint8Array 1.2289 s/op 1.4889 s/op 0.83
compare ViewDU to Uint8Array 1.4188 s/op 779.60 ms/op 1.82
migrate state 1000000 validators, 24 modified, 0 new 785.76 ms/op 706.44 ms/op 1.11
migrate state 1000000 validators, 1700 modified, 1000 new 1.0395 s/op 952.07 ms/op 1.09
migrate state 1000000 validators, 3400 modified, 2000 new 1.3600 s/op 1.0389 s/op 1.31
migrate state 1500000 validators, 24 modified, 0 new 762.30 ms/op 683.18 ms/op 1.12
migrate state 1500000 validators, 1700 modified, 1000 new 1.0379 s/op 989.03 ms/op 1.05
migrate state 1500000 validators, 3400 modified, 2000 new 1.2045 s/op 979.52 ms/op 1.23
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.6800 ns/op 6.2200 ns/op 0.75
state getBlockRootAtSlot - 250000 vs - 7PWei 499.46 ns/op 712.41 ns/op 0.70
computeProposers - vc 250000 6.9606 ms/op 5.7425 ms/op 1.21
computeEpochShuffling - vc 250000 44.745 ms/op 35.210 ms/op 1.27
getNextSyncCommittee - vc 250000 130.06 ms/op 97.077 ms/op 1.34
computeSigningRoot for AttestationData 18.715 us/op 17.768 us/op 1.05
hash AttestationData serialized data then Buffer.toString(base64) 1.6596 us/op 1.2442 us/op 1.33
toHexString serialized data 925.47 ns/op 849.84 ns/op 1.09
Buffer.toString(base64) 187.54 ns/op 152.37 ns/op 1.23
nodejs block root to RootHex using toHex 156.83 ns/op 129.08 ns/op 1.21
nodejs block root to RootHex using toRootHex 95.186 ns/op 83.510 ns/op 1.14
browser block root to RootHex using the deprecated toHexString 232.54 ns/op 221.24 ns/op 1.05
browser block root to RootHex using toHex 188.19 ns/op 172.91 ns/op 1.09
browser block root to RootHex using toRootHex 167.77 ns/op 151.72 ns/op 1.11

by benchmarkbot/action

Copy link
Member

@wemeetagain wemeetagain left a comment

Choose a reason for hiding this comment

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

generally looks good

biome.jsonc Outdated Show resolved Hide resolved
biome.jsonc Outdated Show resolved Hide resolved
biome.jsonc Outdated Show resolved Hide resolved
biome.jsonc Outdated Show resolved Hide resolved
biome.jsonc Outdated Show resolved Hide resolved
biome.jsonc Outdated Show resolved Hide resolved
biome.jsonc Outdated Show resolved Hide resolved
biome.jsonc Show resolved Hide resolved
packages/beacon-node/src/eth1/eth1DataCache.ts Outdated Show resolved Hide resolved
@@ -92,7 +92,7 @@ export function signedBlindedBlockToFull(

// state transition can't seem to handle executionPayloadHeader presense in merge block
// so just delete the extra field we don't require
delete (signedBlock.message.body as {executionPayloadHeader?: ExecutionPayloadHeader}).executionPayloadHeader;
(signedBlock.message.body as {executionPayloadHeader?: ExecutionPayloadHeader}).executionPayloadHeader = undefined;
Copy link
Member

@nflaig nflaig Oct 11, 2024

Choose a reason for hiding this comment

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

Not a fan of the performance/noDelete rule, setting a property to undefined is not equivalent in some cases

e.g.

>  Object.keys({})
[]
>  Object.keys({foo: undefined})
[ 'foo' ]

or when merging objects

> {...{hello: "world"}, ...{}}
{ hello: 'world' }
> {...{hello: "world"}, ...{hello: undefined}}
{ hello: undefined }

sometimes you just wanna get rid of the property altogether

Copy link
Member

Choose a reason for hiding this comment

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

I'm actually a fan of this one. Not having delete makes turbofan optimization much better. We should be paying attention to the usage. I've noticed it when we go from one SSZ container to another and curious if there is a way to update the ssz to ignore undefined fields if they are not part of the container definition...

Copy link
Member

Choose a reason for hiding this comment

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

ssz to ignore undefined fields if they are not part of the container definitio

that's already the case, it only reads fields that are defined in the container, and ignores all others

Not having delete makes turbofan optimization much better

need to carefully review all cases then that are in this PR, afterwards it should be fine, just don't like lint rules that change behavior

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted the change for this rule from this PR.

I am in favor of not using delete, but this should be done with more deliberate review in a separate PR.

Copy link
Member

Choose a reason for hiding this comment

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

Let's do it in another PR if this has performance improvements we can take advantage of

Copy link
Member

@matthewkeil matthewkeil Oct 14, 2024

Choose a reason for hiding this comment

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

this may have unintended consequences... i forget the exact situation but the ssz library was not happy about creating a root (or maybe it was container statics accepting the value, but i forget) when there was an undefined after converting container types...

Copy link

codecov bot commented Oct 14, 2024

Codecov Report

Attention: Patch coverage is 25.56391% with 198 lines in your changes missing coverage. Please review.

Project coverage is 49.21%. Comparing base (d37bdb0) to head (4f31ed9).
Report is 3 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #7153      +/-   ##
============================================
+ Coverage     49.18%   49.21%   +0.02%     
============================================
  Files           598      598              
  Lines         39801    39726      -75     
  Branches       2082     2092      +10     
============================================
- Hits          19576    19550      -26     
+ Misses        20184    20136      -48     
+ Partials         41       40       -1     

Copy link
Member

@wemeetagain wemeetagain left a comment

Choose a reason for hiding this comment

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

LGTM, waiting for another approval to merge

@@ -636,45 +636,43 @@ export function getNotSeenValidatorsFn(state: CachedBeaconStateAllForks): GetNot
}

// altair and future forks
else {
Copy link
Member

Choose a reason for hiding this comment

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

do we really think this is a good change? Especially for larger code block being explicit with the else seems good to me as it does not rely on if-block to return or throw

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was suggested by @wemeetagain snd I am also in favor of not using such else bocks. More levels of indentations make code less readable.

Copy link
Member

Choose a reason for hiding this comment

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

More levels of indentations make code less readable.

I don't think this can be applied generally, some cases I think identation can help make it more readable

Copy link
Member

Choose a reason for hiding this comment

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

no strong opinions from me. I don't think that this needs to be enforced by the linter.

Copy link
Member

Choose a reason for hiding this comment

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

I would just go with the style that the original author of the code preferred, else is more explicit and can support readability imo.

Doesn't apply everything e.g. sometimes you just wanna throw an error and not use else, if it's a 1-liner

Copy link
Contributor Author

@nazarhussain nazarhussain Oct 14, 2024

Choose a reason for hiding this comment

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

If indentation is needed for readability, one can use code blocks. There is a reason community named such style noUselessElse.

Also if there is larger code block which needs indentation for readability, it should be splited into multiple functions.

Copy link
Member

Choose a reason for hiding this comment

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

I tend to agree with that... else is a code smell of overly long code blocks that could be made more readable...

packages/cli/src/applyPreset.ts Show resolved Hide resolved
nflaig
nflaig previously approved these changes Oct 14, 2024
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 🎸

@@ -92,7 +92,7 @@ export function signedBlindedBlockToFull(

// state transition can't seem to handle executionPayloadHeader presense in merge block
// so just delete the extra field we don't require
delete (signedBlock.message.body as {executionPayloadHeader?: ExecutionPayloadHeader}).executionPayloadHeader;
(signedBlock.message.body as {executionPayloadHeader?: ExecutionPayloadHeader}).executionPayloadHeader = undefined;
Copy link
Member

@matthewkeil matthewkeil Oct 14, 2024

Choose a reason for hiding this comment

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

this may have unintended consequences... i forget the exact situation but the ssz library was not happy about creating a root (or maybe it was container statics accepting the value, but i forget) when there was an undefined after converting container types...

@wemeetagain wemeetagain merged commit 4e853d6 into unstable Oct 14, 2024
21 checks passed
@wemeetagain wemeetagain deleted the nh/biome-rules branch October 14, 2024 18:55
philknows pushed a commit that referenced this pull request Oct 18, 2024
* Enable recomended correctness/noVoidTypeReturn

* Enable recomended rule correctness/useYield

* Enable recomended rule performance/noAccumulatingSpread

* Enable recomended rule performance/noDelete

* Enable recomended rule suspicious/noAsyncPromiseExecutor

* Enable recommended rule suspicious/noDoubleEquals

* Enable recommended rule suspicious/noDuplicateTestHooks

* Enable recommended rule suspicious/noExportsInTest

* Enable recommended rule suspicious/noFallthroughSwitchClause

* Enable recommended rule suspicious/noGlobalIsFinite

* Enable recommended rule suspicious/noGlobalIsNan

* Enable recommended rule suspicious/noPrototypeBuiltins

* Enable recommended rule suspicious/noShadowRestrictedNames

* Enable recommended rule suspicious/useDefaultSwitchClauseLast

* Enable recommended rule suspicious/useGetterReturn

* Enable recommended rule style/noUnusedTemplateLiteral

* Convert default case to unreachable code

* Enable recommended rule complexity/noForEach

* Enable recommended rule complexity/noThisInStatic

* Enable recommended rule complexity/useFlatMap

* Enable recommended rule complexity/useOptionalChain

* Enable recommended rule complexity/useRegexLiterals

* Reorganize the config structure

* Fix few typos

* Revert "Enable recomended rule performance/noDelete"

This reverts commit 6cc060b.

* Fix formatting

* Enable recommended rule style/noUselessElse

* Enable recommended rule complexity/useLiteralKeys

* Enable recommended rule complexity/useArrowFunction

* Fix few types

* Fix a test file

* Fix formatting

* Enable recommended rule suspicious/noImplicitAnyLet

* Enable recommended rule complexity/noUselessEmptyExport

* Fix types

* Fix unti tests

* Fix unit test

* Fix lint error

* Fix a unit test pattern

* Fix formatting
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