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: migrate api unit tests to vitest #6177

Merged
merged 3 commits into from
Dec 11, 2023
Merged

test: migrate api unit tests to vitest #6177

merged 3 commits into from
Dec 11, 2023

Conversation

nazarhussain
Copy link
Contributor

Motivation

Consolidate the testing frameworks and migrate to vitest.

Description

Migrate api unit tests to vitest.

Steps to test or reproduce

  • Run all tests

@nazarhussain nazarhussain requested a review from a team as a code owner December 11, 2023 10:10
@nazarhussain nazarhussain self-assigned this Dec 11, 2023
Comment on lines +12 to +13
const root = new Uint8Array(32).fill(1);
const randao = new Uint8Array(32).fill(1);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

One observation for reviewers, it seems that chai was matching the Buffer and Uint8Array equality. Which is logically wrong, if we are expecting a Buffer instance of a value then assertion should pass otherwise fail.

For this reason have to update a lot of fixture data in this PR, converting Buffer to actual returning Uint8Array instances.

Comment on lines 48 to 54
args: [
32000,
randaoReveal,
graffiti,
undefined,
{feeRecipient: undefined, builderSelection: undefined, strictFeeRecipientCheck: undefined},
],
Copy link
Contributor Author

@nazarhussain nazarhussain Dec 11, 2023

Choose a reason for hiding this comment

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

sinon assertions were passing with partial arguments as well. To pass with the vitest we have to add the full arguments that were used to call that function.

That's because we are reusing reqSerializer for produceBlockV3 for other methods as well.

produceBlock: produceBlockV3 as ReqSerializers<Api, ReqTypes>["produceBlock"],
produceBlockV2: produceBlockV3 as ReqSerializers<Api, ReqTypes>["produceBlockV2"],
produceBlockV3,
produceBlindedBlock: produceBlockV3 as ReqSerializers<Api, ReqTypes>["produceBlindedBlock"],

To make it logically correct we should have different serializers for each method. Would be nice to know why it's actually written in this way in first place. @g11tech Do you remember any rationale for it?

Copy link
Contributor

Choose a reason for hiding this comment

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

because produceBlockV3 serializer is superset of all of them

Copy link
Contributor

Choose a reason for hiding this comment

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

you can create separate serializer fns for each of these but then delegate the call to produceBlockV3 inside it with so that you may not need to pass undefined values here

but we anyway will remove these fns and not support them so we can leave it like that as well

Copy link

codecov bot commented Dec 11, 2023

Codecov Report

Merging #6177 (43737eb) into unstable (8bd19f4) will increase coverage by 10.33%.
Report is 1 commits behind head on unstable.
The diff coverage is n/a.

Additional details and impacted files
@@              Coverage Diff              @@
##           unstable    #6177       +/-   ##
=============================================
+ Coverage     80.02%   90.35%   +10.33%     
=============================================
  Files            19       78       +59     
  Lines          1717     8089     +6372     
  Branches        155      490      +335     
=============================================
+ Hits           1374     7309     +5935     
- Misses          341      772      +431     
- Partials          2        8        +6     

Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: aec79dc Previous: 1a63b07 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 803.99 us/op 705.26 us/op 1.14
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 172.42 us/op 80.296 us/op 2.15
BLS verify - blst-native 1.4443 ms/op 1.2769 ms/op 1.13
BLS verifyMultipleSignatures 3 - blst-native 2.9885 ms/op 2.6805 ms/op 1.11
BLS verifyMultipleSignatures 8 - blst-native 6.4020 ms/op 5.8815 ms/op 1.09
BLS verifyMultipleSignatures 32 - blst-native 24.753 ms/op 21.500 ms/op 1.15
BLS verifyMultipleSignatures 64 - blst-native 47.905 ms/op 42.046 ms/op 1.14
BLS verifyMultipleSignatures 128 - blst-native 96.269 ms/op 82.257 ms/op 1.17
BLS deserializing 10000 signatures 995.27 ms/op 887.56 ms/op 1.12
BLS deserializing 100000 signatures 9.4927 s/op 9.2907 s/op 1.02
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.4672 ms/op 1.3084 ms/op 1.12
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.6642 ms/op 1.4762 ms/op 1.13
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.5169 ms/op 2.8441 ms/op 0.88
BLS verifyMultipleSignatures - same message - 64 - blst-native 3.6341 ms/op 4.2120 ms/op 0.86
BLS verifyMultipleSignatures - same message - 128 - blst-native 5.9986 ms/op 7.0902 ms/op 0.85
BLS aggregatePubkeys 32 - blst-native 27.310 us/op 27.094 us/op 1.01
BLS aggregatePubkeys 128 - blst-native 107.23 us/op 99.287 us/op 1.08
getAttestationsForBlock 63.761 ms/op 47.933 ms/op 1.33
getSlashingsAndExits - default max 300.02 us/op 156.92 us/op 1.91
getSlashingsAndExits - 2k 574.26 us/op 411.99 us/op 1.39
proposeBlockBody type=full, size=empty 7.0712 ms/op 5.2402 ms/op 1.35
isKnown best case - 1 super set check 669.00 ns/op 330.00 ns/op 2.03
isKnown normal case - 2 super set checks 686.00 ns/op 332.00 ns/op 2.07
isKnown worse case - 16 super set checks 680.00 ns/op 314.00 ns/op 2.17
CheckpointStateCache - add get delete 6.6440 us/op 5.8110 us/op 1.14
validate api signedAggregateAndProof - struct 2.9698 ms/op 2.8189 ms/op 1.05
validate gossip signedAggregateAndProof - struct 2.9626 ms/op 2.8282 ms/op 1.05
validate gossip attestation - vc 640000 1.4592 ms/op 1.3438 ms/op 1.09
batch validate gossip attestation - vc 640000 - chunk 32 182.19 us/op 165.68 us/op 1.10
batch validate gossip attestation - vc 640000 - chunk 64 169.34 us/op 145.94 us/op 1.16
batch validate gossip attestation - vc 640000 - chunk 128 167.38 us/op 136.93 us/op 1.22
batch validate gossip attestation - vc 640000 - chunk 256 157.01 us/op 135.84 us/op 1.16
pickEth1Vote - no votes 1.4638 ms/op 1.3503 ms/op 1.08
pickEth1Vote - max votes 13.783 ms/op 10.644 ms/op 1.29
pickEth1Vote - Eth1Data hashTreeRoot value x2048 24.226 ms/op 19.598 ms/op 1.24
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 35.835 ms/op 31.291 ms/op 1.15
pickEth1Vote - Eth1Data fastSerialize value x2048 786.18 us/op 661.02 us/op 1.19
pickEth1Vote - Eth1Data fastSerialize tree x2048 6.5538 ms/op 8.2197 ms/op 0.80
bytes32 toHexString 903.00 ns/op 607.00 ns/op 1.49
bytes32 Buffer.toString(hex) 350.00 ns/op 292.00 ns/op 1.20
bytes32 Buffer.toString(hex) from Uint8Array 614.00 ns/op 522.00 ns/op 1.18
bytes32 Buffer.toString(hex) + 0x 361.00 ns/op 287.00 ns/op 1.26
Object access 1 prop 0.25900 ns/op 0.17500 ns/op 1.48
Map access 1 prop 0.16900 ns/op 0.14500 ns/op 1.17
Object get x1000 9.1210 ns/op 7.7420 ns/op 1.18
Map get x1000 0.97000 ns/op 0.87300 ns/op 1.11
Object set x1000 89.308 ns/op 64.407 ns/op 1.39
Map set x1000 62.088 ns/op 44.148 ns/op 1.41
Return object 10000 times 0.27500 ns/op 0.24700 ns/op 1.11
Throw Error 10000 times 4.2563 us/op 3.9578 us/op 1.08
fastMsgIdFn sha256 / 200 bytes 3.7320 us/op 3.3680 us/op 1.11
fastMsgIdFn h32 xxhash / 200 bytes 396.00 ns/op 310.00 ns/op 1.28
fastMsgIdFn h64 xxhash / 200 bytes 431.00 ns/op 352.00 ns/op 1.22
fastMsgIdFn sha256 / 1000 bytes 12.818 us/op 11.554 us/op 1.11
fastMsgIdFn h32 xxhash / 1000 bytes 547.00 ns/op 457.00 ns/op 1.20
fastMsgIdFn h64 xxhash / 1000 bytes 505.00 ns/op 453.00 ns/op 1.11
fastMsgIdFn sha256 / 10000 bytes 111.06 us/op 103.33 us/op 1.07
fastMsgIdFn h32 xxhash / 10000 bytes 2.1780 us/op 1.9960 us/op 1.09
fastMsgIdFn h64 xxhash / 10000 bytes 1.5200 us/op 1.3950 us/op 1.09
send data - 1000 256B messages 25.036 ms/op 21.173 ms/op 1.18
send data - 1000 512B messages 33.228 ms/op 27.873 ms/op 1.19
send data - 1000 1024B messages 49.327 ms/op 44.261 ms/op 1.11
send data - 1000 1200B messages 48.602 ms/op 26.083 ms/op 1.86
send data - 1000 2048B messages 58.015 ms/op 44.533 ms/op 1.30
send data - 1000 4096B messages 50.202 ms/op 46.062 ms/op 1.09
send data - 1000 16384B messages 134.22 ms/op 118.58 ms/op 1.13
send data - 1000 65536B messages 635.69 ms/op 497.78 ms/op 1.28
enrSubnets - fastDeserialize 64 bits 1.8320 us/op 1.5430 us/op 1.19
enrSubnets - ssz BitVector 64 bits 602.00 ns/op 555.00 ns/op 1.08
enrSubnets - fastDeserialize 4 bits 255.00 ns/op 226.00 ns/op 1.13
enrSubnets - ssz BitVector 4 bits 603.00 ns/op 487.00 ns/op 1.24
prioritizePeers score -10:0 att 32-0.1 sync 2-0 124.22 us/op 113.96 us/op 1.09
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 170.58 us/op 150.95 us/op 1.13
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 223.43 us/op 204.94 us/op 1.09
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 371.91 us/op 333.26 us/op 1.12
prioritizePeers score 0:0 att 64-1 sync 4-1 416.03 us/op 396.70 us/op 1.05
array of 16000 items push then shift 1.8111 us/op 1.6822 us/op 1.08
LinkedList of 16000 items push then shift 9.7360 ns/op 9.2890 ns/op 1.05
array of 16000 items push then pop 113.86 ns/op 116.09 ns/op 0.98
LinkedList of 16000 items push then pop 10.638 ns/op 9.0510 ns/op 1.18
array of 24000 items push then shift 2.7539 us/op 2.6712 us/op 1.03
LinkedList of 24000 items push then shift 10.331 ns/op 9.8420 ns/op 1.05
array of 24000 items push then pop 170.19 ns/op 156.44 ns/op 1.09
LinkedList of 24000 items push then pop 9.6760 ns/op 8.9950 ns/op 1.08
intersect bitArray bitLen 8 7.0470 ns/op 6.6110 ns/op 1.07
intersect array and set length 8 104.66 ns/op 75.088 ns/op 1.39
intersect bitArray bitLen 128 37.059 ns/op 35.402 ns/op 1.05
intersect array and set length 128 1.1827 us/op 1.0401 us/op 1.14
bitArray.getTrueBitIndexes() bitLen 128 1.9970 us/op 1.7030 us/op 1.17
bitArray.getTrueBitIndexes() bitLen 248 3.2690 us/op 3.0510 us/op 1.07
bitArray.getTrueBitIndexes() bitLen 512 7.0230 us/op 5.9500 us/op 1.18
Buffer.concat 32 items 1.2420 us/op 1.0170 us/op 1.22
Uint8Array.set 32 items 1.9160 us/op 1.9430 us/op 0.99
Set add up to 64 items then delete first 5.1679 us/op 4.9074 us/op 1.05
OrderedSet add up to 64 items then delete first 6.8501 us/op 6.3182 us/op 1.08
Set add up to 64 items then delete last 5.4974 us/op 5.3090 us/op 1.04
OrderedSet add up to 64 items then delete last 7.2071 us/op 6.5877 us/op 1.09
Set add up to 64 items then delete middle 5.5138 us/op 5.1189 us/op 1.08
OrderedSet add up to 64 items then delete middle 8.5589 us/op 8.3508 us/op 1.02
Set add up to 128 items then delete first 11.112 us/op 10.421 us/op 1.07
OrderedSet add up to 128 items then delete first 14.458 us/op 13.180 us/op 1.10
Set add up to 128 items then delete last 10.688 us/op 9.6488 us/op 1.11
OrderedSet add up to 128 items then delete last 13.864 us/op 13.117 us/op 1.06
Set add up to 128 items then delete middle 10.888 us/op 9.8906 us/op 1.10
OrderedSet add up to 128 items then delete middle 20.160 us/op 18.320 us/op 1.10
Set add up to 256 items then delete first 22.523 us/op 20.655 us/op 1.09
OrderedSet add up to 256 items then delete first 31.418 us/op 28.353 us/op 1.11
Set add up to 256 items then delete last 21.617 us/op 20.094 us/op 1.08
OrderedSet add up to 256 items then delete last 29.935 us/op 25.900 us/op 1.16
Set add up to 256 items then delete middle 22.329 us/op 19.872 us/op 1.12
OrderedSet add up to 256 items then delete middle 53.470 us/op 50.159 us/op 1.07
transfer serialized Status (84 B) 2.1320 us/op 1.9230 us/op 1.11
copy serialized Status (84 B) 1.8500 us/op 1.6160 us/op 1.14
transfer serialized SignedVoluntaryExit (112 B) 2.1340 us/op 2.1410 us/op 1.00
copy serialized SignedVoluntaryExit (112 B) 1.7550 us/op 1.7080 us/op 1.03
transfer serialized ProposerSlashing (416 B) 2.2450 us/op 2.4210 us/op 0.93
copy serialized ProposerSlashing (416 B) 2.3400 us/op 2.5080 us/op 0.93
transfer serialized Attestation (485 B) 2.2540 us/op 2.3340 us/op 0.97
copy serialized Attestation (485 B) 2.1860 us/op 2.4190 us/op 0.90
transfer serialized AttesterSlashing (33232 B) 2.2070 us/op 2.4280 us/op 0.91
copy serialized AttesterSlashing (33232 B) 7.5620 us/op 7.9560 us/op 0.95
transfer serialized Small SignedBeaconBlock (128000 B) 3.5430 us/op 2.6460 us/op 1.34
copy serialized Small SignedBeaconBlock (128000 B) 21.054 us/op 18.583 us/op 1.13
transfer serialized Avg SignedBeaconBlock (200000 B) 4.2000 us/op 3.2140 us/op 1.31
copy serialized Avg SignedBeaconBlock (200000 B) 33.040 us/op 25.436 us/op 1.30
transfer serialized BlobsSidecar (524380 B) 4.3200 us/op 3.0810 us/op 1.40
copy serialized BlobsSidecar (524380 B) 122.87 us/op 94.144 us/op 1.31
transfer serialized Big SignedBeaconBlock (1000000 B) 4.7390 us/op 3.1460 us/op 1.51
copy serialized Big SignedBeaconBlock (1000000 B) 228.46 us/op 213.73 us/op 1.07
pass gossip attestations to forkchoice per slot 4.3731 ms/op 4.4584 ms/op 0.98
forkChoice updateHead vc 100000 bc 64 eq 0 670.94 us/op 689.58 us/op 0.97
forkChoice updateHead vc 600000 bc 64 eq 0 4.6985 ms/op 4.8198 ms/op 0.97
forkChoice updateHead vc 1000000 bc 64 eq 0 7.1413 ms/op 7.7114 ms/op 0.93
forkChoice updateHead vc 600000 bc 320 eq 0 4.2148 ms/op 4.3627 ms/op 0.97
forkChoice updateHead vc 600000 bc 1200 eq 0 4.3064 ms/op 4.4761 ms/op 0.96
forkChoice updateHead vc 600000 bc 7200 eq 0 5.7481 ms/op 5.4940 ms/op 1.05
forkChoice updateHead vc 600000 bc 64 eq 1000 11.653 ms/op 11.313 ms/op 1.03
forkChoice updateHead vc 600000 bc 64 eq 10000 12.511 ms/op 11.923 ms/op 1.05
forkChoice updateHead vc 600000 bc 64 eq 300000 17.034 ms/op 16.270 ms/op 1.05
computeDeltas 500000 validators 300 proto nodes 6.8848 ms/op 6.6111 ms/op 1.04
computeDeltas 500000 validators 1200 proto nodes 6.7650 ms/op 6.4994 ms/op 1.04
computeDeltas 500000 validators 7200 proto nodes 6.4768 ms/op 6.3751 ms/op 1.02
computeDeltas 750000 validators 300 proto nodes 9.6444 ms/op 9.3607 ms/op 1.03
computeDeltas 750000 validators 1200 proto nodes 9.7390 ms/op 9.5787 ms/op 1.02
computeDeltas 750000 validators 7200 proto nodes 10.013 ms/op 9.4139 ms/op 1.06
computeDeltas 1400000 validators 300 proto nodes 19.118 ms/op 18.447 ms/op 1.04
computeDeltas 1400000 validators 1200 proto nodes 19.256 ms/op 18.211 ms/op 1.06
computeDeltas 1400000 validators 7200 proto nodes 18.576 ms/op 17.721 ms/op 1.05
computeDeltas 2100000 validators 300 proto nodes 30.119 ms/op 26.997 ms/op 1.12
computeDeltas 2100000 validators 1200 proto nodes 30.152 ms/op 27.313 ms/op 1.10
computeDeltas 2100000 validators 7200 proto nodes 30.070 ms/op 27.255 ms/op 1.10
computeProposerBoostScoreFromBalances 500000 validators 4.0299 ms/op 3.6555 ms/op 1.10
computeProposerBoostScoreFromBalances 750000 validators 4.0629 ms/op 3.6444 ms/op 1.11
computeProposerBoostScoreFromBalances 1400000 validators 3.8043 ms/op 3.6390 ms/op 1.05
computeProposerBoostScoreFromBalances 2100000 validators 3.8360 ms/op 3.6498 ms/op 1.05
altair processAttestation - 250000 vs - 7PWei normalcase 2.2636 ms/op 2.1299 ms/op 1.06
altair processAttestation - 250000 vs - 7PWei worstcase 3.4090 ms/op 3.1577 ms/op 1.08
altair processAttestation - setStatus - 1/6 committees join 184.57 us/op 140.74 us/op 1.31
altair processAttestation - setStatus - 1/3 committees join 391.95 us/op 266.90 us/op 1.47
altair processAttestation - setStatus - 1/2 committees join 506.06 us/op 375.58 us/op 1.35
altair processAttestation - setStatus - 2/3 committees join 612.92 us/op 472.97 us/op 1.30
altair processAttestation - setStatus - 4/5 committees join 808.38 us/op 635.47 us/op 1.27
altair processAttestation - setStatus - 100% committees join 946.19 us/op 742.03 us/op 1.28
altair processBlock - 250000 vs - 7PWei normalcase 9.7530 ms/op 10.134 ms/op 0.96
altair processBlock - 250000 vs - 7PWei normalcase hashState 34.690 ms/op 35.428 ms/op 0.98
altair processBlock - 250000 vs - 7PWei worstcase 41.403 ms/op 39.706 ms/op 1.04
altair processBlock - 250000 vs - 7PWei worstcase hashState 98.351 ms/op 98.930 ms/op 0.99
phase0 processBlock - 250000 vs - 7PWei normalcase 2.9750 ms/op 3.0355 ms/op 0.98
phase0 processBlock - 250000 vs - 7PWei worstcase 38.189 ms/op 32.671 ms/op 1.17
altair processEth1Data - 250000 vs - 7PWei normalcase 575.34 us/op 601.44 us/op 0.96
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 20.903 us/op 17.455 us/op 1.20
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 95.939 us/op 51.808 us/op 1.85
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 24.936 us/op 32.307 us/op 0.77
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 21.460 us/op 11.112 us/op 1.93
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 202.18 us/op 160.16 us/op 1.26
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.6340 ms/op 2.1421 ms/op 0.76
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.1048 ms/op 3.0487 ms/op 0.69
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.3571 ms/op 1.4242 ms/op 1.65
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.5274 ms/op 3.2880 ms/op 1.38
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 3.0057 ms/op 2.2136 ms/op 1.36
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 7.5121 ms/op 4.6304 ms/op 1.62
Tree 40 250000 create 507.43 ms/op 364.23 ms/op 1.39
Tree 40 250000 get(125000) 227.81 ns/op 186.40 ns/op 1.22
Tree 40 250000 set(125000) 1.5787 us/op 943.75 ns/op 1.67
Tree 40 250000 toArray() 26.999 ms/op 17.897 ms/op 1.51
Tree 40 250000 iterate all - toArray() + loop 24.068 ms/op 17.938 ms/op 1.34
Tree 40 250000 iterate all - get(i) 78.786 ms/op 62.427 ms/op 1.26
MutableVector 250000 create 14.581 ms/op 22.116 ms/op 0.66
MutableVector 250000 get(125000) 6.9900 ns/op 6.4160 ns/op 1.09
MutableVector 250000 set(125000) 296.84 ns/op 248.44 ns/op 1.19
MutableVector 250000 toArray() 4.3344 ms/op 3.1698 ms/op 1.37
MutableVector 250000 iterate all - toArray() + loop 4.6300 ms/op 3.2537 ms/op 1.42
MutableVector 250000 iterate all - get(i) 1.6181 ms/op 1.5067 ms/op 1.07
Array 250000 create 2.8996 ms/op 2.8638 ms/op 1.01
Array 250000 clone - spread 1.3247 ms/op 1.2545 ms/op 1.06
Array 250000 get(125000) 1.1550 ns/op 1.0220 ns/op 1.13
Array 250000 set(125000) 4.3900 ns/op 4.0510 ns/op 1.08
Array 250000 iterate all - loop 172.72 us/op 162.87 us/op 1.06
effectiveBalanceIncrements clone Uint8Array 300000 29.630 us/op 27.373 us/op 1.08
effectiveBalanceIncrements clone MutableVector 300000 409.00 ns/op 363.00 ns/op 1.13
effectiveBalanceIncrements rw all Uint8Array 300000 206.89 us/op 203.93 us/op 1.01
effectiveBalanceIncrements rw all MutableVector 300000 113.59 ms/op 84.385 ms/op 1.35
phase0 afterProcessEpoch - 250000 vs - 7PWei 121.10 ms/op 110.80 ms/op 1.09
phase0 beforeProcessEpoch - 250000 vs - 7PWei 58.510 ms/op 52.841 ms/op 1.11
altair processEpoch - mainnet_e81889 618.43 ms/op 545.16 ms/op 1.13
mainnet_e81889 - altair beforeProcessEpoch 105.67 ms/op 83.259 ms/op 1.27
mainnet_e81889 - altair processJustificationAndFinalization 29.889 us/op 23.248 us/op 1.29
mainnet_e81889 - altair processInactivityUpdates 8.1657 ms/op 5.9393 ms/op 1.37
mainnet_e81889 - altair processRewardsAndPenalties 73.625 ms/op 74.589 ms/op 0.99
mainnet_e81889 - altair processRegistryUpdates 5.6320 us/op 4.0710 us/op 1.38
mainnet_e81889 - altair processSlashings 1.1260 us/op 731.00 ns/op 1.54
mainnet_e81889 - altair processEth1DataReset 1.8650 us/op 823.00 ns/op 2.27
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.3644 ms/op 2.6627 ms/op 0.89
mainnet_e81889 - altair processSlashingsReset 7.7740 us/op 6.1240 us/op 1.27
mainnet_e81889 - altair processRandaoMixesReset 11.096 us/op 6.5120 us/op 1.70
mainnet_e81889 - altair processHistoricalRootsUpdate 2.0240 us/op 852.00 ns/op 2.38
mainnet_e81889 - altair processParticipationFlagUpdates 3.5270 us/op 2.4310 us/op 1.45
mainnet_e81889 - altair processSyncCommitteeUpdates 891.00 ns/op 1.2800 us/op 0.70
mainnet_e81889 - altair afterProcessEpoch 147.55 ms/op 110.86 ms/op 1.33
capella processEpoch - mainnet_e217614 2.1847 s/op 2.3166 s/op 0.94
mainnet_e217614 - capella beforeProcessEpoch 524.84 ms/op 519.01 ms/op 1.01
mainnet_e217614 - capella processJustificationAndFinalization 18.877 us/op 32.724 us/op 0.58
mainnet_e217614 - capella processInactivityUpdates 21.087 ms/op 19.316 ms/op 1.09
mainnet_e217614 - capella processRewardsAndPenalties 415.90 ms/op 440.06 ms/op 0.95
mainnet_e217614 - capella processRegistryUpdates 22.539 us/op 30.253 us/op 0.75
mainnet_e217614 - capella processSlashings 429.00 ns/op 876.00 ns/op 0.49
mainnet_e217614 - capella processEth1DataReset 531.00 ns/op 579.00 ns/op 0.92
mainnet_e217614 - capella processEffectiveBalanceUpdates 4.7963 ms/op 5.9412 ms/op 0.81
mainnet_e217614 - capella processSlashingsReset 4.5120 us/op 3.8290 us/op 1.18
mainnet_e217614 - capella processRandaoMixesReset 4.8320 us/op 7.6420 us/op 0.63
mainnet_e217614 - capella processHistoricalRootsUpdate 649.00 ns/op 923.00 ns/op 0.70
mainnet_e217614 - capella processParticipationFlagUpdates 2.4750 us/op 2.0810 us/op 1.19
mainnet_e217614 - capella afterProcessEpoch 333.09 ms/op 295.98 ms/op 1.13
phase0 processEpoch - mainnet_e58758 460.90 ms/op 478.86 ms/op 0.96
mainnet_e58758 - phase0 beforeProcessEpoch 134.92 ms/op 143.59 ms/op 0.94
mainnet_e58758 - phase0 processJustificationAndFinalization 15.762 us/op 24.689 us/op 0.64
mainnet_e58758 - phase0 processRewardsAndPenalties 50.321 ms/op 70.686 ms/op 0.71
mainnet_e58758 - phase0 processRegistryUpdates 10.728 us/op 15.004 us/op 0.72
mainnet_e58758 - phase0 processSlashings 616.00 ns/op 829.00 ns/op 0.74
mainnet_e58758 - phase0 processEth1DataReset 425.00 ns/op 666.00 ns/op 0.64
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.1668 ms/op 2.1747 ms/op 0.54
mainnet_e58758 - phase0 processSlashingsReset 3.1990 us/op 4.9860 us/op 0.64
mainnet_e58758 - phase0 processRandaoMixesReset 4.7040 us/op 6.3450 us/op 0.74
mainnet_e58758 - phase0 processHistoricalRootsUpdate 419.00 ns/op 616.00 ns/op 0.68
mainnet_e58758 - phase0 processParticipationRecordUpdates 6.2070 us/op 6.0050 us/op 1.03
mainnet_e58758 - phase0 afterProcessEpoch 102.14 ms/op 92.889 ms/op 1.10
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.4061 ms/op 1.2873 ms/op 1.09
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5163 ms/op 1.3921 ms/op 1.09
altair processInactivityUpdates - 250000 normalcase 20.283 ms/op 34.907 ms/op 0.58
altair processInactivityUpdates - 250000 worstcase 22.110 ms/op 27.704 ms/op 0.80
phase0 processRegistryUpdates - 250000 normalcase 8.5250 us/op 11.892 us/op 0.72
phase0 processRegistryUpdates - 250000 badcase_full_deposits 346.13 us/op 602.58 us/op 0.57
phase0 processRegistryUpdates - 250000 worstcase 0.5 126.70 ms/op 137.65 ms/op 0.92
altair processRewardsAndPenalties - 250000 normalcase 55.631 ms/op 72.976 ms/op 0.76
altair processRewardsAndPenalties - 250000 worstcase 59.388 ms/op 65.859 ms/op 0.90
phase0 getAttestationDeltas - 250000 normalcase 8.5360 ms/op 8.8511 ms/op 0.96
phase0 getAttestationDeltas - 250000 worstcase 8.6510 ms/op 8.7969 ms/op 0.98
phase0 processSlashings - 250000 worstcase 80.903 us/op 130.07 us/op 0.62
altair processSyncCommitteeUpdates - 250000 157.04 ms/op 149.69 ms/op 1.05
BeaconState.hashTreeRoot - No change 240.00 ns/op 252.00 ns/op 0.95
BeaconState.hashTreeRoot - 1 full validator 156.14 us/op 156.93 us/op 0.99
BeaconState.hashTreeRoot - 32 full validator 1.3754 ms/op 1.9666 ms/op 0.70
BeaconState.hashTreeRoot - 512 full validator 16.607 ms/op 19.948 ms/op 0.83
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 183.19 us/op 228.43 us/op 0.80
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.2034 ms/op 2.6870 ms/op 0.82
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 32.047 ms/op 29.736 ms/op 1.08
BeaconState.hashTreeRoot - 1 balances 136.15 us/op 168.57 us/op 0.81
BeaconState.hashTreeRoot - 32 balances 1.3004 ms/op 1.4000 ms/op 0.93
BeaconState.hashTreeRoot - 512 balances 12.652 ms/op 13.831 ms/op 0.91
BeaconState.hashTreeRoot - 250000 balances 205.22 ms/op 244.61 ms/op 0.84
aggregationBits - 2048 els - zipIndexesInBitList 17.223 us/op 17.054 us/op 1.01
byteArrayEquals 32 74.900 ns/op 72.131 ns/op 1.04
Buffer.compare 32 56.470 ns/op 54.595 ns/op 1.03
byteArrayEquals 1024 2.0447 us/op 2.0156 us/op 1.01
Buffer.compare 1024 72.825 ns/op 71.230 ns/op 1.02
byteArrayEquals 16384 32.587 us/op 32.080 us/op 1.02
Buffer.compare 16384 250.54 ns/op 261.83 ns/op 0.96
byteArrayEquals 123687377 246.31 ms/op 237.45 ms/op 1.04
Buffer.compare 123687377 7.4356 ms/op 6.0809 ms/op 1.22
byteArrayEquals 32 - diff last byte 80.699 ns/op 71.015 ns/op 1.14
Buffer.compare 32 - diff last byte 58.406 ns/op 60.076 ns/op 0.97
byteArrayEquals 1024 - diff last byte 2.0714 us/op 1.9722 us/op 1.05
Buffer.compare 1024 - diff last byte 74.400 ns/op 70.086 ns/op 1.06
byteArrayEquals 16384 - diff last byte 32.836 us/op 32.129 us/op 1.02
Buffer.compare 16384 - diff last byte 279.47 ns/op 275.36 ns/op 1.01
byteArrayEquals 123687377 - diff last byte 250.79 ms/op 238.85 ms/op 1.05
Buffer.compare 123687377 - diff last byte 8.4001 ms/op 6.2814 ms/op 1.34
byteArrayEquals 32 - random bytes 6.2620 ns/op 5.0410 ns/op 1.24
Buffer.compare 32 - random bytes 63.933 ns/op 56.970 ns/op 1.12
byteArrayEquals 1024 - random bytes 5.7530 ns/op 4.8780 ns/op 1.18
Buffer.compare 1024 - random bytes 63.307 ns/op 56.351 ns/op 1.12
byteArrayEquals 16384 - random bytes 6.1380 ns/op 4.8790 ns/op 1.26
Buffer.compare 16384 - random bytes 63.263 ns/op 56.146 ns/op 1.13
byteArrayEquals 123687377 - random bytes 8.9500 ns/op 8.0200 ns/op 1.12
Buffer.compare 123687377 - random bytes 66.510 ns/op 59.490 ns/op 1.12
regular array get 100000 times 46.892 us/op 41.429 us/op 1.13
wrappedArray get 100000 times 46.769 us/op 41.449 us/op 1.13
arrayWithProxy get 100000 times 15.161 ms/op 13.330 ms/op 1.14
ssz.Root.equals 56.238 ns/op 50.532 ns/op 1.11
byteArrayEquals 54.338 ns/op 49.579 ns/op 1.10
Buffer.compare 11.354 ns/op 10.859 ns/op 1.05
shuffle list - 16384 els 7.1658 ms/op 6.7937 ms/op 1.05
shuffle list - 250000 els 104.90 ms/op 99.745 ms/op 1.05
processSlot - 1 slots 18.213 us/op 16.378 us/op 1.11
processSlot - 32 slots 3.0401 ms/op 3.9023 ms/op 0.78
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 59.905 ms/op 62.773 ms/op 0.95
getCommitteeAssignments - req 1 vs - 250000 vc 2.5529 ms/op 2.4397 ms/op 1.05
getCommitteeAssignments - req 100 vs - 250000 vc 3.6947 ms/op 3.5910 ms/op 1.03
getCommitteeAssignments - req 1000 vs - 250000 vc 4.0357 ms/op 3.9339 ms/op 1.03
findModifiedValidators - 10000 modified validators 527.87 ms/op 546.96 ms/op 0.97
findModifiedValidators - 1000 modified validators 441.49 ms/op 443.82 ms/op 0.99
findModifiedValidators - 100 modified validators 445.84 ms/op 411.59 ms/op 1.08
findModifiedValidators - 10 modified validators 436.84 ms/op 421.09 ms/op 1.04
findModifiedValidators - 1 modified validators 396.32 ms/op 401.24 ms/op 0.99
findModifiedValidators - no difference 391.05 ms/op 392.53 ms/op 1.00
compare ViewDUs 4.6366 s/op 4.9043 s/op 0.95
compare each validator Uint8Array 1.6669 s/op 1.7851 s/op 0.93
compare ViewDU to Uint8Array 1.4669 s/op 1.0959 s/op 1.34
migrate state 1000000 validators, 24 modified, 0 new 873.89 ms/op 888.54 ms/op 0.98
migrate state 1000000 validators, 1700 modified, 1000 new 1.0562 s/op 1.2047 s/op 0.88
migrate state 1000000 validators, 3400 modified, 2000 new 1.3027 s/op 1.4484 s/op 0.90
migrate state 1500000 validators, 24 modified, 0 new 788.46 ms/op 898.84 ms/op 0.88
migrate state 1500000 validators, 1700 modified, 1000 new 1.0826 s/op 1.1856 s/op 0.91
migrate state 1500000 validators, 3400 modified, 2000 new 1.3232 s/op 1.4172 s/op 0.93
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.4200 ns/op 4.1400 ns/op 1.07
state getBlockRootAtSlot - 250000 vs - 7PWei 1.0141 us/op 794.90 ns/op 1.28
computeProposers - vc 250000 10.543 ms/op 9.2985 ms/op 1.13
computeEpochShuffling - vc 250000 105.73 ms/op 101.07 ms/op 1.05
getNextSyncCommittee - vc 250000 165.81 ms/op 150.99 ms/op 1.10
computeSigningRoot for AttestationData 28.581 us/op 27.831 us/op 1.03
hash AttestationData serialized data then Buffer.toString(base64) 2.2939 us/op 2.2260 us/op 1.03
toHexString serialized data 1.0490 us/op 1.0269 us/op 1.02
Buffer.toString(base64) 222.44 ns/op 214.98 ns/op 1.03

by benchmarkbot/action

await expect(fetch(url, {signal: signalHandler?.()})).to.be.rejected.then((error: FetchError) => {
expect(error.type).to.be.equal(testCase.errorType);
expect(error.code).to.be.equal(testCase.errorCode);
await expect(fetch(url, {signal: signalHandler?.()})).rejects.toSatisfy((err) => {
Copy link
Member

Choose a reason for hiding this comment

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

can't this be changed to?

Suggested change
await expect(fetch(url, {signal: signalHandler?.()})).rejects.toSatisfy((err) => {
await expect(fetch(url, {signal: signalHandler?.()})).rejects.toSatisfy((err: FetchError) => {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not that's the strict type issue we can't assign type inside the function descriptor.

Argument of type '(err: FetchError) => true' is not assignable to parameter of type '(value: unknown) => boolean'

@nazarhussain nazarhussain merged commit 959a8af into unstable Dec 11, 2023
15 checks passed
@nazarhussain nazarhussain deleted the nh/test-api branch December 11, 2023 14:23
@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.

4 participants