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

SSE emit payload attributes before each slot #5281

Merged
merged 2 commits into from
Mar 22, 2023

Conversation

g11tech
Copy link
Contributor

@g11tech g11tech commented Mar 17, 2023

SSE payload attributes before each slot if enabled via a cli option --emitPayloadAttributes

ref:

Closes #5251

@g11tech g11tech requested a review from a team as a code owner March 17, 2023 18:16
@github-actions
Copy link
Contributor

github-actions bot commented Mar 17, 2023

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: cc103d2 Previous: de53bad Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 802.93 us/op 1.0837 ms/op 0.74
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 46.450 us/op 66.794 us/op 0.70
BLS verify - blst-native 1.2116 ms/op 1.4680 ms/op 0.83
BLS verifyMultipleSignatures 3 - blst-native 2.4646 ms/op 2.9938 ms/op 0.82
BLS verifyMultipleSignatures 8 - blst-native 5.3185 ms/op 6.3066 ms/op 0.84
BLS verifyMultipleSignatures 32 - blst-native 19.444 ms/op 22.333 ms/op 0.87
BLS aggregatePubkeys 32 - blst-native 25.688 us/op 32.019 us/op 0.80
BLS aggregatePubkeys 128 - blst-native 100.80 us/op 116.66 us/op 0.86
getAttestationsForBlock 53.917 ms/op 86.737 ms/op 0.62
isKnown best case - 1 super set check 263.00 ns/op 328.00 ns/op 0.80
isKnown normal case - 2 super set checks 249.00 ns/op 311.00 ns/op 0.80
isKnown worse case - 16 super set checks 248.00 ns/op 316.00 ns/op 0.78
CheckpointStateCache - add get delete 4.9180 us/op 6.4620 us/op 0.76
validate gossip signedAggregateAndProof - struct 2.7454 ms/op 3.4734 ms/op 0.79
validate gossip attestation - struct 1.3079 ms/op 1.5952 ms/op 0.82
pickEth1Vote - no votes 1.2827 ms/op 1.5623 ms/op 0.82
pickEth1Vote - max votes 8.3095 ms/op 15.362 ms/op 0.54
pickEth1Vote - Eth1Data hashTreeRoot value x2048 8.4795 ms/op 12.031 ms/op 0.70
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 13.076 ms/op 19.763 ms/op 0.66
pickEth1Vote - Eth1Data fastSerialize value x2048 624.41 us/op 927.35 us/op 0.67
pickEth1Vote - Eth1Data fastSerialize tree x2048 5.0859 ms/op 6.4811 ms/op 0.78
bytes32 toHexString 491.00 ns/op 816.00 ns/op 0.60
bytes32 Buffer.toString(hex) 346.00 ns/op 484.00 ns/op 0.71
bytes32 Buffer.toString(hex) from Uint8Array 550.00 ns/op 734.00 ns/op 0.75
bytes32 Buffer.toString(hex) + 0x 347.00 ns/op 507.00 ns/op 0.68
Object access 1 prop 0.16200 ns/op 0.25300 ns/op 0.64
Map access 1 prop 0.15700 ns/op 0.21800 ns/op 0.72
Object get x1000 6.6360 ns/op 7.8190 ns/op 0.85
Map get x1000 0.54300 ns/op 0.84000 ns/op 0.65
Object set x1000 52.119 ns/op 84.112 ns/op 0.62
Map set x1000 43.008 ns/op 67.477 ns/op 0.64
Return object 10000 times 0.23710 ns/op 0.29640 ns/op 0.80
Throw Error 10000 times 4.1965 us/op 4.9450 us/op 0.85
fastMsgIdFn sha256 / 200 bytes 3.4980 us/op 4.1270 us/op 0.85
fastMsgIdFn h32 xxhash / 200 bytes 277.00 ns/op 376.00 ns/op 0.74
fastMsgIdFn h64 xxhash / 200 bytes 393.00 ns/op 567.00 ns/op 0.69
fastMsgIdFn sha256 / 1000 bytes 11.728 us/op 13.423 us/op 0.87
fastMsgIdFn h32 xxhash / 1000 bytes 404.00 ns/op 521.00 ns/op 0.78
fastMsgIdFn h64 xxhash / 1000 bytes 459.00 ns/op 648.00 ns/op 0.71
fastMsgIdFn sha256 / 10000 bytes 104.72 us/op 128.38 us/op 0.82
fastMsgIdFn h32 xxhash / 10000 bytes 1.9080 us/op 2.3880 us/op 0.80
fastMsgIdFn h64 xxhash / 10000 bytes 1.3670 us/op 1.8790 us/op 0.73
enrSubnets - fastDeserialize 64 bits 1.2630 us/op 2.1570 us/op 0.59
enrSubnets - ssz BitVector 64 bits 485.00 ns/op 737.00 ns/op 0.66
enrSubnets - fastDeserialize 4 bits 162.00 ns/op 241.00 ns/op 0.67
enrSubnets - ssz BitVector 4 bits 491.00 ns/op 753.00 ns/op 0.65
prioritizePeers score -10:0 att 32-0.1 sync 2-0 104.60 us/op 144.73 us/op 0.72
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 132.11 us/op 195.91 us/op 0.67
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 164.29 us/op 240.31 us/op 0.68
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 300.55 us/op 458.08 us/op 0.66
prioritizePeers score 0:0 att 64-1 sync 4-1 364.74 us/op 504.90 us/op 0.72
array of 16000 items push then shift 1.6272 us/op 2.1996 us/op 0.74
LinkedList of 16000 items push then shift 8.7720 ns/op 14.375 ns/op 0.61
array of 16000 items push then pop 80.584 ns/op 164.26 ns/op 0.49
LinkedList of 16000 items push then pop 8.5020 ns/op 12.014 ns/op 0.71
array of 24000 items push then shift 2.3379 us/op 2.8117 us/op 0.83
LinkedList of 24000 items push then shift 8.8760 ns/op 12.259 ns/op 0.72
array of 24000 items push then pop 77.449 ns/op 128.23 ns/op 0.60
LinkedList of 24000 items push then pop 8.5780 ns/op 12.626 ns/op 0.68
intersect bitArray bitLen 8 13.341 ns/op 18.923 ns/op 0.71
intersect array and set length 8 78.259 ns/op 132.61 ns/op 0.59
intersect bitArray bitLen 128 44.067 ns/op 58.305 ns/op 0.76
intersect array and set length 128 1.0621 us/op 1.8715 us/op 0.57
Buffer.concat 32 items 2.8360 us/op 3.4900 us/op 0.81
Uint8Array.set 32 items 2.8430 us/op 2.8550 us/op 1.00
pass gossip attestations to forkchoice per slot 2.5694 ms/op 4.8976 ms/op 0.52
computeDeltas 2.8689 ms/op 3.9561 ms/op 0.73
computeProposerBoostScoreFromBalances 1.7837 ms/op 2.2039 ms/op 0.81
altair processAttestation - 250000 vs - 7PWei normalcase 2.1545 ms/op 4.6854 ms/op 0.46
altair processAttestation - 250000 vs - 7PWei worstcase 3.4151 ms/op 5.5822 ms/op 0.61
altair processAttestation - setStatus - 1/6 committees join 137.14 us/op 200.89 us/op 0.68
altair processAttestation - setStatus - 1/3 committees join 271.75 us/op 417.39 us/op 0.65
altair processAttestation - setStatus - 1/2 committees join 348.75 us/op 439.59 us/op 0.79
altair processAttestation - setStatus - 2/3 committees join 437.13 us/op 543.16 us/op 0.80
altair processAttestation - setStatus - 4/5 committees join 619.86 us/op 945.70 us/op 0.66
altair processAttestation - setStatus - 100% committees join 722.67 us/op 955.83 us/op 0.76
altair processBlock - 250000 vs - 7PWei normalcase 17.947 ms/op 23.987 ms/op 0.75
altair processBlock - 250000 vs - 7PWei normalcase hashState 26.223 ms/op 40.474 ms/op 0.65
altair processBlock - 250000 vs - 7PWei worstcase 49.467 ms/op 76.918 ms/op 0.64
altair processBlock - 250000 vs - 7PWei worstcase hashState 65.085 ms/op 92.610 ms/op 0.70
phase0 processBlock - 250000 vs - 7PWei normalcase 2.0322 ms/op 2.9907 ms/op 0.68
phase0 processBlock - 250000 vs - 7PWei worstcase 27.501 ms/op 43.360 ms/op 0.63
altair processEth1Data - 250000 vs - 7PWei normalcase 465.31 us/op 696.70 us/op 0.67
vc - 250000 eb 1 eth1 1 we 0 wn 0 - smpl 15 6.7300 us/op 15.475 us/op 0.43
vc - 250000 eb 0.95 eth1 0.1 we 0.05 wn 0 - smpl 219 19.442 us/op 35.664 us/op 0.55
vc - 250000 eb 0.95 eth1 0.3 we 0.05 wn 0 - smpl 42 8.4750 us/op 16.463 us/op 0.51
vc - 250000 eb 0.95 eth1 0.7 we 0.05 wn 0 - smpl 18 6.1220 us/op 14.011 us/op 0.44
vc - 250000 eb 0.1 eth1 0.1 we 0 wn 0 - smpl 1020 73.959 us/op 118.82 us/op 0.62
vc - 250000 eb 0.03 eth1 0.03 we 0 wn 0 - smpl 11777 618.50 us/op 1.0425 ms/op 0.59
vc - 250000 eb 0.01 eth1 0.01 we 0 wn 0 - smpl 16384 900.13 us/op 1.2773 ms/op 0.70
vc - 250000 eb 0 eth1 0 we 0 wn 0 - smpl 16384 857.49 us/op 1.5526 ms/op 0.55
vc - 250000 eb 0 eth1 0 we 0 wn 0 nocache - smpl 16384 2.2537 ms/op 4.0523 ms/op 0.56
vc - 250000 eb 0 eth1 1 we 0 wn 0 - smpl 16384 1.4968 ms/op 1.9790 ms/op 0.76
vc - 250000 eb 0 eth1 1 we 0 wn 0 nocache - smpl 16384 3.6884 ms/op 6.3195 ms/op 0.58
Tree 40 250000 create 296.56 ms/op 617.35 ms/op 0.48
Tree 40 250000 get(125000) 178.91 ns/op 224.28 ns/op 0.80
Tree 40 250000 set(125000) 907.38 ns/op 1.4617 us/op 0.62
Tree 40 250000 toArray() 16.844 ms/op 26.922 ms/op 0.63
Tree 40 250000 iterate all - toArray() + loop 16.870 ms/op 26.435 ms/op 0.64
Tree 40 250000 iterate all - get(i) 67.829 ms/op 85.914 ms/op 0.79
MutableVector 250000 create 10.602 ms/op 15.459 ms/op 0.69
MutableVector 250000 get(125000) 6.3110 ns/op 8.4210 ns/op 0.75
MutableVector 250000 set(125000) 253.79 ns/op 528.42 ns/op 0.48
MutableVector 250000 toArray() 2.6783 ms/op 4.8259 ms/op 0.55
MutableVector 250000 iterate all - toArray() + loop 2.8585 ms/op 5.0096 ms/op 0.57
MutableVector 250000 iterate all - get(i) 1.5057 ms/op 1.8844 ms/op 0.80
Array 250000 create 2.5437 ms/op 4.9505 ms/op 0.51
Array 250000 clone - spread 1.2424 ms/op 1.6465 ms/op 0.75
Array 250000 get(125000) 0.58400 ns/op 0.77600 ns/op 0.75
Array 250000 set(125000) 0.67100 ns/op 0.97700 ns/op 0.69
Array 250000 iterate all - loop 103.31 us/op 101.99 us/op 1.01
effectiveBalanceIncrements clone Uint8Array 300000 27.997 us/op 54.364 us/op 0.51
effectiveBalanceIncrements clone MutableVector 300000 396.00 ns/op 444.00 ns/op 0.89
effectiveBalanceIncrements rw all Uint8Array 300000 166.74 us/op 197.68 us/op 0.84
effectiveBalanceIncrements rw all MutableVector 300000 86.047 ms/op 150.13 ms/op 0.57
phase0 afterProcessEpoch - 250000 vs - 7PWei 115.75 ms/op 138.58 ms/op 0.84
phase0 beforeProcessEpoch - 250000 vs - 7PWei 33.361 ms/op 56.638 ms/op 0.59
altair processEpoch - mainnet_e81889 331.44 ms/op 469.46 ms/op 0.71
mainnet_e81889 - altair beforeProcessEpoch 50.992 ms/op 87.612 ms/op 0.58
mainnet_e81889 - altair processJustificationAndFinalization 15.402 us/op 41.969 us/op 0.37
mainnet_e81889 - altair processInactivityUpdates 5.9644 ms/op 8.0364 ms/op 0.74
mainnet_e81889 - altair processRewardsAndPenalties 48.534 ms/op 70.628 ms/op 0.69
mainnet_e81889 - altair processRegistryUpdates 2.5290 us/op 7.9380 us/op 0.32
mainnet_e81889 - altair processSlashings 470.00 ns/op 1.4970 us/op 0.31
mainnet_e81889 - altair processEth1DataReset 532.00 ns/op 1.6890 us/op 0.31
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.2306 ms/op 2.0279 ms/op 0.61
mainnet_e81889 - altair processSlashingsReset 4.9660 us/op 14.757 us/op 0.34
mainnet_e81889 - altair processRandaoMixesReset 4.6250 us/op 13.659 us/op 0.34
mainnet_e81889 - altair processHistoricalRootsUpdate 653.00 ns/op 2.0950 us/op 0.31
mainnet_e81889 - altair processParticipationFlagUpdates 2.3980 us/op 7.6360 us/op 0.31
mainnet_e81889 - altair processSyncCommitteeUpdates 811.00 ns/op 1.7870 us/op 0.45
mainnet_e81889 - altair afterProcessEpoch 117.62 ms/op 161.76 ms/op 0.73
phase0 processEpoch - mainnet_e58758 319.34 ms/op 486.27 ms/op 0.66
mainnet_e58758 - phase0 beforeProcessEpoch 122.74 ms/op 185.69 ms/op 0.66
mainnet_e58758 - phase0 processJustificationAndFinalization 18.351 us/op 40.212 us/op 0.46
mainnet_e58758 - phase0 processRewardsAndPenalties 46.834 ms/op 71.135 ms/op 0.66
mainnet_e58758 - phase0 processRegistryUpdates 8.2660 us/op 18.101 us/op 0.46
mainnet_e58758 - phase0 processSlashings 550.00 ns/op 1.7700 us/op 0.31
mainnet_e58758 - phase0 processEth1DataReset 563.00 ns/op 1.5700 us/op 0.36
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.0219 ms/op 1.4146 ms/op 0.72
mainnet_e58758 - phase0 processSlashingsReset 3.8140 us/op 9.1200 us/op 0.42
mainnet_e58758 - phase0 processRandaoMixesReset 4.9490 us/op 13.505 us/op 0.37
mainnet_e58758 - phase0 processHistoricalRootsUpdate 787.00 ns/op 2.4510 us/op 0.32
mainnet_e58758 - phase0 processParticipationRecordUpdates 13.941 us/op 14.180 us/op 0.98
mainnet_e58758 - phase0 afterProcessEpoch 136.35 ms/op 108.44 ms/op 1.26
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.8101 ms/op 1.4996 ms/op 1.87
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 3.4497 ms/op 1.8961 ms/op 1.82
altair processInactivityUpdates - 250000 normalcase 36.316 ms/op 31.289 ms/op 1.16
altair processInactivityUpdates - 250000 worstcase 32.900 ms/op 34.423 ms/op 0.96
phase0 processRegistryUpdates - 250000 normalcase 17.953 us/op 16.816 us/op 1.07
phase0 processRegistryUpdates - 250000 badcase_full_deposits 308.64 us/op 447.38 us/op 0.69
phase0 processRegistryUpdates - 250000 worstcase 0.5 134.49 ms/op 176.22 ms/op 0.76
altair processRewardsAndPenalties - 250000 normalcase 65.288 ms/op 75.832 ms/op 0.86
altair processRewardsAndPenalties - 250000 worstcase 59.584 ms/op 79.684 ms/op 0.75
phase0 getAttestationDeltas - 250000 normalcase 7.5597 ms/op 9.5552 ms/op 0.79
phase0 getAttestationDeltas - 250000 worstcase 7.2757 ms/op 11.026 ms/op 0.66
phase0 processSlashings - 250000 worstcase 3.4603 ms/op 5.0054 ms/op 0.69
altair processSyncCommitteeUpdates - 250000 191.38 ms/op 214.46 ms/op 0.89
BeaconState.hashTreeRoot - No change 310.00 ns/op 553.00 ns/op 0.56
BeaconState.hashTreeRoot - 1 full validator 55.210 us/op 60.659 us/op 0.91
BeaconState.hashTreeRoot - 32 full validator 585.93 us/op 666.55 us/op 0.88
BeaconState.hashTreeRoot - 512 full validator 5.4896 ms/op 6.6281 ms/op 0.83
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 65.522 us/op 74.351 us/op 0.88
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 986.72 us/op 1.1113 ms/op 0.89
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 12.616 ms/op 15.341 ms/op 0.82
BeaconState.hashTreeRoot - 1 balances 50.952 us/op 60.895 us/op 0.84
BeaconState.hashTreeRoot - 32 balances 477.26 us/op 572.55 us/op 0.83
BeaconState.hashTreeRoot - 512 balances 4.7489 ms/op 5.6288 ms/op 0.84
BeaconState.hashTreeRoot - 250000 balances 76.466 ms/op 95.016 ms/op 0.80
aggregationBits - 2048 els - zipIndexesInBitList 18.101 us/op 24.715 us/op 0.73
regular array get 100000 times 37.811 us/op 51.340 us/op 0.74
wrappedArray get 100000 times 34.037 us/op 50.890 us/op 0.67
arrayWithProxy get 100000 times 15.889 ms/op 18.325 ms/op 0.87
ssz.Root.equals 616.00 ns/op 785.00 ns/op 0.78
byteArrayEquals 586.00 ns/op 700.00 ns/op 0.84
shuffle list - 16384 els 7.0199 ms/op 7.7444 ms/op 0.91
shuffle list - 250000 els 103.73 ms/op 116.30 ms/op 0.89
processSlot - 1 slots 9.2390 us/op 10.769 us/op 0.86
processSlot - 32 slots 1.3935 ms/op 1.6723 ms/op 0.83
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 32.500 ms/op 44.274 ms/op 0.73
getCommitteeAssignments - req 1 vs - 250000 vc 2.9520 ms/op 3.4703 ms/op 0.85
getCommitteeAssignments - req 100 vs - 250000 vc 4.1871 ms/op 4.7173 ms/op 0.89
getCommitteeAssignments - req 1000 vs - 250000 vc 4.6736 ms/op 5.3591 ms/op 0.87
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.9600 ns/op 6.0000 ns/op 0.83
state getBlockRootAtSlot - 250000 vs - 7PWei 849.90 ns/op 1.0733 us/op 0.79
computeProposers - vc 250000 11.939 ms/op 16.147 ms/op 0.74
computeEpochShuffling - vc 250000 109.05 ms/op 129.46 ms/op 0.84
getNextSyncCommittee - vc 250000 193.29 ms/op 228.49 ms/op 0.85

by benchmarkbot/action

prepareState,
prepareSlot,
parentBlockRoot: fromHex(headRoot),
feeRecipient: "0x0000000000000000000000000000000000000000000000000000000000000000",
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this always ZERO_HASH?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm it could be set to the proposer's fee recipient (or the beacon's default in case we don't have one), it any way seems to be irrelevant/ignorable

image

https://github.com/ethereum/beacon-APIs/pull/305/files#diff-3cc6eaa800c1a4bd6adcd78f1722b466f7a24048a66e320c8f92872fbcd9eefbR120

@g11tech g11tech enabled auto-merge (squash) March 22, 2023 10:59
@g11tech g11tech merged commit f28adf6 into unstable Mar 22, 2023
@g11tech g11tech deleted the g11tech/sse-payload-attributes branch March 22, 2023 11:09
@wemeetagain
Copy link
Member

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

Add Payload Attribute SSE API
3 participants