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: update the block production race #6241

Merged
merged 41 commits into from
Feb 5, 2024

Conversation

nazarhussain
Copy link
Contributor

Motivation

Simplify the implementation of race promise

Description

  • Simplify the promise race implementation
  • Remove the event handling of the promise race
  • Improve the block production race

Steps to test or reproduce

  • Run all tests

@nazarhussain nazarhussain requested a review from a team as a code owner December 29, 2023 13:30
@nazarhussain nazarhussain self-assigned this Dec 29, 2023
Copy link
Contributor

@g11tech g11tech left a comment

Choose a reason for hiding this comment

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

please remove promise race changes and only add body optimization

@nazarhussain
Copy link
Contributor Author

please remove promise race changes and only add body optimization

This PR is just for the promise optimization. The PR for block body will come separate.

Copy link
Contributor

@g11tech g11tech left a comment

Choose a reason for hiding this comment

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

great refactor, however add the events callback back as its an important source for debugging

packages/beacon-node/src/api/impl/validator/index.ts Outdated Show resolved Hide resolved
packages/beacon-node/src/api/impl/validator/index.ts Outdated Show resolved Hide resolved
packages/beacon-node/src/api/impl/validator/index.ts Outdated Show resolved Hide resolved
packages/utils/src/promise.ts Outdated Show resolved Hide resolved
packages/utils/src/promise.ts Show resolved Hide resolved
packages/utils/src/promise.ts Show resolved Hide resolved
packages/utils/src/types.ts Show resolved Hide resolved
packages/utils/src/promise.ts Outdated Show resolved Hide resolved
@g11tech g11tech force-pushed the builder_boost branch 2 times, most recently from 4267b3b to 41d1112 Compare January 7, 2024 16:00
Base automatically changed from builder_boost to unstable January 8, 2024 18:05
Copy link

codecov bot commented Jan 19, 2024

Codecov Report

Merging #6241 (3391626) into unstable (00dfa63) will decrease coverage by 0.01%.
The diff coverage is n/a.

❗ Current head 3391626 differs from pull request most recent head cb022e4. Consider uploading reports for the commit cb022e4 to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #6241      +/-   ##
============================================
- Coverage     60.15%   60.15%   -0.01%     
============================================
  Files           407      407              
  Lines         46512    46502      -10     
  Branches       1551     1547       -4     
============================================
- Hits          27978    27971       -7     
+ Misses        18502    18499       -3     
  Partials         32       32              

Copy link
Contributor

github-actions bot commented Jan 19, 2024

⚠️ Performance Alert ⚠️

Possible performance regression was detected for some benchmarks.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold.

Benchmark suite Current: 26d4cf6 Previous: 00dfa63 Ratio
Map set x1000 55.348 ns/op 17.989 ns/op 3.08
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 42.407 us/op 5.0180 us/op 8.45
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 30.924 us/op 3.8680 us/op 7.99
phase0 getAttestationDeltas - 250000 worstcase 16.880 ms/op 5.2664 ms/op 3.21
Full benchmark results
Benchmark suite Current: 26d4cf6 Previous: 00dfa63 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 709.38 us/op 684.00 us/op 1.04
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 93.451 us/op 59.111 us/op 1.58
BLS verify - blst-native 1.3596 ms/op 1.1248 ms/op 1.21
BLS verifyMultipleSignatures 3 - blst-native 2.9404 ms/op 2.4066 ms/op 1.22
BLS verifyMultipleSignatures 8 - blst-native 6.1310 ms/op 5.3349 ms/op 1.15
BLS verifyMultipleSignatures 32 - blst-native 22.344 ms/op 19.397 ms/op 1.15
BLS verifyMultipleSignatures 64 - blst-native 43.993 ms/op 37.987 ms/op 1.16
BLS verifyMultipleSignatures 128 - blst-native 87.473 ms/op 75.634 ms/op 1.16
BLS deserializing 10000 signatures 938.17 ms/op 815.67 ms/op 1.15
BLS deserializing 100000 signatures 9.4472 s/op 8.3433 s/op 1.13
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.4210 ms/op 1.2159 ms/op 1.17
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.6151 ms/op 1.2978 ms/op 1.24
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.4596 ms/op 2.0581 ms/op 1.20
BLS verifyMultipleSignatures - same message - 64 - blst-native 3.5495 ms/op 4.0723 ms/op 0.87
BLS verifyMultipleSignatures - same message - 128 - blst-native 5.8246 ms/op 5.0152 ms/op 1.16
BLS aggregatePubkeys 32 - blst-native 27.181 us/op 22.698 us/op 1.20
BLS aggregatePubkeys 128 - blst-native 107.30 us/op 89.114 us/op 1.20
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 67.321 ms/op 42.295 ms/op 1.59
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 64.143 ms/op 39.405 ms/op 1.63
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 50.663 ms/op 25.263 ms/op 2.01
getSlashingsAndExits - default max 246.06 us/op 142.00 us/op 1.73
getSlashingsAndExits - 2k 591.26 us/op 342.30 us/op 1.73
proposeBlockBody type=full, size=empty 9.0671 ms/op 4.0434 ms/op 2.24
isKnown best case - 1 super set check 684.00 ns/op 335.00 ns/op 2.04
isKnown normal case - 2 super set checks 793.00 ns/op 316.00 ns/op 2.51
isKnown worse case - 16 super set checks 772.00 ns/op 304.00 ns/op 2.54
CheckpointStateCache - add get delete 8.7630 us/op 5.1420 us/op 1.70
validate api signedAggregateAndProof - struct 3.5953 ms/op 2.5634 ms/op 1.40
validate gossip signedAggregateAndProof - struct 3.2430 ms/op 2.4344 ms/op 1.33
validate gossip attestation - vc 640000 1.5299 ms/op 1.1748 ms/op 1.30
batch validate gossip attestation - vc 640000 - chunk 32 189.82 us/op 145.33 us/op 1.31
batch validate gossip attestation - vc 640000 - chunk 64 185.04 us/op 131.03 us/op 1.41
batch validate gossip attestation - vc 640000 - chunk 128 149.88 us/op 120.12 us/op 1.25
batch validate gossip attestation - vc 640000 - chunk 256 144.56 us/op 118.93 us/op 1.22
pickEth1Vote - no votes 1.3657 ms/op 1.2650 ms/op 1.08
pickEth1Vote - max votes 14.867 ms/op 11.827 ms/op 1.26
pickEth1Vote - Eth1Data hashTreeRoot value x2048 21.302 ms/op 15.426 ms/op 1.38
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 30.699 ms/op 20.482 ms/op 1.50
pickEth1Vote - Eth1Data fastSerialize value x2048 876.80 us/op 443.67 us/op 1.98
pickEth1Vote - Eth1Data fastSerialize tree x2048 6.5812 ms/op 3.7958 ms/op 1.73
bytes32 toHexString 607.00 ns/op 548.00 ns/op 1.11
bytes32 Buffer.toString(hex) 329.00 ns/op 336.00 ns/op 0.98
bytes32 Buffer.toString(hex) from Uint8Array 523.00 ns/op 485.00 ns/op 1.08
bytes32 Buffer.toString(hex) + 0x 316.00 ns/op 349.00 ns/op 0.91
Object access 1 prop 0.21500 ns/op 0.21200 ns/op 1.01
Map access 1 prop 0.15600 ns/op 0.20100 ns/op 0.78
Object get x1000 8.4650 ns/op 5.1980 ns/op 1.63
Map get x1000 0.93800 ns/op 0.79900 ns/op 1.17
Object set x1000 77.526 ns/op 30.928 ns/op 2.51
Map set x1000 55.348 ns/op 17.989 ns/op 3.08
Return object 10000 times 0.27450 ns/op 0.22660 ns/op 1.21
Throw Error 10000 times 4.3881 us/op 2.6858 us/op 1.63
fastMsgIdFn sha256 / 200 bytes 3.6860 us/op 2.0700 us/op 1.78
fastMsgIdFn h32 xxhash / 200 bytes 375.00 ns/op 316.00 ns/op 1.19
fastMsgIdFn h64 xxhash / 200 bytes 395.00 ns/op 379.00 ns/op 1.04
fastMsgIdFn sha256 / 1000 bytes 12.213 us/op 6.2020 us/op 1.97
fastMsgIdFn h32 xxhash / 1000 bytes 482.00 ns/op 448.00 ns/op 1.08
fastMsgIdFn h64 xxhash / 1000 bytes 458.00 ns/op 427.00 ns/op 1.07
fastMsgIdFn sha256 / 10000 bytes 108.36 us/op 52.374 us/op 2.07
fastMsgIdFn h32 xxhash / 10000 bytes 2.0780 us/op 1.8590 us/op 1.12
fastMsgIdFn h64 xxhash / 10000 bytes 1.4560 us/op 1.2830 us/op 1.13
send data - 1000 256B messages 21.858 ms/op 11.844 ms/op 1.85
send data - 1000 512B messages 25.173 ms/op 16.252 ms/op 1.55
send data - 1000 1024B messages 45.455 ms/op 28.161 ms/op 1.61
send data - 1000 1200B messages 46.153 ms/op 35.088 ms/op 1.32
send data - 1000 2048B messages 52.252 ms/op 39.988 ms/op 1.31
send data - 1000 4096B messages 47.724 ms/op 35.559 ms/op 1.34
send data - 1000 16384B messages 132.51 ms/op 85.979 ms/op 1.54
send data - 1000 65536B messages 493.98 ms/op 440.28 ms/op 1.12
enrSubnets - fastDeserialize 64 bits 1.9340 us/op 1.0640 us/op 1.82
enrSubnets - ssz BitVector 64 bits 678.00 ns/op 450.00 ns/op 1.51
enrSubnets - fastDeserialize 4 bits 238.00 ns/op 199.00 ns/op 1.20
enrSubnets - ssz BitVector 4 bits 531.00 ns/op 445.00 ns/op 1.19
prioritizePeers score -10:0 att 32-0.1 sync 2-0 118.20 us/op 71.654 us/op 1.65
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 151.26 us/op 78.569 us/op 1.93
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 242.15 us/op 108.91 us/op 2.22
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 325.74 us/op 188.90 us/op 1.72
prioritizePeers score 0:0 att 64-1 sync 4-1 380.99 us/op 204.31 us/op 1.86
array of 16000 items push then shift 1.8209 us/op 1.3314 us/op 1.37
LinkedList of 16000 items push then shift 10.338 ns/op 6.0160 ns/op 1.72
array of 16000 items push then pop 114.59 ns/op 98.365 ns/op 1.16
LinkedList of 16000 items push then pop 9.2270 ns/op 5.9400 ns/op 1.55
array of 24000 items push then shift 2.5538 us/op 1.8558 us/op 1.38
LinkedList of 24000 items push then shift 9.2600 ns/op 7.0260 ns/op 1.32
array of 24000 items push then pop 146.98 ns/op 85.882 ns/op 1.71
LinkedList of 24000 items push then pop 9.0270 ns/op 5.7900 ns/op 1.56
intersect bitArray bitLen 8 6.0630 ns/op 4.8080 ns/op 1.26
intersect array and set length 8 75.758 ns/op 48.355 ns/op 1.57
intersect bitArray bitLen 128 36.568 ns/op 28.780 ns/op 1.27
intersect array and set length 128 1.0940 us/op 692.62 ns/op 1.58
bitArray.getTrueBitIndexes() bitLen 128 1.8480 us/op 1.2670 us/op 1.46
bitArray.getTrueBitIndexes() bitLen 248 3.3590 us/op 2.1560 us/op 1.56
bitArray.getTrueBitIndexes() bitLen 512 6.7290 us/op 3.9630 us/op 1.70
Buffer.concat 32 items 1.1820 us/op 832.00 ns/op 1.42
Uint8Array.set 32 items 1.9750 us/op 1.5910 us/op 1.24
Set add up to 64 items then delete first 5.2709 us/op 1.7765 us/op 2.97
OrderedSet add up to 64 items then delete first 6.3338 us/op 2.6874 us/op 2.36
Set add up to 64 items then delete last 5.3840 us/op 2.0403 us/op 2.64
OrderedSet add up to 64 items then delete last 6.8234 us/op 2.9808 us/op 2.29
Set add up to 64 items then delete middle 5.1049 us/op 1.9923 us/op 2.56
OrderedSet add up to 64 items then delete middle 7.9111 us/op 4.2265 us/op 1.87
Set add up to 128 items then delete first 10.596 us/op 3.9514 us/op 2.68
OrderedSet add up to 128 items then delete first 14.470 us/op 6.2040 us/op 2.33
Set add up to 128 items then delete last 10.442 us/op 3.8158 us/op 2.74
OrderedSet add up to 128 items then delete last 13.763 us/op 5.7147 us/op 2.41
Set add up to 128 items then delete middle 10.660 us/op 3.8492 us/op 2.77
OrderedSet add up to 128 items then delete middle 19.581 us/op 10.877 us/op 1.80
Set add up to 256 items then delete first 20.875 us/op 7.6834 us/op 2.72
OrderedSet add up to 256 items then delete first 30.165 us/op 12.158 us/op 2.48
Set add up to 256 items then delete last 21.553 us/op 7.4444 us/op 2.90
OrderedSet add up to 256 items then delete last 25.846 us/op 11.365 us/op 2.27
Set add up to 256 items then delete middle 19.472 us/op 7.4250 us/op 2.62
OrderedSet add up to 256 items then delete middle 50.766 us/op 30.334 us/op 1.67
transfer serialized Status (84 B) 1.8890 us/op 1.3300 us/op 1.42
copy serialized Status (84 B) 1.3830 us/op 1.0580 us/op 1.31
transfer serialized SignedVoluntaryExit (112 B) 1.9280 us/op 1.3120 us/op 1.47
copy serialized SignedVoluntaryExit (112 B) 1.4260 us/op 1.1020 us/op 1.29
transfer serialized ProposerSlashing (416 B) 2.9310 us/op 1.9610 us/op 1.49
copy serialized ProposerSlashing (416 B) 2.8070 us/op 2.0300 us/op 1.38
transfer serialized Attestation (485 B) 3.6210 us/op 2.0770 us/op 1.74
copy serialized Attestation (485 B) 2.9910 us/op 1.7380 us/op 1.72
transfer serialized AttesterSlashing (33232 B) 3.0850 us/op 2.0930 us/op 1.47
copy serialized AttesterSlashing (33232 B) 8.7530 us/op 5.1030 us/op 1.72
transfer serialized Small SignedBeaconBlock (128000 B) 2.9940 us/op 2.2360 us/op 1.34
copy serialized Small SignedBeaconBlock (128000 B) 25.792 us/op 12.057 us/op 2.14
transfer serialized Avg SignedBeaconBlock (200000 B) 3.5980 us/op 2.0560 us/op 1.75
copy serialized Avg SignedBeaconBlock (200000 B) 37.097 us/op 17.843 us/op 2.08
transfer serialized BlobsSidecar (524380 B) 3.5440 us/op 1.8660 us/op 1.90
copy serialized BlobsSidecar (524380 B) 128.44 us/op 73.719 us/op 1.74
transfer serialized Big SignedBeaconBlock (1000000 B) 4.3070 us/op 2.0990 us/op 2.05
copy serialized Big SignedBeaconBlock (1000000 B) 194.85 us/op 132.92 us/op 1.47
pass gossip attestations to forkchoice per slot 5.2487 ms/op 2.6458 ms/op 1.98
forkChoice updateHead vc 100000 bc 64 eq 0 796.47 us/op 496.91 us/op 1.60
forkChoice updateHead vc 600000 bc 64 eq 0 4.9191 ms/op 2.5642 ms/op 1.92
forkChoice updateHead vc 1000000 bc 64 eq 0 7.3365 ms/op 4.3253 ms/op 1.70
forkChoice updateHead vc 600000 bc 320 eq 0 4.3599 ms/op 2.6313 ms/op 1.66
forkChoice updateHead vc 600000 bc 1200 eq 0 4.5959 ms/op 2.6818 ms/op 1.71
forkChoice updateHead vc 600000 bc 7200 eq 0 5.8288 ms/op 3.2177 ms/op 1.81
forkChoice updateHead vc 600000 bc 64 eq 1000 11.907 ms/op 9.8004 ms/op 1.21
forkChoice updateHead vc 600000 bc 64 eq 10000 12.955 ms/op 9.8880 ms/op 1.31
forkChoice updateHead vc 600000 bc 64 eq 300000 17.031 ms/op 11.872 ms/op 1.43
computeDeltas 500000 validators 300 proto nodes 7.2813 ms/op 3.1550 ms/op 2.31
computeDeltas 500000 validators 1200 proto nodes 7.0183 ms/op 3.0425 ms/op 2.31
computeDeltas 500000 validators 7200 proto nodes 6.9561 ms/op 2.9930 ms/op 2.32
computeDeltas 750000 validators 300 proto nodes 10.339 ms/op 4.6445 ms/op 2.23
computeDeltas 750000 validators 1200 proto nodes 10.501 ms/op 4.4902 ms/op 2.34
computeDeltas 750000 validators 7200 proto nodes 11.046 ms/op 4.7106 ms/op 2.35
computeDeltas 1400000 validators 300 proto nodes 21.129 ms/op 8.8414 ms/op 2.39
computeDeltas 1400000 validators 1200 proto nodes 21.033 ms/op 9.1566 ms/op 2.30
computeDeltas 1400000 validators 7200 proto nodes 20.535 ms/op 8.7482 ms/op 2.35
computeDeltas 2100000 validators 300 proto nodes 32.900 ms/op 12.896 ms/op 2.55
computeDeltas 2100000 validators 1200 proto nodes 34.973 ms/op 12.919 ms/op 2.71
computeDeltas 2100000 validators 7200 proto nodes 30.824 ms/op 13.389 ms/op 2.30
altair processAttestation - 250000 vs - 7PWei normalcase 3.1919 ms/op 1.5855 ms/op 2.01
altair processAttestation - 250000 vs - 7PWei worstcase 4.8291 ms/op 2.2388 ms/op 2.16
altair processAttestation - setStatus - 1/6 committees join 184.63 us/op 74.941 us/op 2.46
altair processAttestation - setStatus - 1/3 committees join 325.22 us/op 153.62 us/op 2.12
altair processAttestation - setStatus - 1/2 committees join 442.93 us/op 213.83 us/op 2.07
altair processAttestation - setStatus - 2/3 committees join 566.55 us/op 285.88 us/op 1.98
altair processAttestation - setStatus - 4/5 committees join 797.11 us/op 390.93 us/op 2.04
altair processAttestation - setStatus - 100% committees join 933.01 us/op 462.04 us/op 2.02
altair processBlock - 250000 vs - 7PWei normalcase 13.320 ms/op 7.7470 ms/op 1.72
altair processBlock - 250000 vs - 7PWei normalcase hashState 42.767 ms/op 29.179 ms/op 1.47
altair processBlock - 250000 vs - 7PWei worstcase 52.011 ms/op 32.207 ms/op 1.61
altair processBlock - 250000 vs - 7PWei worstcase hashState 122.91 ms/op 79.405 ms/op 1.55
phase0 processBlock - 250000 vs - 7PWei normalcase 3.8566 ms/op 1.8229 ms/op 2.12
phase0 processBlock - 250000 vs - 7PWei worstcase 39.889 ms/op 23.480 ms/op 1.70
altair processEth1Data - 250000 vs - 7PWei normalcase 829.41 us/op 357.56 us/op 2.32
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 25.812 us/op 9.1400 us/op 2.82
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 77.207 us/op 41.346 us/op 1.87
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 42.407 us/op 5.0180 us/op 8.45
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 30.924 us/op 3.8680 us/op 7.99
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 264.64 us/op 153.50 us/op 1.72
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.9313 ms/op 1.1420 ms/op 1.69
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.4051 ms/op 1.1865 ms/op 2.03
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.3316 ms/op 1.0431 ms/op 2.24
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 6.2350 ms/op 2.7924 ms/op 2.23
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 4.2012 ms/op 2.0044 ms/op 2.10
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 8.7105 ms/op 3.8856 ms/op 2.24
Tree 40 250000 create 848.98 ms/op 259.83 ms/op 3.27
Tree 40 250000 get(125000) 242.61 ns/op 115.53 ns/op 2.10
Tree 40 250000 set(125000) 2.7155 us/op 751.98 ns/op 3.61
Tree 40 250000 toArray() 28.338 ms/op 9.7883 ms/op 2.90
Tree 40 250000 iterate all - toArray() + loop 35.355 ms/op 10.064 ms/op 3.51
Tree 40 250000 iterate all - get(i) 92.387 ms/op 42.097 ms/op 2.19
MutableVector 250000 create 18.112 ms/op 11.900 ms/op 1.52
MutableVector 250000 get(125000) 7.3570 ns/op 5.6580 ns/op 1.30
MutableVector 250000 set(125000) 875.92 ns/op 218.40 ns/op 4.01
MutableVector 250000 toArray() 5.5328 ms/op 3.0036 ms/op 1.84
MutableVector 250000 iterate all - toArray() + loop 6.1556 ms/op 3.3155 ms/op 1.86
MutableVector 250000 iterate all - get(i) 1.8243 ms/op 1.2950 ms/op 1.41
Array 250000 create 5.2964 ms/op 2.9946 ms/op 1.77
Array 250000 clone - spread 7.1865 ms/op 1.1861 ms/op 6.06
Array 250000 get(125000) 3.5090 ns/op 1.0190 ns/op 3.44
Array 250000 set(125000) 6.9840 ns/op 1.2100 ns/op 5.77
Array 250000 iterate all - loop 222.80 us/op 146.47 us/op 1.52
effectiveBalanceIncrements clone Uint8Array 300000 238.45 us/op 26.247 us/op 9.08
effectiveBalanceIncrements clone MutableVector 300000 1.7960 us/op 426.00 ns/op 4.22
effectiveBalanceIncrements rw all Uint8Array 300000 225.90 us/op 177.63 us/op 1.27
effectiveBalanceIncrements rw all MutableVector 300000 195.53 ms/op 69.854 ms/op 2.80
phase0 afterProcessEpoch - 250000 vs - 7PWei 164.35 ms/op 73.517 ms/op 2.24
phase0 beforeProcessEpoch - 250000 vs - 7PWei 82.341 ms/op 33.745 ms/op 2.44
altair processEpoch - mainnet_e81889 719.85 ms/op 413.34 ms/op 1.74
mainnet_e81889 - altair beforeProcessEpoch 126.13 ms/op 71.573 ms/op 1.76
mainnet_e81889 - altair processJustificationAndFinalization 41.284 us/op 10.185 us/op 4.05
mainnet_e81889 - altair processInactivityUpdates 13.255 ms/op 4.5232 ms/op 2.93
mainnet_e81889 - altair processRewardsAndPenalties 77.440 ms/op 58.621 ms/op 1.32
mainnet_e81889 - altair processRegistryUpdates 8.0220 us/op 1.8210 us/op 4.41
mainnet_e81889 - altair processSlashings 1.8170 us/op 567.00 ns/op 3.20
mainnet_e81889 - altair processEth1DataReset 1.6240 us/op 539.00 ns/op 3.01
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.5648 ms/op 1.7812 ms/op 1.44
mainnet_e81889 - altair processSlashingsReset 7.9460 us/op 2.2560 us/op 3.52
mainnet_e81889 - altair processRandaoMixesReset 10.803 us/op 2.5850 us/op 4.18
mainnet_e81889 - altair processHistoricalRootsUpdate 2.4540 us/op 688.00 ns/op 3.57
mainnet_e81889 - altair processParticipationFlagUpdates 5.5120 us/op 1.2500 us/op 4.41
mainnet_e81889 - altair processSyncCommitteeUpdates 1.4700 us/op 609.00 ns/op 2.41
mainnet_e81889 - altair afterProcessEpoch 157.32 ms/op 80.041 ms/op 1.97
capella processEpoch - mainnet_e217614 3.8734 s/op 1.8286 s/op 2.12
mainnet_e217614 - capella beforeProcessEpoch 737.98 ms/op 447.56 ms/op 1.65
mainnet_e217614 - capella processJustificationAndFinalization 37.464 us/op 10.369 us/op 3.61
mainnet_e217614 - capella processInactivityUpdates 33.467 ms/op 15.954 ms/op 2.10
mainnet_e217614 - capella processRewardsAndPenalties 518.73 ms/op 387.58 ms/op 1.34
mainnet_e217614 - capella processRegistryUpdates 37.513 us/op 18.172 us/op 2.06
mainnet_e217614 - capella processSlashings 1.0460 us/op 558.00 ns/op 1.87
mainnet_e217614 - capella processEth1DataReset 1.5730 us/op 543.00 ns/op 2.90
mainnet_e217614 - capella processEffectiveBalanceUpdates 7.7887 ms/op 5.0723 ms/op 1.54
mainnet_e217614 - capella processSlashingsReset 7.3850 us/op 1.5690 us/op 4.71
mainnet_e217614 - capella processRandaoMixesReset 8.0190 us/op 2.7470 us/op 2.92
mainnet_e217614 - capella processHistoricalRootsUpdate 1.8200 us/op 653.00 ns/op 2.79
mainnet_e217614 - capella processParticipationFlagUpdates 2.7600 us/op 1.4640 us/op 1.89
mainnet_e217614 - capella afterProcessEpoch 350.26 ms/op 237.46 ms/op 1.48
phase0 processEpoch - mainnet_e58758 636.32 ms/op 390.78 ms/op 1.63
mainnet_e58758 - phase0 beforeProcessEpoch 257.76 ms/op 97.940 ms/op 2.63
mainnet_e58758 - phase0 processJustificationAndFinalization 38.164 us/op 10.740 us/op 3.55
mainnet_e58758 - phase0 processRewardsAndPenalties 77.583 ms/op 50.526 ms/op 1.54
mainnet_e58758 - phase0 processRegistryUpdates 21.870 us/op 7.0920 us/op 3.08
mainnet_e58758 - phase0 processSlashings 1.8100 us/op 554.00 ns/op 3.27
mainnet_e58758 - phase0 processEth1DataReset 1.0550 us/op 551.00 ns/op 1.91
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.3681 ms/op 1.3900 ms/op 1.70
mainnet_e58758 - phase0 processSlashingsReset 8.7090 us/op 2.8910 us/op 3.01
mainnet_e58758 - phase0 processRandaoMixesReset 9.8210 us/op 3.0920 us/op 3.18
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.2630 us/op 484.00 ns/op 2.61
mainnet_e58758 - phase0 processParticipationRecordUpdates 10.081 us/op 2.8260 us/op 3.57
mainnet_e58758 - phase0 afterProcessEpoch 142.02 ms/op 63.653 ms/op 2.23
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.5877 ms/op 990.34 us/op 2.61
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.4704 ms/op 1.1561 ms/op 2.14
altair processInactivityUpdates - 250000 normalcase 39.552 ms/op 20.741 ms/op 1.91
altair processInactivityUpdates - 250000 worstcase 43.660 ms/op 21.378 ms/op 2.04
phase0 processRegistryUpdates - 250000 normalcase 21.207 us/op 9.6110 us/op 2.21
phase0 processRegistryUpdates - 250000 badcase_full_deposits 750.49 us/op 393.86 us/op 1.91
phase0 processRegistryUpdates - 250000 worstcase 0.5 227.49 ms/op 116.59 ms/op 1.95
altair processRewardsAndPenalties - 250000 normalcase 76.223 ms/op 58.817 ms/op 1.30
altair processRewardsAndPenalties - 250000 worstcase 82.457 ms/op 56.796 ms/op 1.45
phase0 getAttestationDeltas - 250000 normalcase 13.662 ms/op 5.6794 ms/op 2.41
phase0 getAttestationDeltas - 250000 worstcase 16.880 ms/op 5.2664 ms/op 3.21
phase0 processSlashings - 250000 worstcase 176.04 us/op 87.839 us/op 2.00
altair processSyncCommitteeUpdates - 250000 212.44 ms/op 122.68 ms/op 1.73
BeaconState.hashTreeRoot - No change 1.2000 us/op 610.00 ns/op 1.97
BeaconState.hashTreeRoot - 1 full validator 252.25 us/op 102.31 us/op 2.47
BeaconState.hashTreeRoot - 32 full validator 2.7874 ms/op 1.5302 ms/op 1.82
BeaconState.hashTreeRoot - 512 full validator 24.595 ms/op 12.889 ms/op 1.91
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 302.28 us/op 139.77 us/op 2.16
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.9159 ms/op 1.5345 ms/op 1.90
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 48.518 ms/op 20.360 ms/op 2.38
BeaconState.hashTreeRoot - 1 balances 216.16 us/op 82.813 us/op 2.61
BeaconState.hashTreeRoot - 32 balances 1.8321 ms/op 748.16 us/op 2.45
BeaconState.hashTreeRoot - 512 balances 22.185 ms/op 7.4957 ms/op 2.96
BeaconState.hashTreeRoot - 250000 balances 300.46 ms/op 136.30 ms/op 2.20
aggregationBits - 2048 els - zipIndexesInBitList 44.761 us/op 10.637 us/op 4.21
byteArrayEquals 32 105.04 ns/op 64.710 ns/op 1.62
Buffer.compare 32 67.518 ns/op 37.350 ns/op 1.81
byteArrayEquals 1024 2.9059 us/op 1.7620 us/op 1.65
Buffer.compare 1024 99.351 ns/op 44.286 ns/op 2.24
byteArrayEquals 16384 42.101 us/op 28.056 us/op 1.50
Buffer.compare 16384 378.43 ns/op 218.26 ns/op 1.73
byteArrayEquals 123687377 315.56 ms/op 211.18 ms/op 1.49
Buffer.compare 123687377 15.419 ms/op 6.9481 ms/op 2.22
byteArrayEquals 32 - diff last byte 136.17 ns/op 62.636 ns/op 2.17
Buffer.compare 32 - diff last byte 70.885 ns/op 38.672 ns/op 1.83
byteArrayEquals 1024 - diff last byte 3.1516 us/op 1.8365 us/op 1.72
Buffer.compare 1024 - diff last byte 91.836 ns/op 47.334 ns/op 1.94
byteArrayEquals 16384 - diff last byte 47.280 us/op 28.479 us/op 1.66
Buffer.compare 16384 - diff last byte 371.83 ns/op 224.58 ns/op 1.66
byteArrayEquals 123687377 - diff last byte 300.14 ms/op 212.08 ms/op 1.42
Buffer.compare 123687377 - diff last byte 15.236 ms/op 6.9068 ms/op 2.21
byteArrayEquals 32 - random bytes 8.3630 ns/op 5.0000 ns/op 1.67
Buffer.compare 32 - random bytes 75.879 ns/op 40.823 ns/op 1.86
byteArrayEquals 1024 - random bytes 7.4000 ns/op 5.3890 ns/op 1.37
Buffer.compare 1024 - random bytes 70.530 ns/op 46.172 ns/op 1.53
byteArrayEquals 16384 - random bytes 7.6490 ns/op 5.1410 ns/op 1.49
Buffer.compare 16384 - random bytes 71.005 ns/op 39.107 ns/op 1.82
byteArrayEquals 123687377 - random bytes 21.960 ns/op 8.2700 ns/op 2.66
Buffer.compare 123687377 - random bytes 88.210 ns/op 43.300 ns/op 2.04
regular array get 100000 times 51.521 us/op 42.889 us/op 1.20
wrappedArray get 100000 times 51.728 us/op 43.103 us/op 1.20
arrayWithProxy get 100000 times 16.619 ms/op 10.482 ms/op 1.59
ssz.Root.equals 60.886 ns/op 56.707 ns/op 1.07
byteArrayEquals 58.798 ns/op 55.991 ns/op 1.05
Buffer.compare 14.535 ns/op 10.607 ns/op 1.37
shuffle list - 16384 els 8.5340 ms/op 4.7700 ms/op 1.79
shuffle list - 250000 els 124.94 ms/op 71.349 ms/op 1.75
processSlot - 1 slots 25.312 us/op 13.847 us/op 1.83
processSlot - 32 slots 4.8163 ms/op 2.6486 ms/op 1.82
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 85.360 ms/op 52.061 ms/op 1.64
getCommitteeAssignments - req 1 vs - 250000 vc 3.1894 ms/op 2.2770 ms/op 1.40
getCommitteeAssignments - req 100 vs - 250000 vc 4.4958 ms/op 3.4490 ms/op 1.30
getCommitteeAssignments - req 1000 vs - 250000 vc 4.4387 ms/op 3.8072 ms/op 1.17
findModifiedValidators - 10000 modified validators 850.91 ms/op 447.60 ms/op 1.90
findModifiedValidators - 1000 modified validators 764.60 ms/op 346.90 ms/op 2.20
findModifiedValidators - 100 modified validators 723.68 ms/op 351.60 ms/op 2.06
findModifiedValidators - 10 modified validators 781.85 ms/op 331.78 ms/op 2.36
findModifiedValidators - 1 modified validators 679.50 ms/op 345.25 ms/op 1.97
findModifiedValidators - no difference 762.03 ms/op 350.18 ms/op 2.18
compare ViewDUs 6.9278 s/op 4.4888 s/op 1.54
compare each validator Uint8Array 3.1491 s/op 1.3689 s/op 2.30
compare ViewDU to Uint8Array 2.0758 s/op 1.1868 s/op 1.75
migrate state 1000000 validators, 24 modified, 0 new 1.3117 s/op 809.45 ms/op 1.62
migrate state 1000000 validators, 1700 modified, 1000 new 1.5311 s/op 991.41 ms/op 1.54
migrate state 1000000 validators, 3400 modified, 2000 new 1.6342 s/op 1.1119 s/op 1.47
migrate state 1500000 validators, 24 modified, 0 new 798.75 ms/op 591.10 ms/op 1.35
migrate state 1500000 validators, 1700 modified, 1000 new 1.0452 s/op 870.61 ms/op 1.20
migrate state 1500000 validators, 3400 modified, 2000 new 1.3515 s/op 1.1451 s/op 1.18
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.1500 ns/op 4.2100 ns/op 1.22
state getBlockRootAtSlot - 250000 vs - 7PWei 568.67 ns/op 558.00 ns/op 1.02
computeProposers - vc 250000 9.2803 ms/op 5.8573 ms/op 1.58
computeEpochShuffling - vc 250000 107.43 ms/op 66.787 ms/op 1.61
getNextSyncCommittee - vc 250000 153.56 ms/op 102.89 ms/op 1.49
computeSigningRoot for AttestationData 26.800 us/op 21.387 us/op 1.25
hash AttestationData serialized data then Buffer.toString(base64) 2.3916 us/op 1.2136 us/op 1.97
toHexString serialized data 1.1903 us/op 774.44 ns/op 1.54
Buffer.toString(base64) 259.05 ns/op 148.12 ns/op 1.75

by benchmarkbot/action

wemeetagain
wemeetagain previously approved these changes Jan 22, 2024
Copy link
Member

@wemeetagain wemeetagain left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@g11tech g11tech left a comment

Choose a reason for hiding this comment

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

early return has not been implemented, events have not been implemented, recommended using switch to be more typesafe

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.

Awesome work @wemeetagain @nazarhussain, this looks great! Type safety is even improved compared to unstable branch and block production flow is easy to follow and audit. All of my previous concerns have been addressed, just a few final, mostly cosmetic remarks from my side.

packages/beacon-node/src/api/impl/validator/index.ts Outdated Show resolved Hide resolved
packages/beacon-node/src/api/impl/validator/index.ts Outdated Show resolved Hide resolved
packages/beacon-node/src/api/impl/validator/index.ts Outdated Show resolved Hide resolved
packages/beacon-node/src/api/impl/validator/index.ts Outdated Show resolved Hide resolved
packages/beacon-node/src/api/impl/validator/index.ts Outdated Show resolved Hide resolved
packages/beacon-node/src/api/impl/validator/index.ts Outdated Show resolved Hide resolved
packages/utils/test/unit/promise.test.ts Outdated Show resolved Hide resolved
packages/utils/test/unit/promiserace.test.ts Show resolved Hide resolved
nazarhussain and others added 2 commits February 5, 2024 11:36
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
@nazarhussain
Copy link
Contributor Author

I don't think we do, to support better readability I think we should avoid to add suffixes to arleady long variable names.

That's just the matter of approach, add eth to key or ETH to value. I will leave it to @wemeetagain preferences here.

scripts/run_e2e_env.sh Outdated Show resolved Hide resolved
@nflaig
Copy link
Member

nflaig commented Feb 5, 2024

I don't think we do, to support better readability I think we should avoid to add suffixes to arleady long variable names.

That's just the matter of approach, add eth to key or ETH to value. I will leave it to @wemeetagain preferences here.

Let's revisit this topic in another PR, we should reuse the prettyWeiToEth in validator as well

@wemeetagain wemeetagain merged commit ac4e714 into unstable Feb 5, 2024
13 of 15 checks passed
@wemeetagain wemeetagain deleted the nh/6159-block-prod-race branch February 5, 2024 14:52
@nazarhussain
Copy link
Contributor Author

@g11tech If you still have any feedback, will be happy to cover in separate PR.

Copy link
Contributor

@g11tech g11tech left a comment

Choose a reason for hiding this comment

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

looks good to me as well

@wemeetagain
Copy link
Member

🎉 This PR is included in v1.16.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