Skip to content

EIP-4844: Use BlockInput#4841

Merged
dapplion merged 4 commits intounstablefrom
dapplion/eip-4844-blockimport
Dec 6, 2022
Merged

EIP-4844: Use BlockInput#4841
dapplion merged 4 commits intounstablefrom
dapplion/eip-4844-blockimport

Conversation

@dapplion
Copy link
Contributor

@dapplion dapplion commented Dec 5, 2022

Motivation

Description

This PR should not include any changes in business logic, just replace a function input type, used widely on the codebase

  • Use BlockInput struct enum to accommodate block OR blocks+blobs in the future

@dapplion dapplion requested a review from a team as a code owner December 5, 2022 07:37
@dapplion dapplion changed the title Dapplion/eip 4844 blockimport EIP-4844: Use BlockInput Dec 5, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2022

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 147eb5b Previous: b6032c5 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.0168 ms/op 2.7365 ms/op 0.74
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 65.716 us/op 82.392 us/op 0.80
BLS verify - blst-native 1.8367 ms/op 1.8634 ms/op 0.99
BLS verifyMultipleSignatures 3 - blst-native 3.6846 ms/op 3.8121 ms/op 0.97
BLS verifyMultipleSignatures 8 - blst-native 7.6481 ms/op 8.2051 ms/op 0.93
BLS verifyMultipleSignatures 32 - blst-native 27.585 ms/op 29.742 ms/op 0.93
BLS aggregatePubkeys 32 - blst-native 36.784 us/op 40.054 us/op 0.92
BLS aggregatePubkeys 128 - blst-native 142.78 us/op 152.91 us/op 0.93
getAttestationsForBlock 87.436 ms/op 102.29 ms/op 0.85
isKnown best case - 1 super set check 396.00 ns/op 505.00 ns/op 0.78
isKnown normal case - 2 super set checks 383.00 ns/op 488.00 ns/op 0.78
isKnown worse case - 16 super set checks 384.00 ns/op 487.00 ns/op 0.79
CheckpointStateCache - add get delete 7.9300 us/op 9.7240 us/op 0.82
validate gossip signedAggregateAndProof - struct 4.0076 ms/op 4.2783 ms/op 0.94
validate gossip attestation - struct 1.8819 ms/op 2.0364 ms/op 0.92
pickEth1Vote - no votes 1.9901 ms/op 2.2404 ms/op 0.89
pickEth1Vote - max votes 17.187 ms/op 24.723 ms/op 0.70
pickEth1Vote - Eth1Data hashTreeRoot value x2048 10.062 ms/op 12.093 ms/op 0.83
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 17.984 ms/op 23.689 ms/op 0.76
pickEth1Vote - Eth1Data fastSerialize value x2048 1.3325 ms/op 1.5960 ms/op 0.83
pickEth1Vote - Eth1Data fastSerialize tree x2048 11.379 ms/op 17.280 ms/op 0.66
bytes32 toHexString 885.00 ns/op 1.2530 us/op 0.71
bytes32 Buffer.toString(hex) 634.00 ns/op 742.00 ns/op 0.85
bytes32 Buffer.toString(hex) from Uint8Array 889.00 ns/op 1.0050 us/op 0.88
bytes32 Buffer.toString(hex) + 0x 669.00 ns/op 767.00 ns/op 0.87
Object access 1 prop 0.28900 ns/op 0.42700 ns/op 0.68
Map access 1 prop 0.24800 ns/op 0.29000 ns/op 0.86
Object get x1000 12.868 ns/op 17.384 ns/op 0.74
Map get x1000 0.79300 ns/op 1.1910 ns/op 0.67
Object set x1000 80.202 ns/op 136.62 ns/op 0.59
Map set x1000 54.186 ns/op 83.166 ns/op 0.65
Return object 10000 times 0.32790 ns/op 0.37480 ns/op 0.87
Throw Error 10000 times 5.6242 us/op 6.0206 us/op 0.93
fastMsgIdFn sha256 / 200 bytes 3.9540 us/op 4.3470 us/op 0.91
fastMsgIdFn h32 xxhash / 200 bytes 492.00 ns/op 616.00 ns/op 0.80
fastMsgIdFn h64 xxhash / 200 bytes 618.00 ns/op 861.00 ns/op 0.72
fastMsgIdFn sha256 / 1000 bytes 12.531 us/op 13.157 us/op 0.95
fastMsgIdFn h32 xxhash / 1000 bytes 602.00 ns/op 774.00 ns/op 0.78
fastMsgIdFn h64 xxhash / 1000 bytes 767.00 ns/op 911.00 ns/op 0.84
fastMsgIdFn sha256 / 10000 bytes 108.08 us/op 112.27 us/op 0.96
fastMsgIdFn h32 xxhash / 10000 bytes 2.1190 us/op 2.3460 us/op 0.90
fastMsgIdFn h64 xxhash / 10000 bytes 1.6720 us/op 1.7210 us/op 0.97
enrSubnets - fastDeserialize 64 bits 2.3150 us/op 3.2340 us/op 0.72
enrSubnets - ssz BitVector 64 bits 624.00 ns/op 811.00 ns/op 0.77
enrSubnets - fastDeserialize 4 bits 316.00 ns/op 429.00 ns/op 0.74
enrSubnets - ssz BitVector 4 bits 638.00 ns/op 832.00 ns/op 0.77
prioritizePeers score -10:0 att 32-0.1 sync 2-0 82.564 us/op 104.70 us/op 0.79
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 121.04 us/op 126.51 us/op 0.96
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 212.44 us/op 239.61 us/op 0.89
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 429.81 us/op 500.53 us/op 0.86
prioritizePeers score 0:0 att 64-1 sync 4-1 432.19 us/op 468.95 us/op 0.92
RateTracker 1000000 limit, 1 obj count per request 155.43 ns/op 213.97 ns/op 0.73
RateTracker 1000000 limit, 2 obj count per request 114.80 ns/op 163.74 ns/op 0.70
RateTracker 1000000 limit, 4 obj count per request 95.583 ns/op 137.69 ns/op 0.69
RateTracker 1000000 limit, 8 obj count per request 89.254 ns/op 126.69 ns/op 0.70
RateTracker with prune 4.0140 us/op 6.1550 us/op 0.65
array of 16000 items push then shift 4.2219 us/op 2.8909 us/op 1.46
LinkedList of 16000 items push then shift 13.794 ns/op 19.522 ns/op 0.71
array of 16000 items push then pop 191.77 ns/op 253.03 ns/op 0.76
LinkedList of 16000 items push then pop 13.092 ns/op 17.815 ns/op 0.73
array of 24000 items push then shift 6.0177 us/op 3.9807 us/op 1.51
LinkedList of 24000 items push then shift 14.150 ns/op 24.642 ns/op 0.57
array of 24000 items push then pop 192.56 ns/op 224.22 ns/op 0.86
LinkedList of 24000 items push then pop 13.187 ns/op 20.208 ns/op 0.65
intersect bitArray bitLen 8 9.8740 ns/op 11.735 ns/op 0.84
intersect array and set length 8 144.98 ns/op 193.25 ns/op 0.75
intersect bitArray bitLen 128 56.457 ns/op 61.870 ns/op 0.91
intersect array and set length 128 1.9686 us/op 2.4880 us/op 0.79
Buffer.concat 32 items 1.9570 ns/op 1.9930 ns/op 0.98
pass gossip attestations to forkchoice per slot 5.3867 ms/op 4.0918 ms/op 1.32
computeDeltas 4.7059 ms/op 6.2398 ms/op 0.75
computeProposerBoostScoreFromBalances 697.80 us/op 908.04 us/op 0.77
altair processAttestation - 250000 vs - 7PWei normalcase 3.3525 ms/op 4.6314 ms/op 0.72
altair processAttestation - 250000 vs - 7PWei worstcase 5.3639 ms/op 7.4077 ms/op 0.72
altair processAttestation - setStatus - 1/6 committees join 190.34 us/op 226.74 us/op 0.84
altair processAttestation - setStatus - 1/3 committees join 363.98 us/op 430.84 us/op 0.84
altair processAttestation - setStatus - 1/2 committees join 563.41 us/op 591.20 us/op 0.95
altair processAttestation - setStatus - 2/3 committees join 829.98 us/op 766.31 us/op 1.08
altair processAttestation - setStatus - 4/5 committees join 1.1018 ms/op 1.0624 ms/op 1.04
altair processAttestation - setStatus - 100% committees join 1.2399 ms/op 1.2452 ms/op 1.00
altair processBlock - 250000 vs - 7PWei normalcase 26.058 ms/op 31.086 ms/op 0.84
altair processBlock - 250000 vs - 7PWei normalcase hashState 39.679 ms/op 41.684 ms/op 0.95
altair processBlock - 250000 vs - 7PWei worstcase 143.73 ms/op 95.540 ms/op 1.50
altair processBlock - 250000 vs - 7PWei worstcase hashState 126.83 ms/op 102.67 ms/op 1.24
phase0 processBlock - 250000 vs - 7PWei normalcase 4.0385 ms/op 4.2765 ms/op 0.94
phase0 processBlock - 250000 vs - 7PWei worstcase 48.521 ms/op 48.485 ms/op 1.00
altair processEth1Data - 250000 vs - 7PWei normalcase 919.48 us/op 1.0882 ms/op 0.84
vc - 250000 eb 1 eth1 1 we 0 wn 0 - smpl 15 18.660 us/op 8.1440 us/op 2.29
vc - 250000 eb 0.95 eth1 0.1 we 0.05 wn 0 - smpl 219 38.619 us/op 27.685 us/op 1.39
vc - 250000 eb 0.95 eth1 0.3 we 0.05 wn 0 - smpl 42 21.116 us/op 11.299 us/op 1.87
vc - 250000 eb 0.95 eth1 0.7 we 0.05 wn 0 - smpl 18 20.581 us/op 8.6960 us/op 2.37
vc - 250000 eb 0.1 eth1 0.1 we 0 wn 0 - smpl 1020 144.16 us/op 108.27 us/op 1.33
vc - 250000 eb 0.03 eth1 0.03 we 0 wn 0 - smpl 11777 1.1775 ms/op 1.0804 ms/op 1.09
vc - 250000 eb 0.01 eth1 0.01 we 0 wn 0 - smpl 141069 14.982 ms/op 15.333 ms/op 0.98
vc - 250000 eb 0 eth1 0 we 0 wn 0 - smpl 250000 26.405 ms/op 26.525 ms/op 1.00
vc - 250000 eb 0 eth1 0 we 0 wn 0 nocache - smpl 250000 82.750 ms/op 91.438 ms/op 0.90
vc - 250000 eb 0 eth1 1 we 0 wn 0 - smpl 250000 48.686 ms/op 50.418 ms/op 0.97
vc - 250000 eb 0 eth1 1 we 0 wn 0 nocache - smpl 250000 133.80 ms/op 138.79 ms/op 0.96
Tree 40 250000 create 839.49 ms/op 1.0713 s/op 0.78
Tree 40 250000 get(125000) 303.17 ns/op 292.70 ns/op 1.04
Tree 40 250000 set(125000) 2.9050 us/op 3.3613 us/op 0.86
Tree 40 250000 toArray() 34.302 ms/op 35.528 ms/op 0.97
Tree 40 250000 iterate all - toArray() + loop 35.048 ms/op 35.249 ms/op 0.99
Tree 40 250000 iterate all - get(i) 119.12 ms/op 115.44 ms/op 1.03
MutableVector 250000 create 30.761 ms/op 20.732 ms/op 1.48
MutableVector 250000 get(125000) 12.038 ns/op 13.126 ns/op 0.92
MutableVector 250000 set(125000) 543.12 ns/op 881.37 ns/op 0.62
MutableVector 250000 toArray() 6.6075 ms/op 8.3426 ms/op 0.79
MutableVector 250000 iterate all - toArray() + loop 6.6228 ms/op 8.5978 ms/op 0.77
MutableVector 250000 iterate all - get(i) 3.1119 ms/op 3.4476 ms/op 0.90
Array 250000 create 6.5603 ms/op 7.6858 ms/op 0.85
Array 250000 clone - spread 2.8413 ms/op 4.5200 ms/op 0.63
Array 250000 get(125000) 1.2110 ns/op 1.9400 ns/op 0.62
Array 250000 set(125000) 1.2250 ns/op 1.7120 ns/op 0.72
Array 250000 iterate all - loop 136.46 us/op 168.12 us/op 0.81
effectiveBalanceIncrements clone Uint8Array 300000 63.020 us/op 104.74 us/op 0.60
effectiveBalanceIncrements clone MutableVector 300000 787.00 ns/op 1.3580 us/op 0.58
effectiveBalanceIncrements rw all Uint8Array 300000 247.97 us/op 252.99 us/op 0.98
effectiveBalanceIncrements rw all MutableVector 300000 187.08 ms/op 285.56 ms/op 0.66
phase0 afterProcessEpoch - 250000 vs - 7PWei 178.21 ms/op 186.12 ms/op 0.96
phase0 beforeProcessEpoch - 250000 vs - 7PWei 77.910 ms/op 104.93 ms/op 0.74
altair processEpoch - mainnet_e81889 576.90 ms/op 529.11 ms/op 1.09
mainnet_e81889 - altair beforeProcessEpoch 157.03 ms/op 155.37 ms/op 1.01
mainnet_e81889 - altair processJustificationAndFinalization 73.416 us/op 20.927 us/op 3.51
mainnet_e81889 - altair processInactivityUpdates 9.4380 ms/op 12.704 ms/op 0.74
mainnet_e81889 - altair processRewardsAndPenalties 94.871 ms/op 97.696 ms/op 0.97
mainnet_e81889 - altair processRegistryUpdates 14.592 us/op 3.4950 us/op 4.18
mainnet_e81889 - altair processSlashings 2.8480 us/op 773.00 ns/op 3.68
mainnet_e81889 - altair processEth1DataReset 3.4420 us/op 1.0580 us/op 3.25
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.1665 ms/op 2.2868 ms/op 0.95
mainnet_e81889 - altair processSlashingsReset 27.013 us/op 9.3650 us/op 2.88
mainnet_e81889 - altair processRandaoMixesReset 24.270 us/op 6.3130 us/op 3.84
mainnet_e81889 - altair processHistoricalRootsUpdate 3.7990 us/op 1.0090 us/op 3.77
mainnet_e81889 - altair processParticipationFlagUpdates 15.414 us/op 3.7030 us/op 4.16
mainnet_e81889 - altair processSyncCommitteeUpdates 3.5500 us/op 794.00 ns/op 4.47
mainnet_e81889 - altair afterProcessEpoch 186.52 ms/op 195.34 ms/op 0.95
phase0 processEpoch - mainnet_e58758 538.08 ms/op 563.36 ms/op 0.96
mainnet_e58758 - phase0 beforeProcessEpoch 255.09 ms/op 267.74 ms/op 0.95
mainnet_e58758 - phase0 processJustificationAndFinalization 57.171 us/op 23.972 us/op 2.38
mainnet_e58758 - phase0 processRewardsAndPenalties 146.66 ms/op 147.67 ms/op 0.99
mainnet_e58758 - phase0 processRegistryUpdates 34.862 us/op 10.489 us/op 3.32
mainnet_e58758 - phase0 processSlashings 3.0600 us/op 712.00 ns/op 4.30
mainnet_e58758 - phase0 processEth1DataReset 3.0570 us/op 699.00 ns/op 4.37
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.8381 ms/op 2.1530 ms/op 0.85
mainnet_e58758 - phase0 processSlashingsReset 16.096 us/op 4.5140 us/op 3.57
mainnet_e58758 - phase0 processRandaoMixesReset 26.712 us/op 7.7690 us/op 3.44
mainnet_e58758 - phase0 processHistoricalRootsUpdate 4.3430 us/op 837.00 ns/op 5.19
mainnet_e58758 - phase0 processParticipationRecordUpdates 24.198 us/op 5.7310 us/op 4.22
mainnet_e58758 - phase0 afterProcessEpoch 156.26 ms/op 159.11 ms/op 0.98
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.1736 ms/op 2.5770 ms/op 0.84
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.6177 ms/op 3.5307 ms/op 0.74
altair processInactivityUpdates - 250000 normalcase 49.614 ms/op 41.212 ms/op 1.20
altair processInactivityUpdates - 250000 worstcase 59.808 ms/op 56.615 ms/op 1.06
phase0 processRegistryUpdates - 250000 normalcase 26.065 us/op 8.9470 us/op 2.91
phase0 processRegistryUpdates - 250000 badcase_full_deposits 480.63 us/op 439.77 us/op 1.09
phase0 processRegistryUpdates - 250000 worstcase 0.5 233.55 ms/op 230.76 ms/op 1.01
altair processRewardsAndPenalties - 250000 normalcase 124.18 ms/op 130.76 ms/op 0.95
altair processRewardsAndPenalties - 250000 worstcase 166.03 ms/op 91.493 ms/op 1.81
phase0 getAttestationDeltas - 250000 normalcase 13.434 ms/op 16.549 ms/op 0.81
phase0 getAttestationDeltas - 250000 worstcase 13.767 ms/op 14.433 ms/op 0.95
phase0 processSlashings - 250000 worstcase 6.9050 ms/op 5.9054 ms/op 1.17
altair processSyncCommitteeUpdates - 250000 333.14 ms/op 303.14 ms/op 1.10
BeaconState.hashTreeRoot - No change 527.00 ns/op 486.00 ns/op 1.08
BeaconState.hashTreeRoot - 1 full validator 71.258 us/op 62.095 us/op 1.15
BeaconState.hashTreeRoot - 32 full validator 727.06 us/op 608.44 us/op 1.19
BeaconState.hashTreeRoot - 512 full validator 7.4256 ms/op 6.5780 ms/op 1.13
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 95.049 us/op 81.811 us/op 1.16
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.3622 ms/op 1.2517 ms/op 1.09
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 18.332 ms/op 16.856 ms/op 1.09
BeaconState.hashTreeRoot - 1 balances 64.042 us/op 63.507 us/op 1.01
BeaconState.hashTreeRoot - 32 balances 619.09 us/op 606.86 us/op 1.02
BeaconState.hashTreeRoot - 512 balances 7.1071 ms/op 6.9185 ms/op 1.03
BeaconState.hashTreeRoot - 250000 balances 92.515 ms/op 88.361 ms/op 1.05
aggregationBits - 2048 els - zipIndexesInBitList 25.763 us/op 41.468 us/op 0.62
regular array get 100000 times 48.473 us/op 67.464 us/op 0.72
wrappedArray get 100000 times 47.625 us/op 67.522 us/op 0.71
arrayWithProxy get 100000 times 29.745 ms/op 28.939 ms/op 1.03
ssz.Root.equals 439.00 ns/op 532.00 ns/op 0.83
byteArrayEquals 473.00 ns/op 503.00 ns/op 0.94
shuffle list - 16384 els 9.8258 ms/op 11.116 ms/op 0.88
shuffle list - 250000 els 144.03 ms/op 164.07 ms/op 0.88
processSlot - 1 slots 14.509 us/op 13.417 us/op 1.08
processSlot - 32 slots 1.8587 ms/op 1.9802 ms/op 0.94
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 393.05 us/op 1.1646 ms/op 0.34
getCommitteeAssignments - req 1 vs - 250000 vc 4.7001 ms/op 5.4187 ms/op 0.87
getCommitteeAssignments - req 100 vs - 250000 vc 6.4238 ms/op 7.4581 ms/op 0.86
getCommitteeAssignments - req 1000 vs - 250000 vc 7.2544 ms/op 8.0451 ms/op 0.90
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 7.9400 ns/op 9.8600 ns/op 0.81
state getBlockRootAtSlot - 250000 vs - 7PWei 1.0568 us/op 1.3742 us/op 0.77
computeProposers - vc 250000 17.744 ms/op 17.610 ms/op 1.01
computeEpochShuffling - vc 250000 149.27 ms/op 169.49 ms/op 0.88
getNextSyncCommittee - vc 250000 293.75 ms/op 293.30 ms/op 1.00

by benchmarkbot/action

@dapplion dapplion added the spec-deneb 🐡 Issues targeting the Deneb spec version label Dec 5, 2022
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 apart from the same query @tuyennhv has raised, is it because of the stub type issues since I think i faced a similar situation earlier?

@dapplion dapplion merged commit 8a0e83d into unstable Dec 6, 2022
@dapplion dapplion deleted the dapplion/eip-4844-blockimport branch December 6, 2022 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spec-deneb 🐡 Issues targeting the Deneb spec version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants