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: allow validator to request blinded versions for locally produced and selected blocks #6227

Merged
merged 3 commits into from
Dec 31, 2023

Conversation

g11tech
Copy link
Contributor

@g11tech g11tech commented Dec 21, 2023

if bn and vc are in different networks which we have had seen the need of, the communication size between validator and bn for proposals is a real issue adding unnecessary latency. This PR adds a capability to allow validator to request blinded versions of locally produced and selected blocks.

This PR adds this flag to the request so that the produceBlockV3 flow remains complaint to the spec and the local "blinded" capability aware validators would be able to use this feature, as some validators (vouch etc) or other validators who want to have full blocks for engine so as to assume statelessness can continue to function in the same way

Closes #6219

@g11tech g11tech requested a review from a team as a code owner December 21, 2023 17:21
@g11tech g11tech marked this pull request as draft December 21, 2023 17:21
@twoeths
Copy link
Contributor

twoeths commented Dec 22, 2023

need to make sure we test possible values of blindedLocal flag through sim tests @g11tech

logger.verbose("Assembling block with produceBlockV3 ", {
fork,
builderSelection,
const produceEngineOrBuilderBlock: ServerApi<routes.validator.Api>["produceBlockV3"] =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

changes in produceEngineOrBuilderBlock (old produceBlockV3) are because of formatting changes introduced because of name length changes may be, but this function doesn't essentially change and produceBlockV3 is redefined which uses now this and handles blinding of local payload if requested

@@ -643,6 +654,55 @@ export function getValidatorApi({
}
};

const produceBlockV3: ServerApi<routes.validator.Api>["produceBlockV3"] = async function produceBlockV3(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the real code segment introduced here, old produceBlockV3 is renamed to produceEngineOrBuilderBlock and this one now further undertakes the task of returning blinded response for local is requested by the validator via query param

Copy link

codecov bot commented Dec 23, 2023

Codecov Report

Merging #6227 (dc09a0e) into unstable (1200c59) will decrease coverage by 0.02%.
The diff coverage is n/a.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #6227      +/-   ##
============================================
- Coverage     80.95%   80.94%   -0.02%     
============================================
  Files           185      185              
  Lines         17935    17954      +19     
  Branches       1078     1080       +2     
============================================
+ Hits          14519    14532      +13     
- Misses         3389     3395       +6     
  Partials         27       27              

Base automatically changed from blobs-inclproof to unstable December 25, 2023 09:24
@g11tech g11tech marked this pull request as ready for review December 25, 2023 09:59
Copy link
Contributor

github-actions bot commented Dec 25, 2023

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: d596c0d Previous: 1200c59 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 807.12 us/op 773.76 us/op 1.04
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 84.012 us/op 80.228 us/op 1.05
BLS verify - blst-native 1.2528 ms/op 1.2735 ms/op 0.98
BLS verifyMultipleSignatures 3 - blst-native 2.6191 ms/op 2.6721 ms/op 0.98
BLS verifyMultipleSignatures 8 - blst-native 5.7300 ms/op 5.8582 ms/op 0.98
BLS verifyMultipleSignatures 32 - blst-native 20.992 ms/op 21.415 ms/op 0.98
BLS verifyMultipleSignatures 64 - blst-native 43.563 ms/op 42.169 ms/op 1.03
BLS verifyMultipleSignatures 128 - blst-native 86.378 ms/op 83.609 ms/op 1.03
BLS deserializing 10000 signatures 935.07 ms/op 909.90 ms/op 1.03
BLS deserializing 100000 signatures 9.3581 s/op 9.2158 s/op 1.02
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.3295 ms/op 1.3252 ms/op 1.00
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.4892 ms/op 1.4914 ms/op 1.00
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.2898 ms/op 2.7992 ms/op 0.82
BLS verifyMultipleSignatures - same message - 64 - blst-native 4.5133 ms/op 3.6391 ms/op 1.24
BLS verifyMultipleSignatures - same message - 128 - blst-native 7.5735 ms/op 7.3249 ms/op 1.03
BLS aggregatePubkeys 32 - blst-native 27.655 us/op 26.291 us/op 1.05
BLS aggregatePubkeys 128 - blst-native 101.33 us/op 96.535 us/op 1.05
getAttestationsForBlock 51.473 ms/op 47.805 ms/op 1.08
getSlashingsAndExits - default max 145.80 us/op 184.56 us/op 0.79
getSlashingsAndExits - 2k 550.98 us/op 366.62 us/op 1.50
proposeBlockBody type=full, size=empty 5.1749 ms/op 5.0129 ms/op 1.03
isKnown best case - 1 super set check 330.00 ns/op 311.00 ns/op 1.06
isKnown normal case - 2 super set checks 322.00 ns/op 312.00 ns/op 1.03
isKnown worse case - 16 super set checks 325.00 ns/op 293.00 ns/op 1.11
CheckpointStateCache - add get delete 5.2840 us/op 5.6150 us/op 0.94
validate api signedAggregateAndProof - struct 3.0401 ms/op 2.7024 ms/op 1.12
validate gossip signedAggregateAndProof - struct 2.7953 ms/op 2.7430 ms/op 1.02
validate gossip attestation - vc 640000 1.3240 ms/op 1.3067 ms/op 1.01
batch validate gossip attestation - vc 640000 - chunk 32 156.38 us/op 155.73 us/op 1.00
batch validate gossip attestation - vc 640000 - chunk 64 140.38 us/op 138.52 us/op 1.01
batch validate gossip attestation - vc 640000 - chunk 128 134.87 us/op 128.37 us/op 1.05
batch validate gossip attestation - vc 640000 - chunk 256 127.49 us/op 127.53 us/op 1.00
pickEth1Vote - no votes 1.1315 ms/op 1.1709 ms/op 0.97
pickEth1Vote - max votes 9.3944 ms/op 9.5993 ms/op 0.98
pickEth1Vote - Eth1Data hashTreeRoot value x2048 20.115 ms/op 19.391 ms/op 1.04
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 26.709 ms/op 28.342 ms/op 0.94
pickEth1Vote - Eth1Data fastSerialize value x2048 572.17 us/op 545.08 us/op 1.05
pickEth1Vote - Eth1Data fastSerialize tree x2048 5.4735 ms/op 6.3564 ms/op 0.86
bytes32 toHexString 495.00 ns/op 462.00 ns/op 1.07
bytes32 Buffer.toString(hex) 276.00 ns/op 270.00 ns/op 1.02
bytes32 Buffer.toString(hex) from Uint8Array 429.00 ns/op 397.00 ns/op 1.08
bytes32 Buffer.toString(hex) + 0x 277.00 ns/op 273.00 ns/op 1.01
Object access 1 prop 0.15400 ns/op 0.15100 ns/op 1.02
Map access 1 prop 0.13700 ns/op 0.14100 ns/op 0.97
Object get x1000 7.5600 ns/op 7.6270 ns/op 0.99
Map get x1000 0.75700 ns/op 0.71300 ns/op 1.06
Object set x1000 50.438 ns/op 47.615 ns/op 1.06
Map set x1000 39.297 ns/op 37.223 ns/op 1.06
Return object 10000 times 0.23780 ns/op 0.22890 ns/op 1.04
Throw Error 10000 times 3.9083 us/op 3.7261 us/op 1.05
fastMsgIdFn sha256 / 200 bytes 3.3080 us/op 3.1310 us/op 1.06
fastMsgIdFn h32 xxhash / 200 bytes 270.00 ns/op 258.00 ns/op 1.05
fastMsgIdFn h64 xxhash / 200 bytes 345.00 ns/op 321.00 ns/op 1.07
fastMsgIdFn sha256 / 1000 bytes 11.399 us/op 10.979 us/op 1.04
fastMsgIdFn h32 xxhash / 1000 bytes 399.00 ns/op 379.00 ns/op 1.05
fastMsgIdFn h64 xxhash / 1000 bytes 412.00 ns/op 396.00 ns/op 1.04
fastMsgIdFn sha256 / 10000 bytes 104.08 us/op 100.45 us/op 1.04
fastMsgIdFn h32 xxhash / 10000 bytes 1.8950 us/op 1.8310 us/op 1.03
fastMsgIdFn h64 xxhash / 10000 bytes 1.2910 us/op 1.2520 us/op 1.03
send data - 1000 256B messages 18.370 ms/op 18.062 ms/op 1.02
send data - 1000 512B messages 25.778 ms/op 24.565 ms/op 1.05
send data - 1000 1024B messages 39.842 ms/op 38.574 ms/op 1.03
send data - 1000 1200B messages 37.152 ms/op 37.016 ms/op 1.00
send data - 1000 2048B messages 43.947 ms/op 42.468 ms/op 1.03
send data - 1000 4096B messages 42.697 ms/op 39.643 ms/op 1.08
send data - 1000 16384B messages 118.54 ms/op 114.91 ms/op 1.03
send data - 1000 65536B messages 494.49 ms/op 475.41 ms/op 1.04
enrSubnets - fastDeserialize 64 bits 1.2590 us/op 1.2000 us/op 1.05
enrSubnets - ssz BitVector 64 bits 421.00 ns/op 419.00 ns/op 1.00
enrSubnets - fastDeserialize 4 bits 169.00 ns/op 164.00 ns/op 1.03
enrSubnets - ssz BitVector 4 bits 429.00 ns/op 416.00 ns/op 1.03
prioritizePeers score -10:0 att 32-0.1 sync 2-0 101.20 us/op 97.417 us/op 1.04
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 127.06 us/op 121.65 us/op 1.04
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 178.66 us/op 154.93 us/op 1.15
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 313.84 us/op 284.36 us/op 1.10
prioritizePeers score 0:0 att 64-1 sync 4-1 386.68 us/op 341.18 us/op 1.13
array of 16000 items push then shift 1.6590 us/op 1.5627 us/op 1.06
LinkedList of 16000 items push then shift 9.3590 ns/op 8.6560 ns/op 1.08
array of 16000 items push then pop 54.825 ns/op 70.072 ns/op 0.78
LinkedList of 16000 items push then pop 9.0680 ns/op 8.4640 ns/op 1.07
array of 24000 items push then shift 2.4689 us/op 2.3788 us/op 1.04
LinkedList of 24000 items push then shift 8.7530 ns/op 8.7990 ns/op 0.99
array of 24000 items push then pop 112.43 ns/op 95.100 ns/op 1.18
LinkedList of 24000 items push then pop 9.3370 ns/op 8.5320 ns/op 1.09
intersect bitArray bitLen 8 6.6690 ns/op 6.1570 ns/op 1.08
intersect array and set length 8 68.626 ns/op 59.855 ns/op 1.15
intersect bitArray bitLen 128 34.739 ns/op 32.709 ns/op 1.06
intersect array and set length 128 945.04 ns/op 838.17 ns/op 1.13
bitArray.getTrueBitIndexes() bitLen 128 1.7520 us/op 1.4000 us/op 1.25
bitArray.getTrueBitIndexes() bitLen 248 2.8170 us/op 2.3410 us/op 1.20
bitArray.getTrueBitIndexes() bitLen 512 5.1020 us/op 4.5570 us/op 1.12
Buffer.concat 32 items 925.00 ns/op 943.00 ns/op 0.98
Uint8Array.set 32 items 1.6040 us/op 1.8140 us/op 0.88
Set add up to 64 items then delete first 4.4815 us/op 4.2640 us/op 1.05
OrderedSet add up to 64 items then delete first 5.6089 us/op 5.3503 us/op 1.05
Set add up to 64 items then delete last 4.7354 us/op 4.5285 us/op 1.05
OrderedSet add up to 64 items then delete last 5.9343 us/op 5.6544 us/op 1.05
Set add up to 64 items then delete middle 4.6443 us/op 4.5275 us/op 1.03
OrderedSet add up to 64 items then delete middle 7.2234 us/op 6.9260 us/op 1.04
Set add up to 128 items then delete first 9.6647 us/op 9.2688 us/op 1.04
OrderedSet add up to 128 items then delete first 13.196 us/op 12.223 us/op 1.08
Set add up to 128 items then delete last 9.5776 us/op 9.0973 us/op 1.05
OrderedSet add up to 128 items then delete last 11.907 us/op 11.466 us/op 1.04
Set add up to 128 items then delete middle 9.2791 us/op 8.9614 us/op 1.04
OrderedSet add up to 128 items then delete middle 17.275 us/op 16.683 us/op 1.04
Set add up to 256 items then delete first 19.202 us/op 18.453 us/op 1.04
OrderedSet add up to 256 items then delete first 25.592 us/op 25.008 us/op 1.02
Set add up to 256 items then delete last 18.681 us/op 18.147 us/op 1.03
OrderedSet add up to 256 items then delete last 24.353 us/op 23.167 us/op 1.05
Set add up to 256 items then delete middle 19.134 us/op 17.996 us/op 1.06
OrderedSet add up to 256 items then delete middle 46.712 us/op 45.472 us/op 1.03
transfer serialized Status (84 B) 1.7790 us/op 1.7040 us/op 1.04
copy serialized Status (84 B) 1.5510 us/op 1.4150 us/op 1.10
transfer serialized SignedVoluntaryExit (112 B) 2.1340 us/op 1.8360 us/op 1.16
copy serialized SignedVoluntaryExit (112 B) 1.6650 us/op 1.5000 us/op 1.11
transfer serialized ProposerSlashing (416 B) 2.7610 us/op 2.1780 us/op 1.27
copy serialized ProposerSlashing (416 B) 2.6400 us/op 2.2880 us/op 1.15
transfer serialized Attestation (485 B) 2.9380 us/op 2.6650 us/op 1.10
copy serialized Attestation (485 B) 2.7610 us/op 2.6910 us/op 1.03
transfer serialized AttesterSlashing (33232 B) 3.0560 us/op 2.8910 us/op 1.06
copy serialized AttesterSlashing (33232 B) 8.0410 us/op 5.8700 us/op 1.37
transfer serialized Small SignedBeaconBlock (128000 B) 3.4310 us/op 2.8870 us/op 1.19
copy serialized Small SignedBeaconBlock (128000 B) 18.269 us/op 14.891 us/op 1.23
transfer serialized Avg SignedBeaconBlock (200000 B) 2.8440 us/op 3.3150 us/op 0.86
copy serialized Avg SignedBeaconBlock (200000 B) 25.862 us/op 20.901 us/op 1.24
transfer serialized BlobsSidecar (524380 B) 3.0510 us/op 3.1380 us/op 0.97
copy serialized BlobsSidecar (524380 B) 92.843 us/op 116.22 us/op 0.80
transfer serialized Big SignedBeaconBlock (1000000 B) 3.3460 us/op 3.2810 us/op 1.02
copy serialized Big SignedBeaconBlock (1000000 B) 158.36 us/op 152.15 us/op 1.04
pass gossip attestations to forkchoice per slot 3.8739 ms/op 3.8168 ms/op 1.01
forkChoice updateHead vc 100000 bc 64 eq 0 694.84 us/op 669.74 us/op 1.04
forkChoice updateHead vc 600000 bc 64 eq 0 4.2577 ms/op 4.4347 ms/op 0.96
forkChoice updateHead vc 1000000 bc 64 eq 0 7.7933 ms/op 6.9767 ms/op 1.12
forkChoice updateHead vc 600000 bc 320 eq 0 5.8004 ms/op 4.1915 ms/op 1.38
forkChoice updateHead vc 600000 bc 1200 eq 0 4.5177 ms/op 4.3422 ms/op 1.04
forkChoice updateHead vc 600000 bc 7200 eq 0 5.4578 ms/op 5.3508 ms/op 1.02
forkChoice updateHead vc 600000 bc 64 eq 1000 11.702 ms/op 11.201 ms/op 1.04
forkChoice updateHead vc 600000 bc 64 eq 10000 12.754 ms/op 11.766 ms/op 1.08
forkChoice updateHead vc 600000 bc 64 eq 300000 16.463 ms/op 15.797 ms/op 1.04
computeDeltas 500000 validators 300 proto nodes 6.8067 ms/op 6.4779 ms/op 1.05
computeDeltas 500000 validators 1200 proto nodes 6.4797 ms/op 6.4296 ms/op 1.01
computeDeltas 500000 validators 7200 proto nodes 6.4172 ms/op 6.2796 ms/op 1.02
computeDeltas 750000 validators 300 proto nodes 9.7840 ms/op 9.9190 ms/op 0.99
computeDeltas 750000 validators 1200 proto nodes 9.9346 ms/op 9.7638 ms/op 1.02
computeDeltas 750000 validators 7200 proto nodes 9.6210 ms/op 9.8104 ms/op 0.98
computeDeltas 1400000 validators 300 proto nodes 18.358 ms/op 19.224 ms/op 0.95
computeDeltas 1400000 validators 1200 proto nodes 18.453 ms/op 19.975 ms/op 0.92
computeDeltas 1400000 validators 7200 proto nodes 18.577 ms/op 19.938 ms/op 0.93
computeDeltas 2100000 validators 300 proto nodes 27.526 ms/op 28.405 ms/op 0.97
computeDeltas 2100000 validators 1200 proto nodes 27.190 ms/op 28.749 ms/op 0.95
computeDeltas 2100000 validators 7200 proto nodes 26.823 ms/op 27.122 ms/op 0.99
computeProposerBoostScoreFromBalances 500000 validators 3.7688 ms/op 3.6909 ms/op 1.02
computeProposerBoostScoreFromBalances 750000 validators 3.7217 ms/op 3.6891 ms/op 1.01
computeProposerBoostScoreFromBalances 1400000 validators 3.7927 ms/op 3.6315 ms/op 1.04
computeProposerBoostScoreFromBalances 2100000 validators 3.7491 ms/op 3.6951 ms/op 1.01
altair processAttestation - 250000 vs - 7PWei normalcase 2.2047 ms/op 2.2976 ms/op 0.96
altair processAttestation - 250000 vs - 7PWei worstcase 3.3085 ms/op 3.4650 ms/op 0.95
altair processAttestation - setStatus - 1/6 committees join 146.47 us/op 174.66 us/op 0.84
altair processAttestation - setStatus - 1/3 committees join 290.93 us/op 337.44 us/op 0.86
altair processAttestation - setStatus - 1/2 committees join 397.28 us/op 457.31 us/op 0.87
altair processAttestation - setStatus - 2/3 committees join 503.18 us/op 571.63 us/op 0.88
altair processAttestation - setStatus - 4/5 committees join 679.13 us/op 770.10 us/op 0.88
altair processAttestation - setStatus - 100% committees join 828.02 us/op 894.23 us/op 0.93
altair processBlock - 250000 vs - 7PWei normalcase 7.8482 ms/op 9.7272 ms/op 0.81
altair processBlock - 250000 vs - 7PWei normalcase hashState 35.313 ms/op 39.148 ms/op 0.90
altair processBlock - 250000 vs - 7PWei worstcase 41.537 ms/op 36.169 ms/op 1.15
altair processBlock - 250000 vs - 7PWei worstcase hashState 93.103 ms/op 95.194 ms/op 0.98
phase0 processBlock - 250000 vs - 7PWei normalcase 2.6151 ms/op 2.4537 ms/op 1.07
phase0 processBlock - 250000 vs - 7PWei worstcase 32.234 ms/op 29.315 ms/op 1.10
altair processEth1Data - 250000 vs - 7PWei normalcase 593.82 us/op 556.86 us/op 1.07
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 10.292 us/op 8.8090 us/op 1.17
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 49.025 us/op 57.586 us/op 0.85
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 17.457 us/op 14.672 us/op 1.19
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 11.280 us/op 9.6140 us/op 1.17
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 191.30 us/op 158.67 us/op 1.21
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.1315 ms/op 1.0226 ms/op 1.11
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.6162 ms/op 1.4569 ms/op 1.11
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.5941 ms/op 1.7823 ms/op 0.89
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.8643 ms/op 3.0851 ms/op 1.25
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.3459 ms/op 2.1766 ms/op 1.08
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.8931 ms/op 5.0731 ms/op 0.96
Tree 40 250000 create 316.76 ms/op 337.58 ms/op 0.94
Tree 40 250000 get(125000) 192.79 ns/op 185.54 ns/op 1.04
Tree 40 250000 set(125000) 910.68 ns/op 990.76 ns/op 0.92
Tree 40 250000 toArray() 17.556 ms/op 18.397 ms/op 0.95
Tree 40 250000 iterate all - toArray() + loop 17.633 ms/op 18.398 ms/op 0.96
Tree 40 250000 iterate all - get(i) 62.837 ms/op 63.738 ms/op 0.99
MutableVector 250000 create 11.017 ms/op 11.663 ms/op 0.94
MutableVector 250000 get(125000) 6.1560 ns/op 6.5010 ns/op 0.95
MutableVector 250000 set(125000) 258.85 ns/op 268.93 ns/op 0.96
MutableVector 250000 toArray() 3.1706 ms/op 3.1295 ms/op 1.01
MutableVector 250000 iterate all - toArray() + loop 3.1999 ms/op 3.2592 ms/op 0.98
MutableVector 250000 iterate all - get(i) 1.4710 ms/op 1.5257 ms/op 0.96
Array 250000 create 2.7587 ms/op 3.2357 ms/op 0.85
Array 250000 clone - spread 1.2250 ms/op 1.2026 ms/op 1.02
Array 250000 get(125000) 1.0310 ns/op 0.99000 ns/op 1.04
Array 250000 set(125000) 4.0600 ns/op 3.9880 ns/op 1.02
Array 250000 iterate all - loop 163.50 us/op 162.19 us/op 1.01
effectiveBalanceIncrements clone Uint8Array 300000 28.118 us/op 23.957 us/op 1.17
effectiveBalanceIncrements clone MutableVector 300000 366.00 ns/op 335.00 ns/op 1.09
effectiveBalanceIncrements rw all Uint8Array 300000 196.19 us/op 195.90 us/op 1.00
effectiveBalanceIncrements rw all MutableVector 300000 81.444 ms/op 78.874 ms/op 1.03
phase0 afterProcessEpoch - 250000 vs - 7PWei 106.95 ms/op 111.37 ms/op 0.96
phase0 beforeProcessEpoch - 250000 vs - 7PWei 49.139 ms/op 53.056 ms/op 0.93
altair processEpoch - mainnet_e81889 487.50 ms/op 473.93 ms/op 1.03
mainnet_e81889 - altair beforeProcessEpoch 79.040 ms/op 85.708 ms/op 0.92
mainnet_e81889 - altair processJustificationAndFinalization 13.932 us/op 14.236 us/op 0.98
mainnet_e81889 - altair processInactivityUpdates 5.6015 ms/op 5.7833 ms/op 0.97
mainnet_e81889 - altair processRewardsAndPenalties 62.198 ms/op 40.335 ms/op 1.54
mainnet_e81889 - altair processRegistryUpdates 2.4950 us/op 2.4680 us/op 1.01
mainnet_e81889 - altair processSlashings 405.00 ns/op 437.00 ns/op 0.93
mainnet_e81889 - altair processEth1DataReset 448.00 ns/op 468.00 ns/op 0.96
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.4171 ms/op 1.4155 ms/op 1.00
mainnet_e81889 - altair processSlashingsReset 2.7990 us/op 3.6480 us/op 0.77
mainnet_e81889 - altair processRandaoMixesReset 4.8120 us/op 3.9140 us/op 1.23
mainnet_e81889 - altair processHistoricalRootsUpdate 915.00 ns/op 728.00 ns/op 1.26
mainnet_e81889 - altair processParticipationFlagUpdates 1.9180 us/op 1.3640 us/op 1.41
mainnet_e81889 - altair processSyncCommitteeUpdates 746.00 ns/op 766.00 ns/op 0.97
mainnet_e81889 - altair afterProcessEpoch 122.48 ms/op 117.03 ms/op 1.05
capella processEpoch - mainnet_e217614 2.1372 s/op 2.1229 s/op 1.01
mainnet_e217614 - capella beforeProcessEpoch 508.64 ms/op 508.69 ms/op 1.00
mainnet_e217614 - capella processJustificationAndFinalization 15.075 us/op 19.084 us/op 0.79
mainnet_e217614 - capella processInactivityUpdates 17.100 ms/op 22.746 ms/op 0.75
mainnet_e217614 - capella processRewardsAndPenalties 417.14 ms/op 423.24 ms/op 0.99
mainnet_e217614 - capella processRegistryUpdates 21.681 us/op 15.091 us/op 1.44
mainnet_e217614 - capella processSlashings 500.00 ns/op 549.00 ns/op 0.91
mainnet_e217614 - capella processEth1DataReset 623.00 ns/op 589.00 ns/op 1.06
mainnet_e217614 - capella processEffectiveBalanceUpdates 7.9676 ms/op 4.5279 ms/op 1.76
mainnet_e217614 - capella processSlashingsReset 3.7340 us/op 2.8050 us/op 1.33
mainnet_e217614 - capella processRandaoMixesReset 7.5160 us/op 3.8930 us/op 1.93
mainnet_e217614 - capella processHistoricalRootsUpdate 915.00 ns/op 508.00 ns/op 1.80
mainnet_e217614 - capella processParticipationFlagUpdates 1.6590 us/op 1.3440 us/op 1.23
mainnet_e217614 - capella afterProcessEpoch 346.90 ms/op 297.78 ms/op 1.16
phase0 processEpoch - mainnet_e58758 522.87 ms/op 433.37 ms/op 1.21
mainnet_e58758 - phase0 beforeProcessEpoch 190.07 ms/op 130.84 ms/op 1.45
mainnet_e58758 - phase0 processJustificationAndFinalization 20.157 us/op 15.624 us/op 1.29
mainnet_e58758 - phase0 processRewardsAndPenalties 58.045 ms/op 55.248 ms/op 1.05
mainnet_e58758 - phase0 processRegistryUpdates 14.172 us/op 8.8390 us/op 1.60
mainnet_e58758 - phase0 processSlashings 625.00 ns/op 552.00 ns/op 1.13
mainnet_e58758 - phase0 processEth1DataReset 526.00 ns/op 414.00 ns/op 1.27
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.2520 ms/op 1.1546 ms/op 1.08
mainnet_e58758 - phase0 processSlashingsReset 4.5380 us/op 2.6470 us/op 1.71
mainnet_e58758 - phase0 processRandaoMixesReset 4.5620 us/op 3.9840 us/op 1.15
mainnet_e58758 - phase0 processHistoricalRootsUpdate 545.00 ns/op 513.00 ns/op 1.06
mainnet_e58758 - phase0 processParticipationRecordUpdates 5.3220 us/op 3.0810 us/op 1.73
mainnet_e58758 - phase0 afterProcessEpoch 104.99 ms/op 93.998 ms/op 1.12
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.4857 ms/op 1.3423 ms/op 1.11
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5795 ms/op 1.4540 ms/op 1.09
altair processInactivityUpdates - 250000 normalcase 36.539 ms/op 19.719 ms/op 1.85
altair processInactivityUpdates - 250000 worstcase 28.336 ms/op 20.381 ms/op 1.39
phase0 processRegistryUpdates - 250000 normalcase 12.515 us/op 7.7090 us/op 1.62
phase0 processRegistryUpdates - 250000 badcase_full_deposits 452.39 us/op 324.44 us/op 1.39
phase0 processRegistryUpdates - 250000 worstcase 0.5 164.10 ms/op 136.58 ms/op 1.20
altair processRewardsAndPenalties - 250000 normalcase 60.417 ms/op 54.865 ms/op 1.10
altair processRewardsAndPenalties - 250000 worstcase 59.115 ms/op 52.677 ms/op 1.12
phase0 getAttestationDeltas - 250000 normalcase 8.3521 ms/op 8.8107 ms/op 0.95
phase0 getAttestationDeltas - 250000 worstcase 8.6720 ms/op 8.7546 ms/op 0.99
phase0 processSlashings - 250000 worstcase 100.97 us/op 80.714 us/op 1.25
altair processSyncCommitteeUpdates - 250000 161.49 ms/op 153.30 ms/op 1.05
BeaconState.hashTreeRoot - No change 280.00 ns/op 249.00 ns/op 1.12
BeaconState.hashTreeRoot - 1 full validator 132.37 us/op 141.25 us/op 0.94
BeaconState.hashTreeRoot - 32 full validator 1.4356 ms/op 1.4439 ms/op 0.99
BeaconState.hashTreeRoot - 512 full validator 17.259 ms/op 15.542 ms/op 1.11
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 204.77 us/op 178.55 us/op 1.15
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.6258 ms/op 1.9376 ms/op 1.36
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 29.882 ms/op 24.513 ms/op 1.22
BeaconState.hashTreeRoot - 1 balances 155.74 us/op 114.10 us/op 1.36
BeaconState.hashTreeRoot - 32 balances 1.2051 ms/op 1.2865 ms/op 0.94
BeaconState.hashTreeRoot - 512 balances 10.622 ms/op 12.754 ms/op 0.83
BeaconState.hashTreeRoot - 250000 balances 244.56 ms/op 195.30 ms/op 1.25
aggregationBits - 2048 els - zipIndexesInBitList 36.667 us/op 17.936 us/op 2.04
byteArrayEquals 32 75.292 ns/op 74.637 ns/op 1.01
Buffer.compare 32 57.355 ns/op 55.750 ns/op 1.03
byteArrayEquals 1024 2.1028 us/op 2.0238 us/op 1.04
Buffer.compare 1024 72.527 ns/op 71.613 ns/op 1.01
byteArrayEquals 16384 32.934 us/op 32.407 us/op 1.02
Buffer.compare 16384 275.97 ns/op 269.58 ns/op 1.02
byteArrayEquals 123687377 251.10 ms/op 250.99 ms/op 1.00
Buffer.compare 123687377 7.5353 ms/op 6.0576 ms/op 1.24
byteArrayEquals 32 - diff last byte 78.886 ns/op 72.948 ns/op 1.08
Buffer.compare 32 - diff last byte 63.369 ns/op 57.415 ns/op 1.10
byteArrayEquals 1024 - diff last byte 2.0960 us/op 2.0577 us/op 1.02
Buffer.compare 1024 - diff last byte 74.854 ns/op 74.485 ns/op 1.00
byteArrayEquals 16384 - diff last byte 33.509 us/op 32.743 us/op 1.02
Buffer.compare 16384 - diff last byte 265.46 ns/op 246.12 ns/op 1.08
byteArrayEquals 123687377 - diff last byte 257.78 ms/op 244.31 ms/op 1.06
Buffer.compare 123687377 - diff last byte 9.6253 ms/op 6.1137 ms/op 1.57
byteArrayEquals 32 - random bytes 5.5930 ns/op 5.2610 ns/op 1.06
Buffer.compare 32 - random bytes 63.397 ns/op 58.940 ns/op 1.08
byteArrayEquals 1024 - random bytes 6.0180 ns/op 7.1830 ns/op 0.84
Buffer.compare 1024 - random bytes 62.840 ns/op 58.367 ns/op 1.08
byteArrayEquals 16384 - random bytes 5.7470 ns/op 5.0540 ns/op 1.14
Buffer.compare 16384 - random bytes 62.975 ns/op 58.420 ns/op 1.08
byteArrayEquals 123687377 - random bytes 8.8400 ns/op 8.2100 ns/op 1.08
Buffer.compare 123687377 - random bytes 70.000 ns/op 61.670 ns/op 1.14
regular array get 100000 times 47.281 us/op 43.019 us/op 1.10
wrappedArray get 100000 times 47.037 us/op 43.036 us/op 1.09
arrayWithProxy get 100000 times 14.698 ms/op 14.372 ms/op 1.02
ssz.Root.equals 56.698 ns/op 52.394 ns/op 1.08
byteArrayEquals 55.341 ns/op 51.289 ns/op 1.08
Buffer.compare 13.107 ns/op 10.448 ns/op 1.25
shuffle list - 16384 els 7.6126 ms/op 6.8176 ms/op 1.12
shuffle list - 250000 els 104.64 ms/op 99.671 ms/op 1.05
processSlot - 1 slots 18.898 us/op 16.120 us/op 1.17
processSlot - 32 slots 3.5327 ms/op 3.2216 ms/op 1.10
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 65.422 ms/op 58.393 ms/op 1.12
getCommitteeAssignments - req 1 vs - 250000 vc 2.5921 ms/op 2.4537 ms/op 1.06
getCommitteeAssignments - req 100 vs - 250000 vc 3.9403 ms/op 3.6239 ms/op 1.09
getCommitteeAssignments - req 1000 vs - 250000 vc 4.2738 ms/op 4.0692 ms/op 1.05
findModifiedValidators - 10000 modified validators 549.79 ms/op 530.92 ms/op 1.04
findModifiedValidators - 1000 modified validators 454.43 ms/op 421.67 ms/op 1.08
findModifiedValidators - 100 modified validators 581.16 ms/op 420.65 ms/op 1.38
findModifiedValidators - 10 modified validators 485.41 ms/op 388.59 ms/op 1.25
findModifiedValidators - 1 modified validators 466.72 ms/op 395.21 ms/op 1.18
findModifiedValidators - no difference 477.86 ms/op 409.10 ms/op 1.17
compare ViewDUs 4.7745 s/op 4.3091 s/op 1.11
compare each validator Uint8Array 1.9614 s/op 1.8792 s/op 1.04
compare ViewDU to Uint8Array 1.1708 s/op 1.1009 s/op 1.06
migrate state 1000000 validators, 24 modified, 0 new 801.61 ms/op 766.10 ms/op 1.05
migrate state 1000000 validators, 1700 modified, 1000 new 1.1020 s/op 1.0694 s/op 1.03
migrate state 1000000 validators, 3400 modified, 2000 new 1.3203 s/op 1.3239 s/op 1.00
migrate state 1500000 validators, 24 modified, 0 new 810.27 ms/op 791.93 ms/op 1.02
migrate state 1500000 validators, 1700 modified, 1000 new 1.1168 s/op 1.1054 s/op 1.01
migrate state 1500000 validators, 3400 modified, 2000 new 1.3311 s/op 1.3488 s/op 0.99
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.2400 ns/op 4.3000 ns/op 0.99
state getBlockRootAtSlot - 250000 vs - 7PWei 905.33 ns/op 535.22 ns/op 1.69
computeProposers - vc 250000 9.8444 ms/op 9.0298 ms/op 1.09
computeEpochShuffling - vc 250000 103.18 ms/op 103.55 ms/op 1.00
getNextSyncCommittee - vc 250000 152.36 ms/op 153.41 ms/op 0.99
computeSigningRoot for AttestationData 27.071 us/op 23.317 us/op 1.16
hash AttestationData serialized data then Buffer.toString(base64) 2.1799 us/op 2.3464 us/op 0.93
toHexString serialized data 1.0502 us/op 1.1035 us/op 0.95
Buffer.toString(base64) 212.44 ns/op 217.37 ns/op 0.98

by benchmarkbot/action

// of local block and subsequent publishing via publishBlindedBlock
clientOptions: {
useProduceBlockV3: false,
"builder.selection": "maxprofit",
Copy link
Contributor

Choose a reason for hiding this comment

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

need to set blindedLocal: true here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no this doesn't use produceBlockV3 flow but calls older method of produceBlindedBlockV2 which also blinds local and return it in the blinded fashion just like produceBlockV3 does but with less metadata in the response

@g11tech g11tech merged commit c86a669 into unstable Dec 31, 2023
14 of 15 checks passed
@g11tech g11tech deleted the blinded-local branch December 31, 2023 08:07
nflaig added a commit that referenced this pull request Jan 7, 2024
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.14.0 🎉

ensi321 pushed a commit to ensi321/lodestar that referenced this pull request Jan 22, 2024
…d and selected blocks (ChainSafe#6227)

* feat: allow validator to request blinded versions for locally produced and selected blocks

lint

fix the types and tests

* add blinded local combinations to sim

* debug and fix issues
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.

publishBlockV2: latency streaming body from vc to bn due to big payload
3 participants