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

test(prover): move tests for prover to vitest #6074

Merged
merged 40 commits into from
Dec 8, 2023
Merged

Conversation

nazarhussain
Copy link
Contributor

@nazarhussain nazarhussain commented Oct 30, 2023

Motivation

Use the consistent testing pattern across the packages.

Description

As we started migrating our tests form mocha + chai + sinon to vitest, this PR migrate further the @lodestar/prover package.

  • Move prover unit tests to vitest
  • Move prover e2e tests to vitest
  • Move prover browsers tests to vitest

We had to drop the testing support for the electron for short while during this migration.

Steps to test or reproduce

  • Run all tests.

@nazarhussain nazarhussain requested a review from a team as a code owner October 30, 2023 13:17
@nazarhussain nazarhussain self-assigned this Oct 30, 2023
@nazarhussain
Copy link
Contributor Author

For reviewers, please skip the first commit if you intend to review commit by commit.

@nazarhussain nazarhussain changed the title Move tests for prover to vitest test(prover): move tests for prover to vitest Oct 30, 2023
package.json Outdated
},
"resolutions": {
"dns-over-http-resolver": "^2.1.1"
"dns-over-http-resolver": "^2.1.1",
"chai": "^4.3.10"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As we are still using chai as direct dev-dependency of our packages, so have to add a resolution to solve conflict between vitest deep dependency.

@nazarhussain nazarhussain marked this pull request as draft October 30, 2023 13:21
@github-actions
Copy link
Contributor

github-actions bot commented Oct 30, 2023

Performance Report

✔️ no performance regression detected

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: 6e7bb2e Previous: fa702df Ratio
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 178.01 us/op 565.22 us/op 0.31
Set add up to 64 items then delete middle 2.0175 us/op 6.7225 us/op 0.30
Set add up to 128 items then delete first 3.9538 us/op 13.045 us/op 0.30
OrderedSet add up to 128 items then delete first 6.2454 us/op 21.082 us/op 0.30
Set add up to 128 items then delete last 3.8955 us/op 13.576 us/op 0.29
Set add up to 128 items then delete middle 3.8282 us/op 14.198 us/op 0.27
Set add up to 256 items then delete first 7.6821 us/op 26.749 us/op 0.29
OrderedSet add up to 256 items then delete first 13.291 us/op 41.387 us/op 0.32
Set add up to 256 items then delete last 7.4418 us/op 27.077 us/op 0.27
Set add up to 256 items then delete middle 7.5331 us/op 27.869 us/op 0.27
forkChoice updateHead vc 600000 bc 64 eq 300000 14.500 ms/op 99.779 ms/op 0.15
Full benchmark results
Benchmark suite Current: 6e7bb2e Previous: fa702df Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 670.17 us/op 594.68 us/op 1.13
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 112.36 us/op 159.68 us/op 0.70
BLS verify - blst-native 1.1897 ms/op 1.5078 ms/op 0.79
BLS verifyMultipleSignatures 3 - blst-native 2.4200 ms/op 3.1082 ms/op 0.78
BLS verifyMultipleSignatures 8 - blst-native 5.4705 ms/op 6.5695 ms/op 0.83
BLS verifyMultipleSignatures 32 - blst-native 19.571 ms/op 24.313 ms/op 0.80
BLS verifyMultipleSignatures 64 - blst-native 39.529 ms/op 50.197 ms/op 0.79
BLS verifyMultipleSignatures 128 - blst-native 78.703 ms/op 95.762 ms/op 0.82
BLS deserializing 10000 signatures 839.57 ms/op 1.0508 s/op 0.80
BLS deserializing 100000 signatures 8.9136 s/op 10.597 s/op 0.84
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.6772 ms/op 1.6810 ms/op 1.00
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.5269 ms/op 1.7267 ms/op 0.88
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.6400 ms/op 2.6432 ms/op 1.00
BLS verifyMultipleSignatures - same message - 64 - blst-native 5.1379 ms/op 3.8865 ms/op 1.32
BLS verifyMultipleSignatures - same message - 128 - blst-native 5.6180 ms/op 6.5971 ms/op 0.85
BLS aggregatePubkeys 32 - blst-native 27.206 us/op 28.757 us/op 0.95
BLS aggregatePubkeys 128 - blst-native 95.271 us/op 111.25 us/op 0.86
getAttestationsForBlock 54.760 ms/op 112.89 ms/op 0.49
getSlashingsAndExits - default max 309.78 us/op 743.64 us/op 0.42
getSlashingsAndExits - 2k 554.33 us/op 1.3346 ms/op 0.42
proposeBlockBody type=full, size=empty 4.5985 ms/op 7.8433 ms/op 0.59
isKnown best case - 1 super set check 373.00 ns/op 683.00 ns/op 0.55
isKnown normal case - 2 super set checks 401.00 ns/op 696.00 ns/op 0.58
isKnown worse case - 16 super set checks 362.00 ns/op 765.00 ns/op 0.47
CheckpointStateCache - add get delete 5.3750 us/op 7.2180 us/op 0.74
validate api signedAggregateAndProof - struct 2.6994 ms/op 3.3339 ms/op 0.81
validate gossip signedAggregateAndProof - struct 2.4578 ms/op 3.2018 ms/op 0.77
validate gossip attestation - vc 640000 1.2200 ms/op 1.7063 ms/op 0.72
batch validate gossip attestation - vc 640000 - chunk 32 151.91 us/op 213.14 us/op 0.71
batch validate gossip attestation - vc 640000 - chunk 64 136.90 us/op 195.95 us/op 0.70
batch validate gossip attestation - vc 640000 - chunk 128 130.11 us/op 191.35 us/op 0.68
batch validate gossip attestation - vc 640000 - chunk 256 123.60 us/op 163.05 us/op 0.76
pickEth1Vote - no votes 1.0865 ms/op 1.5482 ms/op 0.70
pickEth1Vote - max votes 7.8613 ms/op 14.981 ms/op 0.52
pickEth1Vote - Eth1Data hashTreeRoot value x2048 19.332 ms/op 26.582 ms/op 0.73
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 39.071 ms/op 37.127 ms/op 1.05
pickEth1Vote - Eth1Data fastSerialize value x2048 527.74 us/op 803.20 us/op 0.66
pickEth1Vote - Eth1Data fastSerialize tree x2048 9.2439 ms/op 7.5219 ms/op 1.23
bytes32 toHexString 617.00 ns/op 1.1660 us/op 0.53
bytes32 Buffer.toString(hex) 390.00 ns/op 458.00 ns/op 0.85
bytes32 Buffer.toString(hex) from Uint8Array 631.00 ns/op 679.00 ns/op 0.93
bytes32 Buffer.toString(hex) + 0x 368.00 ns/op 401.00 ns/op 0.92
Object access 1 prop 0.27000 ns/op 0.25100 ns/op 1.08
Map access 1 prop 0.20000 ns/op 0.17300 ns/op 1.16
Object get x1000 5.2410 ns/op 9.4610 ns/op 0.55
Map get x1000 0.84900 ns/op 0.94800 ns/op 0.90
Object set x1000 44.306 ns/op 83.832 ns/op 0.53
Map set x1000 29.574 ns/op 61.220 ns/op 0.48
Return object 10000 times 0.23470 ns/op 0.33690 ns/op 0.70
Throw Error 10000 times 2.7907 us/op 4.3968 us/op 0.63
fastMsgIdFn sha256 / 200 bytes 2.1440 us/op 3.8890 us/op 0.55
fastMsgIdFn h32 xxhash / 200 bytes 383.00 ns/op 419.00 ns/op 0.91
fastMsgIdFn h64 xxhash / 200 bytes 425.00 ns/op 457.00 ns/op 0.93
fastMsgIdFn sha256 / 1000 bytes 6.4860 us/op 13.304 us/op 0.49
fastMsgIdFn h32 xxhash / 1000 bytes 505.00 ns/op 544.00 ns/op 0.93
fastMsgIdFn h64 xxhash / 1000 bytes 505.00 ns/op 545.00 ns/op 0.93
fastMsgIdFn sha256 / 10000 bytes 54.647 us/op 118.38 us/op 0.46
fastMsgIdFn h32 xxhash / 10000 bytes 1.9830 us/op 2.1830 us/op 0.91
fastMsgIdFn h64 xxhash / 10000 bytes 1.3720 us/op 1.5180 us/op 0.90
send data - 1000 256B messages 16.272 ms/op 25.181 ms/op 0.65
send data - 1000 512B messages 19.706 ms/op 32.417 ms/op 0.61
send data - 1000 1024B messages 28.034 ms/op 47.730 ms/op 0.59
send data - 1000 1200B messages 33.364 ms/op 50.609 ms/op 0.66
send data - 1000 2048B messages 37.617 ms/op 55.463 ms/op 0.68
send data - 1000 4096B messages 42.410 ms/op 59.327 ms/op 0.71
send data - 1000 16384B messages 88.933 ms/op 132.29 ms/op 0.67
send data - 1000 65536B messages 437.23 ms/op 590.78 ms/op 0.74
enrSubnets - fastDeserialize 64 bits 1.0880 us/op 2.2670 us/op 0.48
enrSubnets - ssz BitVector 64 bits 456.00 ns/op 778.00 ns/op 0.59
enrSubnets - fastDeserialize 4 bits 218.00 ns/op 319.00 ns/op 0.68
enrSubnets - ssz BitVector 4 bits 448.00 ns/op 727.00 ns/op 0.62
prioritizePeers score -10:0 att 32-0.1 sync 2-0 68.376 us/op 165.25 us/op 0.41
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 87.882 us/op 215.82 us/op 0.41
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 118.25 us/op 220.60 us/op 0.54
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 178.01 us/op 565.22 us/op 0.31
prioritizePeers score 0:0 att 64-1 sync 4-1 202.29 us/op 499.71 us/op 0.40
array of 16000 items push then shift 1.3219 us/op 2.1042 us/op 0.63
LinkedList of 16000 items push then shift 5.9420 ns/op 10.941 ns/op 0.54
array of 16000 items push then pop 90.648 ns/op 140.22 ns/op 0.65
LinkedList of 16000 items push then pop 5.7660 ns/op 12.006 ns/op 0.48
array of 24000 items push then shift 1.9041 us/op 2.9741 us/op 0.64
LinkedList of 24000 items push then shift 6.7530 ns/op 12.193 ns/op 0.55
array of 24000 items push then pop 134.00 ns/op 184.01 ns/op 0.73
LinkedList of 24000 items push then pop 5.8630 ns/op 10.579 ns/op 0.55
intersect bitArray bitLen 8 5.0730 ns/op 7.2420 ns/op 0.70
intersect array and set length 8 51.148 ns/op 135.62 ns/op 0.38
intersect bitArray bitLen 128 27.889 ns/op 50.723 ns/op 0.55
intersect array and set length 128 682.92 ns/op 1.1619 us/op 0.59
bitArray.getTrueBitIndexes() bitLen 128 1.3240 us/op 2.0430 us/op 0.65
bitArray.getTrueBitIndexes() bitLen 248 2.3750 us/op 3.4080 us/op 0.70
bitArray.getTrueBitIndexes() bitLen 512 4.3860 us/op 7.2790 us/op 0.60
Buffer.concat 32 items 950.00 ns/op 1.3670 us/op 0.69
Uint8Array.set 32 items 1.5130 us/op 2.7870 us/op 0.54
Set add up to 64 items then delete first 1.8110 us/op 5.4215 us/op 0.33
OrderedSet add up to 64 items then delete first 2.7006 us/op 7.6360 us/op 0.35
Set add up to 64 items then delete last 2.0680 us/op 6.0506 us/op 0.34
OrderedSet add up to 64 items then delete last 3.0595 us/op 8.0051 us/op 0.38
Set add up to 64 items then delete middle 2.0175 us/op 6.7225 us/op 0.30
OrderedSet add up to 64 items then delete middle 4.2604 us/op 12.589 us/op 0.34
Set add up to 128 items then delete first 3.9538 us/op 13.045 us/op 0.30
OrderedSet add up to 128 items then delete first 6.2454 us/op 21.082 us/op 0.30
Set add up to 128 items then delete last 3.8955 us/op 13.576 us/op 0.29
OrderedSet add up to 128 items then delete last 5.9188 us/op 17.268 us/op 0.34
Set add up to 128 items then delete middle 3.8282 us/op 14.198 us/op 0.27
OrderedSet add up to 128 items then delete middle 10.950 us/op 30.501 us/op 0.36
Set add up to 256 items then delete first 7.6821 us/op 26.749 us/op 0.29
OrderedSet add up to 256 items then delete first 13.291 us/op 41.387 us/op 0.32
Set add up to 256 items then delete last 7.4418 us/op 27.077 us/op 0.27
OrderedSet add up to 256 items then delete last 12.598 us/op 37.035 us/op 0.34
Set add up to 256 items then delete middle 7.5331 us/op 27.869 us/op 0.27
OrderedSet add up to 256 items then delete middle 33.391 us/op 82.518 us/op 0.40
transfer serialized Status (84 B) 1.4470 us/op 3.6670 us/op 0.39
copy serialized Status (84 B) 1.2740 us/op 2.6240 us/op 0.49
transfer serialized SignedVoluntaryExit (112 B) 1.4890 us/op 2.8080 us/op 0.53
copy serialized SignedVoluntaryExit (112 B) 1.4590 us/op 2.5240 us/op 0.58
transfer serialized ProposerSlashing (416 B) 1.9090 us/op 3.1230 us/op 0.61
copy serialized ProposerSlashing (416 B) 1.9840 us/op 3.1840 us/op 0.62
transfer serialized Attestation (485 B) 1.7040 us/op 3.0540 us/op 0.56
copy serialized Attestation (485 B) 2.4750 us/op 3.1430 us/op 0.79
transfer serialized AttesterSlashing (33232 B) 2.5080 us/op 3.4570 us/op 0.73
copy serialized AttesterSlashing (33232 B) 5.6240 us/op 13.004 us/op 0.43
transfer serialized Small SignedBeaconBlock (128000 B) 3.0950 us/op 4.2160 us/op 0.73
copy serialized Small SignedBeaconBlock (128000 B) 9.6880 us/op 44.057 us/op 0.22
transfer serialized Avg SignedBeaconBlock (200000 B) 2.9160 us/op 6.5760 us/op 0.44
copy serialized Avg SignedBeaconBlock (200000 B) 13.568 us/op 60.341 us/op 0.22
transfer serialized BlobsSidecar (524380 B) 3.2120 us/op 8.5780 us/op 0.37
copy serialized BlobsSidecar (524380 B) 145.23 us/op 209.92 us/op 0.69
transfer serialized Big SignedBeaconBlock (1000000 B) 3.4820 us/op 12.711 us/op 0.27
copy serialized Big SignedBeaconBlock (1000000 B) 311.02 us/op 362.98 us/op 0.86
pass gossip attestations to forkchoice per slot 2.7769 ms/op 6.5041 ms/op 0.43
forkChoice updateHead vc 100000 bc 64 eq 0 543.83 us/op 1.0865 ms/op 0.50
forkChoice updateHead vc 600000 bc 64 eq 0 3.6264 ms/op 9.3564 ms/op 0.39
forkChoice updateHead vc 1000000 bc 64 eq 0 5.2238 ms/op 11.763 ms/op 0.44
forkChoice updateHead vc 600000 bc 320 eq 0 3.1828 ms/op 6.7960 ms/op 0.47
forkChoice updateHead vc 600000 bc 1200 eq 0 3.5759 ms/op 8.7170 ms/op 0.41
forkChoice updateHead vc 600000 bc 7200 eq 0 4.0580 ms/op 11.170 ms/op 0.36
forkChoice updateHead vc 600000 bc 64 eq 1000 10.514 ms/op 17.633 ms/op 0.60
forkChoice updateHead vc 600000 bc 64 eq 10000 10.898 ms/op 21.330 ms/op 0.51
forkChoice updateHead vc 600000 bc 64 eq 300000 14.500 ms/op 99.779 ms/op 0.15
computeDeltas 500000 validators 300 proto nodes 3.9088 ms/op 8.7628 ms/op 0.45
computeDeltas 500000 validators 1200 proto nodes 3.4044 ms/op 7.7669 ms/op 0.44
computeDeltas 500000 validators 7200 proto nodes 3.5865 ms/op 7.5430 ms/op 0.48
computeDeltas 750000 validators 300 proto nodes 5.4240 ms/op 16.051 ms/op 0.34
computeDeltas 750000 validators 1200 proto nodes 5.4947 ms/op 15.417 ms/op 0.36
computeDeltas 750000 validators 7200 proto nodes 4.8599 ms/op 11.409 ms/op 0.43
computeDeltas 1400000 validators 300 proto nodes 9.2602 ms/op 22.003 ms/op 0.42
computeDeltas 1400000 validators 1200 proto nodes 9.1019 ms/op 21.910 ms/op 0.42
computeDeltas 1400000 validators 7200 proto nodes 9.0535 ms/op 21.172 ms/op 0.43
computeDeltas 2100000 validators 300 proto nodes 13.309 ms/op 30.331 ms/op 0.44
computeDeltas 2100000 validators 1200 proto nodes 13.705 ms/op 30.997 ms/op 0.44
computeDeltas 2100000 validators 7200 proto nodes 14.145 ms/op 32.176 ms/op 0.44
computeProposerBoostScoreFromBalances 500000 validators 3.2669 ms/op 4.3780 ms/op 0.75
computeProposerBoostScoreFromBalances 750000 validators 3.2344 ms/op 4.4315 ms/op 0.73
computeProposerBoostScoreFromBalances 1400000 validators 3.2850 ms/op 4.4071 ms/op 0.75
computeProposerBoostScoreFromBalances 2100000 validators 3.3115 ms/op 4.3916 ms/op 0.75
altair processAttestation - 250000 vs - 7PWei normalcase 1.5219 ms/op 3.4494 ms/op 0.44
altair processAttestation - 250000 vs - 7PWei worstcase 2.2058 ms/op 5.0003 ms/op 0.44
altair processAttestation - setStatus - 1/6 committees join 69.799 us/op 176.87 us/op 0.39
altair processAttestation - setStatus - 1/3 committees join 152.85 us/op 319.89 us/op 0.48
altair processAttestation - setStatus - 1/2 committees join 208.80 us/op 412.57 us/op 0.51
altair processAttestation - setStatus - 2/3 committees join 274.99 us/op 524.63 us/op 0.52
altair processAttestation - setStatus - 4/5 committees join 400.93 us/op 769.96 us/op 0.52
altair processAttestation - setStatus - 100% committees join 464.99 us/op 905.82 us/op 0.51
altair processBlock - 250000 vs - 7PWei normalcase 7.4382 ms/op 11.642 ms/op 0.64
altair processBlock - 250000 vs - 7PWei normalcase hashState 33.929 ms/op 41.495 ms/op 0.82
altair processBlock - 250000 vs - 7PWei worstcase 34.702 ms/op 43.611 ms/op 0.80
altair processBlock - 250000 vs - 7PWei worstcase hashState 75.660 ms/op 107.06 ms/op 0.71
phase0 processBlock - 250000 vs - 7PWei normalcase 3.0278 ms/op 3.0657 ms/op 0.99
phase0 processBlock - 250000 vs - 7PWei worstcase 30.068 ms/op 40.110 ms/op 0.75
altair processEth1Data - 250000 vs - 7PWei normalcase 493.77 us/op 644.14 us/op 0.77
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 14.558 us/op 15.234 us/op 0.96
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 56.456 us/op 64.938 us/op 0.87
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 15.121 us/op 23.897 us/op 0.63
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 13.068 us/op 15.766 us/op 0.83
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 170.80 us/op 171.37 us/op 1.00
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.3485 ms/op 1.4688 ms/op 0.92
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 982.49 us/op 2.1498 ms/op 0.46
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.2139 ms/op 1.6119 ms/op 0.75
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 2.2645 ms/op 3.8598 ms/op 0.59
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.9277 ms/op 2.5965 ms/op 0.74
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.7294 ms/op 5.7406 ms/op 0.65
Tree 40 250000 create 244.83 ms/op 413.97 ms/op 0.59
Tree 40 250000 get(125000) 127.15 ns/op 219.21 ns/op 0.58
Tree 40 250000 set(125000) 761.65 ns/op 1.0632 us/op 0.72
Tree 40 250000 toArray() 20.544 ms/op 23.886 ms/op 0.86
Tree 40 250000 iterate all - toArray() + loop 13.952 ms/op 23.644 ms/op 0.59
Tree 40 250000 iterate all - get(i) 51.786 ms/op 75.638 ms/op 0.68
MutableVector 250000 create 13.484 ms/op 14.367 ms/op 0.94
MutableVector 250000 get(125000) 6.6820 ns/op 6.9070 ns/op 0.97
MutableVector 250000 set(125000) 252.19 ns/op 315.24 ns/op 0.80
MutableVector 250000 toArray() 2.5572 ms/op 4.4092 ms/op 0.58
MutableVector 250000 iterate all - toArray() + loop 2.8445 ms/op 5.1019 ms/op 0.56
MutableVector 250000 iterate all - get(i) 1.3598 ms/op 1.5896 ms/op 0.86
Array 250000 create 2.3355 ms/op 3.8679 ms/op 0.60
Array 250000 clone - spread 1.2548 ms/op 1.2853 ms/op 0.98
Array 250000 get(125000) 1.0540 ns/op 1.1040 ns/op 0.95
Array 250000 set(125000) 1.2610 ns/op 4.4790 ns/op 0.28
Array 250000 iterate all - loop 154.60 us/op 173.65 us/op 0.89
effectiveBalanceIncrements clone Uint8Array 300000 16.701 us/op 36.096 us/op 0.46
effectiveBalanceIncrements clone MutableVector 300000 416.00 ns/op 361.00 ns/op 1.15
effectiveBalanceIncrements rw all Uint8Array 300000 183.84 us/op 215.47 us/op 0.85
effectiveBalanceIncrements rw all MutableVector 300000 128.51 ms/op 92.484 ms/op 1.39
phase0 afterProcessEpoch - 250000 vs - 7PWei 77.559 ms/op 121.31 ms/op 0.64
phase0 beforeProcessEpoch - 250000 vs - 7PWei 37.895 ms/op 56.808 ms/op 0.67
altair processEpoch - mainnet_e81889 467.25 ms/op 561.74 ms/op 0.83
mainnet_e81889 - altair beforeProcessEpoch 78.213 ms/op 89.589 ms/op 0.87
mainnet_e81889 - altair processJustificationAndFinalization 13.131 us/op 25.138 us/op 0.52
mainnet_e81889 - altair processInactivityUpdates 5.5976 ms/op 7.1146 ms/op 0.79
mainnet_e81889 - altair processRewardsAndPenalties 63.529 ms/op 68.353 ms/op 0.93
mainnet_e81889 - altair processRegistryUpdates 3.4140 us/op 3.1700 us/op 1.08
mainnet_e81889 - altair processSlashings 736.00 ns/op 855.00 ns/op 0.86
mainnet_e81889 - altair processEth1DataReset 799.00 ns/op 683.00 ns/op 1.17
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.3839 ms/op 1.6498 ms/op 0.84
mainnet_e81889 - altair processSlashingsReset 3.5960 us/op 4.9340 us/op 0.73
mainnet_e81889 - altair processRandaoMixesReset 6.9330 us/op 6.3910 us/op 1.08
mainnet_e81889 - altair processHistoricalRootsUpdate 760.00 ns/op 1.0800 us/op 0.70
mainnet_e81889 - altair processParticipationFlagUpdates 3.4640 us/op 3.8440 us/op 0.90
mainnet_e81889 - altair processSyncCommitteeUpdates 820.00 ns/op 973.00 ns/op 0.84
mainnet_e81889 - altair afterProcessEpoch 78.751 ms/op 134.84 ms/op 0.58
capella processEpoch - mainnet_e217614 2.4994 s/op 2.8107 s/op 0.89
mainnet_e217614 - capella beforeProcessEpoch 606.57 ms/op 650.06 ms/op 0.93
mainnet_e217614 - capella processJustificationAndFinalization 24.401 us/op 20.151 us/op 1.21
mainnet_e217614 - capella processInactivityUpdates 21.787 ms/op 25.361 ms/op 0.86
mainnet_e217614 - capella processRewardsAndPenalties 440.26 ms/op 478.79 ms/op 0.92
mainnet_e217614 - capella processRegistryUpdates 26.995 us/op 41.104 us/op 0.66
mainnet_e217614 - capella processSlashings 1.0960 us/op 1.0600 us/op 1.03
mainnet_e217614 - capella processEth1DataReset 752.00 ns/op 871.00 ns/op 0.86
mainnet_e217614 - capella processEffectiveBalanceUpdates 5.1076 ms/op 5.9142 ms/op 0.86
mainnet_e217614 - capella processSlashingsReset 4.6420 us/op 5.2310 us/op 0.89
mainnet_e217614 - capella processRandaoMixesReset 9.2070 us/op 8.1450 us/op 1.13
mainnet_e217614 - capella processHistoricalRootsUpdate 1.9370 us/op 763.00 ns/op 2.54
mainnet_e217614 - capella processParticipationFlagUpdates 3.7960 us/op 3.3310 us/op 1.14
mainnet_e217614 - capella afterProcessEpoch 281.91 ms/op 349.61 ms/op 0.81
phase0 processEpoch - mainnet_e58758 505.95 ms/op 637.69 ms/op 0.79
mainnet_e58758 - phase0 beforeProcessEpoch 156.02 ms/op 199.54 ms/op 0.78
mainnet_e58758 - phase0 processJustificationAndFinalization 20.665 us/op 27.007 us/op 0.77
mainnet_e58758 - phase0 processRewardsAndPenalties 60.550 ms/op 66.193 ms/op 0.91
mainnet_e58758 - phase0 processRegistryUpdates 18.276 us/op 14.964 us/op 1.22
mainnet_e58758 - phase0 processSlashings 1.0080 us/op 828.00 ns/op 1.22
mainnet_e58758 - phase0 processEth1DataReset 1.2020 us/op 1.0730 us/op 1.12
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.2031 ms/op 1.5962 ms/op 0.75
mainnet_e58758 - phase0 processSlashingsReset 5.6330 us/op 5.0380 us/op 1.12
mainnet_e58758 - phase0 processRandaoMixesReset 7.7570 us/op 7.3140 us/op 1.06
mainnet_e58758 - phase0 processHistoricalRootsUpdate 906.00 ns/op 806.00 ns/op 1.12
mainnet_e58758 - phase0 processParticipationRecordUpdates 6.4110 us/op 9.4510 us/op 0.68
mainnet_e58758 - phase0 afterProcessEpoch 67.500 ms/op 112.26 ms/op 0.60
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.2652 ms/op 1.7080 ms/op 0.74
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.0741 ms/op 2.2199 ms/op 0.93
altair processInactivityUpdates - 250000 normalcase 30.630 ms/op 36.654 ms/op 0.84
altair processInactivityUpdates - 250000 worstcase 24.962 ms/op 28.911 ms/op 0.86
phase0 processRegistryUpdates - 250000 normalcase 15.568 us/op 14.934 us/op 1.04
phase0 processRegistryUpdates - 250000 badcase_full_deposits 435.02 us/op 461.96 us/op 0.94
phase0 processRegistryUpdates - 250000 worstcase 0.5 202.45 ms/op 158.59 ms/op 1.28
altair processRewardsAndPenalties - 250000 normalcase 66.698 ms/op 70.995 ms/op 0.94
altair processRewardsAndPenalties - 250000 worstcase 69.621 ms/op 70.408 ms/op 0.99
phase0 getAttestationDeltas - 250000 normalcase 12.519 ms/op 15.326 ms/op 0.82
phase0 getAttestationDeltas - 250000 worstcase 11.489 ms/op 15.448 ms/op 0.74
phase0 processSlashings - 250000 worstcase 83.782 us/op 121.21 us/op 0.69
altair processSyncCommitteeUpdates - 250000 135.84 ms/op 183.31 ms/op 0.74
BeaconState.hashTreeRoot - No change 332.00 ns/op 323.00 ns/op 1.03
BeaconState.hashTreeRoot - 1 full validator 210.93 us/op 215.55 us/op 0.98
BeaconState.hashTreeRoot - 32 full validator 1.6510 ms/op 2.3365 ms/op 0.71
BeaconState.hashTreeRoot - 512 full validator 24.586 ms/op 24.346 ms/op 1.01
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 192.70 us/op 194.92 us/op 0.99
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.4194 ms/op 2.4638 ms/op 0.98
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 24.203 ms/op 34.464 ms/op 0.70
BeaconState.hashTreeRoot - 1 balances 147.78 us/op 156.98 us/op 0.94
BeaconState.hashTreeRoot - 32 balances 916.59 us/op 1.5700 ms/op 0.58
BeaconState.hashTreeRoot - 512 balances 9.6809 ms/op 17.545 ms/op 0.55
BeaconState.hashTreeRoot - 250000 balances 190.24 ms/op 276.62 ms/op 0.69
aggregationBits - 2048 els - zipIndexesInBitList 13.677 us/op 36.718 us/op 0.37
byteArrayEquals 32 68.467 ns/op 82.086 ns/op 0.83
Buffer.compare 32 53.036 ns/op 63.246 ns/op 0.84
byteArrayEquals 1024 2.0142 us/op 2.3712 us/op 0.85
Buffer.compare 1024 48.289 ns/op 79.392 ns/op 0.61
byteArrayEquals 16384 38.463 us/op 36.665 us/op 1.05
Buffer.compare 16384 246.50 ns/op 290.28 ns/op 0.85
byteArrayEquals 123687377 227.01 ms/op 282.64 ms/op 0.80
Buffer.compare 123687377 8.1133 ms/op 9.9542 ms/op 0.82
byteArrayEquals 32 - diff last byte 81.493 ns/op 85.121 ns/op 0.96
Buffer.compare 32 - diff last byte 59.316 ns/op 68.318 ns/op 0.87
byteArrayEquals 1024 - diff last byte 2.4147 us/op 2.3698 us/op 1.02
Buffer.compare 1024 - diff last byte 67.263 ns/op 88.105 ns/op 0.76
byteArrayEquals 16384 - diff last byte 34.998 us/op 37.549 us/op 0.93
Buffer.compare 16384 - diff last byte 240.19 ns/op 300.54 ns/op 0.80
byteArrayEquals 123687377 - diff last byte 256.23 ms/op 294.28 ms/op 0.87
Buffer.compare 123687377 - diff last byte 9.5488 ms/op 11.121 ms/op 0.86
byteArrayEquals 32 - random bytes 7.4070 ns/op 6.4280 ns/op 1.15
Buffer.compare 32 - random bytes 50.356 ns/op 64.421 ns/op 0.78
byteArrayEquals 1024 - random bytes 6.6830 ns/op 6.8770 ns/op 0.97
Buffer.compare 1024 - random bytes 47.961 ns/op 66.805 ns/op 0.72
byteArrayEquals 16384 - random bytes 6.9170 ns/op 7.0030 ns/op 0.99
Buffer.compare 16384 - random bytes 43.673 ns/op 68.486 ns/op 0.64
byteArrayEquals 123687377 - random bytes 22.920 ns/op 16.290 ns/op 1.41
Buffer.compare 123687377 - random bytes 61.050 ns/op 81.490 ns/op 0.75
regular array get 100000 times 47.069 us/op 51.387 us/op 0.92
wrappedArray get 100000 times 46.026 us/op 52.016 us/op 0.88
arrayWithProxy get 100000 times 13.884 ms/op 19.013 ms/op 0.73
ssz.Root.equals 62.885 ns/op 66.289 ns/op 0.95
byteArrayEquals 66.077 ns/op 61.574 ns/op 1.07
Buffer.compare 13.067 ns/op 16.882 ns/op 0.77
shuffle list - 16384 els 5.7193 ms/op 8.7222 ms/op 0.66
shuffle list - 250000 els 78.706 ms/op 112.93 ms/op 0.70
processSlot - 1 slots 21.197 us/op 20.550 us/op 1.03
processSlot - 32 slots 4.2069 ms/op 4.6048 ms/op 0.91
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 62.041 ms/op 74.681 ms/op 0.83
getCommitteeAssignments - req 1 vs - 250000 vc 2.4374 ms/op 2.7642 ms/op 0.88
getCommitteeAssignments - req 100 vs - 250000 vc 3.6254 ms/op 4.1240 ms/op 0.88
getCommitteeAssignments - req 1000 vs - 250000 vc 3.8198 ms/op 4.6889 ms/op 0.81
findModifiedValidators - 10000 modified validators 578.15 ms/op 713.68 ms/op 0.81
findModifiedValidators - 1000 modified validators 413.36 ms/op 567.94 ms/op 0.73
findModifiedValidators - 100 modified validators 403.84 ms/op 607.42 ms/op 0.66
findModifiedValidators - 10 modified validators 374.59 ms/op 602.25 ms/op 0.62
findModifiedValidators - 1 modified validators 346.13 ms/op 616.52 ms/op 0.56
findModifiedValidators - no difference 424.99 ms/op 596.68 ms/op 0.71
compare ViewDUs 4.7412 s/op 6.1921 s/op 0.77
compare each validator Uint8Array 1.9296 s/op 2.0871 s/op 0.92
compare ViewDU to Uint8Array 1.1559 s/op 1.5649 s/op 0.74
migrate state 1000000 validators, 24 modified, 0 new 795.81 ms/op 1.0386 s/op 0.77
migrate state 1000000 validators, 1700 modified, 1000 new 1.1150 s/op 1.3737 s/op 0.81
migrate state 1000000 validators, 3400 modified, 2000 new 1.3215 s/op 1.6719 s/op 0.79
migrate state 1500000 validators, 24 modified, 0 new 707.69 ms/op 1.0960 s/op 0.65
migrate state 1500000 validators, 1700 modified, 1000 new 1.1682 s/op 1.2474 s/op 0.94
migrate state 1500000 validators, 3400 modified, 2000 new 1.1448 s/op 1.6962 s/op 0.67
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.3400 ns/op 5.7000 ns/op 0.76
state getBlockRootAtSlot - 250000 vs - 7PWei 394.18 ns/op 879.09 ns/op 0.45
computeProposers - vc 250000 5.5901 ms/op 12.269 ms/op 0.46
computeEpochShuffling - vc 250000 69.542 ms/op 123.04 ms/op 0.57
getNextSyncCommittee - vc 250000 124.76 ms/op 194.64 ms/op 0.64
computeSigningRoot for AttestationData 24.287 us/op 37.181 us/op 0.65
hash AttestationData serialized data then Buffer.toString(base64) 1.3105 us/op 2.7885 us/op 0.47
toHexString serialized data 880.91 ns/op 1.8016 us/op 0.49
Buffer.toString(base64) 168.52 ns/op 295.11 ns/op 0.57

by benchmarkbot/action

"test:browsers": "test:browsers:chrome && test:browsers:firefox && test:browsers:electron",
"test:browsers:chrome": "vitest --run --browser chrome --config ./vitest.browser.config.ts --dir test/unit",
"test:browsers:firefox": "vitest --run --browser firefox --config ./vitest.browser.config.ts --dir test/unit",
"test:browsers:electron": "echo 'Electron tests will be introduced back in the future as soon vitest supports electron.'",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can bring back electron to our stack, soon when vitest bring it support, else writing a custom BrowserProvider will not be difficult for it.

@codecov
Copy link

codecov bot commented Oct 30, 2023

Codecov Report

Merging #6074 (2e8d0a0) into unstable (6154029) will increase coverage by 80.02%.
The diff coverage is n/a.

Additional details and impacted files
@@              Coverage Diff              @@
##           unstable    #6074       +/-   ##
=============================================
+ Coverage          0   80.02%   +80.02%     
=============================================
  Files             0       19       +19     
  Lines             0     1717     +1717     
  Branches          0      155      +155     
=============================================
+ Hits              0     1374     +1374     
- Misses            0      341      +341     
- Partials          0        2        +2     

Comment on lines 33 to 41
await cli
.parseAsync(parseArgs(args), {}, (err, _argv, output) => {
if (err) return reject(err);

resolve(output);
});
resolve(output);
})
.catch(() => {
// We are suppressing error here as we are throwing from inside the callback
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was a weird double throw case, but never catched with mocha earlier.

@nazarhussain nazarhussain force-pushed the nh/prover-tests branch 2 times, most recently from 255d1f7 to f25a8c7 Compare December 5, 2023 09:49
@nazarhussain nazarhussain marked this pull request as ready for review December 5, 2023 15:16
@@ -213,7 +214,8 @@ const unknownBlockSync = await env.createNodePair({
// unknown block sync can work only if the gap is maximum `slotImportTolerance * 2`
// default value for slotImportTolerance is one epoch, so if gap is more than 2 epoch
// unknown block sync will not work. So why we have to increase it for tests.
"sync.slotImportTolerance": headForUnknownBlockSync.response.data.message.slot / 2 + 2,
// Adding SLOTS_PER_EPOCH will cover the case if the node starts on the last slot of epoch
"sync.slotImportTolerance": headForUnknownBlockSync.response.data.message.slot / 2 + SLOTS_PER_EPOCH,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Eph 8/6 0.320[unknown-block-sync-node-beacon_lodestar] �[32minfo�[39m: Lodestar network=dev, version=v1.12.0/fc67c5e, commit=fc67c5e7bef36b868d69a0bc55d4c33068106e85
....
....
Eph 8/6 1.720[unknown-block-sync-node-beacon_lodestar/sync] �[36mverbose�[39m: UnknownBlockSync enabled.
Eph 8/6 1.720[unknown-block-sync-node-beacon_lodestar/sync] �[34mdebug�[39m: RangeSync disabled.
....
....
Eph 9/7 0.003[unknown-block-sync-node-beacon_lodestar/sync] �[32minfo�[39m: Initiating epoch check for sync progress
....
....
Eph 10/0 0.006[unknown-block-sync-node-beacon_lodestar/sync] �[36mverbose�[39m: UnknownBlockSync disabled.
....
....

As from the logs its seen that UnknownBlockSync disabled right after the Initiating epoch check for sync progress because it was open epoch over epoch since it was started when we calculated the epoch slotImportTolerance. So had to increase the tolerance level more.

Copy link
Contributor

@g11tech g11tech left a comment

Choose a reason for hiding this comment

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

lgtm

@nazarhussain nazarhussain merged commit 53378e1 into unstable Dec 8, 2023
17 checks passed
@nazarhussain nazarhussain deleted the nh/prover-tests branch December 8, 2023 09:30
Copy link
Member

Choose a reason for hiding this comment

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

This script is effectively useless now, I am getting a bunch of different warnings when running yarn install

> yarn
yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
warning Pattern ["buffer@^6.0.3"] is trying to unpack in the same destination "/home/nico/.cache/yarn/v6/npm-buffer-polyfill-6.0.3-2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6-integrity/node_modules/buffer-polyfill" as pattern ["buffer-polyfill@npm:buffer@^6.0.3"]. This could result in non-deterministic behavior, skipping.
[4/5] Linking dependencies...
warning " > vite-plugin-node-polyfills@0.17.0" has unmet peer dependency "vite@^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0".
warning " > vite-plugin-top-level-await@1.3.1" has unmet peer dependency "vite@>=2.8".
warning Workspaces can only be enabled in private projects.
warning Workspaces can only be enabled in private projects.
[5/5] Building fresh packages...
Done in 56.69s.

This PR just hides this change in a massiv diff without properly mentioning it and disregards previous efforts put into getting rid of these warnings. There has been concerns from multiple users and we know this causes bad UX

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was discussed in detail before modifying the yarn lint script.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As mentioned in the lint script there was only one warning warning Pattern ["buffer@^6.0.3"] muted. Other warnings were not produced then otherwise would have been catched by the lint script.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Related to lock diff, verified locally it was produced after rebasing the unstable on target branch. Obviously had no way to detect it locally for me. We may add some check for it on the CI ti detect uncommitted local changes after the build step.

Copy link
Member

Choose a reason for hiding this comment

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

It was discussed in detail before modifying the yarn lint script.

Last thing I remember was https://discord.com/channels/593655374469660673/605818244036821012/1169747785462054933, this wasn't really resolved at that time, just disregarded

As mentioned in the lint script there was only one warning warning Pattern ["buffer@^6.0.3"] muted

I don't think the script works (at least not locally)

 ./scripts/assert_no_yarn_warnings.sh
yarn install v1.22.19 [1/5] Validating package.json... [2/5] Resolving packages... success Already up-to-date. Done in 13.11s.
Running grep -qi -e warning --exclude Pattern \[".*"\] is trying to unpack in the same destination
grep: \[".*"\]: No such file or directory
grep: is: No such file or directory
grep: trying: No such file or directory
grep: to: No such file or directory
grep: unpack: No such file or directory
grep: in: No such file or directory
grep: the: No such file or directory
grep: same: No such file or directory
grep: destination: No such file or directory
No warnings in yarn install --check-files

Copy link
Member

Choose a reason for hiding this comment

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

Related to lock diff, verified locally it was produced after rebasing the unstable on target branch.

Not an issue, we can easily fix that in a follow up PR

@wemeetagain
Copy link
Member

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

5 participants