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

chore: cleanup mocha/chai/sinon usage across the repo #6311

Merged
merged 24 commits into from
Jan 22, 2024

Conversation

nazarhussain
Copy link
Contributor

Motivation

Use consistent test runner.

Description

  • Cleanup mocha/chai usage across the repo
  • Split the test config files for unit/e2e/spec/browsers
  • Use consistent configuration for each package

Steps to test or reproduce

  • Run all tests.

Copy link

codecov bot commented Jan 18, 2024

Codecov Report

Merging #6311 (9ca0865) into unstable (8cc5f04) will decrease coverage by 17.43%.
Report is 4 commits behind head on unstable.
The diff coverage is n/a.

Additional details and impacted files
@@              Coverage Diff              @@
##           unstable    #6311       +/-   ##
=============================================
- Coverage     76.53%   59.10%   -17.43%     
=============================================
  Files           248      372      +124     
  Lines         25943    43809    +17866     
  Branches       1449     1346      -103     
=============================================
+ Hits          19855    25894     +6039     
- Misses         6058    17887    +11829     
+ Partials         30       28        -2     

Copy link
Contributor

github-actions bot commented Jan 18, 2024

⚠️ Performance Alert ⚠️

Possible performance regression was detected for some benchmarks.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold.

Benchmark suite Current: d26cc43 Previous: c423687 Ratio
computeDeltas 750000 validators 300 proto nodes 13.738 ms/op 4.3947 ms/op 3.13
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 22.114 us/op 6.9470 us/op 3.18
Full benchmark results
Benchmark suite Current: d26cc43 Previous: c423687 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 873.11 us/op 467.39 us/op 1.87
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 98.726 us/op 79.486 us/op 1.24
BLS verify - blst-native 1.3109 ms/op 1.1391 ms/op 1.15
BLS verifyMultipleSignatures 3 - blst-native 2.7429 ms/op 2.4092 ms/op 1.14
BLS verifyMultipleSignatures 8 - blst-native 6.0607 ms/op 5.3746 ms/op 1.13
BLS verifyMultipleSignatures 32 - blst-native 22.826 ms/op 19.620 ms/op 1.16
BLS verifyMultipleSignatures 64 - blst-native 43.971 ms/op 38.743 ms/op 1.13
BLS verifyMultipleSignatures 128 - blst-native 90.786 ms/op 76.980 ms/op 1.18
BLS deserializing 10000 signatures 938.74 ms/op 830.68 ms/op 1.13
BLS deserializing 100000 signatures 9.3994 s/op 8.4042 s/op 1.12
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.3320 ms/op 1.1404 ms/op 1.17
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.6818 ms/op 1.2947 ms/op 1.30
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.8686 ms/op 2.0375 ms/op 1.41
BLS verifyMultipleSignatures - same message - 64 - blst-native 3.8407 ms/op 4.1089 ms/op 0.93
BLS verifyMultipleSignatures - same message - 128 - blst-native 8.4685 ms/op 6.8087 ms/op 1.24
BLS aggregatePubkeys 32 - blst-native 27.807 us/op 22.965 us/op 1.21
BLS aggregatePubkeys 128 - blst-native 102.92 us/op 88.563 us/op 1.16
getAttestationsForBlock 45.950 ms/op 35.638 ms/op 1.29
getSlashingsAndExits - default max 196.14 us/op 126.36 us/op 1.55
getSlashingsAndExits - 2k 410.37 us/op 317.75 us/op 1.29
proposeBlockBody type=full, size=empty 4.9449 ms/op 3.9087 ms/op 1.27
isKnown best case - 1 super set check 341.00 ns/op 316.00 ns/op 1.08
isKnown normal case - 2 super set checks 320.00 ns/op 309.00 ns/op 1.04
isKnown worse case - 16 super set checks 307.00 ns/op 323.00 ns/op 0.95
CheckpointStateCache - add get delete 5.6620 us/op 3.6060 us/op 1.57
validate api signedAggregateAndProof - struct 2.7880 ms/op 2.3729 ms/op 1.17
validate gossip signedAggregateAndProof - struct 2.8256 ms/op 2.3927 ms/op 1.18
validate gossip attestation - vc 640000 1.3654 ms/op 1.1255 ms/op 1.21
batch validate gossip attestation - vc 640000 - chunk 32 162.77 us/op 143.86 us/op 1.13
batch validate gossip attestation - vc 640000 - chunk 64 141.22 us/op 132.65 us/op 1.06
batch validate gossip attestation - vc 640000 - chunk 128 134.73 us/op 121.20 us/op 1.11
batch validate gossip attestation - vc 640000 - chunk 256 134.65 us/op 121.42 us/op 1.11
pickEth1Vote - no votes 1.2707 ms/op 884.91 us/op 1.44
pickEth1Vote - max votes 7.7873 ms/op 5.4631 ms/op 1.43
pickEth1Vote - Eth1Data hashTreeRoot value x2048 17.331 ms/op 11.476 ms/op 1.51
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 25.428 ms/op 19.290 ms/op 1.32
pickEth1Vote - Eth1Data fastSerialize value x2048 618.93 us/op 430.99 us/op 1.44
pickEth1Vote - Eth1Data fastSerialize tree x2048 4.3938 ms/op 3.3129 ms/op 1.33
bytes32 toHexString 523.00 ns/op 438.00 ns/op 1.19
bytes32 Buffer.toString(hex) 293.00 ns/op 306.00 ns/op 0.96
bytes32 Buffer.toString(hex) from Uint8Array 474.00 ns/op 472.00 ns/op 1.00
bytes32 Buffer.toString(hex) + 0x 296.00 ns/op 308.00 ns/op 0.96
Object access 1 prop 0.17500 ns/op 0.20500 ns/op 0.85
Map access 1 prop 0.15300 ns/op 0.19300 ns/op 0.79
Object get x1000 7.5920 ns/op 5.4550 ns/op 1.39
Map get x1000 0.82100 ns/op 0.79800 ns/op 1.03
Object set x1000 55.981 ns/op 28.168 ns/op 1.99
Map set x1000 40.885 ns/op 17.406 ns/op 2.35
Return object 10000 times 0.24850 ns/op 0.23150 ns/op 1.07
Throw Error 10000 times 3.8881 us/op 2.9820 us/op 1.30
fastMsgIdFn sha256 / 200 bytes 3.2890 us/op 1.9950 us/op 1.65
fastMsgIdFn h32 xxhash / 200 bytes 286.00 ns/op 299.00 ns/op 0.96
fastMsgIdFn h64 xxhash / 200 bytes 343.00 ns/op 351.00 ns/op 0.98
fastMsgIdFn sha256 / 1000 bytes 11.257 us/op 6.2630 us/op 1.80
fastMsgIdFn h32 xxhash / 1000 bytes 405.00 ns/op 433.00 ns/op 0.94
fastMsgIdFn h64 xxhash / 1000 bytes 474.00 ns/op 440.00 ns/op 1.08
fastMsgIdFn sha256 / 10000 bytes 103.18 us/op 52.671 us/op 1.96
fastMsgIdFn h32 xxhash / 10000 bytes 1.9290 us/op 1.8640 us/op 1.03
fastMsgIdFn h64 xxhash / 10000 bytes 1.3570 us/op 1.2870 us/op 1.05
send data - 1000 256B messages 20.372 ms/op 11.736 ms/op 1.74
send data - 1000 512B messages 23.665 ms/op 16.338 ms/op 1.45
send data - 1000 1024B messages 41.111 ms/op 26.657 ms/op 1.54
send data - 1000 1200B messages 37.972 ms/op 31.567 ms/op 1.20
send data - 1000 2048B messages 49.841 ms/op 42.561 ms/op 1.17
send data - 1000 4096B messages 42.170 ms/op 36.165 ms/op 1.17
send data - 1000 16384B messages 116.96 ms/op 98.571 ms/op 1.19
send data - 1000 65536B messages 398.07 ms/op 427.36 ms/op 0.93
enrSubnets - fastDeserialize 64 bits 1.4830 us/op 1.0060 us/op 1.47
enrSubnets - ssz BitVector 64 bits 476.00 ns/op 473.00 ns/op 1.01
enrSubnets - fastDeserialize 4 bits 166.00 ns/op 202.00 ns/op 0.82
enrSubnets - ssz BitVector 4 bits 451.00 ns/op 449.00 ns/op 1.00
prioritizePeers score -10:0 att 32-0.1 sync 2-0 100.33 us/op 66.390 us/op 1.51
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 120.73 us/op 79.359 us/op 1.52
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 175.83 us/op 154.10 us/op 1.14
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 313.68 us/op 247.19 us/op 1.27
prioritizePeers score 0:0 att 64-1 sync 4-1 359.65 us/op 229.47 us/op 1.57
array of 16000 items push then shift 1.6505 us/op 1.3435 us/op 1.23
LinkedList of 16000 items push then shift 9.0090 ns/op 6.4890 ns/op 1.39
array of 16000 items push then pop 105.12 ns/op 97.668 ns/op 1.08
LinkedList of 16000 items push then pop 8.9310 ns/op 6.2180 ns/op 1.44
array of 24000 items push then shift 2.5806 us/op 1.9860 us/op 1.30
LinkedList of 24000 items push then shift 8.9270 ns/op 7.4950 ns/op 1.19
array of 24000 items push then pop 134.92 ns/op 125.91 ns/op 1.07
LinkedList of 24000 items push then pop 8.8920 ns/op 5.7080 ns/op 1.56
intersect bitArray bitLen 8 6.7520 ns/op 5.0980 ns/op 1.32
intersect array and set length 8 67.360 ns/op 53.816 ns/op 1.25
intersect bitArray bitLen 128 33.746 ns/op 29.649 ns/op 1.14
intersect array and set length 128 886.53 ns/op 961.96 ns/op 0.92
bitArray.getTrueBitIndexes() bitLen 128 1.6660 us/op 1.5400 us/op 1.08
bitArray.getTrueBitIndexes() bitLen 248 2.6270 us/op 2.5750 us/op 1.02
bitArray.getTrueBitIndexes() bitLen 512 5.7410 us/op 5.0120 us/op 1.15
Buffer.concat 32 items 1.0450 us/op 882.00 ns/op 1.18
Uint8Array.set 32 items 1.7320 us/op 2.1820 us/op 0.79
Set add up to 64 items then delete first 4.5940 us/op 1.8126 us/op 2.53
OrderedSet add up to 64 items then delete first 5.6467 us/op 2.6892 us/op 2.10
Set add up to 64 items then delete last 4.8388 us/op 2.0103 us/op 2.41
OrderedSet add up to 64 items then delete last 5.7022 us/op 3.0805 us/op 1.85
Set add up to 64 items then delete middle 4.5521 us/op 1.9877 us/op 2.29
OrderedSet add up to 64 items then delete middle 7.2286 us/op 4.2157 us/op 1.71
Set add up to 128 items then delete first 10.026 us/op 3.8687 us/op 2.59
OrderedSet add up to 128 items then delete first 14.937 us/op 5.7545 us/op 2.60
Set add up to 128 items then delete last 9.6787 us/op 3.7713 us/op 2.57
OrderedSet add up to 128 items then delete last 12.808 us/op 5.9280 us/op 2.16
Set add up to 128 items then delete middle 9.8299 us/op 3.7757 us/op 2.60
OrderedSet add up to 128 items then delete middle 19.449 us/op 10.830 us/op 1.80
Set add up to 256 items then delete first 20.478 us/op 7.7395 us/op 2.65
OrderedSet add up to 256 items then delete first 26.750 us/op 11.645 us/op 2.30
Set add up to 256 items then delete last 19.929 us/op 7.7307 us/op 2.58
OrderedSet add up to 256 items then delete last 27.017 us/op 11.940 us/op 2.26
Set add up to 256 items then delete middle 21.232 us/op 7.3277 us/op 2.90
OrderedSet add up to 256 items then delete middle 50.113 us/op 31.150 us/op 1.61
transfer serialized Status (84 B) 1.9490 us/op 1.4230 us/op 1.37
copy serialized Status (84 B) 1.4470 us/op 1.1440 us/op 1.26
transfer serialized SignedVoluntaryExit (112 B) 2.1720 us/op 1.5020 us/op 1.45
copy serialized SignedVoluntaryExit (112 B) 1.5060 us/op 1.1930 us/op 1.26
transfer serialized ProposerSlashing (416 B) 2.6840 us/op 2.1370 us/op 1.26
copy serialized ProposerSlashing (416 B) 2.5570 us/op 2.2260 us/op 1.15
transfer serialized Attestation (485 B) 2.7130 us/op 2.6490 us/op 1.02
copy serialized Attestation (485 B) 2.4870 us/op 2.5940 us/op 0.96
transfer serialized AttesterSlashing (33232 B) 2.7110 us/op 2.7130 us/op 1.00
copy serialized AttesterSlashing (33232 B) 8.0340 us/op 7.2620 us/op 1.11
transfer serialized Small SignedBeaconBlock (128000 B) 4.3000 us/op 2.5500 us/op 1.69
copy serialized Small SignedBeaconBlock (128000 B) 25.095 us/op 19.155 us/op 1.31
transfer serialized Avg SignedBeaconBlock (200000 B) 3.2260 us/op 2.8980 us/op 1.11
copy serialized Avg SignedBeaconBlock (200000 B) 25.958 us/op 30.785 us/op 0.84
transfer serialized BlobsSidecar (524380 B) 3.6730 us/op 2.2780 us/op 1.61
copy serialized BlobsSidecar (524380 B) 89.112 us/op 92.085 us/op 0.97
transfer serialized Big SignedBeaconBlock (1000000 B) 3.6570 us/op 2.5800 us/op 1.42
copy serialized Big SignedBeaconBlock (1000000 B) 205.01 us/op 154.95 us/op 1.32
pass gossip attestations to forkchoice per slot 4.5521 ms/op 2.6023 ms/op 1.75
forkChoice updateHead vc 100000 bc 64 eq 0 715.33 us/op 437.31 us/op 1.64
forkChoice updateHead vc 600000 bc 64 eq 0 5.1665 ms/op 2.6208 ms/op 1.97
forkChoice updateHead vc 1000000 bc 64 eq 0 7.3668 ms/op 4.2718 ms/op 1.72
forkChoice updateHead vc 600000 bc 320 eq 0 4.4403 ms/op 2.5890 ms/op 1.72
forkChoice updateHead vc 600000 bc 1200 eq 0 4.5045 ms/op 2.6597 ms/op 1.69
forkChoice updateHead vc 600000 bc 7200 eq 0 6.3737 ms/op 3.2874 ms/op 1.94
forkChoice updateHead vc 600000 bc 64 eq 1000 12.091 ms/op 9.8207 ms/op 1.23
forkChoice updateHead vc 600000 bc 64 eq 10000 12.394 ms/op 9.5519 ms/op 1.30
forkChoice updateHead vc 600000 bc 64 eq 300000 19.138 ms/op 11.773 ms/op 1.63
computeDeltas 500000 validators 300 proto nodes 7.2418 ms/op 3.0378 ms/op 2.38
computeDeltas 500000 validators 1200 proto nodes 7.0200 ms/op 2.8402 ms/op 2.47
computeDeltas 500000 validators 7200 proto nodes 7.6707 ms/op 2.8832 ms/op 2.66
computeDeltas 750000 validators 300 proto nodes 13.738 ms/op 4.3947 ms/op 3.13
computeDeltas 750000 validators 1200 proto nodes 13.047 ms/op 4.3827 ms/op 2.98
computeDeltas 750000 validators 7200 proto nodes 12.278 ms/op 4.3849 ms/op 2.80
computeDeltas 1400000 validators 300 proto nodes 24.050 ms/op 10.071 ms/op 2.39
computeDeltas 1400000 validators 1200 proto nodes 23.712 ms/op 8.8545 ms/op 2.68
computeDeltas 1400000 validators 7200 proto nodes 24.016 ms/op 8.8059 ms/op 2.73
computeDeltas 2100000 validators 300 proto nodes 36.738 ms/op 13.347 ms/op 2.75
computeDeltas 2100000 validators 1200 proto nodes 36.076 ms/op 13.186 ms/op 2.74
computeDeltas 2100000 validators 7200 proto nodes 35.808 ms/op 12.843 ms/op 2.79
altair processAttestation - 250000 vs - 7PWei normalcase 4.0012 ms/op 1.4251 ms/op 2.81
altair processAttestation - 250000 vs - 7PWei worstcase 5.5116 ms/op 2.2253 ms/op 2.48
altair processAttestation - setStatus - 1/6 committees join 179.79 us/op 69.965 us/op 2.57
altair processAttestation - setStatus - 1/3 committees join 364.40 us/op 138.93 us/op 2.62
altair processAttestation - setStatus - 1/2 committees join 452.46 us/op 199.88 us/op 2.26
altair processAttestation - setStatus - 2/3 committees join 580.59 us/op 257.74 us/op 2.25
altair processAttestation - setStatus - 4/5 committees join 977.05 us/op 381.90 us/op 2.56
altair processAttestation - setStatus - 100% committees join 1.1574 ms/op 447.40 us/op 2.59
altair processBlock - 250000 vs - 7PWei normalcase 13.924 ms/op 9.5824 ms/op 1.45
altair processBlock - 250000 vs - 7PWei normalcase hashState 50.161 ms/op 31.495 ms/op 1.59
altair processBlock - 250000 vs - 7PWei worstcase 52.445 ms/op 33.338 ms/op 1.57
altair processBlock - 250000 vs - 7PWei worstcase hashState 153.81 ms/op 78.044 ms/op 1.97
phase0 processBlock - 250000 vs - 7PWei normalcase 4.4753 ms/op 2.5599 ms/op 1.75
phase0 processBlock - 250000 vs - 7PWei worstcase 37.431 ms/op 24.799 ms/op 1.51
altair processEth1Data - 250000 vs - 7PWei normalcase 832.18 us/op 295.75 us/op 2.81
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 22.114 us/op 6.9470 us/op 3.18
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 76.009 us/op 29.996 us/op 2.53
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 30.706 us/op 15.354 us/op 2.00
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 19.672 us/op 13.264 us/op 1.48
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 220.05 us/op 97.488 us/op 2.26
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.4795 ms/op 988.58 us/op 1.50
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.0156 ms/op 1.4078 ms/op 1.43
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.9212 ms/op 1.3620 ms/op 1.41
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.3743 ms/op 2.3643 ms/op 1.85
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.9716 ms/op 1.4958 ms/op 1.99
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 5.4325 ms/op 3.4496 ms/op 1.57
Tree 40 250000 create 384.56 ms/op 283.03 ms/op 1.36
Tree 40 250000 get(125000) 209.15 ns/op 114.75 ns/op 1.82
Tree 40 250000 set(125000) 1.1504 us/op 699.20 ns/op 1.65
Tree 40 250000 toArray() 23.328 ms/op 19.893 ms/op 1.17
Tree 40 250000 iterate all - toArray() + loop 23.577 ms/op 21.490 ms/op 1.10
Tree 40 250000 iterate all - get(i) 76.643 ms/op 50.481 ms/op 1.52
MutableVector 250000 create 16.083 ms/op 11.330 ms/op 1.42
MutableVector 250000 get(125000) 6.8690 ns/op 5.7680 ns/op 1.19
MutableVector 250000 set(125000) 295.57 ns/op 207.39 ns/op 1.43
MutableVector 250000 toArray() 3.6443 ms/op 2.8749 ms/op 1.27
MutableVector 250000 iterate all - toArray() + loop 3.8586 ms/op 2.3405 ms/op 1.65
MutableVector 250000 iterate all - get(i) 1.6299 ms/op 1.3326 ms/op 1.22
Array 250000 create 3.4429 ms/op 2.1999 ms/op 1.57
Array 250000 clone - spread 1.3899 ms/op 1.2103 ms/op 1.15
Array 250000 get(125000) 1.1270 ns/op 1.0500 ns/op 1.07
Array 250000 set(125000) 4.3380 ns/op 1.2610 ns/op 3.44
Array 250000 iterate all - loop 168.11 us/op 152.72 us/op 1.10
effectiveBalanceIncrements clone Uint8Array 300000 36.722 us/op 15.084 us/op 2.43
effectiveBalanceIncrements clone MutableVector 300000 427.00 ns/op 429.00 ns/op 1.00
effectiveBalanceIncrements rw all Uint8Array 300000 203.44 us/op 183.78 us/op 1.11
effectiveBalanceIncrements rw all MutableVector 300000 91.773 ms/op 72.026 ms/op 1.27
phase0 afterProcessEpoch - 250000 vs - 7PWei 115.50 ms/op 76.625 ms/op 1.51
phase0 beforeProcessEpoch - 250000 vs - 7PWei 40.841 ms/op 36.753 ms/op 1.11
altair processEpoch - mainnet_e81889 463.99 ms/op 439.21 ms/op 1.06
mainnet_e81889 - altair beforeProcessEpoch 82.361 ms/op 71.577 ms/op 1.15
mainnet_e81889 - altair processJustificationAndFinalization 15.314 us/op 11.286 us/op 1.36
mainnet_e81889 - altair processInactivityUpdates 6.0052 ms/op 4.6898 ms/op 1.28
mainnet_e81889 - altair processRewardsAndPenalties 59.952 ms/op 60.247 ms/op 1.00
mainnet_e81889 - altair processRegistryUpdates 2.4870 us/op 4.2340 us/op 0.59
mainnet_e81889 - altair processSlashings 478.00 ns/op 907.00 ns/op 0.53
mainnet_e81889 - altair processEth1DataReset 682.00 ns/op 898.00 ns/op 0.76
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.1452 ms/op 1.0939 ms/op 1.96
mainnet_e81889 - altair processSlashingsReset 4.4450 us/op 3.6050 us/op 1.23
mainnet_e81889 - altair processRandaoMixesReset 5.2990 us/op 7.0540 us/op 0.75
mainnet_e81889 - altair processHistoricalRootsUpdate 1.1300 us/op 1.3070 us/op 0.86
mainnet_e81889 - altair processParticipationFlagUpdates 3.3870 us/op 2.1020 us/op 1.61
mainnet_e81889 - altair processSyncCommitteeUpdates 774.00 ns/op 1.0730 us/op 0.72
mainnet_e81889 - altair afterProcessEpoch 121.47 ms/op 87.574 ms/op 1.39
capella processEpoch - mainnet_e217614 2.0924 s/op 2.8188 s/op 0.74
mainnet_e217614 - capella beforeProcessEpoch 550.09 ms/op 711.76 ms/op 0.77
mainnet_e217614 - capella processJustificationAndFinalization 30.863 us/op 24.819 us/op 1.24
mainnet_e217614 - capella processInactivityUpdates 23.738 ms/op 33.060 ms/op 0.72
mainnet_e217614 - capella processRewardsAndPenalties 442.81 ms/op 447.34 ms/op 0.99
mainnet_e217614 - capella processRegistryUpdates 30.701 us/op 28.122 us/op 1.09
mainnet_e217614 - capella processSlashings 571.00 ns/op 1.4890 us/op 0.38
mainnet_e217614 - capella processEth1DataReset 601.00 ns/op 560.00 ns/op 1.07
mainnet_e217614 - capella processEffectiveBalanceUpdates 4.5508 ms/op 3.6185 ms/op 1.26
mainnet_e217614 - capella processSlashingsReset 3.8630 us/op 5.3950 us/op 0.72
mainnet_e217614 - capella processRandaoMixesReset 7.1540 us/op 7.8760 us/op 0.91
mainnet_e217614 - capella processHistoricalRootsUpdate 924.00 ns/op 931.00 ns/op 0.99
mainnet_e217614 - capella processParticipationFlagUpdates 4.0860 us/op 2.3310 us/op 1.75
mainnet_e217614 - capella afterProcessEpoch 396.70 ms/op 249.48 ms/op 1.59
phase0 processEpoch - mainnet_e58758 567.94 ms/op 418.75 ms/op 1.36
mainnet_e58758 - phase0 beforeProcessEpoch 115.77 ms/op 126.88 ms/op 0.91
mainnet_e58758 - phase0 processJustificationAndFinalization 20.413 us/op 13.301 us/op 1.53
mainnet_e58758 - phase0 processRewardsAndPenalties 53.871 ms/op 43.942 ms/op 1.23
mainnet_e58758 - phase0 processRegistryUpdates 16.548 us/op 7.0420 us/op 2.35
mainnet_e58758 - phase0 processSlashings 849.00 ns/op 810.00 ns/op 1.05
mainnet_e58758 - phase0 processEth1DataReset 1.0530 us/op 537.00 ns/op 1.96
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.2050 ms/op 1.4351 ms/op 1.54
mainnet_e58758 - phase0 processSlashingsReset 6.3800 us/op 4.8220 us/op 1.32
mainnet_e58758 - phase0 processRandaoMixesReset 10.289 us/op 4.5280 us/op 2.27
mainnet_e58758 - phase0 processHistoricalRootsUpdate 918.00 ns/op 644.00 ns/op 1.43
mainnet_e58758 - phase0 processParticipationRecordUpdates 12.317 us/op 3.9600 us/op 3.11
mainnet_e58758 - phase0 afterProcessEpoch 121.25 ms/op 70.134 ms/op 1.73
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.5373 ms/op 1.0097 ms/op 2.51
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.5886 ms/op 1.1430 ms/op 2.26
altair processInactivityUpdates - 250000 normalcase 40.088 ms/op 26.777 ms/op 1.50
altair processInactivityUpdates - 250000 worstcase 37.241 ms/op 24.261 ms/op 1.53
phase0 processRegistryUpdates - 250000 normalcase 19.826 us/op 6.9070 us/op 2.87
phase0 processRegistryUpdates - 250000 badcase_full_deposits 580.97 us/op 301.48 us/op 1.93
phase0 processRegistryUpdates - 250000 worstcase 0.5 219.38 ms/op 106.23 ms/op 2.07
altair processRewardsAndPenalties - 250000 normalcase 91.657 ms/op 52.343 ms/op 1.75
altair processRewardsAndPenalties - 250000 worstcase 102.64 ms/op 54.583 ms/op 1.88
phase0 getAttestationDeltas - 250000 normalcase 16.819 ms/op 7.9209 ms/op 2.12
phase0 getAttestationDeltas - 250000 worstcase 16.836 ms/op 7.1404 ms/op 2.36
phase0 processSlashings - 250000 worstcase 155.60 us/op 87.487 us/op 1.78
altair processSyncCommitteeUpdates - 250000 194.90 ms/op 109.10 ms/op 1.79
BeaconState.hashTreeRoot - No change 701.00 ns/op 598.00 ns/op 1.17
BeaconState.hashTreeRoot - 1 full validator 180.47 us/op 133.34 us/op 1.35
BeaconState.hashTreeRoot - 32 full validator 2.0938 ms/op 1.3548 ms/op 1.55
BeaconState.hashTreeRoot - 512 full validator 23.484 ms/op 16.547 ms/op 1.42
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 197.50 us/op 167.26 us/op 1.18
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.8701 ms/op 2.0423 ms/op 1.41
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 36.557 ms/op 28.183 ms/op 1.30
BeaconState.hashTreeRoot - 1 balances 151.06 us/op 134.78 us/op 1.12
BeaconState.hashTreeRoot - 32 balances 1.3331 ms/op 1.5411 ms/op 0.87
BeaconState.hashTreeRoot - 512 balances 11.829 ms/op 14.936 ms/op 0.79
BeaconState.hashTreeRoot - 250000 balances 234.54 ms/op 211.10 ms/op 1.11
aggregationBits - 2048 els - zipIndexesInBitList 20.115 us/op 11.562 us/op 1.74
byteArrayEquals 32 76.489 ns/op 68.998 ns/op 1.11
Buffer.compare 32 56.737 ns/op 41.373 ns/op 1.37
byteArrayEquals 1024 2.1050 us/op 1.7630 us/op 1.19
Buffer.compare 1024 73.312 ns/op 46.741 ns/op 1.57
byteArrayEquals 16384 33.486 us/op 28.230 us/op 1.19
Buffer.compare 16384 282.93 ns/op 223.88 ns/op 1.26
byteArrayEquals 123687377 247.62 ms/op 202.13 ms/op 1.23
Buffer.compare 123687377 7.1131 ms/op 5.9386 ms/op 1.20
byteArrayEquals 32 - diff last byte 72.185 ns/op 60.346 ns/op 1.20
Buffer.compare 32 - diff last byte 56.160 ns/op 36.155 ns/op 1.55
byteArrayEquals 1024 - diff last byte 2.0693 us/op 1.6943 us/op 1.22
Buffer.compare 1024 - diff last byte 70.833 ns/op 42.784 ns/op 1.66
byteArrayEquals 16384 - diff last byte 33.027 us/op 26.300 us/op 1.26
Buffer.compare 16384 - diff last byte 280.79 ns/op 200.21 ns/op 1.40
byteArrayEquals 123687377 - diff last byte 282.86 ms/op 223.97 ms/op 1.26
Buffer.compare 123687377 - diff last byte 10.113 ms/op 4.1636 ms/op 2.43
byteArrayEquals 32 - random bytes 5.9750 ns/op 4.5670 ns/op 1.31
Buffer.compare 32 - random bytes 62.825 ns/op 41.734 ns/op 1.51
byteArrayEquals 1024 - random bytes 6.6480 ns/op 4.5130 ns/op 1.47
Buffer.compare 1024 - random bytes 62.249 ns/op 36.977 ns/op 1.68
byteArrayEquals 16384 - random bytes 7.1730 ns/op 4.4570 ns/op 1.61
Buffer.compare 16384 - random bytes 66.324 ns/op 37.149 ns/op 1.79
byteArrayEquals 123687377 - random bytes 19.420 ns/op 8.0400 ns/op 2.42
Buffer.compare 123687377 - random bytes 89.470 ns/op 40.290 ns/op 2.22
regular array get 100000 times 51.122 us/op 41.798 us/op 1.22
wrappedArray get 100000 times 52.529 us/op 41.845 us/op 1.26
arrayWithProxy get 100000 times 15.365 ms/op 9.8586 ms/op 1.56
ssz.Root.equals 62.124 ns/op 54.561 ns/op 1.14
byteArrayEquals 62.044 ns/op 53.652 ns/op 1.16
Buffer.compare 13.617 ns/op 9.5180 ns/op 1.43
shuffle list - 16384 els 7.2285 ms/op 4.4879 ms/op 1.61
shuffle list - 250000 els 104.58 ms/op 66.370 ms/op 1.58
processSlot - 1 slots 15.614 us/op 10.986 us/op 1.42
processSlot - 32 slots 5.3279 ms/op 2.0642 ms/op 2.58
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 60.868 ms/op 50.545 ms/op 1.20
getCommitteeAssignments - req 1 vs - 250000 vc 2.4969 ms/op 2.2210 ms/op 1.12
getCommitteeAssignments - req 100 vs - 250000 vc 3.6601 ms/op 3.3314 ms/op 1.10
getCommitteeAssignments - req 1000 vs - 250000 vc 3.9960 ms/op 3.6310 ms/op 1.10
findModifiedValidators - 10000 modified validators 540.89 ms/op 419.09 ms/op 1.29
findModifiedValidators - 1000 modified validators 420.58 ms/op 345.67 ms/op 1.22
findModifiedValidators - 100 modified validators 427.40 ms/op 294.53 ms/op 1.45
findModifiedValidators - 10 modified validators 421.57 ms/op 303.60 ms/op 1.39
findModifiedValidators - 1 modified validators 407.33 ms/op 283.05 ms/op 1.44
findModifiedValidators - no difference 409.31 ms/op 314.69 ms/op 1.30
compare ViewDUs 4.2664 s/op 3.9066 s/op 1.09
compare each validator Uint8Array 1.6179 s/op 1.6100 s/op 1.00
compare ViewDU to Uint8Array 1.2482 s/op 827.06 ms/op 1.51
migrate state 1000000 validators, 24 modified, 0 new 736.38 ms/op 732.64 ms/op 1.01
migrate state 1000000 validators, 1700 modified, 1000 new 1.0529 s/op 970.97 ms/op 1.08
migrate state 1000000 validators, 3400 modified, 2000 new 1.3220 s/op 1.2693 s/op 1.04
migrate state 1500000 validators, 24 modified, 0 new 794.23 ms/op 761.55 ms/op 1.04
migrate state 1500000 validators, 1700 modified, 1000 new 1.0893 s/op 1.0389 s/op 1.05
migrate state 1500000 validators, 3400 modified, 2000 new 1.3296 s/op 1.1413 s/op 1.16
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.1800 ns/op 4.8800 ns/op 0.86
state getBlockRootAtSlot - 250000 vs - 7PWei 718.90 ns/op 530.89 ns/op 1.35
computeProposers - vc 250000 9.2912 ms/op 6.0083 ms/op 1.55
computeEpochShuffling - vc 250000 102.20 ms/op 69.499 ms/op 1.47
getNextSyncCommittee - vc 250000 149.89 ms/op 98.427 ms/op 1.52
computeSigningRoot for AttestationData 25.753 us/op 19.054 us/op 1.35
hash AttestationData serialized data then Buffer.toString(base64) 2.2474 us/op 1.3287 us/op 1.69
toHexString serialized data 1.0642 us/op 804.63 ns/op 1.32
Buffer.toString(base64) 209.28 ns/op 145.85 ns/op 1.43

by benchmarkbot/action

@nazarhussain nazarhussain marked this pull request as ready for review January 19, 2024 09:31
@nazarhussain nazarhussain requested a review from a team as a code owner January 19, 2024 09:31
@nazarhussain nazarhussain changed the title chore: cleanup mocha/chai usage across the repo chore: cleanup mocha/chai/sinon usage across the repo Jan 19, 2024
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.

I only did a really high-level review, looks mostly correct, left few comments

Please before merging this, make sure it is rebased against unstable to avoid issues like lock file diffs on unstable branch

CONTRIBUTING.md Outdated Show resolved Hide resolved
@@ -84,53 +84,6 @@ function runTests({useWorker}: {useWorker: boolean}): void {
return [netA, netB, await getPeerIdOf(netA), await getPeerIdOf(netB)];
}

// it("should send/receive a ping message", async function () {
Copy link
Member

Choose a reason for hiding this comment

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

Do you know why those were commented out in the first place and can be removed now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was commented a year earlier in following PR. https://github.com/ChainSafe/lodestar/pull/5229/files#diff-ed1686203e4792b95a12ac893ea47ec4435a2c453ff81ccd14b0fa83943a82cc

I believe testing those messages are not necessary as we are testing connection and other messages already.

Comment on lines +17 to 18
// eslint-disable-next-line vitest/valid-describe-callback
describe("network / peers / priorization", async () => {
Copy link
Member

Choose a reason for hiding this comment

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

why is this eslint disable required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

vitest/recommended eslint rules suggest to have no async for describe blocks and move such code into hooks.

Copy link
Member

Choose a reason for hiding this comment

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

Silly question, do you think we can/should put the setup in a hook? Seems like it can but am guessing you have a reason to go this route instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are multiple ways

  1. Do setup in test level hooks
  2. Create a file for config level setupFile that execute before every test context.
  3. Create a file for config level globalSetup that execute before a test run.

Te basic idea is any async code usually evolve some resources, so calling it in beforeAll or beforeEach and then clearing resources in afterAll or afterEach is preferred. If you do on describe level, there is more chances you forget to clear the resources.

Comment on lines -136 to -138
* Starting Aug 2023, this test case is not valid because when an attestation is added
* to forkchoice, the block should come first, i.e. nextIndex should be a number
*/
Copy link
Member

Choose a reason for hiding this comment

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

maybe @tuyennhv can confirm that this is ok to be removed, I would assume it was just commented out instead of fully removed for a reason

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.

Overall seems like a great update!!! 🎸 There are a few high level things that I think should be changed by this PR in the comments.

There are a lot of code changes here and it will be easier to review a bit more closely on a call or something. In particular how all the mocking was changed.

.eslintrc.js Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
packages/api/package.json Show resolved Hide resolved
packages/api/test/perf/compileRouteUrlFormater.test.ts Outdated Show resolved Hide resolved
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.

Looks great overall!! Thanks for taking this across the finish line. There is a lot of great, detailed work here. Just a couple of small questions that came up when i went through with a fine toothed comb.

packages/reqresp/test/utils/index.ts Show resolved Hide resolved
tsconfig.build.json Show resolved Hide resolved
vitest.base.unit.config.ts Show resolved Hide resolved
karma.base.config.js Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
Co-authored-by: Matthew Keil <me@matthewkeil.com>
@nazarhussain
Copy link
Contributor Author

@matthewkeil I am merging this PR to move further with remaining action points. But would be happy to answer any questions or work on feedback in upcoming PRs.

@nazarhussain nazarhussain merged commit 5b129f0 into unstable Jan 22, 2024
14 of 15 checks passed
@nazarhussain nazarhussain deleted the nh/test-cleanup branch January 22, 2024 17:35
@matthewkeil
Copy link
Member

@matthewkeil I am merging this PR to move further with remaining action points. But would be happy to answer any questions or work on feedback in upcoming PRs.

Looks good. No worries, was mostly just concerned about the other reviews and @wemeetagain gave a final blessing so all is gravy baby 😊. Good work!

@wemeetagain
Copy link
Member

🎉 This PR is included in v1.15.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