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

feat: add finalized metadata field to HTTP API responses #6645

Merged
merged 7 commits into from
Apr 11, 2024

Conversation

nflaig
Copy link
Member

@nflaig nflaig commented Apr 5, 2024

Motivation

Description

Add finalized metadata field to HTTP API responses

Closes #5693

@nflaig nflaig changed the title feat: add finalized metadata field to HTTP API responses feat: add finalized metadata field to HTTP API responses Apr 5, 2024
@nflaig nflaig added this to the v1.18.0 milestone Apr 5, 2024
Copy link

codecov bot commented Apr 5, 2024

Codecov Report

Merging #6645 (2b0025a) into unstable (7fadd30) will increase coverage by 0.08%.
The diff coverage is 100.00%.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #6645      +/-   ##
============================================
+ Coverage     61.69%   61.77%   +0.08%     
============================================
  Files           556      556              
  Lines         58820    58946     +126     
  Branches       1887     1889       +2     
============================================
+ Hits          36287    36413     +126     
  Misses        22492    22492              
  Partials         41       41              

Copy link
Contributor

github-actions bot commented Apr 5, 2024

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 3b66da6 Previous: 7fadd30 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 987.28 us/op 925.85 us/op 1.07
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 53.914 us/op 50.330 us/op 1.07
BLS verify - blst-native 1.1303 ms/op 1.1226 ms/op 1.01
BLS verifyMultipleSignatures 3 - blst-native 2.4105 ms/op 2.3994 ms/op 1.00
BLS verifyMultipleSignatures 8 - blst-native 5.3164 ms/op 5.3047 ms/op 1.00
BLS verifyMultipleSignatures 32 - blst-native 19.580 ms/op 19.490 ms/op 1.00
BLS verifyMultipleSignatures 64 - blst-native 38.234 ms/op 38.374 ms/op 1.00
BLS verifyMultipleSignatures 128 - blst-native 76.593 ms/op 76.155 ms/op 1.01
BLS deserializing 10000 signatures 789.56 ms/op 816.15 ms/op 0.97
BLS deserializing 100000 signatures 8.3095 s/op 8.2644 s/op 1.01
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.1315 ms/op 1.0904 ms/op 1.04
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.2991 ms/op 1.2893 ms/op 1.01
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.0396 ms/op 1.9943 ms/op 1.02
BLS verifyMultipleSignatures - same message - 64 - blst-native 3.9787 ms/op 3.9604 ms/op 1.00
BLS verifyMultipleSignatures - same message - 128 - blst-native 4.9953 ms/op 4.8839 ms/op 1.02
BLS aggregatePubkeys 32 - blst-native 22.517 us/op 22.229 us/op 1.01
BLS aggregatePubkeys 128 - blst-native 89.176 us/op 89.085 us/op 1.00
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 54.547 ms/op 52.286 ms/op 1.04
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 52.677 ms/op 44.753 ms/op 1.18
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 27.644 ms/op 26.760 ms/op 1.03
getSlashingsAndExits - default max 120.19 us/op 174.17 us/op 0.69
getSlashingsAndExits - 2k 353.19 us/op 380.10 us/op 0.93
proposeBlockBody type=full, size=empty 4.6003 ms/op 4.0564 ms/op 1.13
isKnown best case - 1 super set check 342.00 ns/op 370.00 ns/op 0.92
isKnown normal case - 2 super set checks 337.00 ns/op 338.00 ns/op 1.00
isKnown worse case - 16 super set checks 340.00 ns/op 360.00 ns/op 0.94
InMemoryCheckpointStateCache - add get delete 4.0680 us/op 4.7540 us/op 0.86
validate api signedAggregateAndProof - struct 2.5846 ms/op 2.4232 ms/op 1.07
validate gossip signedAggregateAndProof - struct 2.5029 ms/op 2.5795 ms/op 0.97
validate gossip attestation - vc 640000 1.1607 ms/op 1.1450 ms/op 1.01
batch validate gossip attestation - vc 640000 - chunk 32 145.54 us/op 140.25 us/op 1.04
batch validate gossip attestation - vc 640000 - chunk 64 124.84 us/op 118.38 us/op 1.05
batch validate gossip attestation - vc 640000 - chunk 128 120.10 us/op 118.60 us/op 1.01
batch validate gossip attestation - vc 640000 - chunk 256 113.97 us/op 118.04 us/op 0.97
pickEth1Vote - no votes 846.49 us/op 863.93 us/op 0.98
pickEth1Vote - max votes 5.2871 ms/op 11.179 ms/op 0.47
pickEth1Vote - Eth1Data hashTreeRoot value x2048 11.600 ms/op 14.471 ms/op 0.80
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 15.628 ms/op 21.075 ms/op 0.74
pickEth1Vote - Eth1Data fastSerialize value x2048 434.67 us/op 464.66 us/op 0.94
pickEth1Vote - Eth1Data fastSerialize tree x2048 3.2064 ms/op 5.7448 ms/op 0.56
bytes32 toHexString 452.00 ns/op 438.00 ns/op 1.03
bytes32 Buffer.toString(hex) 309.00 ns/op 305.00 ns/op 1.01
bytes32 Buffer.toString(hex) from Uint8Array 411.00 ns/op 417.00 ns/op 0.99
bytes32 Buffer.toString(hex) + 0x 320.00 ns/op 319.00 ns/op 1.00
Object access 1 prop 0.20900 ns/op 0.19900 ns/op 1.05
Map access 1 prop 0.19600 ns/op 0.19100 ns/op 1.03
Object get x1000 5.5300 ns/op 5.2140 ns/op 1.06
Map get x1000 0.74200 ns/op 0.72400 ns/op 1.02
Object set x1000 25.220 ns/op 28.128 ns/op 0.90
Map set x1000 18.430 ns/op 17.009 ns/op 1.08
Return object 10000 times 0.23280 ns/op 0.22920 ns/op 1.02
Throw Error 10000 times 2.7356 us/op 2.7430 us/op 1.00
fastMsgIdFn sha256 / 200 bytes 1.9500 us/op 1.9620 us/op 0.99
fastMsgIdFn h32 xxhash / 200 bytes 300.00 ns/op 294.00 ns/op 1.02
fastMsgIdFn h64 xxhash / 200 bytes 366.00 ns/op 351.00 ns/op 1.04
fastMsgIdFn sha256 / 1000 bytes 6.2310 us/op 6.2030 us/op 1.00
fastMsgIdFn h32 xxhash / 1000 bytes 418.00 ns/op 414.00 ns/op 1.01
fastMsgIdFn h64 xxhash / 1000 bytes 447.00 ns/op 414.00 ns/op 1.08
fastMsgIdFn sha256 / 10000 bytes 52.837 us/op 52.763 us/op 1.00
fastMsgIdFn h32 xxhash / 10000 bytes 1.8400 us/op 1.8020 us/op 1.02
fastMsgIdFn h64 xxhash / 10000 bytes 1.2850 us/op 1.2430 us/op 1.03
send data - 1000 256B messages 12.626 ms/op 10.269 ms/op 1.23
send data - 1000 512B messages 15.718 ms/op 15.500 ms/op 1.01
send data - 1000 1024B messages 26.390 ms/op 27.837 ms/op 0.95
send data - 1000 1200B messages 29.610 ms/op 29.038 ms/op 1.02
send data - 1000 2048B messages 44.772 ms/op 33.999 ms/op 1.32
send data - 1000 4096B messages 35.768 ms/op 30.243 ms/op 1.18
send data - 1000 16384B messages 96.634 ms/op 78.496 ms/op 1.23
send data - 1000 65536B messages 412.73 ms/op 347.06 ms/op 1.19
enrSubnets - fastDeserialize 64 bits 1.0730 us/op 982.00 ns/op 1.09
enrSubnets - ssz BitVector 64 bits 452.00 ns/op 435.00 ns/op 1.04
enrSubnets - fastDeserialize 4 bits 230.00 ns/op 195.00 ns/op 1.18
enrSubnets - ssz BitVector 4 bits 443.00 ns/op 441.00 ns/op 1.00
prioritizePeers score -10:0 att 32-0.1 sync 2-0 83.201 us/op 65.656 us/op 1.27
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 108.47 us/op 77.598 us/op 1.40
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 127.69 us/op 106.03 us/op 1.20
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 220.47 us/op 179.67 us/op 1.23
prioritizePeers score 0:0 att 64-1 sync 4-1 213.97 us/op 200.01 us/op 1.07
array of 16000 items push then shift 1.3420 us/op 1.2263 us/op 1.09
LinkedList of 16000 items push then shift 6.0410 ns/op 6.8970 ns/op 0.88
array of 16000 items push then pop 81.831 ns/op 61.653 ns/op 1.33
LinkedList of 16000 items push then pop 5.7300 ns/op 5.8980 ns/op 0.97
array of 24000 items push then shift 1.9456 us/op 1.8969 us/op 1.03
LinkedList of 24000 items push then shift 6.1740 ns/op 6.8560 ns/op 0.90
array of 24000 items push then pop 112.62 ns/op 99.319 ns/op 1.13
LinkedList of 24000 items push then pop 5.8610 ns/op 5.6050 ns/op 1.05
intersect bitArray bitLen 8 4.6300 ns/op 4.4820 ns/op 1.03
intersect array and set length 8 49.051 ns/op 46.663 ns/op 1.05
intersect bitArray bitLen 128 28.533 ns/op 27.963 ns/op 1.02
intersect array and set length 128 710.47 ns/op 650.74 ns/op 1.09
bitArray.getTrueBitIndexes() bitLen 128 1.4100 us/op 1.2530 us/op 1.13
bitArray.getTrueBitIndexes() bitLen 248 2.5700 us/op 1.9610 us/op 1.31
bitArray.getTrueBitIndexes() bitLen 512 5.0420 us/op 3.8120 us/op 1.32
Buffer.concat 32 items 952.00 ns/op 797.00 ns/op 1.19
Uint8Array.set 32 items 2.1360 us/op 1.6150 us/op 1.32
Set add up to 64 items then delete first 2.0128 us/op 1.6697 us/op 1.21
OrderedSet add up to 64 items then delete first 3.8585 us/op 2.6254 us/op 1.47
Set add up to 64 items then delete last 2.2933 us/op 1.9181 us/op 1.20
OrderedSet add up to 64 items then delete last 3.0550 us/op 2.9494 us/op 1.04
Set add up to 64 items then delete middle 2.0358 us/op 1.9738 us/op 1.03
OrderedSet add up to 64 items then delete middle 4.3853 us/op 4.1826 us/op 1.05
Set add up to 128 items then delete first 4.4008 us/op 3.9033 us/op 1.13
OrderedSet add up to 128 items then delete first 6.5301 us/op 6.1340 us/op 1.06
Set add up to 128 items then delete last 4.0131 us/op 3.7808 us/op 1.06
OrderedSet add up to 128 items then delete last 5.9632 us/op 5.6735 us/op 1.05
Set add up to 128 items then delete middle 3.9354 us/op 3.7714 us/op 1.04
OrderedSet add up to 128 items then delete middle 11.078 us/op 10.721 us/op 1.03
Set add up to 256 items then delete first 7.8877 us/op 7.6476 us/op 1.03
OrderedSet add up to 256 items then delete first 12.367 us/op 12.135 us/op 1.02
Set add up to 256 items then delete last 7.5921 us/op 7.4161 us/op 1.02
OrderedSet add up to 256 items then delete last 11.737 us/op 11.242 us/op 1.04
Set add up to 256 items then delete middle 7.8018 us/op 7.4321 us/op 1.05
OrderedSet add up to 256 items then delete middle 35.063 us/op 30.418 us/op 1.15
transfer serialized Status (84 B) 1.6470 us/op 1.4860 us/op 1.11
copy serialized Status (84 B) 1.2150 us/op 1.2440 us/op 0.98
transfer serialized SignedVoluntaryExit (112 B) 1.8180 us/op 1.6500 us/op 1.10
copy serialized SignedVoluntaryExit (112 B) 1.3090 us/op 1.3310 us/op 0.98
transfer serialized ProposerSlashing (416 B) 1.8670 us/op 2.6960 us/op 0.69
copy serialized ProposerSlashing (416 B) 2.2740 us/op 2.5860 us/op 0.88
transfer serialized Attestation (485 B) 2.9970 us/op 2.7710 us/op 1.08
copy serialized Attestation (485 B) 2.8520 us/op 2.8090 us/op 1.02
transfer serialized AttesterSlashing (33232 B) 2.8300 us/op 2.6880 us/op 1.05
copy serialized AttesterSlashing (33232 B) 6.1270 us/op 5.2190 us/op 1.17
transfer serialized Small SignedBeaconBlock (128000 B) 2.4610 us/op 2.9530 us/op 0.83
copy serialized Small SignedBeaconBlock (128000 B) 10.378 us/op 9.9520 us/op 1.04
transfer serialized Avg SignedBeaconBlock (200000 B) 2.0800 us/op 2.7490 us/op 0.76
copy serialized Avg SignedBeaconBlock (200000 B) 34.175 us/op 13.504 us/op 2.53
transfer serialized BlobsSidecar (524380 B) 3.0810 us/op 2.7270 us/op 1.13
copy serialized BlobsSidecar (524380 B) 167.26 us/op 111.52 us/op 1.50
transfer serialized Big SignedBeaconBlock (1000000 B) 3.7040 us/op 2.9680 us/op 1.25
copy serialized Big SignedBeaconBlock (1000000 B) 288.89 us/op 133.27 us/op 2.17
pass gossip attestations to forkchoice per slot 2.9358 ms/op 2.7096 ms/op 1.08
forkChoice updateHead vc 100000 bc 64 eq 0 464.38 us/op 448.64 us/op 1.04
forkChoice updateHead vc 600000 bc 64 eq 0 3.0143 ms/op 3.7080 ms/op 0.81
forkChoice updateHead vc 1000000 bc 64 eq 0 5.8684 ms/op 4.5157 ms/op 1.30
forkChoice updateHead vc 600000 bc 320 eq 0 2.8479 ms/op 2.5620 ms/op 1.11
forkChoice updateHead vc 600000 bc 1200 eq 0 3.0090 ms/op 2.7794 ms/op 1.08
forkChoice updateHead vc 600000 bc 7200 eq 0 3.9413 ms/op 3.4175 ms/op 1.15
forkChoice updateHead vc 600000 bc 64 eq 1000 9.8208 ms/op 9.5058 ms/op 1.03
forkChoice updateHead vc 600000 bc 64 eq 10000 9.8216 ms/op 9.5965 ms/op 1.02
forkChoice updateHead vc 600000 bc 64 eq 300000 13.571 ms/op 12.245 ms/op 1.11
computeDeltas 500000 validators 300 proto nodes 3.1607 ms/op 3.0841 ms/op 1.02
computeDeltas 500000 validators 1200 proto nodes 3.2398 ms/op 2.9818 ms/op 1.09
computeDeltas 500000 validators 7200 proto nodes 3.4581 ms/op 2.9586 ms/op 1.17
computeDeltas 750000 validators 300 proto nodes 5.3042 ms/op 4.5324 ms/op 1.17
computeDeltas 750000 validators 1200 proto nodes 5.0774 ms/op 4.4422 ms/op 1.14
computeDeltas 750000 validators 7200 proto nodes 4.9838 ms/op 4.4418 ms/op 1.12
computeDeltas 1400000 validators 300 proto nodes 9.6741 ms/op 8.8217 ms/op 1.10
computeDeltas 1400000 validators 1200 proto nodes 9.9983 ms/op 9.0205 ms/op 1.11
computeDeltas 1400000 validators 7200 proto nodes 9.8153 ms/op 9.4098 ms/op 1.04
computeDeltas 2100000 validators 300 proto nodes 14.752 ms/op 14.686 ms/op 1.00
computeDeltas 2100000 validators 1200 proto nodes 14.217 ms/op 14.383 ms/op 0.99
computeDeltas 2100000 validators 7200 proto nodes 14.665 ms/op 15.156 ms/op 0.97
altair processAttestation - 250000 vs - 7PWei normalcase 1.4590 ms/op 1.5708 ms/op 0.93
altair processAttestation - 250000 vs - 7PWei worstcase 2.3794 ms/op 3.5013 ms/op 0.68
altair processAttestation - setStatus - 1/6 committees join 84.287 us/op 112.04 us/op 0.75
altair processAttestation - setStatus - 1/3 committees join 172.95 us/op 207.31 us/op 0.83
altair processAttestation - setStatus - 1/2 committees join 229.80 us/op 301.42 us/op 0.76
altair processAttestation - setStatus - 2/3 committees join 291.65 us/op 394.64 us/op 0.74
altair processAttestation - setStatus - 4/5 committees join 420.68 us/op 520.11 us/op 0.81
altair processAttestation - setStatus - 100% committees join 508.88 us/op 607.16 us/op 0.84
altair processBlock - 250000 vs - 7PWei normalcase 7.6550 ms/op 7.2426 ms/op 1.06
altair processBlock - 250000 vs - 7PWei normalcase hashState 30.608 ms/op 30.408 ms/op 1.01
altair processBlock - 250000 vs - 7PWei worstcase 37.073 ms/op 34.692 ms/op 1.07
altair processBlock - 250000 vs - 7PWei worstcase hashState 87.699 ms/op 90.556 ms/op 0.97
phase0 processBlock - 250000 vs - 7PWei normalcase 2.7119 ms/op 1.9789 ms/op 1.37
phase0 processBlock - 250000 vs - 7PWei worstcase 28.156 ms/op 24.830 ms/op 1.13
altair processEth1Data - 250000 vs - 7PWei normalcase 414.04 us/op 293.98 us/op 1.41
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 15.285 us/op 11.636 us/op 1.31
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 71.150 us/op 60.537 us/op 1.18
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 19.002 us/op 12.685 us/op 1.50
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 11.179 us/op 6.7480 us/op 1.66
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 167.18 us/op 136.00 us/op 1.23
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.0072 ms/op 1.1038 ms/op 0.91
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.5115 ms/op 965.37 us/op 1.57
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.4119 ms/op 1.2148 ms/op 1.16
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.4817 ms/op 2.6321 ms/op 1.32
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.1418 ms/op 1.9259 ms/op 1.11
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.2748 ms/op 4.6898 ms/op 0.91
Tree 40 250000 create 262.84 ms/op 270.32 ms/op 0.97
Tree 40 250000 get(125000) 123.37 ns/op 122.38 ns/op 1.01
Tree 40 250000 set(125000) 792.71 ns/op 723.56 ns/op 1.10
Tree 40 250000 toArray() 16.476 ms/op 10.374 ms/op 1.59
Tree 40 250000 iterate all - toArray() + loop 20.689 ms/op 10.702 ms/op 1.93
Tree 40 250000 iterate all - get(i) 50.838 ms/op 45.113 ms/op 1.13
MutableVector 250000 create 8.6132 ms/op 12.905 ms/op 0.67
MutableVector 250000 get(125000) 5.9130 ns/op 5.6150 ns/op 1.05
MutableVector 250000 set(125000) 217.52 ns/op 203.66 ns/op 1.07
MutableVector 250000 toArray() 2.2447 ms/op 2.5493 ms/op 0.88
MutableVector 250000 iterate all - toArray() + loop 2.4360 ms/op 2.6298 ms/op 0.93
MutableVector 250000 iterate all - get(i) 1.3880 ms/op 1.3261 ms/op 1.05
Array 250000 create 2.2785 ms/op 2.3060 ms/op 0.99
Array 250000 clone - spread 1.2910 ms/op 1.0626 ms/op 1.21
Array 250000 get(125000) 1.1220 ns/op 0.98900 ns/op 1.13
Array 250000 set(125000) 1.3230 ns/op 1.2070 ns/op 1.10
Array 250000 iterate all - loop 158.68 us/op 148.01 us/op 1.07
effectiveBalanceIncrements clone Uint8Array 300000 15.980 us/op 19.767 us/op 0.81
effectiveBalanceIncrements clone MutableVector 300000 472.00 ns/op 397.00 ns/op 1.19
effectiveBalanceIncrements rw all Uint8Array 300000 199.22 us/op 179.31 us/op 1.11
effectiveBalanceIncrements rw all MutableVector 300000 69.910 ms/op 65.687 ms/op 1.06
phase0 afterProcessEpoch - 250000 vs - 7PWei 78.373 ms/op 75.189 ms/op 1.04
phase0 beforeProcessEpoch - 250000 vs - 7PWei 33.802 ms/op 44.402 ms/op 0.76
altair processEpoch - mainnet_e81889 411.13 ms/op 425.17 ms/op 0.97
mainnet_e81889 - altair beforeProcessEpoch 77.938 ms/op 68.924 ms/op 1.13
mainnet_e81889 - altair processJustificationAndFinalization 20.928 us/op 6.5150 us/op 3.21
mainnet_e81889 - altair processInactivityUpdates 6.2005 ms/op 5.4041 ms/op 1.15
mainnet_e81889 - altair processRewardsAndPenalties 62.926 ms/op 74.232 ms/op 0.85
mainnet_e81889 - altair processRegistryUpdates 2.5290 us/op 2.0920 us/op 1.21
mainnet_e81889 - altair processSlashings 792.00 ns/op 589.00 ns/op 1.34
mainnet_e81889 - altair processEth1DataReset 878.00 ns/op 689.00 ns/op 1.27
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.3352 ms/op 1.6603 ms/op 0.80
mainnet_e81889 - altair processSlashingsReset 5.8730 us/op 2.6390 us/op 2.23
mainnet_e81889 - altair processRandaoMixesReset 6.9550 us/op 3.2420 us/op 2.15
mainnet_e81889 - altair processHistoricalRootsUpdate 1.1750 us/op 704.00 ns/op 1.67
mainnet_e81889 - altair processParticipationFlagUpdates 2.4120 us/op 1.0710 us/op 2.25
mainnet_e81889 - altair processSyncCommitteeUpdates 1.0060 us/op 672.00 ns/op 1.50
mainnet_e81889 - altair afterProcessEpoch 81.747 ms/op 81.171 ms/op 1.01
capella processEpoch - mainnet_e217614 1.5891 s/op 1.6940 s/op 0.94
mainnet_e217614 - capella beforeProcessEpoch 426.55 ms/op 397.86 ms/op 1.07
mainnet_e217614 - capella processJustificationAndFinalization 19.170 us/op 8.7070 us/op 2.20
mainnet_e217614 - capella processInactivityUpdates 16.382 ms/op 13.520 ms/op 1.21
mainnet_e217614 - capella processRewardsAndPenalties 497.32 ms/op 464.64 ms/op 1.07
mainnet_e217614 - capella processRegistryUpdates 19.952 us/op 7.8970 us/op 2.53
mainnet_e217614 - capella processSlashings 744.00 ns/op 569.00 ns/op 1.31
mainnet_e217614 - capella processEth1DataReset 768.00 ns/op 496.00 ns/op 1.55
mainnet_e217614 - capella processEffectiveBalanceUpdates 3.6332 ms/op 3.4654 ms/op 1.05
mainnet_e217614 - capella processSlashingsReset 3.2050 us/op 1.5460 us/op 2.07
mainnet_e217614 - capella processRandaoMixesReset 4.8930 us/op 1.8810 us/op 2.60
mainnet_e217614 - capella processHistoricalRootsUpdate 1.0760 us/op 361.00 ns/op 2.98
mainnet_e217614 - capella processParticipationFlagUpdates 1.8750 us/op 1.1170 us/op 1.68
mainnet_e217614 - capella afterProcessEpoch 235.08 ms/op 204.27 ms/op 1.15
phase0 processEpoch - mainnet_e58758 415.37 ms/op 386.66 ms/op 1.07
mainnet_e58758 - phase0 beforeProcessEpoch 118.39 ms/op 118.92 ms/op 1.00
mainnet_e58758 - phase0 processJustificationAndFinalization 19.843 us/op 11.455 us/op 1.73
mainnet_e58758 - phase0 processRewardsAndPenalties 57.377 ms/op 61.922 ms/op 0.93
mainnet_e58758 - phase0 processRegistryUpdates 9.2800 us/op 11.911 us/op 0.78
mainnet_e58758 - phase0 processSlashings 713.00 ns/op 416.00 ns/op 1.71
mainnet_e58758 - phase0 processEth1DataReset 629.00 ns/op 689.00 ns/op 0.91
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 826.84 us/op 858.05 us/op 0.96
mainnet_e58758 - phase0 processSlashingsReset 2.1890 us/op 1.9760 us/op 1.11
mainnet_e58758 - phase0 processRandaoMixesReset 3.4990 us/op 2.7040 us/op 1.29
mainnet_e58758 - phase0 processHistoricalRootsUpdate 750.00 ns/op 725.00 ns/op 1.03
mainnet_e58758 - phase0 processParticipationRecordUpdates 2.6160 us/op 3.4260 us/op 0.76
mainnet_e58758 - phase0 afterProcessEpoch 68.330 ms/op 69.493 ms/op 0.98
phase0 processEffectiveBalanceUpdates - 250000 normalcase 998.85 us/op 1.0473 ms/op 0.95
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.9452 ms/op 1.0994 ms/op 1.77
altair processInactivityUpdates - 250000 normalcase 22.135 ms/op 24.923 ms/op 0.89
altair processInactivityUpdates - 250000 worstcase 19.053 ms/op 22.491 ms/op 0.85
phase0 processRegistryUpdates - 250000 normalcase 5.7820 us/op 7.3250 us/op 0.79
phase0 processRegistryUpdates - 250000 badcase_full_deposits 500.34 us/op 356.36 us/op 1.40
phase0 processRegistryUpdates - 250000 worstcase 0.5 133.18 ms/op 109.07 ms/op 1.22
altair processRewardsAndPenalties - 250000 normalcase 57.269 ms/op 54.968 ms/op 1.04
altair processRewardsAndPenalties - 250000 worstcase 48.587 ms/op 68.614 ms/op 0.71
phase0 getAttestationDeltas - 250000 normalcase 5.6204 ms/op 6.7454 ms/op 0.83
phase0 getAttestationDeltas - 250000 worstcase 5.9120 ms/op 6.7329 ms/op 0.88
phase0 processSlashings - 250000 worstcase 87.289 us/op 80.008 us/op 1.09
altair processSyncCommitteeUpdates - 250000 113.34 ms/op 120.74 ms/op 0.94
BeaconState.hashTreeRoot - No change 437.00 ns/op 390.00 ns/op 1.12
BeaconState.hashTreeRoot - 1 full validator 118.79 us/op 130.30 us/op 0.91
BeaconState.hashTreeRoot - 32 full validator 1.5099 ms/op 1.4262 ms/op 1.06
BeaconState.hashTreeRoot - 512 full validator 17.047 ms/op 16.272 ms/op 1.05
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 166.52 us/op 119.53 us/op 1.39
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.8614 ms/op 2.5017 ms/op 0.74
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 20.757 ms/op 30.035 ms/op 0.69
BeaconState.hashTreeRoot - 1 balances 121.36 us/op 116.99 us/op 1.04
BeaconState.hashTreeRoot - 32 balances 1.2599 ms/op 1.3536 ms/op 0.93
BeaconState.hashTreeRoot - 512 balances 12.594 ms/op 12.692 ms/op 0.99
BeaconState.hashTreeRoot - 250000 balances 141.63 ms/op 220.55 ms/op 0.64
aggregationBits - 2048 els - zipIndexesInBitList 22.166 us/op 19.308 us/op 1.15
byteArrayEquals 32 65.747 ns/op 66.546 ns/op 0.99
Buffer.compare 32 40.198 ns/op 39.874 ns/op 1.01
byteArrayEquals 1024 1.8036 us/op 1.7981 us/op 1.00
Buffer.compare 1024 49.472 ns/op 45.082 ns/op 1.10
byteArrayEquals 16384 28.711 us/op 29.061 us/op 0.99
Buffer.compare 16384 233.15 ns/op 214.84 ns/op 1.09
byteArrayEquals 123687377 210.14 ms/op 209.09 ms/op 1.01
Buffer.compare 123687377 4.6496 ms/op 4.6171 ms/op 1.01
byteArrayEquals 32 - diff last byte 63.079 ns/op 63.554 ns/op 0.99
Buffer.compare 32 - diff last byte 37.883 ns/op 40.321 ns/op 0.94
byteArrayEquals 1024 - diff last byte 1.6629 us/op 1.8181 us/op 0.91
Buffer.compare 1024 - diff last byte 45.006 ns/op 47.368 ns/op 0.95
byteArrayEquals 16384 - diff last byte 26.347 us/op 28.724 us/op 0.92
Buffer.compare 16384 - diff last byte 219.06 ns/op 218.68 ns/op 1.00
byteArrayEquals 123687377 - diff last byte 211.88 ms/op 216.93 ms/op 0.98
Buffer.compare 123687377 - diff last byte 5.3002 ms/op 4.0916 ms/op 1.30
byteArrayEquals 32 - random bytes 4.9110 ns/op 4.7420 ns/op 1.04
Buffer.compare 32 - random bytes 43.664 ns/op 40.456 ns/op 1.08
byteArrayEquals 1024 - random bytes 4.7120 ns/op 4.5600 ns/op 1.03
Buffer.compare 1024 - random bytes 39.603 ns/op 38.524 ns/op 1.03
byteArrayEquals 16384 - random bytes 4.7460 ns/op 4.5660 ns/op 1.04
Buffer.compare 16384 - random bytes 40.267 ns/op 38.636 ns/op 1.04
byteArrayEquals 123687377 - random bytes 8.2600 ns/op 8.2200 ns/op 1.00
Buffer.compare 123687377 - random bytes 39.840 ns/op 41.670 ns/op 0.96
regular array get 100000 times 41.032 us/op 41.880 us/op 0.98
wrappedArray get 100000 times 41.019 us/op 41.952 us/op 0.98
arrayWithProxy get 100000 times 10.025 ms/op 9.9245 ms/op 1.01
ssz.Root.equals 53.641 ns/op 56.099 ns/op 0.96
byteArrayEquals 53.142 ns/op 54.621 ns/op 0.97
Buffer.compare 8.9690 ns/op 9.2640 ns/op 0.97
shuffle list - 16384 els 5.9139 ms/op 5.6493 ms/op 1.05
shuffle list - 250000 els 84.362 ms/op 85.997 ms/op 0.98
processSlot - 1 slots 14.187 us/op 15.698 us/op 0.90
processSlot - 32 slots 3.1859 ms/op 2.9507 ms/op 1.08
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 55.576 ms/op 58.113 ms/op 0.96
getCommitteeAssignments - req 1 vs - 250000 vc 2.3992 ms/op 2.3986 ms/op 1.00
getCommitteeAssignments - req 100 vs - 250000 vc 3.5646 ms/op 3.5472 ms/op 1.00
getCommitteeAssignments - req 1000 vs - 250000 vc 3.7002 ms/op 3.8054 ms/op 0.97
findModifiedValidators - 10000 modified validators 266.61 ms/op 290.87 ms/op 0.92
findModifiedValidators - 1000 modified validators 158.30 ms/op 161.45 ms/op 0.98
findModifiedValidators - 100 modified validators 139.95 ms/op 139.29 ms/op 1.00
findModifiedValidators - 10 modified validators 124.88 ms/op 144.68 ms/op 0.86
findModifiedValidators - 1 modified validators 129.43 ms/op 142.80 ms/op 0.91
findModifiedValidators - no difference 150.30 ms/op 154.26 ms/op 0.97
compare ViewDUs 3.9603 s/op 3.9961 s/op 0.99
compare each validator Uint8Array 1.4259 s/op 1.5862 s/op 0.90
compare ViewDU to Uint8Array 825.27 ms/op 776.63 ms/op 1.06
migrate state 1000000 validators, 24 modified, 0 new 713.67 ms/op 652.45 ms/op 1.09
migrate state 1000000 validators, 1700 modified, 1000 new 892.31 ms/op 971.31 ms/op 0.92
migrate state 1000000 validators, 3400 modified, 2000 new 1.0515 s/op 1.1680 s/op 0.90
migrate state 1500000 validators, 24 modified, 0 new 647.68 ms/op 734.52 ms/op 0.88
migrate state 1500000 validators, 1700 modified, 1000 new 878.86 ms/op 988.90 ms/op 0.89
migrate state 1500000 validators, 3400 modified, 2000 new 1.2020 s/op 1.1296 s/op 1.06
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.9400 ns/op 4.9200 ns/op 1.00
state getBlockRootAtSlot - 250000 vs - 7PWei 778.76 ns/op 852.17 ns/op 0.91
computeProposers - vc 250000 6.7539 ms/op 7.1337 ms/op 0.95
computeEpochShuffling - vc 250000 88.121 ms/op 85.377 ms/op 1.03
getNextSyncCommittee - vc 250000 120.20 ms/op 107.34 ms/op 1.12
computeSigningRoot for AttestationData 25.716 us/op 27.873 us/op 0.92
hash AttestationData serialized data then Buffer.toString(base64) 1.3541 us/op 1.2451 us/op 1.09
toHexString serialized data 1.0773 us/op 772.99 ns/op 1.39
Buffer.toString(base64) 194.21 ns/op 145.75 ns/op 1.33

by benchmarkbot/action

@nflaig nflaig marked this pull request as ready for review April 6, 2024 14:09
@nflaig nflaig requested a review from a team as a code owner April 6, 2024 14:09
Copy link
Contributor

@twoeths twoeths left a comment

Choose a reason for hiding this comment

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

looks good to me, dropped some comments

@@ -256,6 +256,8 @@ export function getBeaconBlockApi({

// If one block in the response contains an optimistic block, mark the entire response as optimistic
let executionOptimistic = false;
// If one block in the response is non finalized, mark the entire response as unfinalized
Copy link
Contributor

Choose a reason for hiding this comment

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

This behaviour is not clearly defined in the beacon api spec. Might be a good idea to update Finalized description in the spec for the case the endpoint is returning multiple blocks

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the only place where it is relevant, I don't even know why this API has top level metadata fields for finalized and execution_optimisitic...

Those should be part of header response and per block

root: config.getForkTypes(block.message.slot).BeaconBlock.hashTreeRoot(block.message),
canonical,
header: {
message: blockToHeader(config, block.message),
signature: block.signature,
},

Copy link
Member Author

Choose a reason for hiding this comment

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

We could consider proposing this in beacon api spec as current behavior does not make much sense, but would likely require to bump the api anyways

packages/beacon-node/src/api/impl/beacon/blocks/index.ts Outdated Show resolved Hide resolved
packages/beacon-node/src/chain/chain.ts Outdated Show resolved Hide resolved
[HttpStatusCode.OK]: {
data: deneb.BlobSidecars;
executionOptimistic: ExecutionOptimistic;
finalized: Finalized;
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm I don't think we need executionOptimistic or finalized for this endpoint: https://ethereum.github.io/beacon-APIs/#/Beacon/getBlobSidecars

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah it does not, but we already had execution_optimistic field here and I think it should?

I have opened an issue for this a few days ago on the spec

Copy link
Member Author

Choose a reason for hiding this comment

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

As this API is not used by other clients but only users that want to retrieve chain data I would prefer to keep the metadata, unless someone has a good argument why it shouldn't be there

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah I think it's better to have it as it's still compliant to the spec

Copy link
Contributor

@ensi321 ensi321 left a comment

Choose a reason for hiding this comment

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

lgtm. For getBlobSidecars we can merge as is. If client devs have decided against adding metadata to getBlobSidecars we can remove them in a later PR

@nflaig nflaig merged commit 5ccae1c into unstable Apr 11, 2024
20 checks passed
@nflaig nflaig deleted the nflaig/finalized-property branch April 11, 2024 10:39
nflaig added a commit that referenced this pull request Apr 11, 2024
* feat: add finalized metadata field to HTTP API responses

* Clean up getState type casts

* Fix finalized when getting block root

* Add comment for block from hot db

* Fix case where slot equals finalized block slot

* Calculate epoch from unmodded slot
@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.

Add finalized property to HTTP API responses
4 participants