Skip to content

Add validatior option to specify builder block selection strategy#5064

Merged
g11tech merged 8 commits intounstablefrom
g11tech/builder-selection
Feb 1, 2023
Merged

Add validatior option to specify builder block selection strategy#5064
g11tech merged 8 commits intounstablefrom
g11tech/builder-selection

Conversation

@g11tech
Copy link
Contributor

@g11tech g11tech commented Jan 27, 2023

PR

This PR takes #5003 to completion by adding a validator option to specify the builder vs engine block strategy with two options:

  • either --builder.selection builderalways
  • or --builder.selection maxprofit
    with the self explanatory selection behavior

PS:
Even though builder blockValue is always available, but engine's blockValue is/will be only available capella onwards where execution engine provide get_payloadV2 endpoint which returns blockValue of the engine block.
In the case of non-availability, the engine blockValue will be defauled to 0 and hence builder will always be picked so maxprofit startegy collapses to builderalways in that case

@g11tech g11tech requested a review from a team as a code owner January 27, 2023 07:07
@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2023

Performance Report

✔️ no performance regression detected

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: b9aa968 Previous: aaf134a Ratio
altair processInactivityUpdates - 250000 worstcase 32.199 ms/op 103.63 ms/op 0.31
Full benchmark results
Benchmark suite Current: b9aa968 Previous: aaf134a Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 961.46 us/op 1.3982 ms/op 0.69
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 58.365 us/op 99.136 us/op 0.59
BLS verify - blst-native 2.1746 ms/op 2.2561 ms/op 0.96
BLS verifyMultipleSignatures 3 - blst-native 4.4855 ms/op 4.7099 ms/op 0.95
BLS verifyMultipleSignatures 8 - blst-native 9.6965 ms/op 9.7621 ms/op 0.99
BLS verifyMultipleSignatures 32 - blst-native 35.249 ms/op 35.248 ms/op 1.00
BLS aggregatePubkeys 32 - blst-native 46.665 us/op 46.776 us/op 1.00
BLS aggregatePubkeys 128 - blst-native 182.56 us/op 180.97 us/op 1.01
getAttestationsForBlock 77.131 ms/op 108.00 ms/op 0.71
isKnown best case - 1 super set check 469.00 ns/op 519.00 ns/op 0.90
isKnown normal case - 2 super set checks 456.00 ns/op 516.00 ns/op 0.88
isKnown worse case - 16 super set checks 458.00 ns/op 517.00 ns/op 0.89
CheckpointStateCache - add get delete 8.0230 us/op 10.228 us/op 0.78
validate gossip signedAggregateAndProof - struct 5.0223 ms/op 5.1922 ms/op 0.97
validate gossip attestation - struct 2.3590 ms/op 2.3588 ms/op 1.00
pickEth1Vote - no votes 2.5319 ms/op 2.6109 ms/op 0.97
pickEth1Vote - max votes 15.810 ms/op 20.443 ms/op 0.77
pickEth1Vote - Eth1Data hashTreeRoot value x2048 12.962 ms/op 14.186 ms/op 0.91
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 20.570 ms/op 24.809 ms/op 0.83
pickEth1Vote - Eth1Data fastSerialize value x2048 1.1199 ms/op 1.4978 ms/op 0.75
pickEth1Vote - Eth1Data fastSerialize tree x2048 9.6601 ms/op 11.609 ms/op 0.83
bytes32 toHexString 956.00 ns/op 1.2540 us/op 0.76
bytes32 Buffer.toString(hex) 619.00 ns/op 708.00 ns/op 0.87
bytes32 Buffer.toString(hex) from Uint8Array 1.0050 us/op 1.0760 us/op 0.93
bytes32 Buffer.toString(hex) + 0x 633.00 ns/op 701.00 ns/op 0.90
Object access 1 prop 0.35400 ns/op 0.34900 ns/op 1.01
Map access 1 prop 0.30800 ns/op 0.34200 ns/op 0.90
Object get x1000 10.899 ns/op 19.034 ns/op 0.57
Map get x1000 1.0100 ns/op 1.1900 ns/op 0.85
Object set x1000 67.187 ns/op 130.15 ns/op 0.52
Map set x1000 41.637 ns/op 83.747 ns/op 0.50
Return object 10000 times 0.44180 ns/op 0.44000 ns/op 1.00
Throw Error 10000 times 6.6004 us/op 8.2474 us/op 0.80
fastMsgIdFn sha256 / 200 bytes 4.9750 us/op 5.2040 us/op 0.96
fastMsgIdFn h32 xxhash / 200 bytes 517.00 ns/op 579.00 ns/op 0.89
fastMsgIdFn h64 xxhash / 200 bytes 755.00 ns/op 756.00 ns/op 1.00
fastMsgIdFn sha256 / 1000 bytes 15.725 us/op 15.913 us/op 0.99
fastMsgIdFn h32 xxhash / 1000 bytes 692.00 ns/op 748.00 ns/op 0.93
fastMsgIdFn h64 xxhash / 1000 bytes 867.00 ns/op 872.00 ns/op 0.99
fastMsgIdFn sha256 / 10000 bytes 137.41 us/op 139.24 us/op 0.99
fastMsgIdFn h32 xxhash / 10000 bytes 2.6030 us/op 2.7330 us/op 0.95
fastMsgIdFn h64 xxhash / 10000 bytes 1.8540 us/op 1.9570 us/op 0.95
enrSubnets - fastDeserialize 64 bits 2.3350 us/op 2.8370 us/op 0.82
enrSubnets - ssz BitVector 64 bits 968.00 ns/op 977.00 ns/op 0.99
enrSubnets - fastDeserialize 4 bits 329.00 ns/op 349.00 ns/op 0.94
enrSubnets - ssz BitVector 4 bits 963.00 ns/op 1.0250 us/op 0.94
prioritizePeers score -10:0 att 32-0.1 sync 2-0 141.39 us/op 209.36 us/op 0.68
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 180.24 us/op 238.55 us/op 0.76
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 254.48 us/op 356.22 us/op 0.71
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 430.62 us/op 635.09 us/op 0.68
prioritizePeers score 0:0 att 64-1 sync 4-1 482.19 us/op 722.33 us/op 0.67
array of 16000 items push then shift 51.626 us/op 3.3472 us/op 15.42
LinkedList of 16000 items push then shift 12.395 ns/op 20.080 ns/op 0.62
array of 16000 items push then pop 189.37 ns/op 251.75 ns/op 0.75
LinkedList of 16000 items push then pop 12.091 ns/op 19.091 ns/op 0.63
array of 24000 items push then shift 77.374 us/op 4.6922 us/op 16.49
LinkedList of 24000 items push then shift 12.541 ns/op 23.638 ns/op 0.53
array of 24000 items push then pop 192.55 ns/op 242.46 ns/op 0.79
LinkedList of 24000 items push then pop 12.033 ns/op 20.366 ns/op 0.59
intersect bitArray bitLen 8 21.743 ns/op 33.869 ns/op 0.64
intersect array and set length 8 119.40 ns/op 191.75 ns/op 0.62
intersect bitArray bitLen 128 75.017 ns/op 137.68 ns/op 0.54
intersect array and set length 128 1.6191 us/op 2.6380 us/op 0.61
Buffer.concat 32 items 5.1400 us/op 6.0330 us/op 0.85
Uint8Array.set 32 items 3.6540 us/op 4.5330 us/op 0.81
pass gossip attestations to forkchoice per slot 3.6755 ms/op 5.0857 ms/op 0.72
computeDeltas 4.2212 ms/op 7.6181 ms/op 0.55
computeProposerBoostScoreFromBalances 2.4922 ms/op 3.1741 ms/op 0.79
altair processAttestation - 250000 vs - 7PWei normalcase 3.3657 ms/op 4.4735 ms/op 0.75
altair processAttestation - 250000 vs - 7PWei worstcase 6.0706 ms/op 7.2759 ms/op 0.83
altair processAttestation - setStatus - 1/6 committees join 175.21 us/op 248.06 us/op 0.71
altair processAttestation - setStatus - 1/3 committees join 352.34 us/op 481.61 us/op 0.73
altair processAttestation - setStatus - 1/2 committees join 508.68 us/op 648.62 us/op 0.78
altair processAttestation - setStatus - 2/3 committees join 681.42 us/op 846.76 us/op 0.80
altair processAttestation - setStatus - 4/5 committees join 931.01 us/op 1.1415 ms/op 0.82
altair processAttestation - setStatus - 100% committees join 1.1189 ms/op 1.3832 ms/op 0.81
altair processBlock - 250000 vs - 7PWei normalcase 22.924 ms/op 31.003 ms/op 0.74
altair processBlock - 250000 vs - 7PWei normalcase hashState 36.884 ms/op 44.145 ms/op 0.84
altair processBlock - 250000 vs - 7PWei worstcase 78.396 ms/op 95.878 ms/op 0.82
altair processBlock - 250000 vs - 7PWei worstcase hashState 110.79 ms/op 113.58 ms/op 0.98
phase0 processBlock - 250000 vs - 7PWei normalcase 3.0692 ms/op 4.4323 ms/op 0.69
phase0 processBlock - 250000 vs - 7PWei worstcase 50.292 ms/op 57.071 ms/op 0.88
altair processEth1Data - 250000 vs - 7PWei normalcase 626.38 us/op 997.24 us/op 0.63
vc - 250000 eb 1 eth1 1 we 0 wn 0 - smpl 15 14.085 us/op 15.495 us/op 0.91
vc - 250000 eb 0.95 eth1 0.1 we 0.05 wn 0 - smpl 219 36.596 us/op 45.621 us/op 0.80
vc - 250000 eb 0.95 eth1 0.3 we 0.05 wn 0 - smpl 42 15.387 us/op 19.247 us/op 0.80
vc - 250000 eb 0.95 eth1 0.7 we 0.05 wn 0 - smpl 18 11.842 us/op 16.381 us/op 0.72
vc - 250000 eb 0.1 eth1 0.1 we 0 wn 0 - smpl 1020 135.41 us/op 146.58 us/op 0.92
vc - 250000 eb 0.03 eth1 0.03 we 0 wn 0 - smpl 11777 966.88 us/op 1.2100 ms/op 0.80
vc - 250000 eb 0.01 eth1 0.01 we 0 wn 0 - smpl 16384 1.2008 ms/op 1.6268 ms/op 0.74
vc - 250000 eb 0 eth1 0 we 0 wn 0 - smpl 16384 1.2327 ms/op 1.6167 ms/op 0.76
vc - 250000 eb 0 eth1 0 we 0 wn 0 nocache - smpl 16384 4.2285 ms/op 5.4212 ms/op 0.78
vc - 250000 eb 0 eth1 1 we 0 wn 0 - smpl 16384 2.7245 ms/op 3.8367 ms/op 0.71
vc - 250000 eb 0 eth1 1 we 0 wn 0 nocache - smpl 16384 6.8158 ms/op 8.7499 ms/op 0.78
Tree 40 250000 create 606.89 ms/op 810.12 ms/op 0.75
Tree 40 250000 get(125000) 245.82 ns/op 341.76 ns/op 0.72
Tree 40 250000 set(125000) 1.7225 us/op 2.3681 us/op 0.73
Tree 40 250000 toArray() 25.496 ms/op 36.240 ms/op 0.70
Tree 40 250000 iterate all - toArray() + loop 25.340 ms/op 36.243 ms/op 0.70
Tree 40 250000 iterate all - get(i) 102.89 ms/op 120.64 ms/op 0.85
MutableVector 250000 create 12.298 ms/op 18.211 ms/op 0.68
MutableVector 250000 get(125000) 10.593 ns/op 17.388 ns/op 0.61
MutableVector 250000 set(125000) 473.28 ns/op 702.25 ns/op 0.67
MutableVector 250000 toArray() 5.6428 ms/op 7.7647 ms/op 0.73
MutableVector 250000 iterate all - toArray() + loop 5.7412 ms/op 7.9399 ms/op 0.72
MutableVector 250000 iterate all - get(i) 3.0988 ms/op 4.2956 ms/op 0.72
Array 250000 create 5.2353 ms/op 7.6978 ms/op 0.68
Array 250000 clone - spread 1.8546 ms/op 3.2141 ms/op 0.58
Array 250000 get(125000) 0.97900 ns/op 1.4140 ns/op 0.69
Array 250000 set(125000) 0.97900 ns/op 1.4540 ns/op 0.67
Array 250000 iterate all - loop 150.89 us/op 209.25 us/op 0.72
effectiveBalanceIncrements clone Uint8Array 300000 32.625 us/op 96.722 us/op 0.34
effectiveBalanceIncrements clone MutableVector 300000 566.00 ns/op 1.0450 us/op 0.54
effectiveBalanceIncrements rw all Uint8Array 300000 245.01 us/op 310.54 us/op 0.79
effectiveBalanceIncrements rw all MutableVector 300000 135.10 ms/op 238.68 ms/op 0.57
phase0 afterProcessEpoch - 250000 vs - 7PWei 185.81 ms/op 244.72 ms/op 0.76
phase0 beforeProcessEpoch - 250000 vs - 7PWei 55.161 ms/op 79.867 ms/op 0.69
altair processEpoch - mainnet_e81889 528.68 ms/op 668.94 ms/op 0.79
mainnet_e81889 - altair beforeProcessEpoch 107.67 ms/op 179.07 ms/op 0.60
mainnet_e81889 - altair processJustificationAndFinalization 26.330 us/op 31.840 us/op 0.83
mainnet_e81889 - altair processInactivityUpdates 8.7438 ms/op 12.740 ms/op 0.69
mainnet_e81889 - altair processRewardsAndPenalties 76.893 ms/op 160.88 ms/op 0.48
mainnet_e81889 - altair processRegistryUpdates 2.9670 us/op 6.7660 us/op 0.44
mainnet_e81889 - altair processSlashings 995.00 ns/op 1.4360 us/op 0.69
mainnet_e81889 - altair processEth1DataReset 778.00 ns/op 1.6310 us/op 0.48
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.2263 ms/op 2.7524 ms/op 0.81
mainnet_e81889 - altair processSlashingsReset 4.8230 us/op 10.398 us/op 0.46
mainnet_e81889 - altair processRandaoMixesReset 5.2290 us/op 11.897 us/op 0.44
mainnet_e81889 - altair processHistoricalRootsUpdate 969.00 ns/op 2.0710 us/op 0.47
mainnet_e81889 - altair processParticipationFlagUpdates 3.3520 us/op 7.9040 us/op 0.42
mainnet_e81889 - altair processSyncCommitteeUpdates 916.00 ns/op 1.5100 us/op 0.61
mainnet_e81889 - altair afterProcessEpoch 195.56 ms/op 234.76 ms/op 0.83
phase0 processEpoch - mainnet_e58758 477.06 ms/op 609.77 ms/op 0.78
mainnet_e58758 - phase0 beforeProcessEpoch 196.89 ms/op 252.16 ms/op 0.78
mainnet_e58758 - phase0 processJustificationAndFinalization 21.123 us/op 35.688 us/op 0.59
mainnet_e58758 - phase0 processRewardsAndPenalties 97.300 ms/op 162.04 ms/op 0.60
mainnet_e58758 - phase0 processRegistryUpdates 12.328 us/op 19.092 us/op 0.65
mainnet_e58758 - phase0 processSlashings 805.00 ns/op 1.7470 us/op 0.46
mainnet_e58758 - phase0 processEth1DataReset 844.00 ns/op 1.5890 us/op 0.53
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.0455 ms/op 2.5413 ms/op 0.80
mainnet_e58758 - phase0 processSlashingsReset 5.5360 us/op 9.2300 us/op 0.60
mainnet_e58758 - phase0 processRandaoMixesReset 6.1390 us/op 13.695 us/op 0.45
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.2320 us/op 1.9230 us/op 0.64
mainnet_e58758 - phase0 processParticipationRecordUpdates 6.6320 us/op 12.360 us/op 0.54
mainnet_e58758 - phase0 afterProcessEpoch 161.81 ms/op 193.16 ms/op 0.84
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.0974 ms/op 3.3788 ms/op 0.62
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.3714 ms/op 3.5444 ms/op 0.67
altair processInactivityUpdates - 250000 normalcase 39.038 ms/op 46.880 ms/op 0.83
altair processInactivityUpdates - 250000 worstcase 32.199 ms/op 103.63 ms/op 0.31
phase0 processRegistryUpdates - 250000 normalcase 10.538 us/op 14.092 us/op 0.75
phase0 processRegistryUpdates - 250000 badcase_full_deposits 502.25 us/op 590.98 us/op 0.85
phase0 processRegistryUpdates - 250000 worstcase 0.5 172.27 ms/op 252.04 ms/op 0.68
altair processRewardsAndPenalties - 250000 normalcase 72.880 ms/op 101.59 ms/op 0.72
altair processRewardsAndPenalties - 250000 worstcase 112.39 ms/op 131.01 ms/op 0.86
phase0 getAttestationDeltas - 250000 normalcase 11.149 ms/op 13.999 ms/op 0.80
phase0 getAttestationDeltas - 250000 worstcase 11.174 ms/op 14.168 ms/op 0.79
phase0 processSlashings - 250000 worstcase 5.2736 ms/op 6.7150 ms/op 0.79
altair processSyncCommitteeUpdates - 250000 283.71 ms/op 324.89 ms/op 0.87
BeaconState.hashTreeRoot - No change 470.00 ns/op 557.00 ns/op 0.84
BeaconState.hashTreeRoot - 1 full validator 65.817 us/op 74.643 us/op 0.88
BeaconState.hashTreeRoot - 32 full validator 714.48 us/op 778.87 us/op 0.92
BeaconState.hashTreeRoot - 512 full validator 6.8375 ms/op 7.8698 ms/op 0.87
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 88.086 us/op 94.986 us/op 0.93
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.2680 ms/op 1.4032 ms/op 0.90
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 16.423 ms/op 18.064 ms/op 0.91
BeaconState.hashTreeRoot - 1 balances 63.058 us/op 77.349 us/op 0.82
BeaconState.hashTreeRoot - 32 balances 612.72 us/op 635.37 us/op 0.96
BeaconState.hashTreeRoot - 512 balances 6.2738 ms/op 7.3081 ms/op 0.86
BeaconState.hashTreeRoot - 250000 balances 101.79 ms/op 97.238 ms/op 1.05
aggregationBits - 2048 els - zipIndexesInBitList 21.640 us/op 31.009 us/op 0.70
regular array get 100000 times 60.548 us/op 80.510 us/op 0.75
wrappedArray get 100000 times 60.557 us/op 77.545 us/op 0.78
arrayWithProxy get 100000 times 26.672 ms/op 32.213 ms/op 0.83
ssz.Root.equals 986.00 ns/op 1.2700 us/op 0.78
byteArrayEquals 989.00 ns/op 1.2530 us/op 0.79
shuffle list - 16384 els 11.332 ms/op 13.703 ms/op 0.83
shuffle list - 250000 els 167.58 ms/op 197.49 ms/op 0.85
processSlot - 1 slots 13.089 us/op 13.753 us/op 0.95
processSlot - 32 slots 1.9254 ms/op 2.0767 ms/op 0.93
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 317.92 us/op 405.22 us/op 0.78
getCommitteeAssignments - req 1 vs - 250000 vc 5.4433 ms/op 6.4981 ms/op 0.84
getCommitteeAssignments - req 100 vs - 250000 vc 7.9404 ms/op 8.6383 ms/op 0.92
getCommitteeAssignments - req 1000 vs - 250000 vc 8.5108 ms/op 9.4214 ms/op 0.90
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 7.9600 ns/op 11.500 ns/op 0.69
state getBlockRootAtSlot - 250000 vs - 7PWei 1.1957 us/op 1.3977 us/op 0.86
computeProposers - vc 250000 16.962 ms/op 19.715 ms/op 0.86
computeEpochShuffling - vc 250000 170.95 ms/op 205.88 ms/op 0.83
getNextSyncCommittee - vc 250000 284.32 ms/op 320.05 ms/op 0.89

by benchmarkbot/action

@g11tech g11tech enabled auto-merge (squash) January 27, 2023 09:15
@g11tech g11tech merged commit 08dfdb3 into unstable Feb 1, 2023
@g11tech g11tech deleted the g11tech/builder-selection branch February 1, 2023 07:32
wemeetagain pushed a commit that referenced this pull request Feb 27, 2023
)

* Add validatior option to specify builder block selection strategy

* cleanup and improvements

* server api fx

* fix test

* fix the testcase
dapplion added a commit that referenced this pull request Feb 28, 2023
* v1.5.0

* Add validatior option to specify builder block selection strategy (#5064)

* Add validatior option to specify builder block selection strategy

* cleanup and improvements

* server api fx

* fix test

* fix the testcase

* Re-gossip bls changes if submitted earlier than capella (#5049)

* Cache and retransmit bls changes if submitted early

* regossip when synced on/post capella

* fix tests

* modify publish vs cache condition

* add logging

* add error logging

* batchify the processing

* fix some of the cases

* fix log issues

* also delete included keys

* fix lint

* simplify gossip loop

* fix build

* refac to a versioned bls change store

* update

* logging improvements

* improve logging and finish behavior

* cleanup

* Rename eip4844 fork as Deneb (#5082)

* Fix and extract payload to header conversion (#5101)

* Remove unused eslint disable directives (#5046)

* Add execution payload header to light client header capella onwards (#5027)

* Add execution payload header to light client header capella onwards

* add more forks

* add allfork types

* make other types multifork

* make events multifork compatible

* make lightclient routes multifork

* update light-client transport

* upgrade the blocktype on lightclient server import block

* fixes

* fix test

* fix event serialization/deserilization type

* update proof constants

* fix payload index

* update the light client update generation to multi fork

* fix types

* add spec override to pass specs

* make event types allforks

* make req/resp multifork

* make types multifork throughout

* fix the update serialize/deserialize

* fix error log

* better fork determination for update

* fix the fork of finalized

* fix tests

* fix header upgradation

* Fix zero finalized header in lightclient update gen (#5121)

* Schedule capella on sepolia (#5127)

* Get the capella builder functional (#5179)

* Allow blsChange reprocess/republish via API submission (#5185)

* Fix gossiping blsChange on submit if post capella

* comment improvement

* Use new db bucket for light client updates (#5205)

---------

Co-authored-by: Cayman <caymannava@gmail.com>
Co-authored-by: g11tech <develop@g11tech.io>
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
@wemeetagain
Copy link
Member

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

3 participants