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: support .env.test to reuse env variables across the tests #6408

Merged
merged 38 commits into from
Feb 12, 2024

Conversation

nazarhussain
Copy link
Contributor

Motivation

Reuse the env variables.

Description

  • Single source for env variables during testing .env.test
  • Load same file in simulation tests
  • Load same file in the other tests

Steps to test or reproduce

  • Run all tests

@nazarhussain nazarhussain requested a review from a team as a code owner February 7, 2024 17:10
@nazarhussain nazarhussain self-assigned this Feb 7, 2024
Copy link
Member

@matthewkeil matthewkeil left a comment

Choose a reason for hiding this comment

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

Such a good idea!!!

"test:sim:endpoints": "LODESTAR_PRESET=minimal node --loader ts-node/esm test/sim/endpoints.test.ts",
"test:sim:deneb": "LODESTAR_PRESET=minimal node --loader ts-node/esm test/sim/deneb.test.ts",
"test:sim:backup_eth_provider": "LODESTAR_PRESET=minimal node --loader ts-node/esm test/sim/backup_eth_provider.test.ts",
"test:sim:multifork": "DOTENV_CONFIG_PATH=../../.env.test LODESTAR_PRESET=minimal node -r dotenv/config --loader ts-node/esm test/sim/multi_fork.test.ts",
Copy link
Member

Choose a reason for hiding this comment

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

should LODESTAR_PRESET go into the .env?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we can add that there as well. Need to check if any other test file depend on other preset.

Copy link
Member

Choose a reason for hiding this comment

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

Ok. Then let's definitely move that so we are using one pattern (ie and env file)

@@ -1,6 +1,6 @@
import path from "node:path";
import {defineConfig} from "vitest/config";
const __dirname = new URL(".", import.meta.url).pathname;
const currentDir = new URL(".", import.meta.url).pathname;
Copy link
Member

@matthewkeil matthewkeil Feb 7, 2024

Choose a reason for hiding this comment

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

I’m partial to leaving this as __dirname. I dont feel strongly about it but it’s sort of the “node way” to name that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I had that initially as __dirname here and other places as well, but feel like a old pattern now.

Copy link
Member

Choose a reason for hiding this comment

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

For consistency with the rest of the codebase __dirname is better, but no strong opinion here

Copy link
Contributor

github-actions bot commented Feb 7, 2024

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 0c34aaf Previous: 1e67579 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 723.16 us/op 650.20 us/op 1.11
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 57.672 us/op 96.996 us/op 0.59
BLS verify - blst-native 1.0849 ms/op 1.2933 ms/op 0.84
BLS verifyMultipleSignatures 3 - blst-native 2.3180 ms/op 2.7581 ms/op 0.84
BLS verifyMultipleSignatures 8 - blst-native 5.1192 ms/op 5.9589 ms/op 0.86
BLS verifyMultipleSignatures 32 - blst-native 19.022 ms/op 21.801 ms/op 0.87
BLS verifyMultipleSignatures 64 - blst-native 37.059 ms/op 42.893 ms/op 0.86
BLS verifyMultipleSignatures 128 - blst-native 73.187 ms/op 85.170 ms/op 0.86
BLS deserializing 10000 signatures 784.48 ms/op 922.96 ms/op 0.85
BLS deserializing 100000 signatures 8.2225 s/op 9.2309 s/op 0.89
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.1183 ms/op 1.3151 ms/op 0.85
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.2717 ms/op 1.4877 ms/op 0.85
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.5143 ms/op 2.5926 ms/op 0.97
BLS verifyMultipleSignatures - same message - 64 - blst-native 3.9285 ms/op 4.3018 ms/op 0.91
BLS verifyMultipleSignatures - same message - 128 - blst-native 4.9061 ms/op 7.1070 ms/op 0.69
BLS aggregatePubkeys 32 - blst-native 24.441 us/op 27.028 us/op 0.90
BLS aggregatePubkeys 128 - blst-native 95.707 us/op 99.352 us/op 0.96
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 36.163 ms/op 49.866 ms/op 0.73
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 39.428 ms/op 44.605 ms/op 0.88
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 26.865 ms/op 39.795 ms/op 0.68
getSlashingsAndExits - default max 132.47 us/op 189.44 us/op 0.70
getSlashingsAndExits - 2k 501.36 us/op 421.66 us/op 1.19
proposeBlockBody type=full, size=empty 4.0910 ms/op 5.0233 ms/op 0.81
isKnown best case - 1 super set check 674.00 ns/op 313.00 ns/op 2.15
isKnown normal case - 2 super set checks 707.00 ns/op 300.00 ns/op 2.36
isKnown worse case - 16 super set checks 667.00 ns/op 301.00 ns/op 2.22
CheckpointStateCache - add get delete 5.3430 us/op 5.0690 us/op 1.05
validate api signedAggregateAndProof - struct 2.5157 ms/op 2.7769 ms/op 0.91
validate gossip signedAggregateAndProof - struct 2.4876 ms/op 2.7756 ms/op 0.90
validate gossip attestation - vc 640000 1.2118 ms/op 1.3499 ms/op 0.90
batch validate gossip attestation - vc 640000 - chunk 32 155.16 us/op 157.41 us/op 0.99
batch validate gossip attestation - vc 640000 - chunk 64 128.83 us/op 139.73 us/op 0.92
batch validate gossip attestation - vc 640000 - chunk 128 115.85 us/op 136.40 us/op 0.85
batch validate gossip attestation - vc 640000 - chunk 256 113.46 us/op 125.61 us/op 0.90
pickEth1Vote - no votes 1.0715 ms/op 1.2398 ms/op 0.86
pickEth1Vote - max votes 7.6955 ms/op 9.8650 ms/op 0.78
pickEth1Vote - Eth1Data hashTreeRoot value x2048 13.174 ms/op 21.357 ms/op 0.62
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 19.759 ms/op 28.873 ms/op 0.68
pickEth1Vote - Eth1Data fastSerialize value x2048 434.19 us/op 656.88 us/op 0.66
pickEth1Vote - Eth1Data fastSerialize tree x2048 3.2485 ms/op 7.4309 ms/op 0.44
bytes32 toHexString 437.00 ns/op 468.00 ns/op 0.93
bytes32 Buffer.toString(hex) 317.00 ns/op 274.00 ns/op 1.16
bytes32 Buffer.toString(hex) from Uint8Array 418.00 ns/op 401.00 ns/op 1.04
bytes32 Buffer.toString(hex) + 0x 324.00 ns/op 289.00 ns/op 1.12
Object access 1 prop 0.18500 ns/op 0.15300 ns/op 1.21
Map access 1 prop 0.18700 ns/op 0.14700 ns/op 1.27
Object get x1000 4.9620 ns/op 7.0040 ns/op 0.71
Map get x1000 0.69300 ns/op 0.71000 ns/op 0.98
Object set x1000 27.946 ns/op 48.300 ns/op 0.58
Map set x1000 17.517 ns/op 38.068 ns/op 0.46
Return object 10000 times 0.21550 ns/op 0.22740 ns/op 0.95
Throw Error 10000 times 2.6273 us/op 3.6602 us/op 0.72
fastMsgIdFn sha256 / 200 bytes 1.9300 us/op 3.1240 us/op 0.62
fastMsgIdFn h32 xxhash / 200 bytes 312.00 ns/op 262.00 ns/op 1.19
fastMsgIdFn h64 xxhash / 200 bytes 378.00 ns/op 332.00 ns/op 1.14
fastMsgIdFn sha256 / 1000 bytes 6.1580 us/op 10.825 us/op 0.57
fastMsgIdFn h32 xxhash / 1000 bytes 432.00 ns/op 386.00 ns/op 1.12
fastMsgIdFn h64 xxhash / 1000 bytes 453.00 ns/op 407.00 ns/op 1.11
fastMsgIdFn sha256 / 10000 bytes 53.183 us/op 99.433 us/op 0.53
fastMsgIdFn h32 xxhash / 10000 bytes 1.7570 us/op 1.7990 us/op 0.98
fastMsgIdFn h64 xxhash / 10000 bytes 1.2050 us/op 1.2460 us/op 0.97
send data - 1000 256B messages 10.189 ms/op 18.666 ms/op 0.55
send data - 1000 512B messages 14.899 ms/op 23.301 ms/op 0.64
send data - 1000 1024B messages 22.165 ms/op 40.566 ms/op 0.55
send data - 1000 1200B messages 32.104 ms/op 37.024 ms/op 0.87
send data - 1000 2048B messages 39.029 ms/op 46.508 ms/op 0.84
send data - 1000 4096B messages 33.542 ms/op 43.538 ms/op 0.77
send data - 1000 16384B messages 94.075 ms/op 110.41 ms/op 0.85
send data - 1000 65536B messages 413.68 ms/op 505.59 ms/op 0.82
enrSubnets - fastDeserialize 64 bits 1.2950 us/op 1.1700 us/op 1.11
enrSubnets - ssz BitVector 64 bits 513.00 ns/op 401.00 ns/op 1.28
enrSubnets - fastDeserialize 4 bits 246.00 ns/op 159.00 ns/op 1.55
enrSubnets - ssz BitVector 4 bits 531.00 ns/op 401.00 ns/op 1.32
prioritizePeers score -10:0 att 32-0.1 sync 2-0 81.849 us/op 98.301 us/op 0.83
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 117.75 us/op 123.42 us/op 0.95
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 151.85 us/op 155.34 us/op 0.98
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 244.78 us/op 279.87 us/op 0.87
prioritizePeers score 0:0 att 64-1 sync 4-1 246.23 us/op 326.14 us/op 0.75
array of 16000 items push then shift 1.2785 us/op 1.5585 us/op 0.82
LinkedList of 16000 items push then shift 6.0340 ns/op 8.6730 ns/op 0.70
array of 16000 items push then pop 91.222 ns/op 74.326 ns/op 1.23
LinkedList of 16000 items push then pop 5.8590 ns/op 8.4290 ns/op 0.70
array of 24000 items push then shift 2.1542 us/op 2.3215 us/op 0.93
LinkedList of 24000 items push then shift 5.8490 ns/op 8.6050 ns/op 0.68
array of 24000 items push then pop 84.919 ns/op 101.17 ns/op 0.84
LinkedList of 24000 items push then pop 5.6600 ns/op 8.3780 ns/op 0.68
intersect bitArray bitLen 8 4.7330 ns/op 5.5430 ns/op 0.85
intersect array and set length 8 48.300 ns/op 60.026 ns/op 0.80
intersect bitArray bitLen 128 29.238 ns/op 34.302 ns/op 0.85
intersect array and set length 128 717.64 ns/op 843.95 ns/op 0.85
bitArray.getTrueBitIndexes() bitLen 128 1.2160 us/op 1.5110 us/op 0.80
bitArray.getTrueBitIndexes() bitLen 248 2.1960 us/op 2.3920 us/op 0.92
bitArray.getTrueBitIndexes() bitLen 512 4.0460 us/op 4.6330 us/op 0.87
Buffer.concat 32 items 854.00 ns/op 1.0570 us/op 0.81
Uint8Array.set 32 items 1.9120 us/op 1.7890 us/op 1.07
Set add up to 64 items then delete first 2.0684 us/op 4.3007 us/op 0.48
OrderedSet add up to 64 items then delete first 2.7517 us/op 5.3977 us/op 0.51
Set add up to 64 items then delete last 2.4767 us/op 4.6015 us/op 0.54
OrderedSet add up to 64 items then delete last 3.1438 us/op 5.6946 us/op 0.55
Set add up to 64 items then delete middle 2.4899 us/op 4.6145 us/op 0.54
OrderedSet add up to 64 items then delete middle 5.0964 us/op 6.8231 us/op 0.75
Set add up to 128 items then delete first 4.9994 us/op 8.9721 us/op 0.56
OrderedSet add up to 128 items then delete first 7.5659 us/op 11.928 us/op 0.63
Set add up to 128 items then delete last 4.3953 us/op 8.8592 us/op 0.50
OrderedSet add up to 128 items then delete last 6.2694 us/op 11.218 us/op 0.56
Set add up to 128 items then delete middle 4.4637 us/op 8.8454 us/op 0.50
OrderedSet add up to 128 items then delete middle 12.206 us/op 16.385 us/op 0.74
Set add up to 256 items then delete first 8.2469 us/op 18.316 us/op 0.45
OrderedSet add up to 256 items then delete first 13.102 us/op 24.553 us/op 0.53
Set add up to 256 items then delete last 9.2317 us/op 17.911 us/op 0.52
OrderedSet add up to 256 items then delete last 12.305 us/op 22.680 us/op 0.54
Set add up to 256 items then delete middle 8.0847 us/op 17.541 us/op 0.46
OrderedSet add up to 256 items then delete middle 32.474 us/op 43.454 us/op 0.75
transfer serialized Status (84 B) 1.4050 us/op 1.7370 us/op 0.81
copy serialized Status (84 B) 1.1160 us/op 1.2620 us/op 0.88
transfer serialized SignedVoluntaryExit (112 B) 1.5020 us/op 1.8900 us/op 0.79
copy serialized SignedVoluntaryExit (112 B) 1.1650 us/op 1.3230 us/op 0.88
transfer serialized ProposerSlashing (416 B) 1.7080 us/op 2.2810 us/op 0.75
copy serialized ProposerSlashing (416 B) 1.6060 us/op 2.0420 us/op 0.79
transfer serialized Attestation (485 B) 1.7220 us/op 2.3980 us/op 0.72
copy serialized Attestation (485 B) 1.4460 us/op 1.9870 us/op 0.73
transfer serialized AttesterSlashing (33232 B) 1.7820 us/op 2.4680 us/op 0.72
copy serialized AttesterSlashing (33232 B) 4.3090 us/op 5.3190 us/op 0.81
transfer serialized Small SignedBeaconBlock (128000 B) 2.7180 us/op 3.2590 us/op 0.83
copy serialized Small SignedBeaconBlock (128000 B) 9.4360 us/op 14.196 us/op 0.66
transfer serialized Avg SignedBeaconBlock (200000 B) 2.6440 us/op 3.6760 us/op 0.72
copy serialized Avg SignedBeaconBlock (200000 B) 13.730 us/op 20.300 us/op 0.68
transfer serialized BlobsSidecar (524380 B) 2.8980 us/op 3.6440 us/op 0.80
copy serialized BlobsSidecar (524380 B) 76.927 us/op 86.646 us/op 0.89
transfer serialized Big SignedBeaconBlock (1000000 B) 3.0550 us/op 3.2400 us/op 0.94
copy serialized Big SignedBeaconBlock (1000000 B) 200.28 us/op 146.37 us/op 1.37
pass gossip attestations to forkchoice per slot 2.7431 ms/op 4.2479 ms/op 0.65
forkChoice updateHead vc 100000 bc 64 eq 0 421.24 us/op 709.99 us/op 0.59
forkChoice updateHead vc 600000 bc 64 eq 0 4.2958 ms/op 4.5857 ms/op 0.94
forkChoice updateHead vc 1000000 bc 64 eq 0 4.8202 ms/op 6.9729 ms/op 0.69
forkChoice updateHead vc 600000 bc 320 eq 0 2.7711 ms/op 4.0485 ms/op 0.68
forkChoice updateHead vc 600000 bc 1200 eq 0 2.7203 ms/op 4.1289 ms/op 0.66
forkChoice updateHead vc 600000 bc 7200 eq 0 3.6771 ms/op 5.1432 ms/op 0.71
forkChoice updateHead vc 600000 bc 64 eq 1000 10.065 ms/op 10.973 ms/op 0.92
forkChoice updateHead vc 600000 bc 64 eq 10000 10.067 ms/op 11.913 ms/op 0.85
forkChoice updateHead vc 600000 bc 64 eq 300000 12.358 ms/op 15.421 ms/op 0.80
computeDeltas 500000 validators 300 proto nodes 3.4294 ms/op 6.4708 ms/op 0.53
computeDeltas 500000 validators 1200 proto nodes 2.9995 ms/op 6.3358 ms/op 0.47
computeDeltas 500000 validators 7200 proto nodes 2.9949 ms/op 6.3303 ms/op 0.47
computeDeltas 750000 validators 300 proto nodes 4.5068 ms/op 9.8315 ms/op 0.46
computeDeltas 750000 validators 1200 proto nodes 4.4850 ms/op 9.3701 ms/op 0.48
computeDeltas 750000 validators 7200 proto nodes 4.5035 ms/op 9.4572 ms/op 0.48
computeDeltas 1400000 validators 300 proto nodes 8.9720 ms/op 18.929 ms/op 0.47
computeDeltas 1400000 validators 1200 proto nodes 8.9200 ms/op 18.847 ms/op 0.47
computeDeltas 1400000 validators 7200 proto nodes 9.2300 ms/op 18.322 ms/op 0.50
computeDeltas 2100000 validators 300 proto nodes 13.765 ms/op 28.114 ms/op 0.49
computeDeltas 2100000 validators 1200 proto nodes 14.013 ms/op 28.341 ms/op 0.49
computeDeltas 2100000 validators 7200 proto nodes 14.381 ms/op 28.462 ms/op 0.51
altair processAttestation - 250000 vs - 7PWei normalcase 2.2792 ms/op 2.1987 ms/op 1.04
altair processAttestation - 250000 vs - 7PWei worstcase 2.3133 ms/op 3.1161 ms/op 0.74
altair processAttestation - setStatus - 1/6 committees join 87.961 us/op 174.18 us/op 0.50
altair processAttestation - setStatus - 1/3 committees join 158.90 us/op 326.62 us/op 0.49
altair processAttestation - setStatus - 1/2 committees join 221.24 us/op 438.98 us/op 0.50
altair processAttestation - setStatus - 2/3 committees join 299.56 us/op 566.85 us/op 0.53
altair processAttestation - setStatus - 4/5 committees join 399.43 us/op 740.79 us/op 0.54
altair processAttestation - setStatus - 100% committees join 479.38 us/op 905.46 us/op 0.53
altair processBlock - 250000 vs - 7PWei normalcase 8.6173 ms/op 10.437 ms/op 0.83
altair processBlock - 250000 vs - 7PWei normalcase hashState 27.582 ms/op 39.559 ms/op 0.70
altair processBlock - 250000 vs - 7PWei worstcase 30.544 ms/op 37.011 ms/op 0.83
altair processBlock - 250000 vs - 7PWei worstcase hashState 95.449 ms/op 95.252 ms/op 1.00
phase0 processBlock - 250000 vs - 7PWei normalcase 1.7573 ms/op 2.4136 ms/op 0.73
phase0 processBlock - 250000 vs - 7PWei worstcase 23.988 ms/op 29.210 ms/op 0.82
altair processEth1Data - 250000 vs - 7PWei normalcase 308.06 us/op 476.36 us/op 0.65
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 4.4800 us/op 7.2670 us/op 0.62
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 27.590 us/op 60.431 us/op 0.46
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 19.997 us/op 18.666 us/op 1.07
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 12.652 us/op 11.064 us/op 1.14
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 177.99 us/op 124.65 us/op 1.43
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.0498 ms/op 1.0216 ms/op 1.03
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.0369 ms/op 1.5049 ms/op 0.69
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.0464 ms/op 1.7174 ms/op 0.61
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 2.3688 ms/op 3.3248 ms/op 0.71
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.1458 ms/op 2.3418 ms/op 0.92
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 6.5972 ms/op 4.6739 ms/op 1.41
Tree 40 250000 create 310.38 ms/op 345.70 ms/op 0.90
Tree 40 250000 get(125000) 157.13 ns/op 198.28 ns/op 0.79
Tree 40 250000 set(125000) 908.19 ns/op 968.93 ns/op 0.94
Tree 40 250000 toArray() 22.800 ms/op 18.472 ms/op 1.23
Tree 40 250000 iterate all - toArray() + loop 25.749 ms/op 18.356 ms/op 1.40
Tree 40 250000 iterate all - get(i) 67.187 ms/op 66.747 ms/op 1.01
MutableVector 250000 create 13.660 ms/op 11.626 ms/op 1.17
MutableVector 250000 get(125000) 5.8570 ns/op 6.4980 ns/op 0.90
MutableVector 250000 set(125000) 206.10 ns/op 264.52 ns/op 0.78
MutableVector 250000 toArray() 3.2067 ms/op 3.0971 ms/op 1.04
MutableVector 250000 iterate all - toArray() + loop 3.5506 ms/op 3.1784 ms/op 1.12
MutableVector 250000 iterate all - get(i) 1.3307 ms/op 1.4753 ms/op 0.90
Array 250000 create 3.1222 ms/op 2.6681 ms/op 1.17
Array 250000 clone - spread 1.1552 ms/op 1.2698 ms/op 0.91
Array 250000 get(125000) 1.1710 ns/op 1.0380 ns/op 1.13
Array 250000 set(125000) 1.5020 ns/op 4.0130 ns/op 0.37
Array 250000 iterate all - loop 153.43 us/op 160.11 us/op 0.96
effectiveBalanceIncrements clone Uint8Array 300000 35.820 us/op 30.084 us/op 1.19
effectiveBalanceIncrements clone MutableVector 300000 480.00 ns/op 384.00 ns/op 1.25
effectiveBalanceIncrements rw all Uint8Array 300000 195.50 us/op 193.73 us/op 1.01
effectiveBalanceIncrements rw all MutableVector 300000 79.986 ms/op 83.399 ms/op 0.96
phase0 afterProcessEpoch - 250000 vs - 7PWei 80.380 ms/op 108.21 ms/op 0.74
phase0 beforeProcessEpoch - 250000 vs - 7PWei 42.291 ms/op 52.048 ms/op 0.81
altair processEpoch - mainnet_e81889 485.25 ms/op 524.25 ms/op 0.93
mainnet_e81889 - altair beforeProcessEpoch 94.386 ms/op 82.481 ms/op 1.14
mainnet_e81889 - altair processJustificationAndFinalization 19.178 us/op 13.936 us/op 1.38
mainnet_e81889 - altair processInactivityUpdates 6.9073 ms/op 6.0660 ms/op 1.14
mainnet_e81889 - altair processRewardsAndPenalties 56.946 ms/op 59.976 ms/op 0.95
mainnet_e81889 - altair processRegistryUpdates 4.2570 us/op 2.4570 us/op 1.73
mainnet_e81889 - altair processSlashings 718.00 ns/op 420.00 ns/op 1.71
mainnet_e81889 - altair processEth1DataReset 867.00 ns/op 475.00 ns/op 1.83
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.2158 ms/op 1.7177 ms/op 0.71
mainnet_e81889 - altair processSlashingsReset 4.8950 us/op 3.2830 us/op 1.49
mainnet_e81889 - altair processRandaoMixesReset 10.180 us/op 5.2160 us/op 1.95
mainnet_e81889 - altair processHistoricalRootsUpdate 1.8100 us/op 848.00 ns/op 2.13
mainnet_e81889 - altair processParticipationFlagUpdates 3.1480 us/op 1.7530 us/op 1.80
mainnet_e81889 - altair processSyncCommitteeUpdates 922.00 ns/op 680.00 ns/op 1.36
mainnet_e81889 - altair afterProcessEpoch 85.177 ms/op 117.69 ms/op 0.72
capella processEpoch - mainnet_e217614 2.3038 s/op 2.0961 s/op 1.10
mainnet_e217614 - capella beforeProcessEpoch 527.34 ms/op 496.45 ms/op 1.06
mainnet_e217614 - capella processJustificationAndFinalization 19.437 us/op 15.204 us/op 1.28
mainnet_e217614 - capella processInactivityUpdates 18.492 ms/op 16.502 ms/op 1.12
mainnet_e217614 - capella processRewardsAndPenalties 382.10 ms/op 401.59 ms/op 0.95
mainnet_e217614 - capella processRegistryUpdates 22.086 us/op 17.813 us/op 1.24
mainnet_e217614 - capella processSlashings 811.00 ns/op 531.00 ns/op 1.53
mainnet_e217614 - capella processEth1DataReset 811.00 ns/op 402.00 ns/op 2.02
mainnet_e217614 - capella processEffectiveBalanceUpdates 6.3264 ms/op 5.5449 ms/op 1.14
mainnet_e217614 - capella processSlashingsReset 3.2700 us/op 2.9830 us/op 1.10
mainnet_e217614 - capella processRandaoMixesReset 5.0650 us/op 4.7380 us/op 1.07
mainnet_e217614 - capella processHistoricalRootsUpdate 760.00 ns/op 759.00 ns/op 1.00
mainnet_e217614 - capella processParticipationFlagUpdates 2.4130 us/op 1.5350 us/op 1.57
mainnet_e217614 - capella afterProcessEpoch 220.73 ms/op 323.96 ms/op 0.68
phase0 processEpoch - mainnet_e58758 419.36 ms/op 431.74 ms/op 0.97
mainnet_e58758 - phase0 beforeProcessEpoch 108.69 ms/op 110.94 ms/op 0.98
mainnet_e58758 - phase0 processJustificationAndFinalization 17.611 us/op 14.939 us/op 1.18
mainnet_e58758 - phase0 processRewardsAndPenalties 37.052 ms/op 55.044 ms/op 0.67
mainnet_e58758 - phase0 processRegistryUpdates 12.382 us/op 11.489 us/op 1.08
mainnet_e58758 - phase0 processSlashings 767.00 ns/op 560.00 ns/op 1.37
mainnet_e58758 - phase0 processEth1DataReset 887.00 ns/op 402.00 ns/op 2.21
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.5072 ms/op 1.1337 ms/op 1.33
mainnet_e58758 - phase0 processSlashingsReset 5.0910 us/op 2.7980 us/op 1.82
mainnet_e58758 - phase0 processRandaoMixesReset 5.5740 us/op 4.0300 us/op 1.38
mainnet_e58758 - phase0 processHistoricalRootsUpdate 802.00 ns/op 401.00 ns/op 2.00
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.8400 us/op 3.2520 us/op 1.49
mainnet_e58758 - phase0 afterProcessEpoch 69.326 ms/op 94.696 ms/op 0.73
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.0376 ms/op 1.3581 ms/op 0.76
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5326 ms/op 1.5381 ms/op 1.00
altair processInactivityUpdates - 250000 normalcase 27.746 ms/op 24.860 ms/op 1.12
altair processInactivityUpdates - 250000 worstcase 27.738 ms/op 25.061 ms/op 1.11
phase0 processRegistryUpdates - 250000 normalcase 8.7480 us/op 8.2020 us/op 1.07
phase0 processRegistryUpdates - 250000 badcase_full_deposits 434.38 us/op 359.62 us/op 1.21
phase0 processRegistryUpdates - 250000 worstcase 0.5 122.47 ms/op 131.17 ms/op 0.93
altair processRewardsAndPenalties - 250000 normalcase 53.307 ms/op 57.121 ms/op 0.93
altair processRewardsAndPenalties - 250000 worstcase 55.466 ms/op 58.002 ms/op 0.96
phase0 getAttestationDeltas - 250000 normalcase 8.5481 ms/op 9.1989 ms/op 0.93
phase0 getAttestationDeltas - 250000 worstcase 7.9717 ms/op 8.7106 ms/op 0.92
phase0 processSlashings - 250000 worstcase 95.252 us/op 80.685 us/op 1.18
altair processSyncCommitteeUpdates - 250000 108.64 ms/op 150.36 ms/op 0.72
BeaconState.hashTreeRoot - No change 363.00 ns/op 351.00 ns/op 1.03
BeaconState.hashTreeRoot - 1 full validator 84.851 us/op 151.97 us/op 0.56
BeaconState.hashTreeRoot - 32 full validator 864.03 us/op 1.6425 ms/op 0.53
BeaconState.hashTreeRoot - 512 full validator 9.2044 ms/op 16.438 ms/op 0.56
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 103.67 us/op 177.01 us/op 0.59
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.6520 ms/op 2.0899 ms/op 0.79
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 20.600 ms/op 25.788 ms/op 0.80
BeaconState.hashTreeRoot - 1 balances 83.614 us/op 138.84 us/op 0.60
BeaconState.hashTreeRoot - 32 balances 747.60 us/op 1.3987 ms/op 0.53
BeaconState.hashTreeRoot - 512 balances 7.6219 ms/op 12.527 ms/op 0.61
BeaconState.hashTreeRoot - 250000 balances 173.17 ms/op 208.51 ms/op 0.83
aggregationBits - 2048 els - zipIndexesInBitList 10.837 us/op 16.885 us/op 0.64
byteArrayEquals 32 64.834 ns/op 73.140 ns/op 0.89
Buffer.compare 32 58.619 ns/op 54.056 ns/op 1.08
byteArrayEquals 1024 1.7782 us/op 1.9996 us/op 0.89
Buffer.compare 1024 52.967 ns/op 68.223 ns/op 0.78
byteArrayEquals 16384 27.975 us/op 31.893 us/op 0.88
Buffer.compare 16384 239.00 ns/op 265.63 ns/op 0.90
byteArrayEquals 123687377 208.41 ms/op 244.63 ms/op 0.85
Buffer.compare 123687377 6.2453 ms/op 6.0276 ms/op 1.04
byteArrayEquals 32 - diff last byte 60.441 ns/op 71.830 ns/op 0.84
Buffer.compare 32 - diff last byte 59.559 ns/op 54.162 ns/op 1.10
byteArrayEquals 1024 - diff last byte 1.6886 us/op 1.9796 us/op 0.85
Buffer.compare 1024 - diff last byte 50.385 ns/op 68.735 ns/op 0.73
byteArrayEquals 16384 - diff last byte 26.724 us/op 31.531 us/op 0.85
Buffer.compare 16384 - diff last byte 205.84 ns/op 247.72 ns/op 0.83
byteArrayEquals 123687377 - diff last byte 206.17 ms/op 240.47 ms/op 0.86
Buffer.compare 123687377 - diff last byte 6.3604 ms/op 6.1156 ms/op 1.04
byteArrayEquals 32 - random bytes 5.4370 ns/op 5.2470 ns/op 1.04
Buffer.compare 32 - random bytes 49.155 ns/op 60.360 ns/op 0.81
byteArrayEquals 1024 - random bytes 5.5300 ns/op 5.1720 ns/op 1.07
Buffer.compare 1024 - random bytes 50.468 ns/op 59.660 ns/op 0.85
byteArrayEquals 16384 - random bytes 5.5900 ns/op 5.1470 ns/op 1.09
Buffer.compare 16384 - random bytes 49.891 ns/op 59.679 ns/op 0.84
byteArrayEquals 123687377 - random bytes 9.5500 ns/op 8.3200 ns/op 1.15
Buffer.compare 123687377 - random bytes 63.770 ns/op 62.900 ns/op 1.01
regular array get 100000 times 42.583 us/op 44.048 us/op 0.97
wrappedArray get 100000 times 42.197 us/op 44.121 us/op 0.96
arrayWithProxy get 100000 times 11.996 ms/op 14.396 ms/op 0.83
ssz.Root.equals 55.652 ns/op 53.887 ns/op 1.03
byteArrayEquals 55.229 ns/op 52.595 ns/op 1.05
Buffer.compare 10.339 ns/op 10.787 ns/op 0.96
shuffle list - 16384 els 4.8929 ms/op 6.6680 ms/op 0.73
shuffle list - 250000 els 71.816 ms/op 97.784 ms/op 0.73
processSlot - 1 slots 18.890 us/op 16.945 us/op 1.11
processSlot - 32 slots 4.6560 ms/op 3.5918 ms/op 1.30
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 52.343 ms/op 59.667 ms/op 0.88
getCommitteeAssignments - req 1 vs - 250000 vc 2.2236 ms/op 2.4009 ms/op 0.93
getCommitteeAssignments - req 100 vs - 250000 vc 3.4441 ms/op 3.5311 ms/op 0.98
getCommitteeAssignments - req 1000 vs - 250000 vc 3.7092 ms/op 3.8633 ms/op 0.96
findModifiedValidators - 10000 modified validators 445.38 ms/op 527.54 ms/op 0.84
findModifiedValidators - 1000 modified validators 348.75 ms/op 408.11 ms/op 0.85
findModifiedValidators - 100 modified validators 338.71 ms/op 413.49 ms/op 0.82
findModifiedValidators - 10 modified validators 351.47 ms/op 393.97 ms/op 0.89
findModifiedValidators - 1 modified validators 330.87 ms/op 402.90 ms/op 0.82
findModifiedValidators - no difference 342.30 ms/op 371.34 ms/op 0.92
compare ViewDUs 4.9790 s/op 4.3519 s/op 1.14
compare each validator Uint8Array 2.1354 s/op 1.8178 s/op 1.17
compare ViewDU to Uint8Array 1.4180 s/op 1.0633 s/op 1.33
migrate state 1000000 validators, 24 modified, 0 new 768.45 ms/op 792.35 ms/op 0.97
migrate state 1000000 validators, 1700 modified, 1000 new 1.2186 s/op 1.1014 s/op 1.11
migrate state 1000000 validators, 3400 modified, 2000 new 1.4626 s/op 1.3152 s/op 1.11
migrate state 1500000 validators, 24 modified, 0 new 841.50 ms/op 806.30 ms/op 1.04
migrate state 1500000 validators, 1700 modified, 1000 new 1.2511 s/op 1.1001 s/op 1.14
migrate state 1500000 validators, 3400 modified, 2000 new 1.4941 s/op 1.3238 s/op 1.13
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.5800 ns/op 4.3900 ns/op 1.27
state getBlockRootAtSlot - 250000 vs - 7PWei 447.85 ns/op 711.08 ns/op 0.63
computeProposers - vc 250000 7.1539 ms/op 9.4955 ms/op 0.75
computeEpochShuffling - vc 250000 70.955 ms/op 103.47 ms/op 0.69
getNextSyncCommittee - vc 250000 111.37 ms/op 145.28 ms/op 0.77
computeSigningRoot for AttestationData 18.501 us/op 30.195 us/op 0.61
hash AttestationData serialized data then Buffer.toString(base64) 1.3510 us/op 2.2767 us/op 0.59
toHexString serialized data 835.60 ns/op 1.0778 us/op 0.78
Buffer.toString(base64) 200.16 ns/op 206.07 ns/op 0.97

by benchmarkbot/action

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.

It a bit counter intuitive to me to have .env files in source control. I am rather used to having those files to override locally and explicitly not have them tracked by git.

Why can't we just set the default image versions in scripts/run_e2e_env.sh and allow to override them via env variables?

We could consider having dotenv module to override those but seems a bit overkill as there are not many envs and you can just add GETH_DOCKER_IMAGE=... in front of the yarn command to achieve this easily if someone wants to use a different version than the default one.

@nazarhussain
Copy link
Contributor Author

nazarhussain commented Feb 7, 2024

It a bit counter intuitive to me to have .env files in source control

I am also not in favor of keeping .env file in version control as it's used to pass some sensitive data to application and many tooling use it passively so you can't protect values to be transmitted somewhere. But here we don't have a .env file we have a .env.test which is a specific use case and we use that file explicitly where we needed. We could use any name e.g. TestEnv.txt does not matter. If we want to reuse definition of env variables around tests and workflows we need to define those somewhere.

I am rather used to having those files to override locally and explicitly not have them tracked by git.

Not now but if needed we can make this setup in a way that you can override those variables in .env.local file and obviously that file will be git ignored.

@nflaig
Copy link
Member

nflaig commented Feb 7, 2024

But here we don't have a .env file we have a .env.test

Maybe that's just me, but I don't see a difference between those two files, neither should be in source control imo, e.g Nextjs also uses .env.test file for Test Environment Variables

But I like the de-duplication of setting the version which is much better than before

Edit: It seems to be convention to have .env.test as part of source control
image

So I guess we are good to go

.github/actions/dotenv/action.yml Outdated Show resolved Hide resolved
@@ -1,6 +1,6 @@
import path from "node:path";
import {defineConfig} from "vitest/config";
const __dirname = new URL(".", import.meta.url).pathname;
const currentDir = new URL(".", import.meta.url).pathname;
Copy link
Member

Choose a reason for hiding this comment

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

For consistency with the rest of the codebase __dirname is better, but no strong opinion here

Copy link

codecov bot commented Feb 8, 2024

Codecov Report

Merging #6408 (3b2142e) into unstable (b6890ad) will increase coverage by 1.57%.
Report is 14 commits behind head on unstable.
The diff coverage is n/a.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #6408      +/-   ##
============================================
+ Coverage     60.14%   61.72%   +1.57%     
============================================
  Files           407      553     +146     
  Lines         46512    57856   +11344     
  Branches       1551     1829     +278     
============================================
+ Hits          27975    35711    +7736     
- Misses        18505    22108    +3603     
- Partials         32       37       +5     

nflaig
nflaig previously approved these changes Feb 8, 2024
CONTRIBUTING.md Show resolved Hide resolved
nflaig
nflaig previously approved these changes Feb 9, 2024
matthewkeil

This comment was marked as outdated.

@matthewkeil matthewkeil self-requested a review February 10, 2024 04:01
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.

FWIW I am sorry I brought up the LODESTAR_PRESET. Apologies!! I didn’t realize the amount of confusion it would insert because of how we use the two for different tests interchangeably. Thank you for the thoroughness in working through those challenges.

Just the two questions about the inserts and the update for getting the BASH dirname

"test:unit:minimal": "vitest --run --segfaultRetry 3 --dir test/unit/",
"test:unit:mainnet": "LODESTAR_PRESET=mainnet vitest --run --dir test/unit-mainnet",
"test:unit:minimal": "LODESTAR_PRESET=minimal vitest --run --segfaultRetry 3 --dir test/unit/",
"test:unit:mainnet": "LODESTAR_PRESET=mainnet vitest --run --segfaultRetry 3 --dir test/unit-mainnet",
Copy link
Member

Choose a reason for hiding this comment

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

I noticed this segfaultRetry was added. what does that do?

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 earlier added in minimal preset and missing in mainnet. It just check if tests fails with a segfault error, it tries to rerun it.

@@ -14,6 +14,7 @@ const {forkConfig} = defineSimTestConfig({
BELLATRIX_FORK_EPOCH: bellatrixForkEpoch,
CAPELLA_FORK_EPOCH: capellaForkEpoch,
runTillEpoch: Infinity,
initialNodes: 2,
Copy link
Member

Choose a reason for hiding this comment

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

i noticed this was added. what does that do?

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 adjust the genesis delay for the e2e notes, without that default is a bit higher value, so tests take more time to wait for capella fork.

@@ -1,18 +1,19 @@
#!/bin/bash

DIR=$(dirname "$0")
Copy link
Member

Choose a reason for hiding this comment

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

I’ve seen this done like the below before.

DIR="$(CDPATH= cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

It ensures that the directory is obtained correctly even if the script is executed from a different directory or via a symbolic link

@nazarhussain
Copy link
Contributor Author

FWIW I am sorry I brought up the LODESTAR_PRESET. Apologies!!

@matthewkeil No problem at all. We had to clean up today or later anyway.

matthewkeil
matthewkeil previously approved these changes Feb 10, 2024
Copy link
Member

@matthewkeil matthewkeil left a comment

Choose a reason for hiding this comment

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

Sweet!! 🎸 I haven't run with the most recent changes but assuming it works. Although I noticed that CI was not happy. Not sure if that is related to these changes though.... A goal to shoot for is all green CI. If I can help I will be glad to lend a hand. Just point me in a direction and ill do my best

nflaig
nflaig previously approved these changes Feb 10, 2024
@nazarhussain nazarhussain dismissed stale reviews from nflaig and matthewkeil via 6b3522d February 12, 2024 11:34
matthewkeil
matthewkeil previously approved these changes Feb 12, 2024
Copy link
Member

@matthewkeil matthewkeil left a comment

Choose a reason for hiding this comment

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

Reapproving but asked in discord about such a big downgrade to make sure we are not going to run into issues

.env.test Outdated Show resolved Hide resolved
@nazarhussain nazarhussain merged commit da0bcc8 into unstable Feb 12, 2024
14 of 15 checks passed
@nazarhussain nazarhussain deleted the nh/share-env-variables branch February 12, 2024 13:36
@wemeetagain
Copy link
Member

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