Skip to content

Add and propogate blockValue to select full or blinded block#5003

Merged
g11tech merged 2 commits intounstablefrom
g11tech/block-value
Jan 17, 2023
Merged

Add and propogate blockValue to select full or blinded block#5003
g11tech merged 2 commits intounstablefrom
g11tech/block-value

Conversation

@g11tech
Copy link
Contributor

@g11tech g11tech commented Jan 13, 2023

Since capella onwards, blockValue would also be now available from execution generated payloads, its now feasible to choose between engine or execution on max profit naive strategy.

This PR adds and propogates the same.

TODO:

  • Compare blockValue and choose between execution and blinded block in validator's block.ts

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

github-actions bot commented Jan 13, 2023

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 157612b Previous: 080b73b Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.0672 ms/op 1.3318 ms/op 0.80
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 67.924 us/op 79.922 us/op 0.85
BLS verify - blst-native 1.8590 ms/op 2.2322 ms/op 0.83
BLS verifyMultipleSignatures 3 - blst-native 3.8076 ms/op 4.5804 ms/op 0.83
BLS verifyMultipleSignatures 8 - blst-native 8.1990 ms/op 9.8437 ms/op 0.83
BLS verifyMultipleSignatures 32 - blst-native 29.752 ms/op 35.745 ms/op 0.83
BLS aggregatePubkeys 32 - blst-native 39.178 us/op 47.493 us/op 0.82
BLS aggregatePubkeys 128 - blst-native 153.69 us/op 185.59 us/op 0.83
getAttestationsForBlock 85.440 ms/op 112.45 ms/op 0.76
isKnown best case - 1 super set check 462.00 ns/op 529.00 ns/op 0.87
isKnown normal case - 2 super set checks 453.00 ns/op 523.00 ns/op 0.87
isKnown worse case - 16 super set checks 454.00 ns/op 516.00 ns/op 0.88
CheckpointStateCache - add get delete 8.1740 us/op 10.148 us/op 0.81
validate gossip signedAggregateAndProof - struct 4.2633 ms/op 5.1321 ms/op 0.83
validate gossip attestation - struct 2.0285 ms/op 2.4242 ms/op 0.84
pickEth1Vote - no votes 2.2149 ms/op 2.7368 ms/op 0.81
pickEth1Vote - max votes 16.883 ms/op 22.987 ms/op 0.73
pickEth1Vote - Eth1Data hashTreeRoot value x2048 11.715 ms/op 15.091 ms/op 0.78
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 21.103 ms/op 26.823 ms/op 0.79
pickEth1Vote - Eth1Data fastSerialize value x2048 1.2481 ms/op 1.5186 ms/op 0.82
pickEth1Vote - Eth1Data fastSerialize tree x2048 9.5328 ms/op 13.064 ms/op 0.73
bytes32 toHexString 1.0330 us/op 1.3580 us/op 0.76
bytes32 Buffer.toString(hex) 607.00 ns/op 660.00 ns/op 0.92
bytes32 Buffer.toString(hex) from Uint8Array 939.00 ns/op 1.1180 us/op 0.84
bytes32 Buffer.toString(hex) + 0x 609.00 ns/op 721.00 ns/op 0.84
Object access 1 prop 0.28000 ns/op 0.35600 ns/op 0.79
Map access 1 prop 0.27200 ns/op 0.31300 ns/op 0.87
Object get x1000 15.967 ns/op 20.476 ns/op 0.78
Map get x1000 1.0150 ns/op 1.1820 ns/op 0.86
Object set x1000 102.01 ns/op 131.12 ns/op 0.78
Map set x1000 63.334 ns/op 85.964 ns/op 0.74
Return object 10000 times 0.36530 ns/op 0.44710 ns/op 0.82
Throw Error 10000 times 6.9585 us/op 8.3643 us/op 0.83
fastMsgIdFn sha256 / 200 bytes 4.3150 us/op 5.2630 us/op 0.82
fastMsgIdFn h32 xxhash / 200 bytes 470.00 ns/op 563.00 ns/op 0.83
fastMsgIdFn h64 xxhash / 200 bytes 606.00 ns/op 771.00 ns/op 0.79
fastMsgIdFn sha256 / 1000 bytes 13.465 us/op 16.290 us/op 0.83
fastMsgIdFn h32 xxhash / 1000 bytes 619.00 ns/op 734.00 ns/op 0.84
fastMsgIdFn h64 xxhash / 1000 bytes 684.00 ns/op 785.00 ns/op 0.87
fastMsgIdFn sha256 / 10000 bytes 117.07 us/op 140.38 us/op 0.83
fastMsgIdFn h32 xxhash / 10000 bytes 2.3230 us/op 2.8770 us/op 0.81
fastMsgIdFn h64 xxhash / 10000 bytes 1.6350 us/op 2.0860 us/op 0.78
enrSubnets - fastDeserialize 64 bits 2.2380 us/op 3.0700 us/op 0.73
enrSubnets - ssz BitVector 64 bits 786.00 ns/op 1.0250 us/op 0.77
enrSubnets - fastDeserialize 4 bits 290.00 ns/op 372.00 ns/op 0.78
enrSubnets - ssz BitVector 4 bits 792.00 ns/op 1.0250 us/op 0.77
prioritizePeers score -10:0 att 32-0.1 sync 2-0 162.04 us/op 179.62 us/op 0.90
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 196.19 us/op 270.23 us/op 0.73
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 300.11 us/op 379.77 us/op 0.79
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 510.28 us/op 640.58 us/op 0.80
prioritizePeers score 0:0 att 64-1 sync 4-1 597.57 us/op 739.83 us/op 0.81
array of 16000 items push then shift 2.8137 us/op 3.2618 us/op 0.86
LinkedList of 16000 items push then shift 16.994 ns/op 20.806 ns/op 0.82
array of 16000 items push then pop 215.39 ns/op 244.79 ns/op 0.88
LinkedList of 16000 items push then pop 16.495 ns/op 19.904 ns/op 0.83
array of 24000 items push then shift 3.9990 us/op 4.8181 us/op 0.83
LinkedList of 24000 items push then shift 19.157 ns/op 23.697 ns/op 0.81
array of 24000 items push then pop 204.08 ns/op 253.51 ns/op 0.81
LinkedList of 24000 items push then pop 17.473 ns/op 20.893 ns/op 0.84
intersect bitArray bitLen 8 29.701 ns/op 36.101 ns/op 0.82
intersect array and set length 8 153.97 ns/op 206.67 ns/op 0.75
intersect bitArray bitLen 128 108.27 ns/op 134.59 ns/op 0.80
intersect array and set length 128 2.1563 us/op 2.9012 us/op 0.74
Buffer.concat 32 items 5.1810 us/op 6.4000 us/op 0.81
Uint8Array.set 32 items 4.0860 us/op 5.0390 us/op 0.81
pass gossip attestations to forkchoice per slot 6.1933 ms/op 7.8532 ms/op 0.79
computeDeltas 5.6427 ms/op 7.7799 ms/op 0.73
computeProposerBoostScoreFromBalances 2.8388 ms/op 3.1163 ms/op 0.91
altair processAttestation - 250000 vs - 7PWei normalcase 3.7587 ms/op 5.1690 ms/op 0.73
altair processAttestation - 250000 vs - 7PWei worstcase 7.2880 ms/op 8.9193 ms/op 0.82
altair processAttestation - setStatus - 1/6 committees join 209.88 us/op 267.70 us/op 0.78
altair processAttestation - setStatus - 1/3 committees join 400.79 us/op 489.06 us/op 0.82
altair processAttestation - setStatus - 1/2 committees join 560.21 us/op 679.05 us/op 0.82
altair processAttestation - setStatus - 2/3 committees join 713.61 us/op 920.49 us/op 0.78
altair processAttestation - setStatus - 4/5 committees join 998.09 us/op 1.1900 ms/op 0.84
altair processAttestation - setStatus - 100% committees join 1.1854 ms/op 1.4165 ms/op 0.84
altair processBlock - 250000 vs - 7PWei normalcase 26.388 ms/op 30.115 ms/op 0.88
altair processBlock - 250000 vs - 7PWei normalcase hashState 40.262 ms/op 40.962 ms/op 0.98
altair processBlock - 250000 vs - 7PWei worstcase 77.706 ms/op 105.19 ms/op 0.74
altair processBlock - 250000 vs - 7PWei worstcase hashState 95.703 ms/op 115.16 ms/op 0.83
phase0 processBlock - 250000 vs - 7PWei normalcase 4.2510 ms/op 4.1867 ms/op 1.02
phase0 processBlock - 250000 vs - 7PWei worstcase 49.263 ms/op 55.720 ms/op 0.88
altair processEth1Data - 250000 vs - 7PWei normalcase 722.03 us/op 866.68 us/op 0.83
vc - 250000 eb 1 eth1 1 we 0 wn 0 - smpl 15 9.1000 us/op 14.235 us/op 0.64
vc - 250000 eb 0.95 eth1 0.1 we 0.05 wn 0 - smpl 219 28.851 us/op 37.573 us/op 0.77
vc - 250000 eb 0.95 eth1 0.3 we 0.05 wn 0 - smpl 42 19.813 us/op 17.628 us/op 1.12
vc - 250000 eb 0.95 eth1 0.7 we 0.05 wn 0 - smpl 18 17.640 us/op 15.476 us/op 1.14
vc - 250000 eb 0.1 eth1 0.1 we 0 wn 0 - smpl 1020 177.73 us/op 136.57 us/op 1.30
vc - 250000 eb 0.03 eth1 0.03 we 0 wn 0 - smpl 11777 1.2203 ms/op 1.3094 ms/op 0.93
vc - 250000 eb 0.01 eth1 0.01 we 0 wn 0 - smpl 16384 1.5753 ms/op 1.6747 ms/op 0.94
vc - 250000 eb 0 eth1 0 we 0 wn 0 - smpl 16384 1.3295 ms/op 1.7400 ms/op 0.76
vc - 250000 eb 0 eth1 0 we 0 wn 0 nocache - smpl 16384 4.4456 ms/op 5.5847 ms/op 0.80
vc - 250000 eb 0 eth1 1 we 0 wn 0 - smpl 16384 2.8461 ms/op 3.7998 ms/op 0.75
vc - 250000 eb 0 eth1 1 we 0 wn 0 nocache - smpl 16384 7.0984 ms/op 10.065 ms/op 0.71
Tree 40 250000 create 635.67 ms/op 975.78 ms/op 0.65
Tree 40 250000 get(125000) 291.98 ns/op 343.98 ns/op 0.85
Tree 40 250000 set(125000) 2.0921 us/op 2.5256 us/op 0.83
Tree 40 250000 toArray() 31.482 ms/op 37.060 ms/op 0.85
Tree 40 250000 iterate all - toArray() + loop 31.857 ms/op 36.744 ms/op 0.87
Tree 40 250000 iterate all - get(i) 104.36 ms/op 124.75 ms/op 0.84
MutableVector 250000 create 15.252 ms/op 18.391 ms/op 0.83
MutableVector 250000 get(125000) 13.449 ns/op 16.011 ns/op 0.84
MutableVector 250000 set(125000) 710.87 ns/op 776.69 ns/op 0.92
MutableVector 250000 toArray() 6.7136 ms/op 7.9277 ms/op 0.85
MutableVector 250000 iterate all - toArray() + loop 6.8938 ms/op 8.3016 ms/op 0.83
MutableVector 250000 iterate all - get(i) 3.5018 ms/op 4.5632 ms/op 0.77
Array 250000 create 6.4749 ms/op 7.9540 ms/op 0.81
Array 250000 clone - spread 2.8321 ms/op 4.9210 ms/op 0.58
Array 250000 get(125000) 1.2150 ns/op 2.1230 ns/op 0.57
Array 250000 set(125000) 1.2170 ns/op 2.1180 ns/op 0.57
Array 250000 iterate all - loop 167.87 us/op 201.45 us/op 0.83
effectiveBalanceIncrements clone Uint8Array 300000 72.468 us/op 99.287 us/op 0.73
effectiveBalanceIncrements clone MutableVector 300000 861.00 ns/op 1.1010 us/op 0.78
effectiveBalanceIncrements rw all Uint8Array 300000 252.62 us/op 305.65 us/op 0.83
effectiveBalanceIncrements rw all MutableVector 300000 186.00 ms/op 266.24 ms/op 0.70
phase0 afterProcessEpoch - 250000 vs - 7PWei 201.02 ms/op 246.34 ms/op 0.82
phase0 beforeProcessEpoch - 250000 vs - 7PWei 70.850 ms/op 76.406 ms/op 0.93
altair processEpoch - mainnet_e81889 563.39 ms/op 602.82 ms/op 0.93
mainnet_e81889 - altair beforeProcessEpoch 138.06 ms/op 154.01 ms/op 0.90
mainnet_e81889 - altair processJustificationAndFinalization 31.152 us/op 28.570 us/op 1.09
mainnet_e81889 - altair processInactivityUpdates 10.833 ms/op 13.242 ms/op 0.82
mainnet_e81889 - altair processRewardsAndPenalties 90.013 ms/op 108.81 ms/op 0.83
mainnet_e81889 - altair processRegistryUpdates 3.4380 us/op 8.5080 us/op 0.40
mainnet_e81889 - altair processSlashings 847.00 ns/op 1.5470 us/op 0.55
mainnet_e81889 - altair processEth1DataReset 649.00 ns/op 1.7200 us/op 0.38
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.3224 ms/op 2.9423 ms/op 0.79
mainnet_e81889 - altair processSlashingsReset 4.8190 us/op 12.340 us/op 0.39
mainnet_e81889 - altair processRandaoMixesReset 5.8420 us/op 11.114 us/op 0.53
mainnet_e81889 - altair processHistoricalRootsUpdate 751.00 ns/op 2.0090 us/op 0.37
mainnet_e81889 - altair processParticipationFlagUpdates 2.8820 us/op 7.2150 us/op 0.40
mainnet_e81889 - altair processSyncCommitteeUpdates 568.00 ns/op 1.6970 us/op 0.33
mainnet_e81889 - altair afterProcessEpoch 195.03 ms/op 234.70 ms/op 0.83
phase0 processEpoch - mainnet_e58758 513.66 ms/op 619.46 ms/op 0.83
mainnet_e58758 - phase0 beforeProcessEpoch 222.29 ms/op 269.72 ms/op 0.82
mainnet_e58758 - phase0 processJustificationAndFinalization 23.758 us/op 35.120 us/op 0.68
mainnet_e58758 - phase0 processRewardsAndPenalties 132.42 ms/op 152.62 ms/op 0.87
mainnet_e58758 - phase0 processRegistryUpdates 9.4040 us/op 17.697 us/op 0.53
mainnet_e58758 - phase0 processSlashings 653.00 ns/op 1.6250 us/op 0.40
mainnet_e58758 - phase0 processEth1DataReset 677.00 ns/op 1.7510 us/op 0.39
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.1484 ms/op 2.5599 ms/op 0.84
mainnet_e58758 - phase0 processSlashingsReset 7.4880 us/op 8.9010 us/op 0.84
mainnet_e58758 - phase0 processRandaoMixesReset 5.7920 us/op 12.062 us/op 0.48
mainnet_e58758 - phase0 processHistoricalRootsUpdate 732.00 ns/op 1.8900 us/op 0.39
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.7410 us/op 11.147 us/op 0.43
mainnet_e58758 - phase0 afterProcessEpoch 160.63 ms/op 203.77 ms/op 0.79
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.7288 ms/op 3.4648 ms/op 0.79
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 3.2640 ms/op 4.0060 ms/op 0.81
altair processInactivityUpdates - 250000 normalcase 37.889 ms/op 46.601 ms/op 0.81
altair processInactivityUpdates - 250000 worstcase 46.709 ms/op 53.245 ms/op 0.88
phase0 processRegistryUpdates - 250000 normalcase 7.9040 us/op 17.566 us/op 0.45
phase0 processRegistryUpdates - 250000 badcase_full_deposits 426.18 us/op 598.37 us/op 0.71
phase0 processRegistryUpdates - 250000 worstcase 0.5 209.76 ms/op 248.64 ms/op 0.84
altair processRewardsAndPenalties - 250000 normalcase 119.08 ms/op 84.858 ms/op 1.40
altair processRewardsAndPenalties - 250000 worstcase 118.26 ms/op 129.29 ms/op 0.91
phase0 getAttestationDeltas - 250000 normalcase 12.288 ms/op 16.163 ms/op 0.76
phase0 getAttestationDeltas - 250000 worstcase 12.499 ms/op 16.280 ms/op 0.77
phase0 processSlashings - 250000 worstcase 5.4220 ms/op 6.7987 ms/op 0.80
altair processSyncCommitteeUpdates - 250000 265.25 ms/op 327.16 ms/op 0.81
BeaconState.hashTreeRoot - No change 415.00 ns/op 512.00 ns/op 0.81
BeaconState.hashTreeRoot - 1 full validator 60.869 us/op 74.646 us/op 0.82
BeaconState.hashTreeRoot - 32 full validator 649.39 us/op 919.13 us/op 0.71
BeaconState.hashTreeRoot - 512 full validator 5.9714 ms/op 7.7113 ms/op 0.77
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 78.575 us/op 94.986 us/op 0.83
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.1776 ms/op 1.4347 ms/op 0.82
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 15.340 ms/op 20.050 ms/op 0.77
BeaconState.hashTreeRoot - 1 balances 53.408 us/op 72.000 us/op 0.74
BeaconState.hashTreeRoot - 32 balances 622.96 us/op 711.11 us/op 0.88
BeaconState.hashTreeRoot - 512 balances 5.3657 ms/op 7.0238 ms/op 0.76
BeaconState.hashTreeRoot - 250000 balances 90.437 ms/op 110.35 ms/op 0.82
aggregationBits - 2048 els - zipIndexesInBitList 28.199 us/op 40.414 us/op 0.70
regular array get 100000 times 67.385 us/op 83.104 us/op 0.81
wrappedArray get 100000 times 67.384 us/op 84.202 us/op 0.80
arrayWithProxy get 100000 times 27.790 ms/op 34.578 ms/op 0.80
ssz.Root.equals 1.1120 us/op 1.3780 us/op 0.81
byteArrayEquals 1.0970 us/op 1.3520 us/op 0.81
shuffle list - 16384 els 11.322 ms/op 14.355 ms/op 0.79
shuffle list - 250000 els 166.73 ms/op 205.18 ms/op 0.81
processSlot - 1 slots 12.592 us/op 15.134 us/op 0.83
processSlot - 32 slots 1.7404 ms/op 2.1224 ms/op 0.82
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 342.98 us/op 414.58 us/op 0.83
getCommitteeAssignments - req 1 vs - 250000 vc 5.6139 ms/op 6.7669 ms/op 0.83
getCommitteeAssignments - req 100 vs - 250000 vc 7.6187 ms/op 9.2459 ms/op 0.82
getCommitteeAssignments - req 1000 vs - 250000 vc 8.1838 ms/op 9.9335 ms/op 0.82
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 10.330 ns/op 12.180 ns/op 0.85
state getBlockRootAtSlot - 250000 vs - 7PWei 1.1480 us/op 1.5505 us/op 0.74
computeProposers - vc 250000 16.054 ms/op 19.382 ms/op 0.83
computeEpochShuffling - vc 250000 189.29 ms/op 208.53 ms/op 0.91
getNextSyncCommittee - vc 250000 264.81 ms/op 321.83 ms/op 0.82

by benchmarkbot/action

@g11tech g11tech merged commit 2d0938e into unstable Jan 17, 2023
@g11tech g11tech deleted the g11tech/block-value branch January 17, 2023 12:13
@philknows
Copy link
Member

@g11tech Is this done completely autonomously and by default? It will just compare blinded block bid with what the EL block value is and automatically select the higher one?

@g11tech
Copy link
Contributor Author

g11tech commented Jan 27, 2023

@g11tech Is this done completely autonomously and by default? It will just compare blinded block bid with what the EL block value is and automatically select the higher one?

This one just propogates the value to validator, i have a follow-up PR that provides selection option to either choose builder always or choose basis maximum value

Will push in couple of hours

@g11tech
Copy link
Contributor Author

g11tech commented Jan 27, 2023

@philknows this PR will enable the actual selection:

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