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

Remove the Gwei to Wei conversion and vice-versa for withdrawals engine api serialization #5004

Merged
merged 3 commits into from
Jan 13, 2023

Conversation

g11tech
Copy link
Contributor

@g11tech g11tech commented Jan 13, 2023

Remove the Gwei to Wei conversion and vice-versa for withdrawals engine api serialization

Ref:

ps: withdrawals CI runs have been disabled till new builds are available by ELs

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

github-actions bot commented Jan 13, 2023

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 3fd1955 Previous: 50ea681 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.1541 ms/op 1.0161 ms/op 1.14
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 70.244 us/op 60.573 us/op 1.16
BLS verify - blst-native 1.8656 ms/op 2.1760 ms/op 0.86
BLS verifyMultipleSignatures 3 - blst-native 3.8061 ms/op 4.4876 ms/op 0.85
BLS verifyMultipleSignatures 8 - blst-native 8.1937 ms/op 9.7105 ms/op 0.84
BLS verifyMultipleSignatures 32 - blst-native 29.739 ms/op 35.296 ms/op 0.84
BLS aggregatePubkeys 32 - blst-native 39.453 us/op 46.466 us/op 0.85
BLS aggregatePubkeys 128 - blst-native 153.76 us/op 182.43 us/op 0.84
getAttestationsForBlock 88.457 ms/op 78.837 ms/op 1.12
isKnown best case - 1 super set check 428.00 ns/op 442.00 ns/op 0.97
isKnown normal case - 2 super set checks 410.00 ns/op 430.00 ns/op 0.95
isKnown worse case - 16 super set checks 409.00 ns/op 425.00 ns/op 0.96
CheckpointStateCache - add get delete 8.7510 us/op 8.5320 us/op 1.03
validate gossip signedAggregateAndProof - struct 4.2669 ms/op 5.0192 ms/op 0.85
validate gossip attestation - struct 2.0281 ms/op 2.3580 ms/op 0.86
pickEth1Vote - no votes 2.2615 ms/op 2.2380 ms/op 1.01
pickEth1Vote - max votes 17.247 ms/op 16.803 ms/op 1.03
pickEth1Vote - Eth1Data hashTreeRoot value x2048 12.044 ms/op 13.094 ms/op 0.92
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 21.919 ms/op 21.230 ms/op 1.03
pickEth1Vote - Eth1Data fastSerialize value x2048 1.2959 ms/op 1.1368 ms/op 1.14
pickEth1Vote - Eth1Data fastSerialize tree x2048 10.832 ms/op 10.608 ms/op 1.02
bytes32 toHexString 1.1100 us/op 968.00 ns/op 1.15
bytes32 Buffer.toString(hex) 617.00 ns/op 662.00 ns/op 0.93
bytes32 Buffer.toString(hex) from Uint8Array 927.00 ns/op 998.00 ns/op 0.93
bytes32 Buffer.toString(hex) + 0x 623.00 ns/op 657.00 ns/op 0.95
Object access 1 prop 0.29400 ns/op 0.36200 ns/op 0.81
Map access 1 prop 0.26300 ns/op 0.30400 ns/op 0.87
Object get x1000 16.821 ns/op 11.325 ns/op 1.49
Map get x1000 1.0130 ns/op 0.94000 ns/op 1.08
Object set x1000 115.05 ns/op 74.463 ns/op 1.55
Map set x1000 73.988 ns/op 44.340 ns/op 1.67
Return object 10000 times 0.37340 ns/op 0.43820 ns/op 0.85
Throw Error 10000 times 7.0325 us/op 6.6285 us/op 1.06
fastMsgIdFn sha256 / 200 bytes 4.3400 us/op 4.9520 us/op 0.88
fastMsgIdFn h32 xxhash / 200 bytes 500.00 ns/op 537.00 ns/op 0.93
fastMsgIdFn h64 xxhash / 200 bytes 684.00 ns/op 729.00 ns/op 0.94
fastMsgIdFn sha256 / 1000 bytes 13.639 us/op 15.623 us/op 0.87
fastMsgIdFn h32 xxhash / 1000 bytes 648.00 ns/op 704.00 ns/op 0.92
fastMsgIdFn h64 xxhash / 1000 bytes 753.00 ns/op 828.00 ns/op 0.91
fastMsgIdFn sha256 / 10000 bytes 117.13 us/op 137.22 us/op 0.85
fastMsgIdFn h32 xxhash / 10000 bytes 2.3600 us/op 2.5970 us/op 0.91
fastMsgIdFn h64 xxhash / 10000 bytes 1.6950 us/op 1.7810 us/op 0.95
enrSubnets - fastDeserialize 64 bits 2.7180 us/op 2.4700 us/op 1.10
enrSubnets - ssz BitVector 64 bits 894.00 ns/op 960.00 ns/op 0.93
enrSubnets - fastDeserialize 4 bits 310.00 ns/op 313.00 ns/op 0.99
enrSubnets - ssz BitVector 4 bits 903.00 ns/op 959.00 ns/op 0.94
prioritizePeers score -10:0 att 32-0.1 sync 2-0 178.85 us/op 155.82 us/op 1.15
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 204.35 us/op 168.07 us/op 1.22
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 312.17 us/op 255.82 us/op 1.22
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 541.73 us/op 442.77 us/op 1.22
prioritizePeers score 0:0 att 64-1 sync 4-1 632.01 us/op 501.98 us/op 1.26
array of 16000 items push then shift 2.8273 us/op 51.667 us/op 0.05
LinkedList of 16000 items push then shift 19.038 ns/op 12.712 ns/op 1.50
array of 16000 items push then pop 221.14 ns/op 191.58 ns/op 1.15
LinkedList of 16000 items push then pop 17.652 ns/op 12.272 ns/op 1.44
array of 24000 items push then shift 3.9685 us/op 77.401 us/op 0.05
LinkedList of 24000 items push then shift 22.785 ns/op 13.260 ns/op 1.72
array of 24000 items push then pop 209.38 ns/op 193.98 ns/op 1.08
LinkedList of 24000 items push then pop 19.897 ns/op 12.268 ns/op 1.62
intersect bitArray bitLen 8 29.975 ns/op 21.726 ns/op 1.38
intersect array and set length 8 173.50 ns/op 127.47 ns/op 1.36
intersect bitArray bitLen 128 108.47 ns/op 71.800 ns/op 1.51
intersect array and set length 128 2.3465 us/op 1.7280 us/op 1.36
Buffer.concat 32 items 5.2000 us/op 5.3140 us/op 0.98
Uint8Array.set 32 items 4.3330 us/op 3.8080 us/op 1.14
pass gossip attestations to forkchoice per slot 6.5887 ms/op 3.7368 ms/op 1.76
computeDeltas 6.5546 ms/op 4.4873 ms/op 1.46
computeProposerBoostScoreFromBalances 2.8444 ms/op 2.5048 ms/op 1.14
altair processAttestation - 250000 vs - 7PWei normalcase 4.5327 ms/op 3.6429 ms/op 1.24
altair processAttestation - 250000 vs - 7PWei worstcase 6.5232 ms/op 6.3679 ms/op 1.02
altair processAttestation - setStatus - 1/6 committees join 213.45 us/op 177.82 us/op 1.20
altair processAttestation - setStatus - 1/3 committees join 397.46 us/op 352.41 us/op 1.13
altair processAttestation - setStatus - 1/2 committees join 555.33 us/op 513.18 us/op 1.08
altair processAttestation - setStatus - 2/3 committees join 722.59 us/op 676.13 us/op 1.07
altair processAttestation - setStatus - 4/5 committees join 1.0005 ms/op 940.34 us/op 1.06
altair processAttestation - setStatus - 100% committees join 1.1806 ms/op 1.1278 ms/op 1.05
altair processBlock - 250000 vs - 7PWei normalcase 27.339 ms/op 24.432 ms/op 1.12
altair processBlock - 250000 vs - 7PWei normalcase hashState 43.724 ms/op 37.236 ms/op 1.17
altair processBlock - 250000 vs - 7PWei worstcase 72.539 ms/op 78.527 ms/op 0.92
altair processBlock - 250000 vs - 7PWei worstcase hashState 97.542 ms/op 104.13 ms/op 0.94
phase0 processBlock - 250000 vs - 7PWei normalcase 3.6323 ms/op 3.4659 ms/op 1.05
phase0 processBlock - 250000 vs - 7PWei worstcase 46.451 ms/op 51.942 ms/op 0.89
altair processEth1Data - 250000 vs - 7PWei normalcase 922.57 us/op 658.43 us/op 1.40
vc - 250000 eb 1 eth1 1 we 0 wn 0 - smpl 15 8.8500 us/op 7.8500 us/op 1.13
vc - 250000 eb 0.95 eth1 0.1 we 0.05 wn 0 - smpl 219 28.027 us/op 27.330 us/op 1.03
vc - 250000 eb 0.95 eth1 0.3 we 0.05 wn 0 - smpl 42 11.890 us/op 11.337 us/op 1.05
vc - 250000 eb 0.95 eth1 0.7 we 0.05 wn 0 - smpl 18 9.1890 us/op 7.8230 us/op 1.17
vc - 250000 eb 0.1 eth1 0.1 we 0 wn 0 - smpl 1020 106.19 us/op 103.95 us/op 1.02
vc - 250000 eb 0.03 eth1 0.03 we 0 wn 0 - smpl 11777 990.86 us/op 959.85 us/op 1.03
vc - 250000 eb 0.01 eth1 0.01 we 0 wn 0 - smpl 16384 1.4246 ms/op 1.2421 ms/op 1.15
vc - 250000 eb 0 eth1 0 we 0 wn 0 - smpl 16384 1.3240 ms/op 1.2242 ms/op 1.08
vc - 250000 eb 0 eth1 0 we 0 wn 0 nocache - smpl 16384 4.6983 ms/op 4.1151 ms/op 1.14
vc - 250000 eb 0 eth1 1 we 0 wn 0 - smpl 16384 2.7350 ms/op 2.3963 ms/op 1.14
vc - 250000 eb 0 eth1 1 we 0 wn 0 nocache - smpl 16384 6.9864 ms/op 6.8986 ms/op 1.01
Tree 40 250000 create 690.82 ms/op 615.77 ms/op 1.12
Tree 40 250000 get(125000) 287.99 ns/op 245.50 ns/op 1.17
Tree 40 250000 set(125000) 2.2402 us/op 2.0437 us/op 1.10
Tree 40 250000 toArray() 32.503 ms/op 28.687 ms/op 1.13
Tree 40 250000 iterate all - toArray() + loop 32.850 ms/op 29.025 ms/op 1.13
Tree 40 250000 iterate all - get(i) 105.94 ms/op 104.78 ms/op 1.01
MutableVector 250000 create 15.787 ms/op 12.958 ms/op 1.22
MutableVector 250000 get(125000) 13.214 ns/op 10.586 ns/op 1.25
MutableVector 250000 set(125000) 641.10 ns/op 544.52 ns/op 1.18
MutableVector 250000 toArray() 6.6819 ms/op 6.0508 ms/op 1.10
MutableVector 250000 iterate all - toArray() + loop 6.8203 ms/op 6.2041 ms/op 1.10
MutableVector 250000 iterate all - get(i) 3.4606 ms/op 2.8157 ms/op 1.23
Array 250000 create 6.4364 ms/op 6.0845 ms/op 1.06
Array 250000 clone - spread 2.8711 ms/op 2.8474 ms/op 1.01
Array 250000 get(125000) 1.2130 ns/op 1.3570 ns/op 0.89
Array 250000 set(125000) 1.2630 ns/op 1.3280 ns/op 0.95
Array 250000 iterate all - loop 169.06 us/op 150.88 us/op 1.12
effectiveBalanceIncrements clone Uint8Array 300000 77.108 us/op 55.518 us/op 1.39
effectiveBalanceIncrements clone MutableVector 300000 858.00 ns/op 937.00 ns/op 0.92
effectiveBalanceIncrements rw all Uint8Array 300000 252.62 us/op 243.84 us/op 1.04
effectiveBalanceIncrements rw all MutableVector 300000 218.50 ms/op 171.75 ms/op 1.27
phase0 afterProcessEpoch - 250000 vs - 7PWei 185.84 ms/op 191.80 ms/op 0.97
phase0 beforeProcessEpoch - 250000 vs - 7PWei 75.471 ms/op 56.103 ms/op 1.35
altair processEpoch - mainnet_e81889 503.91 ms/op 538.43 ms/op 0.94
mainnet_e81889 - altair beforeProcessEpoch 144.32 ms/op 120.65 ms/op 1.20
mainnet_e81889 - altair processJustificationAndFinalization 20.036 us/op 17.211 us/op 1.16
mainnet_e81889 - altair processInactivityUpdates 11.653 ms/op 9.4466 ms/op 1.23
mainnet_e81889 - altair processRewardsAndPenalties 92.420 ms/op 78.601 ms/op 1.18
mainnet_e81889 - altair processRegistryUpdates 2.8160 us/op 2.1670 us/op 1.30
mainnet_e81889 - altair processSlashings 685.00 ns/op 592.00 ns/op 1.16
mainnet_e81889 - altair processEth1DataReset 723.00 ns/op 515.00 ns/op 1.40
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.3207 ms/op 1.9811 ms/op 1.17
mainnet_e81889 - altair processSlashingsReset 5.4220 us/op 4.3000 us/op 1.26
mainnet_e81889 - altair processRandaoMixesReset 5.7180 us/op 4.3450 us/op 1.32
mainnet_e81889 - altair processHistoricalRootsUpdate 842.00 ns/op 664.00 ns/op 1.27
mainnet_e81889 - altair processParticipationFlagUpdates 2.4820 us/op 2.6070 us/op 0.95
mainnet_e81889 - altair processSyncCommitteeUpdates 660.00 ns/op 671.00 ns/op 0.98
mainnet_e81889 - altair afterProcessEpoch 194.96 ms/op 197.58 ms/op 0.99
phase0 processEpoch - mainnet_e58758 535.02 ms/op 483.02 ms/op 1.11
mainnet_e58758 - phase0 beforeProcessEpoch 248.92 ms/op 180.84 ms/op 1.38
mainnet_e58758 - phase0 processJustificationAndFinalization 22.420 us/op 21.319 us/op 1.05
mainnet_e58758 - phase0 processRewardsAndPenalties 142.16 ms/op 70.543 ms/op 2.02
mainnet_e58758 - phase0 processRegistryUpdates 9.4950 us/op 8.9180 us/op 1.06
mainnet_e58758 - phase0 processSlashings 700.00 ns/op 543.00 ns/op 1.29
mainnet_e58758 - phase0 processEth1DataReset 660.00 ns/op 773.00 ns/op 0.85
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.1527 ms/op 1.8673 ms/op 1.15
mainnet_e58758 - phase0 processSlashingsReset 4.5270 us/op 3.8490 us/op 1.18
mainnet_e58758 - phase0 processRandaoMixesReset 7.7280 us/op 4.3110 us/op 1.79
mainnet_e58758 - phase0 processHistoricalRootsUpdate 788.00 ns/op 623.00 ns/op 1.26
mainnet_e58758 - phase0 processParticipationRecordUpdates 5.1120 us/op 4.5430 us/op 1.13
mainnet_e58758 - phase0 afterProcessEpoch 160.40 ms/op 163.32 ms/op 0.98
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.8243 ms/op 2.0084 ms/op 1.41
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 3.3983 ms/op 2.3876 ms/op 1.42
altair processInactivityUpdates - 250000 normalcase 38.613 ms/op 35.031 ms/op 1.10
altair processInactivityUpdates - 250000 worstcase 48.895 ms/op 41.925 ms/op 1.17
phase0 processRegistryUpdates - 250000 normalcase 7.7890 us/op 7.5020 us/op 1.04
phase0 processRegistryUpdates - 250000 badcase_full_deposits 425.01 us/op 403.69 us/op 1.05
phase0 processRegistryUpdates - 250000 worstcase 0.5 231.89 ms/op 180.03 ms/op 1.29
altair processRewardsAndPenalties - 250000 normalcase 124.55 ms/op 106.89 ms/op 1.17
altair processRewardsAndPenalties - 250000 worstcase 89.194 ms/op 97.434 ms/op 0.92
phase0 getAttestationDeltas - 250000 normalcase 12.945 ms/op 12.285 ms/op 1.05
phase0 getAttestationDeltas - 250000 worstcase 12.777 ms/op 12.679 ms/op 1.01
phase0 processSlashings - 250000 worstcase 5.7145 ms/op 5.1409 ms/op 1.11
altair processSyncCommitteeUpdates - 250000 266.60 ms/op 295.08 ms/op 0.90
BeaconState.hashTreeRoot - No change 443.00 ns/op 521.00 ns/op 0.85
BeaconState.hashTreeRoot - 1 full validator 55.920 us/op 71.364 us/op 0.78
BeaconState.hashTreeRoot - 32 full validator 617.09 us/op 703.51 us/op 0.88
BeaconState.hashTreeRoot - 512 full validator 6.0702 ms/op 7.2954 ms/op 0.83
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 79.886 us/op 91.393 us/op 0.87
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.1476 ms/op 1.2775 ms/op 0.90
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 16.004 ms/op 16.807 ms/op 0.95
BeaconState.hashTreeRoot - 1 balances 62.436 us/op 66.780 us/op 0.93
BeaconState.hashTreeRoot - 32 balances 534.25 us/op 666.76 us/op 0.80
BeaconState.hashTreeRoot - 512 balances 5.8546 ms/op 6.6968 ms/op 0.87
BeaconState.hashTreeRoot - 250000 balances 89.046 ms/op 103.10 ms/op 0.86
aggregationBits - 2048 els - zipIndexesInBitList 29.311 us/op 26.750 us/op 1.10
regular array get 100000 times 67.393 us/op 60.560 us/op 1.11
wrappedArray get 100000 times 67.327 us/op 60.522 us/op 1.11
arrayWithProxy get 100000 times 27.591 ms/op 26.667 ms/op 1.03
ssz.Root.equals 1.0740 us/op 1.0220 us/op 1.05
byteArrayEquals 1.0600 us/op 1.0150 us/op 1.04
shuffle list - 16384 els 11.301 ms/op 11.494 ms/op 0.98
shuffle list - 250000 els 166.30 ms/op 168.82 ms/op 0.99
processSlot - 1 slots 12.405 us/op 13.627 us/op 0.91
processSlot - 32 slots 1.7621 ms/op 1.9914 ms/op 0.88
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 341.04 us/op 328.25 us/op 1.04
getCommitteeAssignments - req 1 vs - 250000 vc 5.6192 ms/op 5.4501 ms/op 1.03
getCommitteeAssignments - req 100 vs - 250000 vc 7.5632 ms/op 7.9876 ms/op 0.95
getCommitteeAssignments - req 1000 vs - 250000 vc 8.1330 ms/op 8.5356 ms/op 0.95
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 10.040 ns/op 8.4400 ns/op 1.19
state getBlockRootAtSlot - 250000 vs - 7PWei 1.1975 us/op 1.1703 us/op 1.02
computeProposers - vc 250000 15.816 ms/op 17.825 ms/op 0.89
computeEpochShuffling - vc 250000 172.64 ms/op 172.22 ms/op 1.00
getNextSyncCommittee - vc 250000 265.49 ms/op 296.37 ms/op 0.90

by benchmarkbot/action

@g11tech g11tech enabled auto-merge (squash) January 13, 2023 11:55
@g11tech g11tech force-pushed the g11tech/remove-wei-conversion branch from 7af019b to 90a7392 Compare January 13, 2023 17:15
@g11tech g11tech merged commit 25417c6 into unstable Jan 13, 2023
@g11tech g11tech deleted the g11tech/remove-wei-conversion branch January 13, 2023 19:01
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.

2 participants