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

refactor: flatten fork logic in notifyNewPayload #7385

Open
wants to merge 3 commits into
base: unstable
Choose a base branch
from

Conversation

ensi321
Copy link
Contributor

@ensi321 ensi321 commented Jan 22, 2025

The way the current notifyNewPayload is structured does not allow new fork and payload method (eg. focil fork and engine_newPayloadV5) to be added easily without introducing more nested if statement.

This PR flattens the logic into a single layer by having a switch statement which makes new methods to be added easily.

@ensi321 ensi321 requested a review from a team as a code owner January 22, 2025 00:46
Copy link

codecov bot commented Jan 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 48.62%. Comparing base (d584aed) to head (dae5d4a).

Additional details and impacted files
@@            Coverage Diff            @@
##           unstable    #7385   +/-   ##
=========================================
  Coverage     48.62%   48.62%           
=========================================
  Files           603      603           
  Lines         40510    40510           
  Branches       2071     2071           
=========================================
  Hits          19700    19700           
  Misses        20772    20772           
  Partials         38       38           

Copy link
Contributor

github-actions bot commented Jan 22, 2025

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 094bdd3 Previous: d584aed Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.1171 ms/op 1.5995 ms/op 0.70
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 39.896 us/op 32.423 us/op 1.23
BLS verify - blst 904.25 us/op 894.82 us/op 1.01
BLS verifyMultipleSignatures 3 - blst 1.2585 ms/op 1.3409 ms/op 0.94
BLS verifyMultipleSignatures 8 - blst 2.7596 ms/op 2.0534 ms/op 1.34
BLS verifyMultipleSignatures 32 - blst 7.3028 ms/op 4.4121 ms/op 1.66
BLS verifyMultipleSignatures 64 - blst 11.404 ms/op 8.2600 ms/op 1.38
BLS verifyMultipleSignatures 128 - blst 17.791 ms/op 15.677 ms/op 1.13
BLS deserializing 10000 signatures 709.01 ms/op 642.86 ms/op 1.10
BLS deserializing 100000 signatures 7.0717 s/op 6.6339 s/op 1.07
BLS verifyMultipleSignatures - same message - 3 - blst 960.57 us/op 937.64 us/op 1.02
BLS verifyMultipleSignatures - same message - 8 - blst 1.0477 ms/op 1.0316 ms/op 1.02
BLS verifyMultipleSignatures - same message - 32 - blst 1.7495 ms/op 1.6675 ms/op 1.05
BLS verifyMultipleSignatures - same message - 64 - blst 2.5980 ms/op 2.4738 ms/op 1.05
BLS verifyMultipleSignatures - same message - 128 - blst 4.3853 ms/op 4.0126 ms/op 1.09
BLS aggregatePubkeys 32 - blst 19.974 us/op 18.216 us/op 1.10
BLS aggregatePubkeys 128 - blst 71.321 us/op 63.269 us/op 1.13
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 62.027 ms/op 44.756 ms/op 1.39
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 64.900 ms/op 38.669 ms/op 1.68
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 46.587 ms/op 34.266 ms/op 1.36
getSlashingsAndExits - default max 85.743 us/op 54.772 us/op 1.57
getSlashingsAndExits - 2k 368.62 us/op 254.80 us/op 1.45
proposeBlockBody type=full, size=empty 6.3360 ms/op 4.2684 ms/op 1.48
isKnown best case - 1 super set check 287.00 ns/op 463.00 ns/op 0.62
isKnown normal case - 2 super set checks 277.00 ns/op 438.00 ns/op 0.63
isKnown worse case - 16 super set checks 297.00 ns/op 436.00 ns/op 0.68
InMemoryCheckpointStateCache - add get delete 2.6910 us/op 2.7120 us/op 0.99
validate api signedAggregateAndProof - struct 2.2522 ms/op 2.0252 ms/op 1.11
validate gossip signedAggregateAndProof - struct 1.9899 ms/op 1.7471 ms/op 1.14
batch validate gossip attestation - vc 640000 - chunk 32 135.40 us/op 124.62 us/op 1.09
batch validate gossip attestation - vc 640000 - chunk 64 114.25 us/op 102.98 us/op 1.11
batch validate gossip attestation - vc 640000 - chunk 128 112.21 us/op 95.936 us/op 1.17
batch validate gossip attestation - vc 640000 - chunk 256 113.30 us/op 94.064 us/op 1.20
pickEth1Vote - no votes 1.0600 ms/op 784.87 us/op 1.35
pickEth1Vote - max votes 7.2530 ms/op 4.7289 ms/op 1.53
pickEth1Vote - Eth1Data hashTreeRoot value x2048 15.930 ms/op 18.862 ms/op 0.84
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 25.091 ms/op 21.093 ms/op 1.19
pickEth1Vote - Eth1Data fastSerialize value x2048 513.98 us/op 388.43 us/op 1.32
pickEth1Vote - Eth1Data fastSerialize tree x2048 4.4401 ms/op 3.2427 ms/op 1.37
bytes32 toHexString 449.00 ns/op 592.00 ns/op 0.76
bytes32 Buffer.toString(hex) 239.00 ns/op 409.00 ns/op 0.58
bytes32 Buffer.toString(hex) from Uint8Array 383.00 ns/op 509.00 ns/op 0.75
bytes32 Buffer.toString(hex) + 0x 241.00 ns/op 416.00 ns/op 0.58
Object access 1 prop 0.13300 ns/op 0.33100 ns/op 0.40
Map access 1 prop 0.14100 ns/op 0.32700 ns/op 0.43
Object get x1000 6.2650 ns/op 4.8180 ns/op 1.30
Map get x1000 7.0830 ns/op 5.4930 ns/op 1.29
Object set x1000 33.111 ns/op 22.332 ns/op 1.48
Map set x1000 23.036 ns/op 19.022 ns/op 1.21
Return object 10000 times 0.30440 ns/op 0.28150 ns/op 1.08
Throw Error 10000 times 3.4891 us/op 2.5034 us/op 1.39
toHex 152.12 ns/op 98.527 ns/op 1.54
Buffer.from 139.70 ns/op 90.349 ns/op 1.55
shared Buffer 91.586 ns/op 60.849 ns/op 1.51
fastMsgIdFn sha256 / 200 bytes 2.2870 us/op 1.8710 us/op 1.22
fastMsgIdFn h32 xxhash / 200 bytes 229.00 ns/op 384.00 ns/op 0.60
fastMsgIdFn h64 xxhash / 200 bytes 274.00 ns/op 425.00 ns/op 0.64
fastMsgIdFn sha256 / 1000 bytes 7.4410 us/op 5.7070 us/op 1.30
fastMsgIdFn h32 xxhash / 1000 bytes 357.00 ns/op 531.00 ns/op 0.67
fastMsgIdFn h64 xxhash / 1000 bytes 348.00 ns/op 506.00 ns/op 0.69
fastMsgIdFn sha256 / 10000 bytes 65.580 us/op 46.214 us/op 1.42
fastMsgIdFn h32 xxhash / 10000 bytes 1.8620 us/op 1.8090 us/op 1.03
fastMsgIdFn h64 xxhash / 10000 bytes 1.2160 us/op 1.2590 us/op 0.97
send data - 1000 256B messages 12.215 ms/op 10.374 ms/op 1.18
send data - 1000 512B messages 17.180 ms/op 14.851 ms/op 1.16
send data - 1000 1024B messages 28.617 ms/op 22.370 ms/op 1.28
send data - 1000 1200B messages 25.291 ms/op 24.249 ms/op 1.04
send data - 1000 2048B messages 29.518 ms/op 29.278 ms/op 1.01
send data - 1000 4096B messages 30.703 ms/op 25.223 ms/op 1.22
send data - 1000 16384B messages 73.310 ms/op 65.741 ms/op 1.12
send data - 1000 65536B messages 209.76 ms/op 257.96 ms/op 0.81
enrSubnets - fastDeserialize 64 bits 1.1250 us/op 1.0700 us/op 1.05
enrSubnets - ssz BitVector 64 bits 354.00 ns/op 493.00 ns/op 0.72
enrSubnets - fastDeserialize 4 bits 142.00 ns/op 323.00 ns/op 0.44
enrSubnets - ssz BitVector 4 bits 361.00 ns/op 500.00 ns/op 0.72
prioritizePeers score -10:0 att 32-0.1 sync 2-0 139.66 us/op 106.50 us/op 1.31
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 153.56 us/op 128.80 us/op 1.19
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 221.96 us/op 189.38 us/op 1.17
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 398.72 us/op 347.90 us/op 1.15
prioritizePeers score 0:0 att 64-1 sync 4-1 498.08 us/op 416.61 us/op 1.20
array of 16000 items push then shift 1.6524 us/op 1.2035 us/op 1.37
LinkedList of 16000 items push then shift 7.1990 ns/op 7.0750 ns/op 1.02
array of 16000 items push then pop 102.20 ns/op 85.527 ns/op 1.19
LinkedList of 16000 items push then pop 7.0300 ns/op 6.0900 ns/op 1.15
array of 24000 items push then shift 2.4110 us/op 1.7561 us/op 1.37
LinkedList of 24000 items push then shift 7.1540 ns/op 6.7800 ns/op 1.06
array of 24000 items push then pop 165.25 ns/op 106.25 ns/op 1.56
LinkedList of 24000 items push then pop 7.1350 ns/op 5.9720 ns/op 1.19
intersect bitArray bitLen 8 6.5410 ns/op 5.1510 ns/op 1.27
intersect array and set length 8 45.180 ns/op 35.139 ns/op 1.29
intersect bitArray bitLen 128 30.633 ns/op 25.152 ns/op 1.22
intersect array and set length 128 677.45 ns/op 534.40 ns/op 1.27
bitArray.getTrueBitIndexes() bitLen 128 1.3800 us/op 1.2870 us/op 1.07
bitArray.getTrueBitIndexes() bitLen 248 2.2390 us/op 2.1450 us/op 1.04
bitArray.getTrueBitIndexes() bitLen 512 4.5810 us/op 3.7920 us/op 1.21
Buffer.concat 32 items 789.00 ns/op 884.00 ns/op 0.89
Uint8Array.set 32 items 2.1010 us/op 2.0060 us/op 1.05
Buffer.copy 3.0660 us/op 2.8750 us/op 1.07
Uint8Array.set - with subarray 2.6310 us/op 2.7440 us/op 0.96
Uint8Array.set - without subarray 1.8450 us/op 2.0380 us/op 0.91
getUint32 - dataview 246.00 ns/op 384.00 ns/op 0.64
getUint32 - manual 162.00 ns/op 325.00 ns/op 0.50
Set add up to 64 items then delete first 2.2271 us/op 1.7467 us/op 1.28
OrderedSet add up to 64 items then delete first 3.3004 us/op 2.7100 us/op 1.22
Set add up to 64 items then delete last 2.6136 us/op 1.9930 us/op 1.31
OrderedSet add up to 64 items then delete last 3.9034 us/op 2.8755 us/op 1.36
Set add up to 64 items then delete middle 2.5633 us/op 1.8524 us/op 1.38
OrderedSet add up to 64 items then delete middle 5.4513 us/op 4.1289 us/op 1.32
Set add up to 128 items then delete first 5.1478 us/op 3.6746 us/op 1.40
OrderedSet add up to 128 items then delete first 7.4697 us/op 6.1900 us/op 1.21
Set add up to 128 items then delete last 5.1634 us/op 3.6970 us/op 1.40
OrderedSet add up to 128 items then delete last 7.6486 us/op 5.7680 us/op 1.33
Set add up to 128 items then delete middle 4.9255 us/op 3.9869 us/op 1.24
OrderedSet add up to 128 items then delete middle 13.818 us/op 11.371 us/op 1.22
Set add up to 256 items then delete first 10.204 us/op 8.1167 us/op 1.26
OrderedSet add up to 256 items then delete first 15.176 us/op 12.191 us/op 1.24
Set add up to 256 items then delete last 10.018 us/op 7.3972 us/op 1.35
OrderedSet add up to 256 items then delete last 15.572 us/op 11.216 us/op 1.39
Set add up to 256 items then delete middle 9.8543 us/op 7.1300 us/op 1.38
OrderedSet add up to 256 items then delete middle 40.532 us/op 32.648 us/op 1.24
transfer serialized Status (84 B) 2.4240 us/op 2.2080 us/op 1.10
copy serialized Status (84 B) 1.2660 us/op 1.5510 us/op 0.82
transfer serialized SignedVoluntaryExit (112 B) 2.4740 us/op 2.8380 us/op 0.87
copy serialized SignedVoluntaryExit (112 B) 1.3140 us/op 1.6760 us/op 0.78
transfer serialized ProposerSlashing (416 B) 2.6100 us/op 2.7190 us/op 0.96
copy serialized ProposerSlashing (416 B) 1.5060 us/op 1.7400 us/op 0.87
transfer serialized Attestation (485 B) 2.5770 us/op 2.6130 us/op 0.99
copy serialized Attestation (485 B) 1.4950 us/op 1.7780 us/op 0.84
transfer serialized AttesterSlashing (33232 B) 2.7910 us/op 2.7070 us/op 1.03
copy serialized AttesterSlashing (33232 B) 4.7910 us/op 4.1850 us/op 1.14
transfer serialized Small SignedBeaconBlock (128000 B) 3.5400 us/op 2.9920 us/op 1.18
copy serialized Small SignedBeaconBlock (128000 B) 13.991 us/op 9.6560 us/op 1.45
transfer serialized Avg SignedBeaconBlock (200000 B) 4.1290 us/op 3.7420 us/op 1.10
copy serialized Avg SignedBeaconBlock (200000 B) 27.390 us/op 14.401 us/op 1.90
transfer serialized BlobsSidecar (524380 B) 3.8810 us/op 4.8140 us/op 0.81
copy serialized BlobsSidecar (524380 B) 87.998 us/op 78.007 us/op 1.13
transfer serialized Big SignedBeaconBlock (1000000 B) 4.3750 us/op 4.8370 us/op 0.90
copy serialized Big SignedBeaconBlock (1000000 B) 163.42 us/op 166.04 us/op 0.98
pass gossip attestations to forkchoice per slot 2.7598 ms/op 2.2639 ms/op 1.22
forkChoice updateHead vc 100000 bc 64 eq 0 461.42 us/op 332.22 us/op 1.39
forkChoice updateHead vc 600000 bc 64 eq 0 3.4473 ms/op 2.9883 ms/op 1.15
forkChoice updateHead vc 1000000 bc 64 eq 0 4.9155 ms/op 3.7346 ms/op 1.32
forkChoice updateHead vc 600000 bc 320 eq 0 2.8980 ms/op 2.3944 ms/op 1.21
forkChoice updateHead vc 600000 bc 1200 eq 0 2.9223 ms/op 2.3170 ms/op 1.26
forkChoice updateHead vc 600000 bc 7200 eq 0 3.7600 ms/op 2.2980 ms/op 1.64
forkChoice updateHead vc 600000 bc 64 eq 1000 10.740 ms/op 9.4327 ms/op 1.14
forkChoice updateHead vc 600000 bc 64 eq 10000 10.700 ms/op 9.3117 ms/op 1.15
forkChoice updateHead vc 600000 bc 64 eq 300000 14.263 ms/op 11.530 ms/op 1.24
computeDeltas 500000 validators 300 proto nodes 4.1945 ms/op 3.2827 ms/op 1.28
computeDeltas 500000 validators 1200 proto nodes 4.1690 ms/op 3.4081 ms/op 1.22
computeDeltas 500000 validators 7200 proto nodes 4.2187 ms/op 3.3157 ms/op 1.27
computeDeltas 750000 validators 300 proto nodes 6.3789 ms/op 4.9541 ms/op 1.29
computeDeltas 750000 validators 1200 proto nodes 6.2357 ms/op 4.9877 ms/op 1.25
computeDeltas 750000 validators 7200 proto nodes 6.2039 ms/op 4.9948 ms/op 1.24
computeDeltas 1400000 validators 300 proto nodes 12.082 ms/op 9.2545 ms/op 1.31
computeDeltas 1400000 validators 1200 proto nodes 12.007 ms/op 9.4817 ms/op 1.27
computeDeltas 1400000 validators 7200 proto nodes 12.248 ms/op 8.9167 ms/op 1.37
computeDeltas 2100000 validators 300 proto nodes 18.012 ms/op 14.099 ms/op 1.28
computeDeltas 2100000 validators 1200 proto nodes 17.699 ms/op 13.994 ms/op 1.26
computeDeltas 2100000 validators 7200 proto nodes 17.456 ms/op 13.943 ms/op 1.25
altair processAttestation - 250000 vs - 7PWei normalcase 2.1902 ms/op 1.7244 ms/op 1.27
altair processAttestation - 250000 vs - 7PWei worstcase 2.9984 ms/op 2.3826 ms/op 1.26
altair processAttestation - setStatus - 1/6 committees join 142.35 us/op 97.512 us/op 1.46
altair processAttestation - setStatus - 1/3 committees join 239.13 us/op 187.93 us/op 1.27
altair processAttestation - setStatus - 1/2 committees join 355.79 us/op 265.21 us/op 1.34
altair processAttestation - setStatus - 2/3 committees join 430.61 us/op 345.30 us/op 1.25
altair processAttestation - setStatus - 4/5 committees join 598.51 us/op 475.44 us/op 1.26
altair processAttestation - setStatus - 100% committees join 752.73 us/op 561.07 us/op 1.34
altair processBlock - 250000 vs - 7PWei normalcase 5.8142 ms/op 4.8590 ms/op 1.20
altair processBlock - 250000 vs - 7PWei normalcase hashState 32.492 ms/op 28.434 ms/op 1.14
altair processBlock - 250000 vs - 7PWei worstcase 38.374 ms/op 35.268 ms/op 1.09
altair processBlock - 250000 vs - 7PWei worstcase hashState 78.273 ms/op 81.194 ms/op 0.96
phase0 processBlock - 250000 vs - 7PWei normalcase 2.5197 ms/op 2.0702 ms/op 1.22
phase0 processBlock - 250000 vs - 7PWei worstcase 24.761 ms/op 25.431 ms/op 0.97
altair processEth1Data - 250000 vs - 7PWei normalcase 409.87 us/op 291.42 us/op 1.41
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 5.5460 us/op 2.7950 us/op 1.98
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 39.455 us/op 17.882 us/op 2.21
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 10.172 us/op 10.369 us/op 0.98
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 6.3360 us/op 4.8460 us/op 1.31
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 200.78 us/op 128.38 us/op 1.56
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 2.3458 ms/op 851.85 us/op 2.75
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.5581 ms/op 1.1453 ms/op 1.36
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.5699 ms/op 1.0664 ms/op 1.47
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.9221 ms/op 2.9878 ms/op 1.31
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.6341 ms/op 1.1760 ms/op 1.39
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.1090 ms/op 2.8650 ms/op 1.43
Tree 40 250000 create 421.83 ms/op 355.02 ms/op 1.19
Tree 40 250000 get(125000) 144.51 ns/op 103.86 ns/op 1.39
Tree 40 250000 set(125000) 1.5814 us/op 1.0878 us/op 1.45
Tree 40 250000 toArray() 15.929 ms/op 12.145 ms/op 1.31
Tree 40 250000 iterate all - toArray() + loop 16.955 ms/op 12.741 ms/op 1.33
Tree 40 250000 iterate all - get(i) 55.433 ms/op 40.851 ms/op 1.36
Array 250000 create 3.0416 ms/op 2.3215 ms/op 1.31
Array 250000 clone - spread 1.5533 ms/op 1.1087 ms/op 1.40
Array 250000 get(125000) 0.42800 ns/op 0.55800 ns/op 0.77
Array 250000 set(125000) 0.44900 ns/op 0.57100 ns/op 0.79
Array 250000 iterate all - loop 87.508 us/op 72.799 us/op 1.20
phase0 afterProcessEpoch - 250000 vs - 7PWei 51.314 ms/op 38.987 ms/op 1.32
Array.fill - length 1000000 3.7502 ms/op 2.2377 ms/op 1.68
Array push - length 1000000 16.926 ms/op 14.132 ms/op 1.20
Array.get 0.29344 ns/op 0.25894 ns/op 1.13
Uint8Array.get 0.45046 ns/op 0.33991 ns/op 1.33
phase0 beforeProcessEpoch - 250000 vs - 7PWei 19.153 ms/op 12.887 ms/op 1.49
altair processEpoch - mainnet_e81889 281.93 ms/op 274.11 ms/op 1.03
mainnet_e81889 - altair beforeProcessEpoch 17.596 ms/op 14.803 ms/op 1.19
mainnet_e81889 - altair processJustificationAndFinalization 23.256 us/op 12.418 us/op 1.87
mainnet_e81889 - altair processInactivityUpdates 4.6649 ms/op 3.4306 ms/op 1.36
mainnet_e81889 - altair processRewardsAndPenalties 60.256 ms/op 57.339 ms/op 1.05
mainnet_e81889 - altair processRegistryUpdates 3.1240 us/op 2.6420 us/op 1.18
mainnet_e81889 - altair processSlashings 591.00 ns/op 823.00 ns/op 0.72
mainnet_e81889 - altair processEth1DataReset 458.00 ns/op 879.00 ns/op 0.52
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.6825 ms/op 1.6237 ms/op 1.65
mainnet_e81889 - altair processSlashingsReset 3.5000 us/op 2.4220 us/op 1.45
mainnet_e81889 - altair processRandaoMixesReset 6.5340 us/op 3.4820 us/op 1.88
mainnet_e81889 - altair processHistoricalRootsUpdate 828.00 ns/op 1.2750 us/op 0.65
mainnet_e81889 - altair processParticipationFlagUpdates 2.3870 us/op 2.0990 us/op 1.14
mainnet_e81889 - altair processSyncCommitteeUpdates 1.0300 us/op 815.00 ns/op 1.26
mainnet_e81889 - altair afterProcessEpoch 51.143 ms/op 42.315 ms/op 1.21
capella processEpoch - mainnet_e217614 1.0836 s/op 991.03 ms/op 1.09
mainnet_e217614 - capella beforeProcessEpoch 66.884 ms/op 67.642 ms/op 0.99
mainnet_e217614 - capella processJustificationAndFinalization 12.849 us/op 11.781 us/op 1.09
mainnet_e217614 - capella processInactivityUpdates 15.095 ms/op 11.049 ms/op 1.37
mainnet_e217614 - capella processRewardsAndPenalties 249.55 ms/op 249.99 ms/op 1.00
mainnet_e217614 - capella processRegistryUpdates 18.201 us/op 10.679 us/op 1.70
mainnet_e217614 - capella processSlashings 671.00 ns/op 832.00 ns/op 0.81
mainnet_e217614 - capella processEth1DataReset 606.00 ns/op 820.00 ns/op 0.74
mainnet_e217614 - capella processEffectiveBalanceUpdates 6.6361 ms/op 3.2528 ms/op 2.04
mainnet_e217614 - capella processSlashingsReset 5.4180 us/op 3.0510 us/op 1.78
mainnet_e217614 - capella processRandaoMixesReset 7.0170 us/op 3.7490 us/op 1.87
mainnet_e217614 - capella processHistoricalRootsUpdate 1.1500 us/op 872.00 ns/op 1.32
mainnet_e217614 - capella processParticipationFlagUpdates 3.9810 us/op 1.8930 us/op 2.10
mainnet_e217614 - capella afterProcessEpoch 123.05 ms/op 101.08 ms/op 1.22
phase0 processEpoch - mainnet_e58758 350.20 ms/op 307.67 ms/op 1.14
mainnet_e58758 - phase0 beforeProcessEpoch 78.113 ms/op 58.171 ms/op 1.34
mainnet_e58758 - phase0 processJustificationAndFinalization 20.481 us/op 13.880 us/op 1.48
mainnet_e58758 - phase0 processRewardsAndPenalties 33.646 ms/op 26.391 ms/op 1.27
mainnet_e58758 - phase0 processRegistryUpdates 12.385 us/op 5.6690 us/op 2.18
mainnet_e58758 - phase0 processSlashings 906.00 ns/op 841.00 ns/op 1.08
mainnet_e58758 - phase0 processEth1DataReset 640.00 ns/op 928.00 ns/op 0.69
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.2021 ms/op 762.03 us/op 2.89
mainnet_e58758 - phase0 processSlashingsReset 5.9670 us/op 2.6180 us/op 2.28
mainnet_e58758 - phase0 processRandaoMixesReset 7.2050 us/op 5.5160 us/op 1.31
mainnet_e58758 - phase0 processHistoricalRootsUpdate 697.00 ns/op 983.00 ns/op 0.71
mainnet_e58758 - phase0 processParticipationRecordUpdates 5.4170 us/op 4.1530 us/op 1.30
mainnet_e58758 - phase0 afterProcessEpoch 42.696 ms/op 36.714 ms/op 1.16
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.3480 ms/op 938.89 us/op 1.44
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 3.4438 ms/op 1.3412 ms/op 2.57
altair processInactivityUpdates - 250000 normalcase 20.885 ms/op 19.420 ms/op 1.08
altair processInactivityUpdates - 250000 worstcase 20.776 ms/op 17.684 ms/op 1.17
phase0 processRegistryUpdates - 250000 normalcase 5.2910 us/op 3.0560 us/op 1.73
phase0 processRegistryUpdates - 250000 badcase_full_deposits 252.82 us/op 274.73 us/op 0.92
phase0 processRegistryUpdates - 250000 worstcase 0.5 123.47 ms/op 110.32 ms/op 1.12
altair processRewardsAndPenalties - 250000 normalcase 47.402 ms/op 48.589 ms/op 0.98
altair processRewardsAndPenalties - 250000 worstcase 46.004 ms/op 41.734 ms/op 1.10
phase0 getAttestationDeltas - 250000 normalcase 7.2700 ms/op 6.4262 ms/op 1.13
phase0 getAttestationDeltas - 250000 worstcase 6.7162 ms/op 5.5333 ms/op 1.21
phase0 processSlashings - 250000 worstcase 123.82 us/op 92.821 us/op 1.33
altair processSyncCommitteeUpdates - 250000 120.39 ms/op 96.087 ms/op 1.25
BeaconState.hashTreeRoot - No change 279.00 ns/op 465.00 ns/op 0.60
BeaconState.hashTreeRoot - 1 full validator 122.13 us/op 121.68 us/op 1.00
BeaconState.hashTreeRoot - 32 full validator 1.1199 ms/op 1.1373 ms/op 0.98
BeaconState.hashTreeRoot - 512 full validator 9.3475 ms/op 8.7281 ms/op 1.07
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 118.38 us/op 125.99 us/op 0.94
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.4623 ms/op 1.5190 ms/op 0.96
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 20.523 ms/op 18.806 ms/op 1.09
BeaconState.hashTreeRoot - 1 balances 87.121 us/op 89.538 us/op 0.97
BeaconState.hashTreeRoot - 32 balances 748.83 us/op 880.77 us/op 0.85
BeaconState.hashTreeRoot - 512 balances 6.8576 ms/op 6.8752 ms/op 1.00
BeaconState.hashTreeRoot - 250000 balances 147.27 ms/op 134.14 ms/op 1.10
aggregationBits - 2048 els - zipIndexesInBitList 24.282 us/op 19.117 us/op 1.27
byteArrayEquals 32 54.461 ns/op 48.143 ns/op 1.13
Buffer.compare 32 17.581 ns/op 16.363 ns/op 1.07
byteArrayEquals 1024 1.6025 us/op 1.2650 us/op 1.27
Buffer.compare 1024 26.227 ns/op 24.635 ns/op 1.06
byteArrayEquals 16384 25.510 us/op 20.094 us/op 1.27
Buffer.compare 16384 196.40 ns/op 210.92 ns/op 0.93
byteArrayEquals 123687377 192.56 ms/op 151.18 ms/op 1.27
Buffer.compare 123687377 6.6572 ms/op 3.8722 ms/op 1.72
byteArrayEquals 32 - diff last byte 53.518 ns/op 46.619 ns/op 1.15
Buffer.compare 32 - diff last byte 17.465 ns/op 16.547 ns/op 1.06
byteArrayEquals 1024 - diff last byte 1.5998 us/op 1.2569 us/op 1.27
Buffer.compare 1024 - diff last byte 26.495 ns/op 23.344 ns/op 1.13
byteArrayEquals 16384 - diff last byte 25.489 us/op 19.951 us/op 1.28
Buffer.compare 16384 - diff last byte 203.59 ns/op 177.43 ns/op 1.15
byteArrayEquals 123687377 - diff last byte 194.96 ms/op 149.46 ms/op 1.30
Buffer.compare 123687377 - diff last byte 8.7716 ms/op 3.8172 ms/op 2.30
byteArrayEquals 32 - random bytes 5.4160 ns/op 4.8700 ns/op 1.11
Buffer.compare 32 - random bytes 18.066 ns/op 16.652 ns/op 1.08
byteArrayEquals 1024 - random bytes 5.4420 ns/op 4.8710 ns/op 1.12
Buffer.compare 1024 - random bytes 17.994 ns/op 16.677 ns/op 1.08
byteArrayEquals 16384 - random bytes 5.4040 ns/op 4.8330 ns/op 1.12
Buffer.compare 16384 - random bytes 18.144 ns/op 16.709 ns/op 1.09
byteArrayEquals 123687377 - random bytes 6.8600 ns/op 7.6900 ns/op 0.89
Buffer.compare 123687377 - random bytes 19.750 ns/op 19.720 ns/op 1.00
regular array get 100000 times 34.699 us/op 30.994 us/op 1.12
wrappedArray get 100000 times 46.032 us/op 31.057 us/op 1.48
arrayWithProxy get 100000 times 13.909 ms/op 9.8019 ms/op 1.42
ssz.Root.equals 47.637 ns/op 43.174 ns/op 1.10
byteArrayEquals 46.991 ns/op 42.796 ns/op 1.10
Buffer.compare 11.066 ns/op 9.7020 ns/op 1.14
processSlot - 1 slots 18.452 us/op 11.650 us/op 1.58
processSlot - 32 slots 3.5657 ms/op 1.8462 ms/op 1.93
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 39.472 ms/op 38.050 ms/op 1.04
getCommitteeAssignments - req 1 vs - 250000 vc 2.1767 ms/op 1.7756 ms/op 1.23
getCommitteeAssignments - req 100 vs - 250000 vc 4.1923 ms/op 3.5444 ms/op 1.18
getCommitteeAssignments - req 1000 vs - 250000 vc 4.5999 ms/op 3.7008 ms/op 1.24
findModifiedValidators - 10000 modified validators 270.24 ms/op 220.24 ms/op 1.23
findModifiedValidators - 1000 modified validators 193.88 ms/op 139.34 ms/op 1.39
findModifiedValidators - 100 modified validators 199.43 ms/op 139.25 ms/op 1.43
findModifiedValidators - 10 modified validators 199.06 ms/op 131.79 ms/op 1.51
findModifiedValidators - 1 modified validators 182.39 ms/op 124.90 ms/op 1.46
findModifiedValidators - no difference 208.33 ms/op 151.00 ms/op 1.38
compare ViewDUs 3.8165 s/op 3.2692 s/op 1.17
compare each validator Uint8Array 1.6860 s/op 1.6863 s/op 1.00
compare ViewDU to Uint8Array 1.3280 s/op 737.08 ms/op 1.80
migrate state 1000000 validators, 24 modified, 0 new 932.21 ms/op 679.76 ms/op 1.37
migrate state 1000000 validators, 1700 modified, 1000 new 1.2620 s/op 918.68 ms/op 1.37
migrate state 1000000 validators, 3400 modified, 2000 new 1.3187 s/op 1.2131 s/op 1.09
migrate state 1500000 validators, 24 modified, 0 new 746.32 ms/op 747.01 ms/op 1.00
migrate state 1500000 validators, 1700 modified, 1000 new 999.57 ms/op 977.36 ms/op 1.02
migrate state 1500000 validators, 3400 modified, 2000 new 1.1739 s/op 1.1608 s/op 1.01
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.7400 ns/op 5.7500 ns/op 0.82
state getBlockRootAtSlot - 250000 vs - 7PWei 610.47 ns/op 1.0498 us/op 0.58
computeProposers - vc 250000 6.7512 ms/op 6.7175 ms/op 1.01
computeEpochShuffling - vc 250000 42.311 ms/op 33.506 ms/op 1.26
getNextSyncCommittee - vc 250000 120.12 ms/op 105.61 ms/op 1.14
computeSigningRoot for AttestationData 17.645 us/op 21.716 us/op 0.81
hash AttestationData serialized data then Buffer.toString(base64) 1.5716 us/op 1.1725 us/op 1.34
toHexString serialized data 920.82 ns/op 787.62 ns/op 1.17
Buffer.toString(base64) 178.97 ns/op 127.43 ns/op 1.40
nodejs block root to RootHex using toHex 149.37 ns/op 115.32 ns/op 1.30
nodejs block root to RootHex using toRootHex 92.065 ns/op 75.014 ns/op 1.23
browser block root to RootHex using the deprecated toHexString 226.60 ns/op 210.16 ns/op 1.08
browser block root to RootHex using toHex 183.61 ns/op 167.65 ns/op 1.10
browser block root to RootHex using toRootHex 160.59 ns/op 146.65 ns/op 1.10

by benchmarkbot/action

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.

Generally looks good, left some thoughts

packages/beacon-node/src/execution/engine/http.ts Outdated Show resolved Hide resolved
packages/beacon-node/src/execution/engine/http.ts Outdated Show resolved Hide resolved
packages/beacon-node/src/execution/engine/types.ts Outdated Show resolved Hide resolved
@ensi321 ensi321 changed the title chore: flatten fork logic in notifyNewPayload refactor: flatten fork logic in notifyNewPayload Jan 23, 2025
serializedExecutionRequests,
],
method,
params: generateSerializedNewPayloadParams(fork, method, {executionPayload}),
Copy link
Member

@nflaig nflaig Jan 23, 2025

Choose a reason for hiding this comment

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

while this looks much cleaner here, we lose a lot of type safety

eg. it's possible to call it like this without complaints

params: generateSerializedNewPayloadParams(fork, method, {}),

and then you will just notice this at runtime

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

Successfully merging this pull request may close these issues.

2 participants