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: forward blinded block ssz bytes to submitBlindedBlock api #7185

Merged
merged 3 commits into from
Oct 28, 2024

Conversation

nflaig
Copy link
Member

@nflaig nflaig commented Oct 21, 2024

Motivation

Follow up on #7180 to forward blinded block bytes directly to submitBlindedBlock to save an extra serialization step.

Description

Forwards the raw ssz bytes of blinded block and use those when submitting blinded block to the builder.

I went with an optional extra argument as this seemed the least complicated / messy in terms of handling.

From a simple function signature point of view, something like

signedBlindedBlock: SignedBlindedBeaconBlock | Uint8Array

might be cleaner but this causes bunch of issues such as having to extract slot from bytes or handling bytes in JSON serialization case.

We always have to deserialize the SignedBlindedBeaconBlock to reconstruct the full block, so there would be no benefit there.

@nflaig nflaig requested a review from a team as a code owner October 21, 2024 17:24
Copy link

codecov bot commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.21%. Comparing base (0e4ea98) to head (288fe51).
Report is 8 commits behind head on unstable.

Additional details and impacted files
@@            Coverage Diff            @@
##           unstable    #7185   +/-   ##
=========================================
  Coverage     49.21%   49.21%           
=========================================
  Files           598      598           
  Lines         39794    39796    +2     
  Branches       2093     2090    -3     
=========================================
+ Hits          19584    19586    +2     
  Misses        20170    20170           
  Partials         40       40           

Copy link
Contributor

github-actions bot commented Oct 21, 2024

Performance Report

✔️ no performance regression detected

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: 1a64e04 Previous: 0e4ea98 Ratio
altair processAttestation - setStatus - 1/2 committees join 197.23 us/op 647.38 us/op 0.30
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.0751 ms/op 3.3776 ms/op 0.32
Full benchmark results
Benchmark suite Current: 1a64e04 Previous: 0e4ea98 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.8371 ms/op 2.0059 ms/op 0.92
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 42.864 us/op 52.802 us/op 0.81
BLS verify - blst 893.46 us/op 1.0596 ms/op 0.84
BLS verifyMultipleSignatures 3 - blst 1.2688 ms/op 1.5554 ms/op 0.82
BLS verifyMultipleSignatures 8 - blst 2.0613 ms/op 2.1669 ms/op 0.95
BLS verifyMultipleSignatures 32 - blst 4.4541 ms/op 6.5700 ms/op 0.68
BLS verifyMultipleSignatures 64 - blst 8.3287 ms/op 10.692 ms/op 0.78
BLS verifyMultipleSignatures 128 - blst 15.847 ms/op 16.812 ms/op 0.94
BLS deserializing 10000 signatures 609.04 ms/op 677.33 ms/op 0.90
BLS deserializing 100000 signatures 6.1217 s/op 6.8036 s/op 0.90
BLS verifyMultipleSignatures - same message - 3 - blst 934.82 us/op 1.1141 ms/op 0.84
BLS verifyMultipleSignatures - same message - 8 - blst 1.0709 ms/op 1.2213 ms/op 0.88
BLS verifyMultipleSignatures - same message - 32 - blst 1.6956 ms/op 1.9477 ms/op 0.87
BLS verifyMultipleSignatures - same message - 64 - blst 2.5591 ms/op 2.7373 ms/op 0.93
BLS verifyMultipleSignatures - same message - 128 - blst 4.2002 ms/op 4.2726 ms/op 0.98
BLS aggregatePubkeys 32 - blst 18.101 us/op 19.929 us/op 0.91
BLS aggregatePubkeys 128 - blst 62.060 us/op 69.957 us/op 0.89
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 62.159 ms/op 68.645 ms/op 0.91
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 48.876 ms/op 82.275 ms/op 0.59
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 36.160 ms/op 49.766 ms/op 0.73
getSlashingsAndExits - default max 62.886 us/op 99.023 us/op 0.64
getSlashingsAndExits - 2k 242.38 us/op 341.76 us/op 0.71
proposeBlockBody type=full, size=empty 4.8315 ms/op 7.0070 ms/op 0.69
isKnown best case - 1 super set check 463.00 ns/op 333.00 ns/op 1.39
isKnown normal case - 2 super set checks 463.00 ns/op 401.00 ns/op 1.15
isKnown worse case - 16 super set checks 464.00 ns/op 391.00 ns/op 1.19
InMemoryCheckpointStateCache - add get delete 2.6570 us/op 3.1950 us/op 0.83
updateUnfinalizedPubkeys - updating 10 pubkeys 913.60 us/op 1.4246 ms/op 0.64
updateUnfinalizedPubkeys - updating 100 pubkeys 3.2170 ms/op 3.6270 ms/op 0.89
updateUnfinalizedPubkeys - updating 1000 pubkeys 38.195 ms/op 62.567 ms/op 0.61
validate api signedAggregateAndProof - struct 1.4980 ms/op 2.9206 ms/op 0.51
validate gossip signedAggregateAndProof - struct 1.4305 ms/op 2.0658 ms/op 0.69
batch validate gossip attestation - vc 640000 - chunk 32 119.16 us/op 137.91 us/op 0.86
batch validate gossip attestation - vc 640000 - chunk 64 108.84 us/op 122.73 us/op 0.89
batch validate gossip attestation - vc 640000 - chunk 128 98.986 us/op 114.01 us/op 0.87
batch validate gossip attestation - vc 640000 - chunk 256 95.772 us/op 108.49 us/op 0.88
pickEth1Vote - no votes 887.40 us/op 1.0255 ms/op 0.87
pickEth1Vote - max votes 5.2778 ms/op 7.1150 ms/op 0.74
pickEth1Vote - Eth1Data hashTreeRoot value x2048 10.603 ms/op 15.159 ms/op 0.70
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 16.718 ms/op 22.728 ms/op 0.74
pickEth1Vote - Eth1Data fastSerialize value x2048 425.19 us/op 452.00 us/op 0.94
pickEth1Vote - Eth1Data fastSerialize tree x2048 3.1630 ms/op 4.0139 ms/op 0.79
bytes32 toHexString 848.00 ns/op 434.00 ns/op 1.95
bytes32 Buffer.toString(hex) 485.00 ns/op 250.00 ns/op 1.94
bytes32 Buffer.toString(hex) from Uint8Array 623.00 ns/op 362.00 ns/op 1.72
bytes32 Buffer.toString(hex) + 0x 447.00 ns/op 254.00 ns/op 1.76
Object access 1 prop 0.33200 ns/op 0.13300 ns/op 2.50
Map access 1 prop 0.32800 ns/op 0.13100 ns/op 2.50
Object get x1000 5.1730 ns/op 6.0210 ns/op 0.86
Map get x1000 6.0770 ns/op 6.3380 ns/op 0.96
Object set x1000 27.654 ns/op 33.319 ns/op 0.83
Map set x1000 22.260 ns/op 22.099 ns/op 1.01
Return object 10000 times 0.31070 ns/op 0.28680 ns/op 1.08
Throw Error 10000 times 2.7389 us/op 3.3022 us/op 0.83
toHex 113.82 ns/op 145.89 ns/op 0.78
Buffer.from 104.45 ns/op 148.93 ns/op 0.70
shared Buffer 71.515 ns/op 87.221 ns/op 0.82
fastMsgIdFn sha256 / 200 bytes 2.0160 us/op 2.1690 us/op 0.93
fastMsgIdFn h32 xxhash / 200 bytes 432.00 ns/op 231.00 ns/op 1.87
fastMsgIdFn h64 xxhash / 200 bytes 476.00 ns/op 265.00 ns/op 1.80
fastMsgIdFn sha256 / 1000 bytes 6.0120 us/op 7.2990 us/op 0.82
fastMsgIdFn h32 xxhash / 1000 bytes 603.00 ns/op 360.00 ns/op 1.68
fastMsgIdFn h64 xxhash / 1000 bytes 589.00 ns/op 334.00 ns/op 1.76
fastMsgIdFn sha256 / 10000 bytes 48.471 us/op 64.585 us/op 0.75
fastMsgIdFn h32 xxhash / 10000 bytes 2.0450 us/op 1.8310 us/op 1.12
fastMsgIdFn h64 xxhash / 10000 bytes 1.3880 us/op 1.2120 us/op 1.15
send data - 1000 256B messages 10.143 ms/op 13.121 ms/op 0.77
send data - 1000 512B messages 12.741 ms/op 16.463 ms/op 0.77
send data - 1000 1024B messages 23.644 ms/op 28.366 ms/op 0.83
send data - 1000 1200B messages 24.208 ms/op 27.838 ms/op 0.87
send data - 1000 2048B messages 29.415 ms/op 33.181 ms/op 0.89
send data - 1000 4096B messages 28.981 ms/op 31.330 ms/op 0.93
send data - 1000 16384B messages 66.671 ms/op 71.958 ms/op 0.93
send data - 1000 65536B messages 278.42 ms/op 221.19 ms/op 1.26
enrSubnets - fastDeserialize 64 bits 1.1580 us/op 1.0810 us/op 1.07
enrSubnets - ssz BitVector 64 bits 540.00 ns/op 348.00 ns/op 1.55
enrSubnets - fastDeserialize 4 bits 342.00 ns/op 142.00 ns/op 2.41
enrSubnets - ssz BitVector 4 bits 526.00 ns/op 352.00 ns/op 1.49
prioritizePeers score -10:0 att 32-0.1 sync 2-0 142.15 us/op 159.62 us/op 0.89
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 156.34 us/op 139.29 us/op 1.12
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 327.73 us/op 229.53 us/op 1.43
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 508.62 us/op 600.01 us/op 0.85
prioritizePeers score 0:0 att 64-1 sync 4-1 508.60 us/op 857.27 us/op 0.59
array of 16000 items push then shift 1.3425 us/op 1.6195 us/op 0.83
LinkedList of 16000 items push then shift 6.4920 ns/op 7.0970 ns/op 0.91
array of 16000 items push then pop 77.512 ns/op 114.10 ns/op 0.68
LinkedList of 16000 items push then pop 6.3420 ns/op 6.9250 ns/op 0.92
array of 24000 items push then shift 1.9185 us/op 2.3825 us/op 0.81
LinkedList of 24000 items push then shift 7.2870 ns/op 6.9990 ns/op 1.04
array of 24000 items push then pop 134.98 ns/op 135.84 ns/op 0.99
LinkedList of 24000 items push then pop 5.9660 ns/op 6.8360 ns/op 0.87
intersect bitArray bitLen 8 5.1400 ns/op 6.3530 ns/op 0.81
intersect array and set length 8 37.760 ns/op 46.517 ns/op 0.81
intersect bitArray bitLen 128 25.047 ns/op 29.311 ns/op 0.85
intersect array and set length 128 553.56 ns/op 671.89 ns/op 0.82
bitArray.getTrueBitIndexes() bitLen 128 1.9240 us/op 2.5700 us/op 0.75
bitArray.getTrueBitIndexes() bitLen 248 3.2180 us/op 3.7180 us/op 0.87
bitArray.getTrueBitIndexes() bitLen 512 7.4300 us/op 8.1740 us/op 0.91
Buffer.concat 32 items 1.0340 us/op 898.00 ns/op 1.15
Uint8Array.set 32 items 1.6460 us/op 1.3780 us/op 1.19
Buffer.copy 1.7370 us/op 1.6790 us/op 1.03
Uint8Array.set - with subarray 2.1410 us/op 2.6400 us/op 0.81
Uint8Array.set - without subarray 1.5560 us/op 1.4980 us/op 1.04
getUint32 - dataview 405.00 ns/op 248.00 ns/op 1.63
getUint32 - manual 327.00 ns/op 155.00 ns/op 2.11
Set add up to 64 items then delete first 1.7221 us/op 2.2287 us/op 0.77
OrderedSet add up to 64 items then delete first 2.6151 us/op 3.2775 us/op 0.80
Set add up to 64 items then delete last 1.9884 us/op 2.5198 us/op 0.79
OrderedSet add up to 64 items then delete last 2.8634 us/op 3.7371 us/op 0.77
Set add up to 64 items then delete middle 1.9745 us/op 2.5631 us/op 0.77
OrderedSet add up to 64 items then delete middle 4.3627 us/op 5.2585 us/op 0.83
Set add up to 128 items then delete first 3.9012 us/op 5.0662 us/op 0.77
OrderedSet add up to 128 items then delete first 6.0279 us/op 7.9946 us/op 0.75
Set add up to 128 items then delete last 3.8073 us/op 4.9965 us/op 0.76
OrderedSet add up to 128 items then delete last 5.6354 us/op 7.3425 us/op 0.77
Set add up to 128 items then delete middle 3.8202 us/op 4.9084 us/op 0.78
OrderedSet add up to 128 items then delete middle 11.245 us/op 13.875 us/op 0.81
Set add up to 256 items then delete first 7.7427 us/op 10.742 us/op 0.72
OrderedSet add up to 256 items then delete first 12.111 us/op 16.271 us/op 0.74
Set add up to 256 items then delete last 7.5430 us/op 9.9144 us/op 0.76
OrderedSet add up to 256 items then delete last 11.528 us/op 14.786 us/op 0.78
Set add up to 256 items then delete middle 7.4713 us/op 9.8693 us/op 0.76
OrderedSet add up to 256 items then delete middle 32.874 us/op 41.582 us/op 0.79
transfer serialized Status (84 B) 1.3110 us/op 1.3790 us/op 0.95
copy serialized Status (84 B) 1.1360 us/op 1.1390 us/op 1.00
transfer serialized SignedVoluntaryExit (112 B) 1.3670 us/op 1.4480 us/op 0.94
copy serialized SignedVoluntaryExit (112 B) 1.1660 us/op 1.1630 us/op 1.00
transfer serialized ProposerSlashing (416 B) 1.5640 us/op 1.5040 us/op 1.04
copy serialized ProposerSlashing (416 B) 1.4350 us/op 1.4370 us/op 1.00
transfer serialized Attestation (485 B) 1.5920 us/op 1.6060 us/op 0.99
copy serialized Attestation (485 B) 1.6630 us/op 1.4530 us/op 1.14
transfer serialized AttesterSlashing (33232 B) 2.4110 us/op 1.8320 us/op 1.32
copy serialized AttesterSlashing (33232 B) 5.2780 us/op 4.6940 us/op 1.12
transfer serialized Small SignedBeaconBlock (128000 B) 1.9500 us/op 2.5760 us/op 0.76
copy serialized Small SignedBeaconBlock (128000 B) 14.097 us/op 15.471 us/op 0.91
transfer serialized Avg SignedBeaconBlock (200000 B) 2.3330 us/op 3.1770 us/op 0.73
copy serialized Avg SignedBeaconBlock (200000 B) 19.430 us/op 23.055 us/op 0.84
transfer serialized BlobsSidecar (524380 B) 2.0210 us/op 2.7930 us/op 0.72
copy serialized BlobsSidecar (524380 B) 92.614 us/op 87.570 us/op 1.06
transfer serialized Big SignedBeaconBlock (1000000 B) 2.6150 us/op 2.7740 us/op 0.94
copy serialized Big SignedBeaconBlock (1000000 B) 129.81 us/op 146.23 us/op 0.89
pass gossip attestations to forkchoice per slot 2.4370 ms/op 2.8189 ms/op 0.86
forkChoice updateHead vc 100000 bc 64 eq 0 377.77 us/op 494.87 us/op 0.76
forkChoice updateHead vc 600000 bc 64 eq 0 2.9495 ms/op 2.7596 ms/op 1.07
forkChoice updateHead vc 1000000 bc 64 eq 0 3.6587 ms/op 6.2508 ms/op 0.59
forkChoice updateHead vc 600000 bc 320 eq 0 2.1846 ms/op 2.7565 ms/op 0.79
forkChoice updateHead vc 600000 bc 1200 eq 0 2.3752 ms/op 2.8289 ms/op 0.84
forkChoice updateHead vc 600000 bc 7200 eq 0 2.9450 ms/op 3.5496 ms/op 0.83
forkChoice updateHead vc 600000 bc 64 eq 1000 8.9791 ms/op 10.159 ms/op 0.88
forkChoice updateHead vc 600000 bc 64 eq 10000 9.2654 ms/op 10.276 ms/op 0.90
forkChoice updateHead vc 600000 bc 64 eq 300000 11.822 ms/op 13.353 ms/op 0.89
computeDeltas 500000 validators 300 proto nodes 3.3936 ms/op 4.0134 ms/op 0.85
computeDeltas 500000 validators 1200 proto nodes 3.3947 ms/op 4.0557 ms/op 0.84
computeDeltas 500000 validators 7200 proto nodes 3.6348 ms/op 3.9924 ms/op 0.91
computeDeltas 750000 validators 300 proto nodes 5.4232 ms/op 5.9964 ms/op 0.90
computeDeltas 750000 validators 1200 proto nodes 5.1166 ms/op 5.9374 ms/op 0.86
computeDeltas 750000 validators 7200 proto nodes 4.9940 ms/op 6.0071 ms/op 0.83
computeDeltas 1400000 validators 300 proto nodes 9.1928 ms/op 11.315 ms/op 0.81
computeDeltas 1400000 validators 1200 proto nodes 9.4466 ms/op 11.231 ms/op 0.84
computeDeltas 1400000 validators 7200 proto nodes 9.8381 ms/op 11.052 ms/op 0.89
computeDeltas 2100000 validators 300 proto nodes 14.812 ms/op 17.513 ms/op 0.85
computeDeltas 2100000 validators 1200 proto nodes 14.603 ms/op 17.427 ms/op 0.84
computeDeltas 2100000 validators 7200 proto nodes 14.603 ms/op 17.349 ms/op 0.84
altair processAttestation - 250000 vs - 7PWei normalcase 1.4579 ms/op 1.7914 ms/op 0.81
altair processAttestation - 250000 vs - 7PWei worstcase 2.1783 ms/op 2.6506 ms/op 0.82
altair processAttestation - setStatus - 1/6 committees join 80.931 us/op 119.07 us/op 0.68
altair processAttestation - setStatus - 1/3 committees join 142.92 us/op 314.41 us/op 0.45
altair processAttestation - setStatus - 1/2 committees join 197.23 us/op 647.38 us/op 0.30
altair processAttestation - setStatus - 2/3 committees join 260.02 us/op 409.69 us/op 0.63
altair processAttestation - setStatus - 4/5 committees join 454.83 us/op 578.15 us/op 0.79
altair processAttestation - setStatus - 100% committees join 516.20 us/op 656.51 us/op 0.79
altair processBlock - 250000 vs - 7PWei normalcase 5.5777 ms/op 5.7935 ms/op 0.96
altair processBlock - 250000 vs - 7PWei normalcase hashState 24.656 ms/op 28.395 ms/op 0.87
altair processBlock - 250000 vs - 7PWei worstcase 33.304 ms/op 42.061 ms/op 0.79
altair processBlock - 250000 vs - 7PWei worstcase hashState 75.234 ms/op 82.579 ms/op 0.91
phase0 processBlock - 250000 vs - 7PWei normalcase 2.6415 ms/op 2.2153 ms/op 1.19
phase0 processBlock - 250000 vs - 7PWei worstcase 24.788 ms/op 27.230 ms/op 0.91
altair processEth1Data - 250000 vs - 7PWei normalcase 293.70 us/op 325.79 us/op 0.90
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 5.7920 us/op 11.211 us/op 0.52
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 31.285 us/op 44.406 us/op 0.70
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 11.526 us/op 13.624 us/op 0.85
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 6.3740 us/op 8.8280 us/op 0.72
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 119.24 us/op 188.31 us/op 0.63
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 930.57 us/op 2.0246 ms/op 0.46
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.2744 ms/op 1.4585 ms/op 0.87
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.3297 ms/op 2.8397 ms/op 0.47
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.1120 ms/op 3.4683 ms/op 0.90
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.2625 ms/op 2.2159 ms/op 0.57
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.2295 ms/op 3.5533 ms/op 0.91
Tree 40 250000 create 418.69 ms/op 217.81 ms/op 1.92
Tree 40 250000 get(125000) 138.56 ns/op 143.42 ns/op 0.97
Tree 40 250000 set(125000) 517.56 ns/op 588.05 ns/op 0.88
Tree 40 250000 toArray() 15.013 ms/op 14.802 ms/op 1.01
Tree 40 250000 iterate all - toArray() + loop 13.896 ms/op 15.171 ms/op 0.92
Tree 40 250000 iterate all - get(i) 47.955 ms/op 47.480 ms/op 1.01
Array 250000 create 2.6633 ms/op 2.8945 ms/op 0.92
Array 250000 clone - spread 1.2206 ms/op 1.3508 ms/op 0.90
Array 250000 get(125000) 0.61100 ns/op 0.42500 ns/op 1.44
Array 250000 set(125000) 0.62800 ns/op 0.43600 ns/op 1.44
Array 250000 iterate all - loop 79.807 us/op 95.755 us/op 0.83
phase0 afterProcessEpoch - 250000 vs - 7PWei 45.307 ms/op 49.622 ms/op 0.91
Array.fill - length 1000000 2.8560 ms/op 3.4872 ms/op 0.82
Array push - length 1000000 18.235 ms/op 16.828 ms/op 1.08
Array.get 0.31491 ns/op 0.27044 ns/op 1.16
Uint8Array.get 0.35621 ns/op 0.43505 ns/op 0.82
phase0 beforeProcessEpoch - 250000 vs - 7PWei 27.667 ms/op 17.839 ms/op 1.55
altair processEpoch - mainnet_e81889 285.48 ms/op 297.97 ms/op 0.96
mainnet_e81889 - altair beforeProcessEpoch 21.590 ms/op 18.335 ms/op 1.18
mainnet_e81889 - altair processJustificationAndFinalization 16.590 us/op 19.988 us/op 0.83
mainnet_e81889 - altair processInactivityUpdates 5.9308 ms/op 5.0530 ms/op 1.17
mainnet_e81889 - altair processRewardsAndPenalties 50.045 ms/op 64.222 ms/op 0.78
mainnet_e81889 - altair processRegistryUpdates 2.6160 us/op 2.9400 us/op 0.89
mainnet_e81889 - altair processSlashings 890.00 ns/op 659.00 ns/op 1.35
mainnet_e81889 - altair processEth1DataReset 785.00 ns/op 513.00 ns/op 1.53
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.2801 ms/op 1.9235 ms/op 0.67
mainnet_e81889 - altair processSlashingsReset 4.5390 us/op 6.8690 us/op 0.66
mainnet_e81889 - altair processRandaoMixesReset 7.1930 us/op 7.4850 us/op 0.96
mainnet_e81889 - altair processHistoricalRootsUpdate 1.6540 us/op 911.00 ns/op 1.82
mainnet_e81889 - altair processParticipationFlagUpdates 4.6900 us/op 3.7520 us/op 1.25
mainnet_e81889 - altair processSyncCommitteeUpdates 1.3110 us/op 722.00 ns/op 1.82
mainnet_e81889 - altair afterProcessEpoch 46.035 ms/op 50.620 ms/op 0.91
capella processEpoch - mainnet_e217614 1.5220 s/op 1.1344 s/op 1.34
mainnet_e217614 - capella beforeProcessEpoch 107.05 ms/op 61.019 ms/op 1.75
mainnet_e217614 - capella processJustificationAndFinalization 33.688 us/op 22.511 us/op 1.50
mainnet_e217614 - capella processInactivityUpdates 22.859 ms/op 15.967 ms/op 1.43
mainnet_e217614 - capella processRewardsAndPenalties 306.47 ms/op 270.00 ms/op 1.14
mainnet_e217614 - capella processRegistryUpdates 20.683 us/op 19.918 us/op 1.04
mainnet_e217614 - capella processSlashings 1.3260 us/op 732.00 ns/op 1.81
mainnet_e217614 - capella processEth1DataReset 1.6530 us/op 611.00 ns/op 2.71
mainnet_e217614 - capella processEffectiveBalanceUpdates 21.767 ms/op 5.6653 ms/op 3.84
mainnet_e217614 - capella processSlashingsReset 8.6120 us/op 4.5450 us/op 1.89
mainnet_e217614 - capella processRandaoMixesReset 12.118 us/op 6.6060 us/op 1.83
mainnet_e217614 - capella processHistoricalRootsUpdate 1.1280 us/op 850.00 ns/op 1.33
mainnet_e217614 - capella processParticipationFlagUpdates 4.3160 us/op 2.9460 us/op 1.47
mainnet_e217614 - capella afterProcessEpoch 116.65 ms/op 120.15 ms/op 0.97
phase0 processEpoch - mainnet_e58758 420.41 ms/op 363.92 ms/op 1.16
mainnet_e58758 - phase0 beforeProcessEpoch 120.02 ms/op 83.096 ms/op 1.44
mainnet_e58758 - phase0 processJustificationAndFinalization 21.234 us/op 23.684 us/op 0.90
mainnet_e58758 - phase0 processRewardsAndPenalties 33.193 ms/op 47.389 ms/op 0.70
mainnet_e58758 - phase0 processRegistryUpdates 8.0190 us/op 12.281 us/op 0.65
mainnet_e58758 - phase0 processSlashings 956.00 ns/op 676.00 ns/op 1.41
mainnet_e58758 - phase0 processEth1DataReset 1.1120 us/op 527.00 ns/op 2.11
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.1373 ms/op 2.0810 ms/op 0.55
mainnet_e58758 - phase0 processSlashingsReset 6.3560 us/op 5.1410 us/op 1.24
mainnet_e58758 - phase0 processRandaoMixesReset 4.4140 us/op 6.3750 us/op 0.69
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.2020 us/op 531.00 ns/op 2.26
mainnet_e58758 - phase0 processParticipationRecordUpdates 6.8290 us/op 4.6800 us/op 1.46
mainnet_e58758 - phase0 afterProcessEpoch 38.829 ms/op 42.539 ms/op 0.91
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.0751 ms/op 3.3776 ms/op 0.32
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.9400 ms/op 2.3472 ms/op 0.83
altair processInactivityUpdates - 250000 normalcase 16.855 ms/op 23.162 ms/op 0.73
altair processInactivityUpdates - 250000 worstcase 16.503 ms/op 24.159 ms/op 0.68
phase0 processRegistryUpdates - 250000 normalcase 7.5730 us/op 10.383 us/op 0.73
phase0 processRegistryUpdates - 250000 badcase_full_deposits 333.35 us/op 460.18 us/op 0.72
phase0 processRegistryUpdates - 250000 worstcase 0.5 124.08 ms/op 139.75 ms/op 0.89
altair processRewardsAndPenalties - 250000 normalcase 34.487 ms/op 51.788 ms/op 0.67
altair processRewardsAndPenalties - 250000 worstcase 24.005 ms/op 48.848 ms/op 0.49
phase0 getAttestationDeltas - 250000 normalcase 6.8796 ms/op 7.7934 ms/op 0.88
phase0 getAttestationDeltas - 250000 worstcase 7.7389 ms/op 7.2403 ms/op 1.07
phase0 processSlashings - 250000 worstcase 93.620 us/op 126.00 us/op 0.74
altair processSyncCommitteeUpdates - 250000 112.76 ms/op 115.66 ms/op 0.97
BeaconState.hashTreeRoot - No change 545.00 ns/op 251.00 ns/op 2.17
BeaconState.hashTreeRoot - 1 full validator 127.55 us/op 146.89 us/op 0.87
BeaconState.hashTreeRoot - 32 full validator 1.2730 ms/op 1.5020 ms/op 0.85
BeaconState.hashTreeRoot - 512 full validator 12.146 ms/op 13.068 ms/op 0.93
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 156.61 us/op 187.56 us/op 0.83
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.4806 ms/op 1.6186 ms/op 1.53
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 23.907 ms/op 23.598 ms/op 1.01
BeaconState.hashTreeRoot - 1 balances 116.11 us/op 116.84 us/op 0.99
BeaconState.hashTreeRoot - 32 balances 1.0481 ms/op 1.1942 ms/op 0.88
BeaconState.hashTreeRoot - 512 balances 7.6234 ms/op 9.2271 ms/op 0.83
BeaconState.hashTreeRoot - 250000 balances 140.57 ms/op 202.80 ms/op 0.69
aggregationBits - 2048 els - zipIndexesInBitList 22.718 us/op 23.327 us/op 0.97
byteArrayEquals 32 45.902 ns/op 53.052 ns/op 0.87
Buffer.compare 32 14.828 ns/op 17.554 ns/op 0.84
byteArrayEquals 1024 1.2279 us/op 1.5679 us/op 0.78
Buffer.compare 1024 22.069 ns/op 26.176 ns/op 0.84
byteArrayEquals 16384 19.516 us/op 24.974 us/op 0.78
Buffer.compare 16384 170.82 ns/op 199.88 ns/op 0.85
byteArrayEquals 123687377 150.46 ms/op 187.99 ms/op 0.80
Buffer.compare 123687377 5.8886 ms/op 6.1809 ms/op 0.95
byteArrayEquals 32 - diff last byte 46.390 ns/op 51.299 ns/op 0.90
Buffer.compare 32 - diff last byte 20.307 ns/op 17.332 ns/op 1.17
byteArrayEquals 1024 - diff last byte 1.2445 us/op 1.5502 us/op 0.80
Buffer.compare 1024 - diff last byte 23.818 ns/op 26.672 ns/op 0.89
byteArrayEquals 16384 - diff last byte 19.999 us/op 24.672 us/op 0.81
Buffer.compare 16384 - diff last byte 179.80 ns/op 199.16 ns/op 0.90
byteArrayEquals 123687377 - diff last byte 151.00 ms/op 187.82 ms/op 0.80
Buffer.compare 123687377 - diff last byte 5.0417 ms/op 6.7051 ms/op 0.75
byteArrayEquals 32 - random bytes 4.9690 ns/op 5.1590 ns/op 0.96
Buffer.compare 32 - random bytes 16.822 ns/op 18.071 ns/op 0.93
byteArrayEquals 1024 - random bytes 5.1740 ns/op 5.1550 ns/op 1.00
Buffer.compare 1024 - random bytes 15.594 ns/op 17.869 ns/op 0.87
byteArrayEquals 16384 - random bytes 4.8740 ns/op 5.0950 ns/op 0.96
Buffer.compare 16384 - random bytes 15.166 ns/op 18.745 ns/op 0.81
byteArrayEquals 123687377 - random bytes 7.7900 ns/op 6.4100 ns/op 1.22
Buffer.compare 123687377 - random bytes 18.330 ns/op 18.860 ns/op 0.97
regular array get 100000 times 30.459 us/op 32.559 us/op 0.94
wrappedArray get 100000 times 30.313 us/op 32.445 us/op 0.93
arrayWithProxy get 100000 times 10.475 ms/op 14.220 ms/op 0.74
ssz.Root.equals 43.723 ns/op 45.424 ns/op 0.96
byteArrayEquals 42.405 ns/op 44.491 ns/op 0.95
Buffer.compare 9.0210 ns/op 10.171 ns/op 0.89
processSlot - 1 slots 11.186 us/op 11.831 us/op 0.95
processSlot - 32 slots 2.8289 ms/op 2.7696 ms/op 1.02
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 36.009 ms/op 39.277 ms/op 0.92
getCommitteeAssignments - req 1 vs - 250000 vc 1.7582 ms/op 2.1123 ms/op 0.83
getCommitteeAssignments - req 100 vs - 250000 vc 3.4669 ms/op 4.1146 ms/op 0.84
getCommitteeAssignments - req 1000 vs - 250000 vc 3.7098 ms/op 4.4277 ms/op 0.84
findModifiedValidators - 10000 modified validators 242.11 ms/op 261.94 ms/op 0.92
findModifiedValidators - 1000 modified validators 153.45 ms/op 159.60 ms/op 0.96
findModifiedValidators - 100 modified validators 134.08 ms/op 152.11 ms/op 0.88
findModifiedValidators - 10 modified validators 154.23 ms/op 156.31 ms/op 0.99
findModifiedValidators - 1 modified validators 135.16 ms/op 143.64 ms/op 0.94
findModifiedValidators - no difference 152.40 ms/op 150.84 ms/op 1.01
compare ViewDUs 3.6101 s/op 3.1957 s/op 1.13
compare each validator Uint8Array 1.3954 s/op 928.71 ms/op 1.50
compare ViewDU to Uint8Array 981.12 ms/op 1.0545 s/op 0.93
migrate state 1000000 validators, 24 modified, 0 new 708.91 ms/op 655.26 ms/op 1.08
migrate state 1000000 validators, 1700 modified, 1000 new 916.46 ms/op 982.23 ms/op 0.93
migrate state 1000000 validators, 3400 modified, 2000 new 1.1977 s/op 1.1929 s/op 1.00
migrate state 1500000 validators, 24 modified, 0 new 797.73 ms/op 773.48 ms/op 1.03
migrate state 1500000 validators, 1700 modified, 1000 new 863.56 ms/op 996.45 ms/op 0.87
migrate state 1500000 validators, 3400 modified, 2000 new 1.1573 s/op 1.2524 s/op 0.92
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 6.7000 ns/op 4.0300 ns/op 1.66
state getBlockRootAtSlot - 250000 vs - 7PWei 701.33 ns/op 816.48 ns/op 0.86
computeProposers - vc 250000 7.3944 ms/op 6.3398 ms/op 1.17
computeEpochShuffling - vc 250000 36.097 ms/op 39.817 ms/op 0.91
getNextSyncCommittee - vc 250000 106.81 ms/op 123.20 ms/op 0.87
computeSigningRoot for AttestationData 28.380 us/op 27.111 us/op 1.05
hash AttestationData serialized data then Buffer.toString(base64) 1.1949 us/op 1.5294 us/op 0.78
toHexString serialized data 775.31 ns/op 862.93 ns/op 0.90
Buffer.toString(base64) 141.51 ns/op 183.56 ns/op 0.77
nodejs block root to RootHex using toHex 104.18 ns/op 158.96 ns/op 0.66
nodejs block root to RootHex using toRootHex 67.522 ns/op 95.524 ns/op 0.71
browser block root to RootHex using the deprecated toHexString 194.18 ns/op 233.49 ns/op 0.83
browser block root to RootHex using toHex 154.29 ns/op 177.86 ns/op 0.87
browser block root to RootHex using toRootHex 137.44 ns/op 158.27 ns/op 0.87

by benchmarkbot/action

@nflaig nflaig force-pushed the nflaig/forward-blinded-block-bytes branch from 0073c2a to 9e06567 Compare October 21, 2024 20:44
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.

This approach makes sense. I guess we need to put a comment somewhere to emphasize blockBytes is the ssz representation of signedBlindedBlock and not another block replacing the latter cuz this line looks kinda like that to me.

body: blockBytes ?? getExecutionForkTypes(fork).SignedBlindedBeaconBlock.serialize(signedBlindedBlock),

@twoeths
Copy link
Contributor

twoeths commented Oct 22, 2024

we may have the same demand for future flow and we have WithBytes<T> but it's not optional, may consider having WithOptionalBytes so that we can reuse later?

@nflaig
Copy link
Member Author

nflaig commented Oct 22, 2024

may consider having WithOptionalBytes so that we can reuse later?

I have refactored it in the last commit to use that, it feels more self-contained which I like, let me know what you think, can always revert the last commit

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.

lgtm, WithBytes should be stayed in types package too but we can do it later

@nflaig nflaig merged commit d8b599a into unstable Oct 28, 2024
20 checks passed
@nflaig nflaig deleted the nflaig/forward-blinded-block-bytes branch October 28, 2024 09:16
@nflaig
Copy link
Member Author

nflaig commented Oct 28, 2024

lgtm, WithBytes should be stayed in types package too but we can do it later

@wemeetagain
Copy link
Member

🎉 This PR is included in v1.23.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants