Skip to content

EIP-4844: Update state transition function#4880

Merged
g11tech merged 1 commit intounstablefrom
dapplion/eip-4844-stfn
Dec 7, 2022
Merged

EIP-4844: Update state transition function#4880
g11tech merged 1 commit intounstablefrom
dapplion/eip-4844-stfn

Conversation

@dapplion
Copy link
Contributor

@dapplion dapplion commented Dec 7, 2022

Motivation

Description

  • Update processBlock
  • Add state fork transform

@dapplion dapplion added the spec-deneb 🐡 Issues targeting the Deneb spec version label Dec 7, 2022
@dapplion dapplion requested a review from a team as a code owner December 7, 2022 08:55
@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2022

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: ce61a15 Previous: 4115f67 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.9494 ms/op 2.3522 ms/op 0.83
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 70.216 us/op 88.916 us/op 0.79
BLS verify - blst-native 1.8556 ms/op 2.7517 ms/op 0.67
BLS verifyMultipleSignatures 3 - blst-native 3.8090 ms/op 5.5217 ms/op 0.69
BLS verifyMultipleSignatures 8 - blst-native 8.2017 ms/op 12.040 ms/op 0.68
BLS verifyMultipleSignatures 32 - blst-native 29.726 ms/op 40.842 ms/op 0.73
BLS aggregatePubkeys 32 - blst-native 39.815 us/op 55.862 us/op 0.71
BLS aggregatePubkeys 128 - blst-native 153.30 us/op 238.52 us/op 0.64
getAttestationsForBlock 87.281 ms/op 119.79 ms/op 0.73
isKnown best case - 1 super set check 413.00 ns/op 508.00 ns/op 0.81
isKnown normal case - 2 super set checks 405.00 ns/op 493.00 ns/op 0.82
isKnown worse case - 16 super set checks 412.00 ns/op 475.00 ns/op 0.87
CheckpointStateCache - add get delete 8.6910 us/op 10.883 us/op 0.80
validate gossip signedAggregateAndProof - struct 4.2695 ms/op 6.0945 ms/op 0.70
validate gossip attestation - struct 2.0312 ms/op 2.8254 ms/op 0.72
pickEth1Vote - no votes 2.0196 ms/op 2.6825 ms/op 0.75
pickEth1Vote - max votes 19.443 ms/op 22.183 ms/op 0.88
pickEth1Vote - Eth1Data hashTreeRoot value x2048 10.728 ms/op 14.179 ms/op 0.76
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 19.387 ms/op 24.148 ms/op 0.80
pickEth1Vote - Eth1Data fastSerialize value x2048 1.5224 ms/op 1.8585 ms/op 0.82
pickEth1Vote - Eth1Data fastSerialize tree x2048 13.382 ms/op 15.190 ms/op 0.88
bytes32 toHexString 1.0350 us/op 1.2230 us/op 0.85
bytes32 Buffer.toString(hex) 709.00 ns/op 799.00 ns/op 0.89
bytes32 Buffer.toString(hex) from Uint8Array 927.00 ns/op 1.0640 us/op 0.87
bytes32 Buffer.toString(hex) + 0x 701.00 ns/op 778.00 ns/op 0.90
Object access 1 prop 0.34500 ns/op 0.42700 ns/op 0.81
Map access 1 prop 0.28800 ns/op 0.32900 ns/op 0.88
Object get x1000 17.257 ns/op 15.740 ns/op 1.10
Map get x1000 1.0120 ns/op 0.91500 ns/op 1.11
Object set x1000 115.66 ns/op 120.88 ns/op 0.96
Map set x1000 68.772 ns/op 79.547 ns/op 0.86
Return object 10000 times 0.37650 ns/op 0.41480 ns/op 0.91
Throw Error 10000 times 6.0459 us/op 7.1478 us/op 0.85
fastMsgIdFn sha256 / 200 bytes 4.2970 us/op 5.2810 us/op 0.81
fastMsgIdFn h32 xxhash / 200 bytes 568.00 ns/op 616.00 ns/op 0.92
fastMsgIdFn h64 xxhash / 200 bytes 712.00 ns/op 890.00 ns/op 0.80
fastMsgIdFn sha256 / 1000 bytes 13.265 us/op 16.590 us/op 0.80
fastMsgIdFn h32 xxhash / 1000 bytes 685.00 ns/op 804.00 ns/op 0.85
fastMsgIdFn h64 xxhash / 1000 bytes 813.00 ns/op 975.00 ns/op 0.83
fastMsgIdFn sha256 / 10000 bytes 112.39 us/op 153.73 us/op 0.73
fastMsgIdFn h32 xxhash / 10000 bytes 2.3610 us/op 2.8630 us/op 0.82
fastMsgIdFn h64 xxhash / 10000 bytes 1.8170 us/op 2.0510 us/op 0.89
enrSubnets - fastDeserialize 64 bits 2.6230 us/op 2.9950 us/op 0.88
enrSubnets - ssz BitVector 64 bits 730.00 ns/op 806.00 ns/op 0.91
enrSubnets - fastDeserialize 4 bits 398.00 ns/op 475.00 ns/op 0.84
enrSubnets - ssz BitVector 4 bits 743.00 ns/op 886.00 ns/op 0.84
prioritizePeers score -10:0 att 32-0.1 sync 2-0 94.586 us/op 109.49 us/op 0.86
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 135.19 us/op 152.52 us/op 0.89
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 225.30 us/op 287.05 us/op 0.78
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 384.16 us/op 580.28 us/op 0.66
prioritizePeers score 0:0 att 64-1 sync 4-1 451.70 us/op 615.01 us/op 0.73
RateTracker 1000000 limit, 1 obj count per request 191.99 ns/op 206.50 ns/op 0.93
RateTracker 1000000 limit, 2 obj count per request 139.14 ns/op 156.96 ns/op 0.89
RateTracker 1000000 limit, 4 obj count per request 118.71 ns/op 131.21 ns/op 0.90
RateTracker 1000000 limit, 8 obj count per request 107.93 ns/op 111.18 ns/op 0.97
RateTracker with prune 4.4150 us/op 5.3770 us/op 0.82
array of 16000 items push then shift 2.8343 us/op 5.0871 us/op 0.56
LinkedList of 16000 items push then shift 17.299 ns/op 19.017 ns/op 0.91
array of 16000 items push then pop 254.71 ns/op 248.49 ns/op 1.03
LinkedList of 16000 items push then pop 16.463 ns/op 18.341 ns/op 0.90
array of 24000 items push then shift 3.9657 us/op 7.5670 us/op 0.52
LinkedList of 24000 items push then shift 20.105 ns/op 19.743 ns/op 1.02
array of 24000 items push then pop 211.97 ns/op 249.49 ns/op 0.85
LinkedList of 24000 items push then pop 18.073 ns/op 17.892 ns/op 1.01
intersect bitArray bitLen 8 11.506 ns/op 12.097 ns/op 0.95
intersect array and set length 8 164.87 ns/op 199.97 ns/op 0.82
intersect bitArray bitLen 128 72.065 ns/op 69.326 ns/op 1.04
intersect array and set length 128 2.2364 us/op 2.5573 us/op 0.87
Buffer.concat 32 items 1.9330 ns/op 2.6230 ns/op 0.74
pass gossip attestations to forkchoice per slot 6.9046 ms/op 4.5404 ms/op 1.52
computeDeltas 6.3939 ms/op 5.5700 ms/op 1.15
computeProposerBoostScoreFromBalances 907.41 us/op 856.30 us/op 1.06
altair processAttestation - 250000 vs - 7PWei normalcase 3.7627 ms/op 5.2350 ms/op 0.72
altair processAttestation - 250000 vs - 7PWei worstcase 5.6014 ms/op 9.2972 ms/op 0.60
altair processAttestation - setStatus - 1/6 committees join 206.53 us/op 235.31 us/op 0.88
altair processAttestation - setStatus - 1/3 committees join 396.03 us/op 450.41 us/op 0.88
altair processAttestation - setStatus - 1/2 committees join 553.15 us/op 656.47 us/op 0.84
altair processAttestation - setStatus - 2/3 committees join 713.52 us/op 910.97 us/op 0.78
altair processAttestation - setStatus - 4/5 committees join 991.22 us/op 1.1653 ms/op 0.85
altair processAttestation - setStatus - 100% committees join 1.1686 ms/op 1.4386 ms/op 0.81
altair processBlock - 250000 vs - 7PWei normalcase 28.445 ms/op 30.195 ms/op 0.94
altair processBlock - 250000 vs - 7PWei normalcase hashState 38.974 ms/op 41.124 ms/op 0.95
altair processBlock - 250000 vs - 7PWei worstcase 72.517 ms/op 103.73 ms/op 0.70
altair processBlock - 250000 vs - 7PWei worstcase hashState 98.665 ms/op 121.24 ms/op 0.81
phase0 processBlock - 250000 vs - 7PWei normalcase 3.5197 ms/op 4.0784 ms/op 0.86
phase0 processBlock - 250000 vs - 7PWei worstcase 45.488 ms/op 61.153 ms/op 0.74
altair processEth1Data - 250000 vs - 7PWei normalcase 819.87 us/op 1.0219 ms/op 0.80
vc - 250000 eb 1 eth1 1 we 0 wn 0 - smpl 15 10.152 us/op 23.186 us/op 0.44
vc - 250000 eb 0.95 eth1 0.1 we 0.05 wn 0 - smpl 219 36.623 us/op 48.326 us/op 0.76
vc - 250000 eb 0.95 eth1 0.3 we 0.05 wn 0 - smpl 42 14.963 us/op 27.610 us/op 0.54
vc - 250000 eb 0.95 eth1 0.7 we 0.05 wn 0 - smpl 18 11.912 us/op 22.435 us/op 0.53
vc - 250000 eb 0.1 eth1 0.1 we 0 wn 0 - smpl 1020 161.90 us/op 152.19 us/op 1.06
vc - 250000 eb 0.03 eth1 0.03 we 0 wn 0 - smpl 11777 1.1051 ms/op 1.2901 ms/op 0.86
vc - 250000 eb 0.01 eth1 0.01 we 0 wn 0 - smpl 141069 13.883 ms/op 17.251 ms/op 0.80
vc - 250000 eb 0 eth1 0 we 0 wn 0 - smpl 250000 24.083 ms/op 27.341 ms/op 0.88
vc - 250000 eb 0 eth1 0 we 0 wn 0 nocache - smpl 250000 88.122 ms/op 88.937 ms/op 0.99
vc - 250000 eb 0 eth1 1 we 0 wn 0 - smpl 250000 46.852 ms/op 55.331 ms/op 0.85
vc - 250000 eb 0 eth1 1 we 0 wn 0 nocache - smpl 250000 131.23 ms/op 144.32 ms/op 0.91
Tree 40 250000 create 784.32 ms/op 1.0225 s/op 0.77
Tree 40 250000 get(125000) 296.55 ns/op 334.77 ns/op 0.89
Tree 40 250000 set(125000) 2.3612 us/op 3.0285 us/op 0.78
Tree 40 250000 toArray() 32.240 ms/op 33.783 ms/op 0.95
Tree 40 250000 iterate all - toArray() + loop 32.120 ms/op 35.296 ms/op 0.91
Tree 40 250000 iterate all - get(i) 110.22 ms/op 126.14 ms/op 0.87
MutableVector 250000 create 14.126 ms/op 16.614 ms/op 0.85
MutableVector 250000 get(125000) 14.937 ns/op 13.525 ns/op 1.10
MutableVector 250000 set(125000) 607.76 ns/op 845.46 ns/op 0.72
MutableVector 250000 toArray() 7.1998 ms/op 7.3368 ms/op 0.98
MutableVector 250000 iterate all - toArray() + loop 7.4822 ms/op 7.6059 ms/op 0.98
MutableVector 250000 iterate all - get(i) 3.3636 ms/op 3.4709 ms/op 0.97
Array 250000 create 6.5461 ms/op 7.1322 ms/op 0.92
Array 250000 clone - spread 3.5279 ms/op 4.1867 ms/op 0.84
Array 250000 get(125000) 1.4710 ns/op 1.7440 ns/op 0.84
Array 250000 set(125000) 1.4720 ns/op 1.7780 ns/op 0.83
Array 250000 iterate all - loop 167.77 us/op 137.41 us/op 1.22
effectiveBalanceIncrements clone Uint8Array 300000 81.979 us/op 113.17 us/op 0.72
effectiveBalanceIncrements clone MutableVector 300000 1.0880 us/op 1.2770 us/op 0.85
effectiveBalanceIncrements rw all Uint8Array 300000 252.41 us/op 286.55 us/op 0.88
effectiveBalanceIncrements rw all MutableVector 300000 197.00 ms/op 276.22 ms/op 0.71
phase0 afterProcessEpoch - 250000 vs - 7PWei 188.21 ms/op 206.47 ms/op 0.91
phase0 beforeProcessEpoch - 250000 vs - 7PWei 101.45 ms/op 76.951 ms/op 1.32
altair processEpoch - mainnet_e81889 580.17 ms/op 660.23 ms/op 0.88
mainnet_e81889 - altair beforeProcessEpoch 141.22 ms/op 156.18 ms/op 0.90
mainnet_e81889 - altair processJustificationAndFinalization 21.184 us/op 72.865 us/op 0.29
mainnet_e81889 - altair processInactivityUpdates 10.485 ms/op 11.698 ms/op 0.90
mainnet_e81889 - altair processRewardsAndPenalties 90.731 ms/op 105.60 ms/op 0.86
mainnet_e81889 - altair processRegistryUpdates 3.7300 us/op 18.375 us/op 0.20
mainnet_e81889 - altair processSlashings 988.00 ns/op 4.6040 us/op 0.21
mainnet_e81889 - altair processEth1DataReset 1.1170 us/op 4.7720 us/op 0.23
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.3910 ms/op 2.4133 ms/op 0.99
mainnet_e81889 - altair processSlashingsReset 8.1840 us/op 23.082 us/op 0.35
mainnet_e81889 - altair processRandaoMixesReset 7.7410 us/op 27.887 us/op 0.28
mainnet_e81889 - altair processHistoricalRootsUpdate 1.1030 us/op 4.1220 us/op 0.27
mainnet_e81889 - altair processParticipationFlagUpdates 3.5750 us/op 18.535 us/op 0.19
mainnet_e81889 - altair processSyncCommitteeUpdates 1.0440 us/op 3.5830 us/op 0.29
mainnet_e81889 - altair afterProcessEpoch 196.81 ms/op 211.89 ms/op 0.93
phase0 processEpoch - mainnet_e58758 520.71 ms/op 626.25 ms/op 0.83
mainnet_e58758 - phase0 beforeProcessEpoch 226.65 ms/op 285.78 ms/op 0.79
mainnet_e58758 - phase0 processJustificationAndFinalization 28.252 us/op 68.988 us/op 0.41
mainnet_e58758 - phase0 processRewardsAndPenalties 139.82 ms/op 157.13 ms/op 0.89
mainnet_e58758 - phase0 processRegistryUpdates 12.634 us/op 36.968 us/op 0.34
mainnet_e58758 - phase0 processSlashings 1.0500 us/op 3.7740 us/op 0.28
mainnet_e58758 - phase0 processEth1DataReset 1.0450 us/op 3.8180 us/op 0.27
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.1807 ms/op 2.4555 ms/op 0.89
mainnet_e58758 - phase0 processSlashingsReset 6.2210 us/op 20.997 us/op 0.30
mainnet_e58758 - phase0 processRandaoMixesReset 7.5400 us/op 28.811 us/op 0.26
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.1850 us/op 4.5820 us/op 0.26
mainnet_e58758 - phase0 processParticipationRecordUpdates 6.2730 us/op 27.352 us/op 0.23
mainnet_e58758 - phase0 afterProcessEpoch 161.02 ms/op 174.31 ms/op 0.92
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.5975 ms/op 2.3961 ms/op 1.08
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 3.4766 ms/op 2.8524 ms/op 1.22
altair processInactivityUpdates - 250000 normalcase 39.565 ms/op 52.093 ms/op 0.76
altair processInactivityUpdates - 250000 worstcase 48.938 ms/op 67.390 ms/op 0.73
phase0 processRegistryUpdates - 250000 normalcase 10.970 us/op 33.216 us/op 0.33
phase0 processRegistryUpdates - 250000 badcase_full_deposits 521.87 us/op 510.75 us/op 1.02
phase0 processRegistryUpdates - 250000 worstcase 0.5 211.47 ms/op 245.52 ms/op 0.86
altair processRewardsAndPenalties - 250000 normalcase 125.22 ms/op 151.09 ms/op 0.83
altair processRewardsAndPenalties - 250000 worstcase 115.76 ms/op 98.810 ms/op 1.17
phase0 getAttestationDeltas - 250000 normalcase 12.510 ms/op 15.104 ms/op 0.83
phase0 getAttestationDeltas - 250000 worstcase 12.512 ms/op 15.673 ms/op 0.80
phase0 processSlashings - 250000 worstcase 6.0308 ms/op 7.2596 ms/op 0.83
altair processSyncCommitteeUpdates - 250000 277.68 ms/op 342.69 ms/op 0.81
BeaconState.hashTreeRoot - No change 461.00 ns/op 740.00 ns/op 0.62
BeaconState.hashTreeRoot - 1 full validator 61.245 us/op 81.661 us/op 0.75
BeaconState.hashTreeRoot - 32 full validator 549.86 us/op 840.81 us/op 0.65
BeaconState.hashTreeRoot - 512 full validator 5.9305 ms/op 7.7104 ms/op 0.77
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 77.830 us/op 129.14 us/op 0.60
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.1630 ms/op 1.5287 ms/op 0.76
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 15.370 ms/op 18.943 ms/op 0.81
BeaconState.hashTreeRoot - 1 balances 58.708 us/op 77.637 us/op 0.76
BeaconState.hashTreeRoot - 32 balances 589.63 us/op 784.71 us/op 0.75
BeaconState.hashTreeRoot - 512 balances 18.798 ms/op 6.9252 ms/op 2.71
BeaconState.hashTreeRoot - 250000 balances 84.416 ms/op 116.06 ms/op 0.73
aggregationBits - 2048 els - zipIndexesInBitList 29.992 us/op 37.999 us/op 0.79
regular array get 100000 times 67.447 us/op 54.712 us/op 1.23
wrappedArray get 100000 times 67.420 us/op 56.565 us/op 1.19
arrayWithProxy get 100000 times 28.432 ms/op 33.007 ms/op 0.86
ssz.Root.equals 463.00 ns/op 562.00 ns/op 0.82
byteArrayEquals 456.00 ns/op 575.00 ns/op 0.79
shuffle list - 16384 els 11.335 ms/op 12.242 ms/op 0.93
shuffle list - 250000 els 166.50 ms/op 173.84 ms/op 0.96
processSlot - 1 slots 12.613 us/op 19.449 us/op 0.65
processSlot - 32 slots 1.7425 ms/op 2.5994 ms/op 0.67
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 398.60 us/op 578.32 us/op 0.69
getCommitteeAssignments - req 1 vs - 250000 vc 5.2749 ms/op 5.5800 ms/op 0.95
getCommitteeAssignments - req 100 vs - 250000 vc 7.2945 ms/op 7.8092 ms/op 0.93
getCommitteeAssignments - req 1000 vs - 250000 vc 7.7843 ms/op 8.7725 ms/op 0.89
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 9.8700 ns/op 9.4900 ns/op 1.04
state getBlockRootAtSlot - 250000 vs - 7PWei 1.0099 us/op 1.3194 us/op 0.77
computeProposers - vc 250000 16.413 ms/op 21.538 ms/op 0.76
computeEpochShuffling - vc 250000 170.55 ms/op 189.10 ms/op 0.90
getNextSyncCommittee - vc 250000 272.04 ms/op 353.99 ms/op 0.77

by benchmarkbot/action

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.

lgtm!

@g11tech g11tech merged commit 7444259 into unstable Dec 7, 2022
@g11tech g11tech deleted the dapplion/eip-4844-stfn branch December 7, 2022 10:06
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.

2 participants