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: properly consider Eth-Consensus-Version header #6582

Closed
wants to merge 2 commits into from

Conversation

jeluard
Copy link
Contributor

@jeluard jeluard commented Mar 22, 2024

Motivation

Follow the beacon-APIs specs.

Description

Get the consensus version of submitted block from the Eth-Consensus-Version header value. Falls back to current behavior (extract from the submitted block payload) if not submitted.
Test by executing the following command, with block.json containing the appropriate block data:

curl -H "Eth-Consensus-Version: altair" localhost:9596/eth/v2/beacon/blocks -X POST -d @block.json -H "Content-Type: application/json"

Fixes #6580

@jeluard jeluard requested a review from a team as a code owner March 22, 2024 17:48
@jeluard jeluard marked this pull request as draft March 22, 2024 17:48
Copy link

codecov bot commented Mar 22, 2024

Codecov Report

Merging #6582 (049909d) into unstable (129f300) will increase coverage by 0.01%.
The diff coverage is 89.58%.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #6582      +/-   ##
============================================
+ Coverage     61.49%   61.50%   +0.01%     
============================================
  Files           556      556              
  Lines         58895    58917      +22     
  Branches       1856     1857       +1     
============================================
+ Hits          36216    36236      +20     
- Misses        22638    22640       +2     
  Partials         41       41              

Copy link
Contributor

github-actions bot commented Mar 22, 2024

Performance Report

✔️ no performance regression detected

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: 7cfc2b2 Previous: 129f300 Ratio
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 4.8260 us/op 19.446 us/op 0.25
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 5.3120 us/op 21.598 us/op 0.25
Full benchmark results
Benchmark suite Current: 7cfc2b2 Previous: 129f300 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 790.35 us/op 884.68 us/op 0.89
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 98.759 us/op 88.691 us/op 1.11
BLS verify - blst-native 1.2097 ms/op 1.2948 ms/op 0.93
BLS verifyMultipleSignatures 3 - blst-native 2.5018 ms/op 2.7264 ms/op 0.92
BLS verifyMultipleSignatures 8 - blst-native 5.5217 ms/op 5.9604 ms/op 0.93
BLS verifyMultipleSignatures 32 - blst-native 20.298 ms/op 22.190 ms/op 0.91
BLS verifyMultipleSignatures 64 - blst-native 40.794 ms/op 44.032 ms/op 0.93
BLS verifyMultipleSignatures 128 - blst-native 79.777 ms/op 86.103 ms/op 0.93
BLS deserializing 10000 signatures 1.0556 s/op 906.44 ms/op 1.16
BLS deserializing 100000 signatures 8.4759 s/op 9.5560 s/op 0.89
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.1827 ms/op 1.3686 ms/op 0.86
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.2952 ms/op 1.5428 ms/op 0.84
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.2146 ms/op 3.0066 ms/op 0.74
BLS verifyMultipleSignatures - same message - 64 - blst-native 3.2844 ms/op 4.5835 ms/op 0.72
BLS verifyMultipleSignatures - same message - 128 - blst-native 5.3101 ms/op 7.1006 ms/op 0.75
BLS aggregatePubkeys 32 - blst-native 25.049 us/op 28.288 us/op 0.89
BLS aggregatePubkeys 128 - blst-native 92.460 us/op 103.54 us/op 0.89
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 79.030 ms/op 68.533 ms/op 1.15
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 68.996 ms/op 65.038 ms/op 1.06
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 41.777 ms/op 43.175 ms/op 0.97
getSlashingsAndExits - default max 259.85 us/op 200.38 us/op 1.30
getSlashingsAndExits - 2k 449.46 us/op 443.12 us/op 1.01
proposeBlockBody type=full, size=empty 4.4070 ms/op 6.1705 ms/op 0.71
isKnown best case - 1 super set check 342.00 ns/op 407.00 ns/op 0.84
isKnown normal case - 2 super set checks 318.00 ns/op 388.00 ns/op 0.82
isKnown worse case - 16 super set checks 331.00 ns/op 406.00 ns/op 0.82
CheckpointStateCache - add get delete 4.7340 us/op 7.3520 us/op 0.64
validate api signedAggregateAndProof - struct 2.2524 ms/op 2.8548 ms/op 0.79
validate gossip signedAggregateAndProof - struct 2.3372 ms/op 2.8529 ms/op 0.82
validate gossip attestation - vc 640000 1.1061 ms/op 1.3884 ms/op 0.80
batch validate gossip attestation - vc 640000 - chunk 32 129.80 us/op 169.62 us/op 0.77
batch validate gossip attestation - vc 640000 - chunk 64 120.44 us/op 159.35 us/op 0.76
batch validate gossip attestation - vc 640000 - chunk 128 116.11 us/op 152.13 us/op 0.76
batch validate gossip attestation - vc 640000 - chunk 256 113.60 us/op 146.59 us/op 0.77
pickEth1Vote - no votes 872.74 us/op 1.3843 ms/op 0.63
pickEth1Vote - max votes 6.7613 ms/op 15.887 ms/op 0.43
pickEth1Vote - Eth1Data hashTreeRoot value x2048 14.029 ms/op 23.449 ms/op 0.60
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 19.500 ms/op 36.142 ms/op 0.54
pickEth1Vote - Eth1Data fastSerialize value x2048 400.62 us/op 751.18 us/op 0.53
pickEth1Vote - Eth1Data fastSerialize tree x2048 5.5893 ms/op 8.7898 ms/op 0.64
bytes32 toHexString 457.00 ns/op 644.00 ns/op 0.71
bytes32 Buffer.toString(hex) 319.00 ns/op 321.00 ns/op 0.99
bytes32 Buffer.toString(hex) from Uint8Array 467.00 ns/op 530.00 ns/op 0.88
bytes32 Buffer.toString(hex) + 0x 370.00 ns/op 317.00 ns/op 1.17
Object access 1 prop 0.21400 ns/op 0.21600 ns/op 0.99
Map access 1 prop 0.18700 ns/op 0.15700 ns/op 1.19
Object get x1000 4.9970 ns/op 8.0900 ns/op 0.62
Map get x1000 0.84300 ns/op 0.87000 ns/op 0.97
Object set x1000 27.702 ns/op 68.984 ns/op 0.40
Map set x1000 18.061 ns/op 53.722 ns/op 0.34
Return object 10000 times 0.23970 ns/op 0.25390 ns/op 0.94
Throw Error 10000 times 2.7574 us/op 4.1914 us/op 0.66
fastMsgIdFn sha256 / 200 bytes 2.0640 us/op 3.4670 us/op 0.60
fastMsgIdFn h32 xxhash / 200 bytes 304.00 ns/op 352.00 ns/op 0.86
fastMsgIdFn h64 xxhash / 200 bytes 352.00 ns/op 408.00 ns/op 0.86
fastMsgIdFn sha256 / 1000 bytes 6.2430 us/op 11.848 us/op 0.53
fastMsgIdFn h32 xxhash / 1000 bytes 405.00 ns/op 509.00 ns/op 0.80
fastMsgIdFn h64 xxhash / 1000 bytes 411.00 ns/op 496.00 ns/op 0.83
fastMsgIdFn sha256 / 10000 bytes 53.451 us/op 105.45 us/op 0.51
fastMsgIdFn h32 xxhash / 10000 bytes 1.8280 us/op 2.1040 us/op 0.87
fastMsgIdFn h64 xxhash / 10000 bytes 1.2440 us/op 1.3970 us/op 0.89
send data - 1000 256B messages 10.959 ms/op 22.322 ms/op 0.49
send data - 1000 512B messages 13.942 ms/op 31.646 ms/op 0.44
send data - 1000 1024B messages 25.547 ms/op 45.392 ms/op 0.56
send data - 1000 1200B messages 28.861 ms/op 46.334 ms/op 0.62
send data - 1000 2048B messages 39.076 ms/op 62.053 ms/op 0.63
send data - 1000 4096B messages 33.814 ms/op 55.827 ms/op 0.61
send data - 1000 16384B messages 91.825 ms/op 130.54 ms/op 0.70
send data - 1000 65536B messages 382.70 ms/op 523.45 ms/op 0.73
enrSubnets - fastDeserialize 64 bits 930.00 ns/op 1.9470 us/op 0.48
enrSubnets - ssz BitVector 64 bits 435.00 ns/op 556.00 ns/op 0.78
enrSubnets - fastDeserialize 4 bits 206.00 ns/op 226.00 ns/op 0.91
enrSubnets - ssz BitVector 4 bits 439.00 ns/op 524.00 ns/op 0.84
prioritizePeers score -10:0 att 32-0.1 sync 2-0 70.331 us/op 129.49 us/op 0.54
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 80.089 us/op 160.00 us/op 0.50
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 106.75 us/op 185.01 us/op 0.58
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 179.55 us/op 372.12 us/op 0.48
prioritizePeers score 0:0 att 64-1 sync 4-1 205.48 us/op 425.41 us/op 0.48
array of 16000 items push then shift 1.3018 us/op 1.7265 us/op 0.75
LinkedList of 16000 items push then shift 7.5250 ns/op 10.250 ns/op 0.73
array of 16000 items push then pop 91.674 ns/op 143.18 ns/op 0.64
LinkedList of 16000 items push then pop 5.8430 ns/op 10.221 ns/op 0.57
array of 24000 items push then shift 1.8915 us/op 2.7407 us/op 0.69
LinkedList of 24000 items push then shift 6.7220 ns/op 14.257 ns/op 0.47
array of 24000 items push then pop 131.19 ns/op 173.28 ns/op 0.76
LinkedList of 24000 items push then pop 5.8860 ns/op 10.081 ns/op 0.58
intersect bitArray bitLen 8 4.7400 ns/op 6.1110 ns/op 0.78
intersect array and set length 8 51.871 ns/op 76.997 ns/op 0.67
intersect bitArray bitLen 128 29.189 ns/op 36.974 ns/op 0.79
intersect array and set length 128 722.11 ns/op 1.1100 us/op 0.65
bitArray.getTrueBitIndexes() bitLen 128 1.4240 us/op 1.7920 us/op 0.79
bitArray.getTrueBitIndexes() bitLen 248 2.5870 us/op 3.1370 us/op 0.82
bitArray.getTrueBitIndexes() bitLen 512 5.2250 us/op 6.9830 us/op 0.75
Buffer.concat 32 items 844.00 ns/op 1.2120 us/op 0.70
Uint8Array.set 32 items 1.4990 us/op 2.2680 us/op 0.66
Set add up to 64 items then delete first 1.8746 us/op 5.1193 us/op 0.37
OrderedSet add up to 64 items then delete first 2.7728 us/op 6.8430 us/op 0.41
Set add up to 64 items then delete last 2.1151 us/op 5.6020 us/op 0.38
OrderedSet add up to 64 items then delete last 3.1047 us/op 7.2970 us/op 0.43
Set add up to 64 items then delete middle 2.2914 us/op 5.4789 us/op 0.42
OrderedSet add up to 64 items then delete middle 4.7510 us/op 7.9979 us/op 0.59
Set add up to 128 items then delete first 4.4271 us/op 11.510 us/op 0.38
OrderedSet add up to 128 items then delete first 6.8133 us/op 14.549 us/op 0.47
Set add up to 128 items then delete last 4.5476 us/op 11.177 us/op 0.41
OrderedSet add up to 128 items then delete last 6.5389 us/op 13.841 us/op 0.47
Set add up to 128 items then delete middle 4.0202 us/op 11.534 us/op 0.35
OrderedSet add up to 128 items then delete middle 12.187 us/op 19.779 us/op 0.62
Set add up to 256 items then delete first 8.5845 us/op 24.287 us/op 0.35
OrderedSet add up to 256 items then delete first 12.720 us/op 32.914 us/op 0.39
Set add up to 256 items then delete last 7.7584 us/op 22.366 us/op 0.35
OrderedSet add up to 256 items then delete last 12.858 us/op 26.031 us/op 0.49
Set add up to 256 items then delete middle 7.6453 us/op 20.230 us/op 0.38
OrderedSet add up to 256 items then delete middle 31.698 us/op 54.724 us/op 0.58
transfer serialized Status (84 B) 1.3250 us/op 1.8670 us/op 0.71
copy serialized Status (84 B) 1.1050 us/op 1.3970 us/op 0.79
transfer serialized SignedVoluntaryExit (112 B) 1.4850 us/op 2.0630 us/op 0.72
copy serialized SignedVoluntaryExit (112 B) 1.2770 us/op 1.5130 us/op 0.84
transfer serialized ProposerSlashing (416 B) 2.7970 us/op 2.4140 us/op 1.16
copy serialized ProposerSlashing (416 B) 2.7710 us/op 2.0480 us/op 1.35
transfer serialized Attestation (485 B) 2.8950 us/op 2.6220 us/op 1.10
copy serialized Attestation (485 B) 2.6950 us/op 2.1020 us/op 1.28
transfer serialized AttesterSlashing (33232 B) 2.6980 us/op 2.2320 us/op 1.21
copy serialized AttesterSlashing (33232 B) 5.0840 us/op 7.5990 us/op 0.67
transfer serialized Small SignedBeaconBlock (128000 B) 2.7120 us/op 2.6090 us/op 1.04
copy serialized Small SignedBeaconBlock (128000 B) 10.788 us/op 17.361 us/op 0.62
transfer serialized Avg SignedBeaconBlock (200000 B) 2.8670 us/op 3.2510 us/op 0.88
copy serialized Avg SignedBeaconBlock (200000 B) 14.064 us/op 28.212 us/op 0.50
transfer serialized BlobsSidecar (524380 B) 2.7360 us/op 4.1760 us/op 0.66
copy serialized BlobsSidecar (524380 B) 92.180 us/op 115.85 us/op 0.80
transfer serialized Big SignedBeaconBlock (1000000 B) 3.1830 us/op 4.1420 us/op 0.77
copy serialized Big SignedBeaconBlock (1000000 B) 197.19 us/op 285.92 us/op 0.69
pass gossip attestations to forkchoice per slot 3.0160 ms/op 4.8584 ms/op 0.62
forkChoice updateHead vc 100000 bc 64 eq 0 442.99 us/op 735.41 us/op 0.60
forkChoice updateHead vc 600000 bc 64 eq 0 4.4904 ms/op 4.8409 ms/op 0.93
forkChoice updateHead vc 1000000 bc 64 eq 0 4.9806 ms/op 7.7559 ms/op 0.64
forkChoice updateHead vc 600000 bc 320 eq 0 2.9303 ms/op 4.3787 ms/op 0.67
forkChoice updateHead vc 600000 bc 1200 eq 0 2.7220 ms/op 4.5008 ms/op 0.60
forkChoice updateHead vc 600000 bc 7200 eq 0 3.9560 ms/op 5.9784 ms/op 0.66
forkChoice updateHead vc 600000 bc 64 eq 1000 10.222 ms/op 11.781 ms/op 0.87
forkChoice updateHead vc 600000 bc 64 eq 10000 9.8475 ms/op 12.712 ms/op 0.77
forkChoice updateHead vc 600000 bc 64 eq 300000 12.112 ms/op 18.691 ms/op 0.65
computeDeltas 500000 validators 300 proto nodes 3.1709 ms/op 6.9080 ms/op 0.46
computeDeltas 500000 validators 1200 proto nodes 3.0909 ms/op 7.0293 ms/op 0.44
computeDeltas 500000 validators 7200 proto nodes 3.0244 ms/op 7.0365 ms/op 0.43
computeDeltas 750000 validators 300 proto nodes 4.5513 ms/op 10.312 ms/op 0.44
computeDeltas 750000 validators 1200 proto nodes 4.7109 ms/op 10.538 ms/op 0.45
computeDeltas 750000 validators 7200 proto nodes 5.0225 ms/op 10.458 ms/op 0.48
computeDeltas 1400000 validators 300 proto nodes 9.9881 ms/op 18.862 ms/op 0.53
computeDeltas 1400000 validators 1200 proto nodes 9.3492 ms/op 19.320 ms/op 0.48
computeDeltas 1400000 validators 7200 proto nodes 9.4795 ms/op 20.263 ms/op 0.47
computeDeltas 2100000 validators 300 proto nodes 13.884 ms/op 30.584 ms/op 0.45
computeDeltas 2100000 validators 1200 proto nodes 12.840 ms/op 31.010 ms/op 0.41
computeDeltas 2100000 validators 7200 proto nodes 13.026 ms/op 30.405 ms/op 0.43
altair processAttestation - 250000 vs - 7PWei normalcase 1.4427 ms/op 3.0873 ms/op 0.47
altair processAttestation - 250000 vs - 7PWei worstcase 2.1329 ms/op 5.3567 ms/op 0.40
altair processAttestation - setStatus - 1/6 committees join 99.289 us/op 158.29 us/op 0.63
altair processAttestation - setStatus - 1/3 committees join 195.29 us/op 315.68 us/op 0.62
altair processAttestation - setStatus - 1/2 committees join 271.50 us/op 403.04 us/op 0.67
altair processAttestation - setStatus - 2/3 committees join 373.72 us/op 533.65 us/op 0.70
altair processAttestation - setStatus - 4/5 committees join 487.28 us/op 738.25 us/op 0.66
altair processAttestation - setStatus - 100% committees join 563.99 us/op 909.33 us/op 0.62
altair processBlock - 250000 vs - 7PWei normalcase 7.9661 ms/op 9.8579 ms/op 0.81
altair processBlock - 250000 vs - 7PWei normalcase hashState 33.079 ms/op 45.426 ms/op 0.73
altair processBlock - 250000 vs - 7PWei worstcase 30.639 ms/op 45.065 ms/op 0.68
altair processBlock - 250000 vs - 7PWei worstcase hashState 70.362 ms/op 117.38 ms/op 0.60
phase0 processBlock - 250000 vs - 7PWei normalcase 2.0710 ms/op 4.2100 ms/op 0.49
phase0 processBlock - 250000 vs - 7PWei worstcase 23.712 ms/op 32.959 ms/op 0.72
altair processEth1Data - 250000 vs - 7PWei normalcase 295.53 us/op 538.14 us/op 0.55
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 4.8260 us/op 19.446 us/op 0.25
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 35.218 us/op 99.374 us/op 0.35
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 10.219 us/op 18.016 us/op 0.57
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 5.3120 us/op 21.598 us/op 0.25
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 94.096 us/op 199.16 us/op 0.47
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 726.12 us/op 2.0617 ms/op 0.35
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 935.22 us/op 2.2621 ms/op 0.41
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 932.07 us/op 2.3909 ms/op 0.39
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 2.4487 ms/op 4.9861 ms/op 0.49
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.5721 ms/op 3.0791 ms/op 0.51
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.4807 ms/op 6.8306 ms/op 0.51
Tree 40 250000 create 267.98 ms/op 444.06 ms/op 0.60
Tree 40 250000 get(125000) 112.18 ns/op 220.07 ns/op 0.51
Tree 40 250000 set(125000) 723.98 ns/op 1.1092 us/op 0.65
Tree 40 250000 toArray() 9.0930 ms/op 25.064 ms/op 0.36
Tree 40 250000 iterate all - toArray() + loop 9.3539 ms/op 30.181 ms/op 0.31
Tree 40 250000 iterate all - get(i) 37.768 ms/op 104.99 ms/op 0.36
MutableVector 250000 create 9.7782 ms/op 28.625 ms/op 0.34
MutableVector 250000 get(125000) 5.4670 ns/op 11.723 ns/op 0.47
MutableVector 250000 set(125000) 199.68 ns/op 1.0377 us/op 0.19
MutableVector 250000 toArray() 2.4320 ms/op 6.9044 ms/op 0.35
MutableVector 250000 iterate all - toArray() + loop 2.5591 ms/op 5.3611 ms/op 0.48
MutableVector 250000 iterate all - get(i) 1.2835 ms/op 1.8621 ms/op 0.69
Array 250000 create 2.0727 ms/op 3.7447 ms/op 0.55
Array 250000 clone - spread 1.1544 ms/op 1.3586 ms/op 0.85
Array 250000 get(125000) 1.0100 ns/op 1.2160 ns/op 0.83
Array 250000 set(125000) 1.2000 ns/op 5.3110 ns/op 0.23
Array 250000 iterate all - loop 144.34 us/op 176.13 us/op 0.82
effectiveBalanceIncrements clone Uint8Array 300000 19.662 us/op 48.602 us/op 0.40
effectiveBalanceIncrements clone MutableVector 300000 418.00 ns/op 395.00 ns/op 1.06
effectiveBalanceIncrements rw all Uint8Array 300000 174.59 us/op 211.57 us/op 0.83
effectiveBalanceIncrements rw all MutableVector 300000 66.383 ms/op 110.23 ms/op 0.60
phase0 afterProcessEpoch - 250000 vs - 7PWei 79.604 ms/op 127.16 ms/op 0.63
phase0 beforeProcessEpoch - 250000 vs - 7PWei 34.085 ms/op 75.182 ms/op 0.45
altair processEpoch - mainnet_e81889 373.95 ms/op 676.79 ms/op 0.55
mainnet_e81889 - altair beforeProcessEpoch 68.391 ms/op 102.57 ms/op 0.67
mainnet_e81889 - altair processJustificationAndFinalization 6.1360 us/op 22.584 us/op 0.27
mainnet_e81889 - altair processInactivityUpdates 4.8567 ms/op 7.5669 ms/op 0.64
mainnet_e81889 - altair processRewardsAndPenalties 47.424 ms/op 87.094 ms/op 0.54
mainnet_e81889 - altair processRegistryUpdates 1.0560 us/op 2.7030 us/op 0.39
mainnet_e81889 - altair processSlashings 312.00 ns/op 608.00 ns/op 0.51
mainnet_e81889 - altair processEth1DataReset 328.00 ns/op 1.0820 us/op 0.30
mainnet_e81889 - altair processEffectiveBalanceUpdates 993.02 us/op 2.0144 ms/op 0.49
mainnet_e81889 - altair processSlashingsReset 2.1630 us/op 6.1360 us/op 0.35
mainnet_e81889 - altair processRandaoMixesReset 2.0140 us/op 5.4860 us/op 0.37
mainnet_e81889 - altair processHistoricalRootsUpdate 404.00 ns/op 1.1110 us/op 0.36
mainnet_e81889 - altair processParticipationFlagUpdates 900.00 ns/op 3.1610 us/op 0.28
mainnet_e81889 - altair processSyncCommitteeUpdates 373.00 ns/op 1.3010 us/op 0.29
mainnet_e81889 - altair afterProcessEpoch 81.478 ms/op 127.17 ms/op 0.64
capella processEpoch - mainnet_e217614 1.5609 s/op 2.1819 s/op 0.72
mainnet_e217614 - capella beforeProcessEpoch 395.74 ms/op 529.85 ms/op 0.75
mainnet_e217614 - capella processJustificationAndFinalization 7.1900 us/op 24.296 us/op 0.30
mainnet_e217614 - capella processInactivityUpdates 16.735 ms/op 24.232 ms/op 0.69
mainnet_e217614 - capella processRewardsAndPenalties 480.62 ms/op 619.63 ms/op 0.78
mainnet_e217614 - capella processRegistryUpdates 13.756 us/op 28.487 us/op 0.48
mainnet_e217614 - capella processSlashings 313.00 ns/op 968.00 ns/op 0.32
mainnet_e217614 - capella processEth1DataReset 711.00 ns/op 447.00 ns/op 1.59
mainnet_e217614 - capella processEffectiveBalanceUpdates 14.046 ms/op 4.5321 ms/op 3.10
mainnet_e217614 - capella processSlashingsReset 1.2580 us/op 3.9290 us/op 0.32
mainnet_e217614 - capella processRandaoMixesReset 2.7880 us/op 6.8370 us/op 0.41
mainnet_e217614 - capella processHistoricalRootsUpdate 1.2530 us/op 800.00 ns/op 1.57
mainnet_e217614 - capella processParticipationFlagUpdates 2.7300 us/op 2.3120 us/op 1.18
mainnet_e217614 - capella afterProcessEpoch 240.03 ms/op 310.23 ms/op 0.77
phase0 processEpoch - mainnet_e58758 408.92 ms/op 479.19 ms/op 0.85
mainnet_e58758 - phase0 beforeProcessEpoch 115.17 ms/op 147.95 ms/op 0.78
mainnet_e58758 - phase0 processJustificationAndFinalization 10.617 us/op 16.762 us/op 0.63
mainnet_e58758 - phase0 processRewardsAndPenalties 53.496 ms/op 69.046 ms/op 0.77
mainnet_e58758 - phase0 processRegistryUpdates 6.4500 us/op 9.5220 us/op 0.68
mainnet_e58758 - phase0 processSlashings 335.00 ns/op 726.00 ns/op 0.46
mainnet_e58758 - phase0 processEth1DataReset 330.00 ns/op 689.00 ns/op 0.48
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 800.30 us/op 2.0642 ms/op 0.39
mainnet_e58758 - phase0 processSlashingsReset 1.4770 us/op 4.0190 us/op 0.37
mainnet_e58758 - phase0 processRandaoMixesReset 2.6980 us/op 6.3460 us/op 0.43
mainnet_e58758 - phase0 processHistoricalRootsUpdate 354.00 ns/op 686.00 ns/op 0.52
mainnet_e58758 - phase0 processParticipationRecordUpdates 2.6630 us/op 5.8770 us/op 0.45
mainnet_e58758 - phase0 afterProcessEpoch 66.240 ms/op 96.144 ms/op 0.69
phase0 processEffectiveBalanceUpdates - 250000 normalcase 928.93 us/op 1.2874 ms/op 0.72
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.0613 ms/op 1.3839 ms/op 0.77
altair processInactivityUpdates - 250000 normalcase 19.263 ms/op 26.659 ms/op 0.72
altair processInactivityUpdates - 250000 worstcase 17.892 ms/op 34.819 ms/op 0.51
phase0 processRegistryUpdates - 250000 normalcase 6.7200 us/op 14.023 us/op 0.48
phase0 processRegistryUpdates - 250000 badcase_full_deposits 242.67 us/op 619.61 us/op 0.39
phase0 processRegistryUpdates - 250000 worstcase 0.5 104.10 ms/op 160.00 ms/op 0.65
altair processRewardsAndPenalties - 250000 normalcase 51.227 ms/op 90.815 ms/op 0.56
altair processRewardsAndPenalties - 250000 worstcase 39.007 ms/op 84.533 ms/op 0.46
phase0 getAttestationDeltas - 250000 normalcase 6.9674 ms/op 9.2495 ms/op 0.75
phase0 getAttestationDeltas - 250000 worstcase 6.2960 ms/op 9.7389 ms/op 0.65
phase0 processSlashings - 250000 worstcase 56.356 us/op 127.62 us/op 0.44
altair processSyncCommitteeUpdates - 250000 106.27 ms/op 162.29 ms/op 0.65
BeaconState.hashTreeRoot - No change 385.00 ns/op 402.00 ns/op 0.96
BeaconState.hashTreeRoot - 1 full validator 88.801 us/op 143.14 us/op 0.62
BeaconState.hashTreeRoot - 32 full validator 896.23 us/op 1.6458 ms/op 0.54
BeaconState.hashTreeRoot - 512 full validator 10.608 ms/op 19.913 ms/op 0.53
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 103.40 us/op 205.64 us/op 0.50
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.3637 ms/op 2.8011 ms/op 0.49
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 18.197 ms/op 36.626 ms/op 0.50
BeaconState.hashTreeRoot - 1 balances 79.593 us/op 163.87 us/op 0.49
BeaconState.hashTreeRoot - 32 balances 776.63 us/op 1.4083 ms/op 0.55
BeaconState.hashTreeRoot - 512 balances 7.8632 ms/op 9.5393 ms/op 0.82
BeaconState.hashTreeRoot - 250000 balances 134.50 ms/op 198.96 ms/op 0.68
aggregationBits - 2048 els - zipIndexesInBitList 20.809 us/op 27.359 us/op 0.76
byteArrayEquals 32 60.589 ns/op 74.462 ns/op 0.81
Buffer.compare 32 36.410 ns/op 55.523 ns/op 0.66
byteArrayEquals 1024 1.6038 us/op 2.0373 us/op 0.79
Buffer.compare 1024 41.562 ns/op 70.010 ns/op 0.59
byteArrayEquals 16384 25.431 us/op 32.399 us/op 0.78
Buffer.compare 16384 196.09 ns/op 244.38 ns/op 0.80
byteArrayEquals 123687377 198.17 ms/op 240.08 ms/op 0.83
Buffer.compare 123687377 3.7134 ms/op 6.8846 ms/op 0.54
byteArrayEquals 32 - diff last byte 62.867 ns/op 74.869 ns/op 0.84
Buffer.compare 32 - diff last byte 37.940 ns/op 57.588 ns/op 0.66
byteArrayEquals 1024 - diff last byte 1.7614 us/op 2.0709 us/op 0.85
Buffer.compare 1024 - diff last byte 47.241 ns/op 73.397 ns/op 0.64
byteArrayEquals 16384 - diff last byte 28.020 us/op 32.787 us/op 0.85
Buffer.compare 16384 - diff last byte 199.42 ns/op 250.53 ns/op 0.80
byteArrayEquals 123687377 - diff last byte 205.70 ms/op 248.08 ms/op 0.83
Buffer.compare 123687377 - diff last byte 3.7691 ms/op 7.1863 ms/op 0.52
byteArrayEquals 32 - random bytes 4.4510 ns/op 5.8830 ns/op 0.76
Buffer.compare 32 - random bytes 38.767 ns/op 62.984 ns/op 0.62
byteArrayEquals 1024 - random bytes 4.3760 ns/op 5.9210 ns/op 0.74
Buffer.compare 1024 - random bytes 37.120 ns/op 62.314 ns/op 0.60
byteArrayEquals 16384 - random bytes 4.3680 ns/op 5.6590 ns/op 0.77
Buffer.compare 16384 - random bytes 37.067 ns/op 62.837 ns/op 0.59
byteArrayEquals 123687377 - random bytes 7.7700 ns/op 8.9100 ns/op 0.87
Buffer.compare 123687377 - random bytes 44.210 ns/op 65.310 ns/op 0.68
regular array get 100000 times 40.515 us/op 45.211 us/op 0.90
wrappedArray get 100000 times 40.567 us/op 45.655 us/op 0.89
arrayWithProxy get 100000 times 9.3125 ms/op 15.133 ms/op 0.62
ssz.Root.equals 52.039 ns/op 55.820 ns/op 0.93
byteArrayEquals 49.553 ns/op 54.787 ns/op 0.90
Buffer.compare 8.3110 ns/op 11.070 ns/op 0.75
shuffle list - 16384 els 5.0573 ms/op 8.7412 ms/op 0.58
shuffle list - 250000 els 74.753 ms/op 128.51 ms/op 0.58
processSlot - 1 slots 12.567 us/op 18.650 us/op 0.67
processSlot - 32 slots 2.8258 ms/op 4.1080 ms/op 0.69
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 53.029 ms/op 63.761 ms/op 0.83
getCommitteeAssignments - req 1 vs - 250000 vc 2.2707 ms/op 2.7392 ms/op 0.83
getCommitteeAssignments - req 100 vs - 250000 vc 3.3771 ms/op 4.1114 ms/op 0.82
getCommitteeAssignments - req 1000 vs - 250000 vc 3.8064 ms/op 4.3784 ms/op 0.87
findModifiedValidators - 10000 modified validators 425.01 ms/op 568.42 ms/op 0.75
findModifiedValidators - 1000 modified validators 306.63 ms/op 492.33 ms/op 0.62
findModifiedValidators - 100 modified validators 269.34 ms/op 511.00 ms/op 0.53
findModifiedValidators - 10 modified validators 289.25 ms/op 449.30 ms/op 0.64
findModifiedValidators - 1 modified validators 301.57 ms/op 461.83 ms/op 0.65
findModifiedValidators - no difference 334.09 ms/op 423.11 ms/op 0.79
compare ViewDUs 4.1178 s/op 4.9739 s/op 0.83
compare each validator Uint8Array 1.8003 s/op 2.0090 s/op 0.90
compare ViewDU to Uint8Array 808.16 ms/op 1.1577 s/op 0.70
migrate state 1000000 validators, 24 modified, 0 new 608.93 ms/op 848.38 ms/op 0.72
migrate state 1000000 validators, 1700 modified, 1000 new 913.82 ms/op 1.2413 s/op 0.74
migrate state 1000000 validators, 3400 modified, 2000 new 1.1199 s/op 1.4387 s/op 0.78
migrate state 1500000 validators, 24 modified, 0 new 568.06 ms/op 946.09 ms/op 0.60
migrate state 1500000 validators, 1700 modified, 1000 new 876.72 ms/op 1.1460 s/op 0.77
migrate state 1500000 validators, 3400 modified, 2000 new 912.30 ms/op 1.4824 s/op 0.62
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.4100 ns/op 5.0100 ns/op 0.88
state getBlockRootAtSlot - 250000 vs - 7PWei 511.18 ns/op 792.77 ns/op 0.64
computeProposers - vc 250000 5.9057 ms/op 13.244 ms/op 0.45
computeEpochShuffling - vc 250000 82.300 ms/op 155.00 ms/op 0.53
getNextSyncCommittee - vc 250000 99.139 ms/op 190.29 ms/op 0.52
computeSigningRoot for AttestationData 18.850 us/op 34.144 us/op 0.55
hash AttestationData serialized data then Buffer.toString(base64) 1.2459 us/op 2.7187 us/op 0.46
toHexString serialized data 813.79 ns/op 1.5747 us/op 0.52
Buffer.toString(base64) 152.71 ns/op 311.67 ns/op 0.49

by benchmarkbot/action

@jeluard jeluard marked this pull request as ready for review March 23, 2024 09:30
publishBlockV2: {
body: unknown;
query: {broadcast_validation?: string};
headers: {"eth-consensus-version"?: ForkName};
Copy link
Member

@nflaig nflaig Mar 25, 2024

Choose a reason for hiding this comment

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

you can't be sure this is a valid ForkName here, as I think we shouldn't be modifying the server side in this PR it doesn't matter much but it is safer to handle this as string as header value needs to be validated first

Suggested change
headers: {"eth-consensus-version"?: ForkName};
headers: {"eth-consensus-version"?: string};

@@ -187,7 +187,7 @@ export type Api = {

publishBlockV2(
blockOrContents: allForks.SignedBeaconBlockOrContents,
opts?: {broadcastValidation?: BroadcastValidation}
opts?: {broadcastValidation?: BroadcastValidation; version?: ForkName}
Copy link
Member

@nflaig nflaig Mar 25, 2024

Choose a reason for hiding this comment

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

relying on consumer to provide this is not correct, this is mandatory and should be handled internally by the API client

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.

This PR does not address the actual problem noted in #6580 that we are not setting the header when sending the request.

As noted in #6580 (comment) I don't think it is worth it to change the behavior on the server at all, current approach works and it compatible with all clients. Would prefer to keep this PR minimal to avoid regressions and cause less conflicts on refactor branch.

Header is still missing

{
  host: '127.0.0.1:9596',
  connection: 'keep-alive',
  'content-type': 'application/json',
  accept: '*/*',
  'accept-language': '*',
  'sec-fetch-mode': 'cors',
  'user-agent': 'node',
  'accept-encoding': 'gzip, deflate',
  'content-length': '1022'
}

body: createAllForksSignedBlockOrContents(version).toJson(item),
query: {broadcast_validation: broadcastValidation},
};
const headers = version !== undefined ? {"eth-consensus-version": version} : {};
Copy link
Member

Choose a reason for hiding this comment

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

Version header must be set as per spec, see how this is handled in the refactored api client

writeReqJson: ({signedBlockOrContents, broadcastValidation}) => {
const slot = isSignedBlockContents(signedBlockOrContents)
? signedBlockOrContents.signedBlock.message.slot
: signedBlockOrContents.message.slot;
return {
body:
config.getForkSeq(slot) < ForkSeq.deneb
? config
.getForkTypes(slot)
.SignedBeaconBlock.toJson(signedBlockOrContents as allForks.SignedBeaconBlock)
: SignedBlockContentsType.toJson(signedBlockOrContents as SignedBlockContents),
headers: {
"Eth-Consensus-Version": config.getForkName(slot),
},

@jeluard
Copy link
Contributor Author

jeluard commented Mar 26, 2024

Superseded by #6593

@jeluard jeluard closed this Mar 26, 2024
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.

Eth-Consensus-Version header is missing in publish block requests
2 participants