Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: unify blockStateCache naming convention #6695

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Apr 22, 2024

Motivation

  • The name StateContextCache is quite general and it does not tell this is a cache of block states

Description

  • Rename it to BlockStateCacheImpl
  • Use blockStateCache every where instead of stateCache, this differentiates blockStateCache vs checkpointStateCache

part of #5968

@twoeths twoeths requested a review from a team as a code owner April 22, 2024 04:18
Copy link

codecov bot commented Apr 22, 2024

Codecov Report

Merging #6695 (2e63af8) into unstable (05fe0ac) will decrease coverage by 0.01%.
The diff coverage is 24.00%.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #6695      +/-   ##
============================================
- Coverage     61.87%   61.87%   -0.01%     
============================================
  Files           557      557              
  Lines         59200    59201       +1     
  Branches       1915     1915              
============================================
  Hits          36628    36628              
- Misses        22529    22530       +1     
  Partials         43       43              

Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 7405961 Previous: 05fe0ac Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 960.27 us/op 644.29 us/op 1.49
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 90.179 us/op 70.122 us/op 1.29
BLS verify - blst-native 1.3223 ms/op 1.1177 ms/op 1.18
BLS verifyMultipleSignatures 3 - blst-native 2.7738 ms/op 2.4172 ms/op 1.15
BLS verifyMultipleSignatures 8 - blst-native 6.0253 ms/op 5.1952 ms/op 1.16
BLS verifyMultipleSignatures 32 - blst-native 22.019 ms/op 18.824 ms/op 1.17
BLS verifyMultipleSignatures 64 - blst-native 43.434 ms/op 36.894 ms/op 1.18
BLS verifyMultipleSignatures 128 - blst-native 86.649 ms/op 80.544 ms/op 1.08
BLS deserializing 10000 signatures 914.40 ms/op 840.56 ms/op 1.09
BLS deserializing 100000 signatures 9.3514 s/op 8.3229 s/op 1.12
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.3292 ms/op 1.1017 ms/op 1.21
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.5092 ms/op 1.2576 ms/op 1.20
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.7710 ms/op 2.0548 ms/op 1.35
BLS verifyMultipleSignatures - same message - 64 - blst-native 4.2972 ms/op 3.5576 ms/op 1.21
BLS verifyMultipleSignatures - same message - 128 - blst-native 7.4127 ms/op 5.1020 ms/op 1.45
BLS aggregatePubkeys 32 - blst-native 26.727 us/op 22.061 us/op 1.21
BLS aggregatePubkeys 128 - blst-native 97.046 us/op 87.099 us/op 1.11
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 65.688 ms/op 43.344 ms/op 1.52
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 57.306 ms/op 47.139 ms/op 1.22
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 42.052 ms/op 27.648 ms/op 1.52
getSlashingsAndExits - default max 155.10 us/op 115.24 us/op 1.35
getSlashingsAndExits - 2k 391.92 us/op 435.11 us/op 0.90
proposeBlockBody type=full, size=empty 5.8041 ms/op 4.3204 ms/op 1.34
isKnown best case - 1 super set check 349.00 ns/op 380.00 ns/op 0.92
isKnown normal case - 2 super set checks 322.00 ns/op 403.00 ns/op 0.80
isKnown worse case - 16 super set checks 311.00 ns/op 355.00 ns/op 0.88
InMemoryCheckpointStateCache - add get delete 6.3390 us/op 5.9980 us/op 1.06
validate api signedAggregateAndProof - struct 2.7919 ms/op 2.5188 ms/op 1.11
validate gossip signedAggregateAndProof - struct 2.8024 ms/op 2.4178 ms/op 1.16
validate gossip attestation - vc 640000 1.3626 ms/op 1.1696 ms/op 1.17
batch validate gossip attestation - vc 640000 - chunk 32 163.79 us/op 141.85 us/op 1.15
batch validate gossip attestation - vc 640000 - chunk 64 147.15 us/op 125.56 us/op 1.17
batch validate gossip attestation - vc 640000 - chunk 128 140.35 us/op 119.82 us/op 1.17
batch validate gossip attestation - vc 640000 - chunk 256 134.03 us/op 117.89 us/op 1.14
pickEth1Vote - no votes 1.3283 ms/op 826.75 us/op 1.61
pickEth1Vote - max votes 11.377 ms/op 5.3754 ms/op 2.12
pickEth1Vote - Eth1Data hashTreeRoot value x2048 23.125 ms/op 11.427 ms/op 2.02
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 31.184 ms/op 17.791 ms/op 1.75
pickEth1Vote - Eth1Data fastSerialize value x2048 727.60 us/op 412.39 us/op 1.76
pickEth1Vote - Eth1Data fastSerialize tree x2048 7.7454 ms/op 3.4864 ms/op 2.22
bytes32 toHexString 601.00 ns/op 458.00 ns/op 1.31
bytes32 Buffer.toString(hex) 308.00 ns/op 336.00 ns/op 0.92
bytes32 Buffer.toString(hex) from Uint8Array 507.00 ns/op 438.00 ns/op 1.16
bytes32 Buffer.toString(hex) + 0x 299.00 ns/op 328.00 ns/op 0.91
Object access 1 prop 0.19800 ns/op 0.21700 ns/op 0.91
Map access 1 prop 0.15100 ns/op 0.18400 ns/op 0.82
Object get x1000 7.6290 ns/op 4.8540 ns/op 1.57
Map get x1000 0.83400 ns/op 0.74100 ns/op 1.13
Object set x1000 60.548 ns/op 29.206 ns/op 2.07
Map set x1000 45.498 ns/op 19.907 ns/op 2.29
Return object 10000 times 0.24540 ns/op 0.22740 ns/op 1.08
Throw Error 10000 times 3.8367 us/op 2.8139 us/op 1.36
fastMsgIdFn sha256 / 200 bytes 3.3640 us/op 2.0420 us/op 1.65
fastMsgIdFn h32 xxhash / 200 bytes 294.00 ns/op 332.00 ns/op 0.89
fastMsgIdFn h64 xxhash / 200 bytes 344.00 ns/op 390.00 ns/op 0.88
fastMsgIdFn sha256 / 1000 bytes 11.367 us/op 6.3760 us/op 1.78
fastMsgIdFn h32 xxhash / 1000 bytes 436.00 ns/op 486.00 ns/op 0.90
fastMsgIdFn h64 xxhash / 1000 bytes 455.00 ns/op 452.00 ns/op 1.01
fastMsgIdFn sha256 / 10000 bytes 103.25 us/op 52.539 us/op 1.97
fastMsgIdFn h32 xxhash / 10000 bytes 1.9840 us/op 1.8560 us/op 1.07
fastMsgIdFn h64 xxhash / 10000 bytes 1.3620 us/op 1.3150 us/op 1.04
send data - 1000 256B messages 21.200 ms/op 13.292 ms/op 1.59
send data - 1000 512B messages 27.329 ms/op 15.148 ms/op 1.80
send data - 1000 1024B messages 41.802 ms/op 22.480 ms/op 1.86
send data - 1000 1200B messages 38.745 ms/op 27.351 ms/op 1.42
send data - 1000 2048B messages 47.835 ms/op 36.294 ms/op 1.32
send data - 1000 4096B messages 45.804 ms/op 32.241 ms/op 1.42
send data - 1000 16384B messages 118.12 ms/op 91.461 ms/op 1.29
send data - 1000 65536B messages 502.88 ms/op 410.09 ms/op 1.23
enrSubnets - fastDeserialize 64 bits 1.2560 us/op 1.2640 us/op 0.99
enrSubnets - ssz BitVector 64 bits 446.00 ns/op 547.00 ns/op 0.82
enrSubnets - fastDeserialize 4 bits 181.00 ns/op 267.00 ns/op 0.68
enrSubnets - ssz BitVector 4 bits 436.00 ns/op 463.00 ns/op 0.94
prioritizePeers score -10:0 att 32-0.1 sync 2-0 216.84 us/op 145.84 us/op 1.49
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 272.78 us/op 218.62 us/op 1.25
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 377.27 us/op 242.07 us/op 1.56
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 580.77 us/op 387.12 us/op 1.50
prioritizePeers score 0:0 att 64-1 sync 4-1 689.93 us/op 452.66 us/op 1.52
array of 16000 items push then shift 1.6245 us/op 1.2551 us/op 1.29
LinkedList of 16000 items push then shift 8.8180 ns/op 7.6750 ns/op 1.15
array of 16000 items push then pop 79.673 ns/op 109.77 ns/op 0.73
LinkedList of 16000 items push then pop 8.6890 ns/op 5.8620 ns/op 1.48
array of 24000 items push then shift 2.3600 us/op 1.8446 us/op 1.28
LinkedList of 24000 items push then shift 8.8370 ns/op 7.3940 ns/op 1.20
array of 24000 items push then pop 134.07 ns/op 96.820 ns/op 1.38
LinkedList of 24000 items push then pop 8.6630 ns/op 5.7640 ns/op 1.50
intersect bitArray bitLen 8 5.9500 ns/op 5.0720 ns/op 1.17
intersect array and set length 8 63.619 ns/op 51.826 ns/op 1.23
intersect bitArray bitLen 128 35.736 ns/op 30.094 ns/op 1.19
intersect array and set length 128 867.03 ns/op 681.89 ns/op 1.27
bitArray.getTrueBitIndexes() bitLen 128 1.4400 us/op 1.1950 us/op 1.21
bitArray.getTrueBitIndexes() bitLen 248 2.4860 us/op 1.9860 us/op 1.25
bitArray.getTrueBitIndexes() bitLen 512 4.7960 us/op 4.0280 us/op 1.19
Buffer.concat 32 items 946.00 ns/op 934.00 ns/op 1.01
Uint8Array.set 32 items 2.2940 us/op 1.6060 us/op 1.43
Set add up to 64 items then delete first 4.3036 us/op 1.8895 us/op 2.28
OrderedSet add up to 64 items then delete first 5.4342 us/op 2.6789 us/op 2.03
Set add up to 64 items then delete last 4.5964 us/op 1.9824 us/op 2.32
OrderedSet add up to 64 items then delete last 5.7031 us/op 2.9503 us/op 1.93
Set add up to 64 items then delete middle 4.5718 us/op 2.0141 us/op 2.27
OrderedSet add up to 64 items then delete middle 6.9771 us/op 4.2559 us/op 1.64
Set add up to 128 items then delete first 9.2668 us/op 3.9601 us/op 2.34
OrderedSet add up to 128 items then delete first 12.231 us/op 6.1990 us/op 1.97
Set add up to 128 items then delete last 9.3088 us/op 3.8893 us/op 2.39
OrderedSet add up to 128 items then delete last 11.654 us/op 5.7233 us/op 2.04
Set add up to 128 items then delete middle 9.2696 us/op 4.1996 us/op 2.21
OrderedSet add up to 128 items then delete middle 17.679 us/op 11.822 us/op 1.50
Set add up to 256 items then delete first 19.500 us/op 8.4668 us/op 2.30
OrderedSet add up to 256 items then delete first 25.297 us/op 13.666 us/op 1.85
Set add up to 256 items then delete last 18.945 us/op 7.7144 us/op 2.46
OrderedSet add up to 256 items then delete last 24.053 us/op 11.574 us/op 2.08
Set add up to 256 items then delete middle 20.264 us/op 7.5159 us/op 2.70
OrderedSet add up to 256 items then delete middle 44.689 us/op 32.600 us/op 1.37
transfer serialized Status (84 B) 1.8520 us/op 1.5980 us/op 1.16
copy serialized Status (84 B) 1.3600 us/op 1.3020 us/op 1.04
transfer serialized SignedVoluntaryExit (112 B) 2.1290 us/op 1.6610 us/op 1.28
copy serialized SignedVoluntaryExit (112 B) 1.4140 us/op 1.2900 us/op 1.10
transfer serialized ProposerSlashing (416 B) 2.3830 us/op 1.7880 us/op 1.33
copy serialized ProposerSlashing (416 B) 2.5340 us/op 2.1390 us/op 1.18
transfer serialized Attestation (485 B) 2.2810 us/op 2.2740 us/op 1.00
copy serialized Attestation (485 B) 2.2150 us/op 2.1900 us/op 1.01
transfer serialized AttesterSlashing (33232 B) 2.1600 us/op 1.9680 us/op 1.10
copy serialized AttesterSlashing (33232 B) 5.1440 us/op 3.9860 us/op 1.29
transfer serialized Small SignedBeaconBlock (128000 B) 2.4750 us/op 2.3080 us/op 1.07
copy serialized Small SignedBeaconBlock (128000 B) 13.623 us/op 15.628 us/op 0.87
transfer serialized Avg SignedBeaconBlock (200000 B) 3.0130 us/op 2.5720 us/op 1.17
copy serialized Avg SignedBeaconBlock (200000 B) 20.279 us/op 21.652 us/op 0.94
transfer serialized BlobsSidecar (524380 B) 3.2230 us/op 2.2820 us/op 1.41
copy serialized BlobsSidecar (524380 B) 83.711 us/op 200.17 us/op 0.42
transfer serialized Big SignedBeaconBlock (1000000 B) 3.4240 us/op 2.9820 us/op 1.15
copy serialized Big SignedBeaconBlock (1000000 B) 171.64 us/op 184.72 us/op 0.93
pass gossip attestations to forkchoice per slot 4.2570 ms/op 2.8814 ms/op 1.48
forkChoice updateHead vc 100000 bc 64 eq 0 682.76 us/op 456.75 us/op 1.49
forkChoice updateHead vc 600000 bc 64 eq 0 4.1680 ms/op 2.5769 ms/op 1.62
forkChoice updateHead vc 1000000 bc 64 eq 0 7.3254 ms/op 4.6520 ms/op 1.57
forkChoice updateHead vc 600000 bc 320 eq 0 4.1968 ms/op 2.6182 ms/op 1.60
forkChoice updateHead vc 600000 bc 1200 eq 0 4.4199 ms/op 2.8464 ms/op 1.55
forkChoice updateHead vc 600000 bc 7200 eq 0 5.2804 ms/op 3.3396 ms/op 1.58
forkChoice updateHead vc 600000 bc 64 eq 1000 11.140 ms/op 9.8962 ms/op 1.13
forkChoice updateHead vc 600000 bc 64 eq 10000 11.761 ms/op 9.6799 ms/op 1.22
forkChoice updateHead vc 600000 bc 64 eq 300000 16.198 ms/op 12.017 ms/op 1.35
computeDeltas 500000 validators 300 proto nodes 6.6785 ms/op 3.4532 ms/op 1.93
computeDeltas 500000 validators 1200 proto nodes 6.6592 ms/op 3.1105 ms/op 2.14
computeDeltas 500000 validators 7200 proto nodes 6.3798 ms/op 3.4984 ms/op 1.82
computeDeltas 750000 validators 300 proto nodes 9.8516 ms/op 6.6001 ms/op 1.49
computeDeltas 750000 validators 1200 proto nodes 9.9982 ms/op 4.8991 ms/op 2.04
computeDeltas 750000 validators 7200 proto nodes 9.6058 ms/op 5.1758 ms/op 1.86
computeDeltas 1400000 validators 300 proto nodes 18.125 ms/op 9.7470 ms/op 1.86
computeDeltas 1400000 validators 1200 proto nodes 18.288 ms/op 9.3299 ms/op 1.96
computeDeltas 1400000 validators 7200 proto nodes 18.638 ms/op 10.216 ms/op 1.82
computeDeltas 2100000 validators 300 proto nodes 26.961 ms/op 15.466 ms/op 1.74
computeDeltas 2100000 validators 1200 proto nodes 27.587 ms/op 15.723 ms/op 1.75
computeDeltas 2100000 validators 7200 proto nodes 28.046 ms/op 13.890 ms/op 2.02
altair processAttestation - 250000 vs - 7PWei normalcase 2.2143 ms/op 2.2155 ms/op 1.00
altair processAttestation - 250000 vs - 7PWei worstcase 3.1760 ms/op 3.0704 ms/op 1.03
altair processAttestation - setStatus - 1/6 committees join 181.01 us/op 83.956 us/op 2.16
altair processAttestation - setStatus - 1/3 committees join 341.30 us/op 157.43 us/op 2.17
altair processAttestation - setStatus - 1/2 committees join 462.07 us/op 211.40 us/op 2.19
altair processAttestation - setStatus - 2/3 committees join 583.09 us/op 281.77 us/op 2.07
altair processAttestation - setStatus - 4/5 committees join 798.73 us/op 412.03 us/op 1.94
altair processAttestation - setStatus - 100% committees join 908.35 us/op 503.07 us/op 1.81
altair processBlock - 250000 vs - 7PWei normalcase 10.557 ms/op 6.3175 ms/op 1.67
altair processBlock - 250000 vs - 7PWei normalcase hashState 37.518 ms/op 22.300 ms/op 1.68
altair processBlock - 250000 vs - 7PWei worstcase 40.497 ms/op 31.464 ms/op 1.29
altair processBlock - 250000 vs - 7PWei worstcase hashState 93.504 ms/op 72.554 ms/op 1.29
phase0 processBlock - 250000 vs - 7PWei normalcase 2.5455 ms/op 2.0268 ms/op 1.26
phase0 processBlock - 250000 vs - 7PWei worstcase 29.509 ms/op 24.754 ms/op 1.19
altair processEth1Data - 250000 vs - 7PWei normalcase 466.00 us/op 267.29 us/op 1.74
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 16.840 us/op 12.627 us/op 1.33
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 81.440 us/op 73.823 us/op 1.10
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 22.968 us/op 36.719 us/op 0.63
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 15.730 us/op 14.905 us/op 1.06
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 207.59 us/op 194.88 us/op 1.07
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 2.3067 ms/op 1.4396 ms/op 1.60
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 3.1251 ms/op 1.1383 ms/op 2.75
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.6035 ms/op 1.2841 ms/op 2.03
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.3581 ms/op 2.4210 ms/op 1.39
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.2838 ms/op 1.9603 ms/op 1.17
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.5878 ms/op 5.2794 ms/op 0.87
Tree 40 250000 create 351.40 ms/op 305.56 ms/op 1.15
Tree 40 250000 get(125000) 192.34 ns/op 112.05 ns/op 1.72
Tree 40 250000 set(125000) 1.0244 us/op 749.21 ns/op 1.37
Tree 40 250000 toArray() 21.203 ms/op 10.410 ms/op 2.04
Tree 40 250000 iterate all - toArray() + loop 19.419 ms/op 10.994 ms/op 1.77
Tree 40 250000 iterate all - get(i) 66.277 ms/op 45.671 ms/op 1.45
MutableVector 250000 create 15.045 ms/op 8.1572 ms/op 1.84
MutableVector 250000 get(125000) 6.6430 ns/op 5.9300 ns/op 1.12
MutableVector 250000 set(125000) 268.14 ns/op 212.09 ns/op 1.26
MutableVector 250000 toArray() 3.4827 ms/op 2.4243 ms/op 1.44
MutableVector 250000 iterate all - toArray() + loop 3.4783 ms/op 2.4702 ms/op 1.41
MutableVector 250000 iterate all - get(i) 1.5547 ms/op 1.3508 ms/op 1.15
Array 250000 create 2.9068 ms/op 2.5135 ms/op 1.16
Array 250000 clone - spread 1.3069 ms/op 1.1754 ms/op 1.11
Array 250000 get(125000) 1.0830 ns/op 1.0510 ns/op 1.03
Array 250000 set(125000) 4.1410 ns/op 1.2690 ns/op 3.26
Array 250000 iterate all - loop 164.56 us/op 157.08 us/op 1.05
effectiveBalanceIncrements clone Uint8Array 300000 31.148 us/op 14.892 us/op 2.09
effectiveBalanceIncrements clone MutableVector 300000 416.00 ns/op 416.00 ns/op 1.00
effectiveBalanceIncrements rw all Uint8Array 300000 199.07 us/op 193.21 us/op 1.03
effectiveBalanceIncrements rw all MutableVector 300000 86.999 ms/op 68.297 ms/op 1.27
phase0 afterProcessEpoch - 250000 vs - 7PWei 113.16 ms/op 78.459 ms/op 1.44
phase0 beforeProcessEpoch - 250000 vs - 7PWei 53.666 ms/op 47.996 ms/op 1.12
altair processEpoch - mainnet_e81889 524.85 ms/op 424.81 ms/op 1.24
mainnet_e81889 - altair beforeProcessEpoch 82.671 ms/op 82.201 ms/op 1.01
mainnet_e81889 - altair processJustificationAndFinalization 23.821 us/op 17.292 us/op 1.38
mainnet_e81889 - altair processInactivityUpdates 5.6905 ms/op 7.6559 ms/op 0.74
mainnet_e81889 - altair processRewardsAndPenalties 80.219 ms/op 71.320 ms/op 1.12
mainnet_e81889 - altair processRegistryUpdates 2.7730 us/op 3.2120 us/op 0.86
mainnet_e81889 - altair processSlashings 1.0740 us/op 719.00 ns/op 1.49
mainnet_e81889 - altair processEth1DataReset 920.00 ns/op 912.00 ns/op 1.01
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.5728 ms/op 1.0107 ms/op 2.55
mainnet_e81889 - altair processSlashingsReset 5.7790 us/op 4.2910 us/op 1.35
mainnet_e81889 - altair processRandaoMixesReset 8.1180 us/op 7.7750 us/op 1.04
mainnet_e81889 - altair processHistoricalRootsUpdate 1.2140 us/op 1.5490 us/op 0.78
mainnet_e81889 - altair processParticipationFlagUpdates 3.3430 us/op 3.7830 us/op 0.88
mainnet_e81889 - altair processSyncCommitteeUpdates 1.2210 us/op 1.0380 us/op 1.18
mainnet_e81889 - altair afterProcessEpoch 115.90 ms/op 84.302 ms/op 1.37
capella processEpoch - mainnet_e217614 2.0538 s/op 1.7547 s/op 1.17
mainnet_e217614 - capella beforeProcessEpoch 470.38 ms/op 400.73 ms/op 1.17
mainnet_e217614 - capella processJustificationAndFinalization 20.983 us/op 14.813 us/op 1.42
mainnet_e217614 - capella processInactivityUpdates 17.494 ms/op 18.038 ms/op 0.97
mainnet_e217614 - capella processRewardsAndPenalties 576.12 ms/op 472.39 ms/op 1.22
mainnet_e217614 - capella processRegistryUpdates 25.475 us/op 19.760 us/op 1.29
mainnet_e217614 - capella processSlashings 916.00 ns/op 905.00 ns/op 1.01
mainnet_e217614 - capella processEth1DataReset 666.00 ns/op 763.00 ns/op 0.87
mainnet_e217614 - capella processEffectiveBalanceUpdates 10.385 ms/op 3.4961 ms/op 2.97
mainnet_e217614 - capella processSlashingsReset 4.6270 us/op 5.0600 us/op 0.91
mainnet_e217614 - capella processRandaoMixesReset 7.1530 us/op 10.293 us/op 0.69
mainnet_e217614 - capella processHistoricalRootsUpdate 1.0910 us/op 1.8010 us/op 0.61
mainnet_e217614 - capella processParticipationFlagUpdates 3.1560 us/op 3.5870 us/op 0.88
mainnet_e217614 - capella afterProcessEpoch 291.05 ms/op 255.60 ms/op 1.14
phase0 processEpoch - mainnet_e58758 515.61 ms/op 418.72 ms/op 1.23
mainnet_e58758 - phase0 beforeProcessEpoch 147.82 ms/op 150.48 ms/op 0.98
mainnet_e58758 - phase0 processJustificationAndFinalization 23.584 us/op 20.303 us/op 1.16
mainnet_e58758 - phase0 processRewardsAndPenalties 87.056 ms/op 59.463 ms/op 1.46
mainnet_e58758 - phase0 processRegistryUpdates 15.285 us/op 16.353 us/op 0.93
mainnet_e58758 - phase0 processSlashings 921.00 ns/op 1.5130 us/op 0.61
mainnet_e58758 - phase0 processEth1DataReset 661.00 ns/op 1.0980 us/op 0.60
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.1114 ms/op 852.03 us/op 2.48
mainnet_e58758 - phase0 processSlashingsReset 4.0630 us/op 5.6390 us/op 0.72
mainnet_e58758 - phase0 processRandaoMixesReset 6.1940 us/op 6.3080 us/op 0.98
mainnet_e58758 - phase0 processHistoricalRootsUpdate 627.00 ns/op 896.00 ns/op 0.70
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.9210 us/op 6.7160 us/op 0.73
mainnet_e58758 - phase0 afterProcessEpoch 99.064 ms/op 77.956 ms/op 1.27
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.5092 ms/op 1.2044 ms/op 2.08
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.6976 ms/op 1.4283 ms/op 1.89
altair processInactivityUpdates - 250000 normalcase 30.923 ms/op 24.027 ms/op 1.29
altair processInactivityUpdates - 250000 worstcase 29.853 ms/op 23.178 ms/op 1.29
phase0 processRegistryUpdates - 250000 normalcase 9.8040 us/op 10.909 us/op 0.90
phase0 processRegistryUpdates - 250000 badcase_full_deposits 609.56 us/op 415.20 us/op 1.47
phase0 processRegistryUpdates - 250000 worstcase 0.5 132.64 ms/op 156.43 ms/op 0.85
altair processRewardsAndPenalties - 250000 normalcase 89.469 ms/op 66.082 ms/op 1.35
altair processRewardsAndPenalties - 250000 worstcase 96.762 ms/op 63.756 ms/op 1.52
phase0 getAttestationDeltas - 250000 normalcase 8.9802 ms/op 6.3809 ms/op 1.41
phase0 getAttestationDeltas - 250000 worstcase 8.7737 ms/op 6.6646 ms/op 1.32
phase0 processSlashings - 250000 worstcase 79.467 us/op 93.148 us/op 0.85
altair processSyncCommitteeUpdates - 250000 148.27 ms/op 127.82 ms/op 1.16
BeaconState.hashTreeRoot - No change 326.00 ns/op 518.00 ns/op 0.63
BeaconState.hashTreeRoot - 1 full validator 166.78 us/op 145.51 us/op 1.15
BeaconState.hashTreeRoot - 32 full validator 1.7596 ms/op 1.1501 ms/op 1.53
BeaconState.hashTreeRoot - 512 full validator 19.005 ms/op 15.530 ms/op 1.22
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 202.10 us/op 191.25 us/op 1.06
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.2825 ms/op 2.7004 ms/op 0.85
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 24.467 ms/op 30.894 ms/op 0.79
BeaconState.hashTreeRoot - 1 balances 129.66 us/op 118.92 us/op 1.09
BeaconState.hashTreeRoot - 32 balances 1.3036 ms/op 1.2146 ms/op 1.07
BeaconState.hashTreeRoot - 512 balances 13.388 ms/op 10.257 ms/op 1.31
BeaconState.hashTreeRoot - 250000 balances 227.09 ms/op 200.83 ms/op 1.13
aggregationBits - 2048 els - zipIndexesInBitList 27.308 us/op 35.046 us/op 0.78
byteArrayEquals 32 73.538 ns/op 63.819 ns/op 1.15
Buffer.compare 32 54.345 ns/op 35.856 ns/op 1.52
byteArrayEquals 1024 2.0059 us/op 1.7002 us/op 1.18
Buffer.compare 1024 70.335 ns/op 41.999 ns/op 1.67
byteArrayEquals 16384 31.933 us/op 28.292 us/op 1.13
Buffer.compare 16384 259.11 ns/op 232.11 ns/op 1.12
byteArrayEquals 123687377 243.46 ms/op 224.81 ms/op 1.08
Buffer.compare 123687377 7.4884 ms/op 8.7294 ms/op 0.86
byteArrayEquals 32 - diff last byte 75.294 ns/op 68.583 ns/op 1.10
Buffer.compare 32 - diff last byte 57.194 ns/op 39.341 ns/op 1.45
byteArrayEquals 1024 - diff last byte 2.0579 us/op 1.8568 us/op 1.11
Buffer.compare 1024 - diff last byte 72.209 ns/op 52.943 ns/op 1.36
byteArrayEquals 16384 - diff last byte 33.067 us/op 30.189 us/op 1.10
Buffer.compare 16384 - diff last byte 271.99 ns/op 274.83 ns/op 0.99
byteArrayEquals 123687377 - diff last byte 246.97 ms/op 221.99 ms/op 1.11
Buffer.compare 123687377 - diff last byte 6.4208 ms/op 6.7136 ms/op 0.96
byteArrayEquals 32 - random bytes 5.2870 ns/op 5.3530 ns/op 0.99
Buffer.compare 32 - random bytes 65.842 ns/op 40.204 ns/op 1.64
byteArrayEquals 1024 - random bytes 5.1930 ns/op 4.6690 ns/op 1.11
Buffer.compare 1024 - random bytes 66.241 ns/op 38.741 ns/op 1.71
byteArrayEquals 16384 - random bytes 5.2860 ns/op 4.6490 ns/op 1.14
Buffer.compare 16384 - random bytes 66.259 ns/op 38.482 ns/op 1.72
byteArrayEquals 123687377 - random bytes 8.5300 ns/op 9.0000 ns/op 0.95
Buffer.compare 123687377 - random bytes 70.300 ns/op 51.960 ns/op 1.35
regular array get 100000 times 45.017 us/op 42.413 us/op 1.06
wrappedArray get 100000 times 45.487 us/op 42.764 us/op 1.06
arrayWithProxy get 100000 times 14.619 ms/op 10.323 ms/op 1.42
ssz.Root.equals 54.676 ns/op 58.308 ns/op 0.94
byteArrayEquals 53.616 ns/op 56.407 ns/op 0.95
Buffer.compare 11.137 ns/op 10.780 ns/op 1.03
shuffle list - 16384 els 8.6017 ms/op 6.1566 ms/op 1.40
shuffle list - 250000 els 125.65 ms/op 87.934 ms/op 1.43
processSlot - 1 slots 17.886 us/op 16.790 us/op 1.07
processSlot - 32 slots 3.5943 ms/op 3.7095 ms/op 0.97
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 59.249 ms/op 48.104 ms/op 1.23
getCommitteeAssignments - req 1 vs - 250000 vc 2.5561 ms/op 2.6359 ms/op 0.97
getCommitteeAssignments - req 100 vs - 250000 vc 3.8301 ms/op 3.8072 ms/op 1.01
getCommitteeAssignments - req 1000 vs - 250000 vc 4.1013 ms/op 4.0351 ms/op 1.02
findModifiedValidators - 10000 modified validators 361.29 ms/op 368.42 ms/op 0.98
findModifiedValidators - 1000 modified validators 192.42 ms/op 209.73 ms/op 0.92
findModifiedValidators - 100 modified validators 184.93 ms/op 165.71 ms/op 1.12
findModifiedValidators - 10 modified validators 182.90 ms/op 175.08 ms/op 1.04
findModifiedValidators - 1 modified validators 185.33 ms/op 179.04 ms/op 1.04
findModifiedValidators - no difference 185.48 ms/op 178.58 ms/op 1.04
compare ViewDUs 5.0363 s/op 5.0275 s/op 1.00
compare each validator Uint8Array 1.9369 s/op 2.0015 s/op 0.97
compare ViewDU to Uint8Array 1.0715 s/op 1.0738 s/op 1.00
migrate state 1000000 validators, 24 modified, 0 new 861.00 ms/op 601.54 ms/op 1.43
migrate state 1000000 validators, 1700 modified, 1000 new 1.1638 s/op 932.65 ms/op 1.25
migrate state 1000000 validators, 3400 modified, 2000 new 1.4094 s/op 1.1347 s/op 1.24
migrate state 1500000 validators, 24 modified, 0 new 874.94 ms/op 786.47 ms/op 1.11
migrate state 1500000 validators, 1700 modified, 1000 new 1.1656 s/op 1.0046 s/op 1.16
migrate state 1500000 validators, 3400 modified, 2000 new 1.3901 s/op 1.4112 s/op 0.99
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.2300 ns/op 5.5400 ns/op 0.76
state getBlockRootAtSlot - 250000 vs - 7PWei 783.37 ns/op 735.90 ns/op 1.06
computeProposers - vc 250000 8.5537 ms/op 7.1872 ms/op 1.19
computeEpochShuffling - vc 250000 122.78 ms/op 100.04 ms/op 1.23
getNextSyncCommittee - vc 250000 149.03 ms/op 141.91 ms/op 1.05
computeSigningRoot for AttestationData 27.200 us/op 29.111 us/op 0.93
hash AttestationData serialized data then Buffer.toString(base64) 2.2578 us/op 1.4803 us/op 1.53
toHexString serialized data 1.0557 us/op 952.16 ns/op 1.11
Buffer.toString(base64) 212.58 ns/op 212.36 ns/op 1.00

by benchmarkbot/action

@twoeths twoeths merged commit b107d4b into unstable Apr 23, 2024
19 of 20 checks passed
@twoeths twoeths deleted the tuyen/block_state_cache branch April 23, 2024 01:18
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.18.0 🎉

nflaig added a commit that referenced this pull request Apr 27, 2024
wemeetagain added a commit that referenced this pull request Jun 10, 2024
* Add config route definitions

* Add debug route definitions

* Add events route description

* Add lightclient route definitions

* Flatten function params

* Type safety for optional params in write / parse req

* Method args are optional if only optional props

* Fix genesisValidatorsRoot type issue

* Revert requiring all params in write / parse req

* Update http client errors

* Add lodestar route definitions

* Add node route definitions

* Add proof route definitions

* Add builder route definitions

* Add validator route definitions

* Application method response can be void

* Generic options can be passed to application methods

* Default endpoint request type has body property

* Improve types of transform methods

* Export server types from index (to be removed)

* Update config api impl

* Update lightclient api impl

* Update events api impl

* Update lodestar api impl

* Update proof api impl

* Update node api impl

* Update debug api impl

* Update state api impl

* Update pool api impl

* Update blocks api impl

* Partially update validator api impl

* Update beacon routes export

* Align submitPoolBlsToExecutionChange method args

* Filters are always a object

* Update errors messages

* Add beacon client methods

* Add missing routeId label to stream time metric

* Fix json casing in codecs

* Apply remaining changes from #6227

* Produce block apis only have version meta

* Add block values meta to all produce block apis

* Apply changes from #6337

* Handle unsafe version in WithMeta and WithVersion

* Restore server api error

* Update fastify route types

* Update server routes / handlers

* Remove unnecessary type cast

* Restore per route clients

* Fix beacon route types

* Remove option to patch fetch from http client

* Update eventstream client, remove fetch override

Fallback does not work like this, see #6180 for proper solution

* Use StringType for validator status until #6059

* Remove empty fetch.ts file

* Add a few todos

* Update builder client and server routes

* Update beacon exports

* Update api index exports

* Update builder index imports

* Improve type safety of schema definitions

* Add headers to fastify schema

* Fix schema definition type

* Add missing schemas to route definitions

* Fix response codec type

* Remove response codec type casts

* Fix casing in json only codec

* Reuse EmptyResponseCodec

* Update base rest api server

* Update keymanager routes, client and server

* Reuse data types in keymanager impl

* Do not await setting headers, not a promise

* Improve type safety of empty codecs

* Only require to implement supported req methods

* Handle requests that only support one format

* Handle responses that only support one format

* Add json / ssz only req codecs

* Update only support errors

* Fix assertion

* Set correct accept header if only supports one format

* Fix eslint / prettier issues

* More formatting fixes

* Fix fallback request retries in case of http errors

* Formatting of res.error

* Add add retry functionality to http client (from #6387)

* Update rewards routes and server (#6178 and #6260)

* Allow to omit body in ssz req if not defined

* Always set metadata headers in response

* Cache wire format in api response

* Only call raw body for json meta

* Update api package tests (wip)

* Test json and ssz format in generic server tests

* Add a bunch of todos

* Fix a few broken route definitions

* Fix partial config test

* Another todo note

* Stringify body of json requests

* Override default response json method

* Validate external consensus version headers in request

* Add error handling todo

* Skip body schema validation for ssz request bodies

* Clean up generic server tests

* Pass node, proof, events generic tests

* Use enum for media types

* Fix a bunch of route definitions

* Add justified to blockid type

* Properly handle booleans, remove block values codec

* Create Uint8Array test data without allocating Buffer

* Let fastify handle Buffer conversion

* Convert Buffer to Uint8Array in content type parser

* Fix build issues

* Fix fork type in builder routes

* Add some notes

* Properly parse request headers

* Fix incorrect type assumptions in transform

* Generic server tests are passing (except lightclient)

* Correctly handle APIs with empty responses

* Update getHeader return type to reflect no bid responses

* Do not append '?' to URL if query string is empty

* Let server handler set status code for parsing errors

* Remove unused import

* Rename function, request specific

* Completely drop ssz support from getSpec

* Spec tests are passing against latest releases

* Drop unused fastify route config

* Drop ssz request from builder routes, not yet supported

* Remove import

* Apply change from #6695

* Update execution optimistic meta

* Apply changes from #6645

* Add workaround to fix epoch committees type issue

* Add todo to fix inefficient state conversion

* Convert committee to normal array

* Apply changes from #6655

* Align args of validators endpoints

* Convert indices to str in rewards apis

* Update api spec version of README badges

* Revert table formatting changes

* Make this accessible for class-basd API implementations

* Throw err if metadata is accessed for failed response

* Add assertOk to api response

* Tweak api error message

* Update operationIds match spec value

* Add missing version to blob sidecars metadata

* Test headers and ssz bodies against spec

* Minor reordering of code in spec parsing

* submitBlindedBlock throws err if fork is not execution

* responseOk might be undefined

* Remove statusOk from route definition

* Remove stale comment

* Less build errors in beacon-node

* getBlobSidecars return version from server impl

* Update validator produce block impl

* More expressive pool method args

* Application methods might be undefined in mock implementations

* Adress open TODOs in server handler

* Api response methods are synchronous now

* Fix all remaining build issues

* Use more performant from/toHex in server api impls

* Clean up some TODOs

* Fix ApiError type

* Errors related to parsing return a 400 status code

* Simplify method binding

* Forward api context to application methods

* There is no easy way to make generic opts typesafe

* Better separation of server / client code

* Fix comment about missing builder bid

* Remove todo, not worth the change / extra indentation

* Rename route definitions functions

* Return 400 if data passed to keymanager is invalid

* Properly handle response metadata headers

* Fix lint issues

* Add header jsdoc

* Move metadata related code into separate file

* Remove ssz from POST requests without body

* Only set content-type header if body exists

* Fix headers extra

* POST requests without body are handled similar to GET requests

* Fix http client options tests

* Improve validation and type safety of JSON metadata

* Add type guard for request without body

* Differentiate based on body instead of GET vs POST

* More renaming

* Simplify RequestCode type

* Review routes, improve validation

* Remaining local diff

* Fix accept header handling if only support one wire format

* Update 406 error to more closely match spec example

* Enforce version header via custom check instead of schema

* Use ssz as default request wire format

* Log failure to receive head event to verbose

* Do not set default value for context

* Update getClient return type to better align with method name

* Consistent pattern to get route definitions

* Dedupe api client type for builder and keymanager

* Fix fallback logic if server returns http error

* Update head event error logging

* Retry 415 errors with JSON and cache SSZ not supported

* Use fetch spy to assert call times

* Update comment

* Update getLightClientUpdatesByRange endpoint meta

* Do not forward ssz bytes of blinded block to publishBlock

* Fix lightclient e2e tests

* Version header in publishBlock api is optional

* Reduce type duplication

* Add option to override request init in route definition

* Add JsonOnlyResp codec

* Validate boolean str value from headers

* Document default wire formats

* Simplify merging of inits in http client

* Remove type hacks from fetchBeaconHealth

* Reduce call stack in http client

* Add .ssz() equivalent method for json to api response

* More http client tests

* Ensure topics query is provided to eventstream api

* Validate request content type in handler

Fastify does not cover all edge cases

* Review routes, fix param docs, no empty comments

* Fix typo

* Add note about builder spec not supporting ssz

* Consistently move keymanager jsdoc to routes

* Sanitize user provided init values before merging

* Remove unused ssz only codec

* Allow passing wire formats as string literals

* chore: review proof routes (#6843)

Review proof routes

* chore: review lightclient routes (#6842)

Review lightclient routes

* chore: review node routes (#6844)

Review node routes

* feat: add cli flags to configure http wire format (#6840)

* Review PR, mostly cosmetic changes

* Fix event stream error handling

---------

Co-authored-by: Cayman <caymannava@gmail.com>
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.

2 participants