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

refactor!: drop MetadataController dependency on BeaconChain #5443

Merged
merged 1 commit into from May 1, 2023

Conversation

dapplion
Copy link
Contributor

@dapplion dapplion commented May 1, 2023

Motivation

Description

Drop MetadataController dependency on BeaconChain

@dapplion dapplion requested a review from a team as a code owner May 1, 2023 09:44
@github-actions
Copy link
Contributor

github-actions bot commented May 1, 2023

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: f89ad25 Previous: 229b77b Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 765.13 us/op 769.40 us/op 0.99
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 46.259 us/op 45.551 us/op 1.02
BLS verify - blst-native 1.2013 ms/op 1.2207 ms/op 0.98
BLS verifyMultipleSignatures 3 - blst-native 2.4433 ms/op 2.4790 ms/op 0.99
BLS verifyMultipleSignatures 8 - blst-native 5.2541 ms/op 5.3246 ms/op 0.99
BLS verifyMultipleSignatures 32 - blst-native 19.128 ms/op 19.248 ms/op 0.99
BLS aggregatePubkeys 32 - blst-native 25.486 us/op 25.835 us/op 0.99
BLS aggregatePubkeys 128 - blst-native 99.533 us/op 100.57 us/op 0.99
getAttestationsForBlock 51.052 ms/op 51.096 ms/op 1.00
isKnown best case - 1 super set check 249.00 ns/op 250.00 ns/op 1.00
isKnown normal case - 2 super set checks 240.00 ns/op 245.00 ns/op 0.98
isKnown worse case - 16 super set checks 240.00 ns/op 248.00 ns/op 0.97
CheckpointStateCache - add get delete 4.9150 us/op 4.8980 us/op 1.00
validate gossip signedAggregateAndProof - struct 2.7566 ms/op 2.7086 ms/op 1.02
validate gossip attestation - struct 1.3150 ms/op 1.3249 ms/op 0.99
pickEth1Vote - no votes 1.2421 ms/op 1.2031 ms/op 1.03
pickEth1Vote - max votes 9.2869 ms/op 9.5468 ms/op 0.97
pickEth1Vote - Eth1Data hashTreeRoot value x2048 8.4210 ms/op 8.5792 ms/op 0.98
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 14.651 ms/op 14.324 ms/op 1.02
pickEth1Vote - Eth1Data fastSerialize value x2048 672.81 us/op 639.75 us/op 1.05
pickEth1Vote - Eth1Data fastSerialize tree x2048 5.8451 ms/op 7.0980 ms/op 0.82
bytes32 toHexString 472.00 ns/op 509.00 ns/op 0.93
bytes32 Buffer.toString(hex) 333.00 ns/op 349.00 ns/op 0.95
bytes32 Buffer.toString(hex) from Uint8Array 546.00 ns/op 558.00 ns/op 0.98
bytes32 Buffer.toString(hex) + 0x 330.00 ns/op 349.00 ns/op 0.95
Object access 1 prop 0.14800 ns/op 0.15900 ns/op 0.93
Map access 1 prop 0.14400 ns/op 0.15900 ns/op 0.91
Object get x1000 6.4500 ns/op 6.9470 ns/op 0.93
Map get x1000 0.58600 ns/op 0.54800 ns/op 1.07
Object set x1000 49.729 ns/op 51.673 ns/op 0.96
Map set x1000 43.491 ns/op 43.570 ns/op 1.00
Return object 10000 times 0.23420 ns/op 0.23560 ns/op 0.99
Throw Error 10000 times 4.1311 us/op 4.1641 us/op 0.99
fastMsgIdFn sha256 / 200 bytes 3.4240 us/op 3.4550 us/op 0.99
fastMsgIdFn h32 xxhash / 200 bytes 270.00 ns/op 281.00 ns/op 0.96
fastMsgIdFn h64 xxhash / 200 bytes 382.00 ns/op 391.00 ns/op 0.98
fastMsgIdFn sha256 / 1000 bytes 11.653 us/op 11.679 us/op 1.00
fastMsgIdFn h32 xxhash / 1000 bytes 425.00 ns/op 405.00 ns/op 1.05
fastMsgIdFn h64 xxhash / 1000 bytes 469.00 ns/op 463.00 ns/op 1.01
fastMsgIdFn sha256 / 10000 bytes 102.90 us/op 104.25 us/op 0.99
fastMsgIdFn h32 xxhash / 10000 bytes 1.9030 us/op 1.8850 us/op 1.01
fastMsgIdFn h64 xxhash / 10000 bytes 1.3560 us/op 1.3450 us/op 1.01
enrSubnets - fastDeserialize 64 bits 1.3490 us/op 1.2820 us/op 1.05
enrSubnets - ssz BitVector 64 bits 507.00 ns/op 491.00 ns/op 1.03
enrSubnets - fastDeserialize 4 bits 168.00 ns/op 173.00 ns/op 0.97
enrSubnets - ssz BitVector 4 bits 491.00 ns/op 488.00 ns/op 1.01
prioritizePeers score -10:0 att 32-0.1 sync 2-0 102.30 us/op 106.74 us/op 0.96
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 129.25 us/op 126.15 us/op 1.02
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 168.07 us/op 166.14 us/op 1.01
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 296.56 us/op 292.66 us/op 1.01
prioritizePeers score 0:0 att 64-1 sync 4-1 395.65 us/op 350.27 us/op 1.13
array of 16000 items push then shift 1.6393 us/op 1.5725 us/op 1.04
LinkedList of 16000 items push then shift 8.7940 ns/op 8.4430 ns/op 1.04
array of 16000 items push then pop 73.871 ns/op 75.077 ns/op 0.98
LinkedList of 16000 items push then pop 8.5260 ns/op 8.2020 ns/op 1.04
array of 24000 items push then shift 2.3324 us/op 2.2680 us/op 1.03
LinkedList of 24000 items push then shift 8.8240 ns/op 8.5870 ns/op 1.03
array of 24000 items push then pop 73.559 ns/op 77.325 ns/op 0.95
LinkedList of 24000 items push then pop 8.4690 ns/op 8.3450 ns/op 1.01
intersect bitArray bitLen 8 16.274 ns/op 12.892 ns/op 1.26
intersect array and set length 8 78.185 ns/op 75.852 ns/op 1.03
intersect bitArray bitLen 128 45.930 ns/op 43.136 ns/op 1.06
intersect array and set length 128 1.0504 us/op 1.0242 us/op 1.03
Buffer.concat 32 items 2.8220 us/op 2.8510 us/op 0.99
Uint8Array.set 32 items 2.3480 us/op 2.8080 us/op 0.84
pass gossip attestations to forkchoice per slot 2.6930 ms/op 2.6862 ms/op 1.00
computeDeltas 3.0751 ms/op 2.8248 ms/op 1.09
computeProposerBoostScoreFromBalances 1.7697 ms/op 1.7692 ms/op 1.00
altair processAttestation - 250000 vs - 7PWei normalcase 2.3808 ms/op 2.1044 ms/op 1.13
altair processAttestation - 250000 vs - 7PWei worstcase 4.1047 ms/op 3.2469 ms/op 1.26
altair processAttestation - setStatus - 1/6 committees join 140.87 us/op 146.93 us/op 0.96
altair processAttestation - setStatus - 1/3 committees join 279.39 us/op 279.68 us/op 1.00
altair processAttestation - setStatus - 1/2 committees join 372.22 us/op 351.24 us/op 1.06
altair processAttestation - setStatus - 2/3 committees join 469.54 us/op 457.79 us/op 1.03
altair processAttestation - setStatus - 4/5 committees join 655.81 us/op 657.09 us/op 1.00
altair processAttestation - setStatus - 100% committees join 791.61 us/op 725.67 us/op 1.09
altair processBlock - 250000 vs - 7PWei normalcase 16.820 ms/op 17.272 ms/op 0.97
altair processBlock - 250000 vs - 7PWei normalcase hashState 25.103 ms/op 23.261 ms/op 1.08
altair processBlock - 250000 vs - 7PWei worstcase 47.409 ms/op 51.081 ms/op 0.93
altair processBlock - 250000 vs - 7PWei worstcase hashState 69.489 ms/op 64.853 ms/op 1.07
phase0 processBlock - 250000 vs - 7PWei normalcase 2.3268 ms/op 1.9182 ms/op 1.21
phase0 processBlock - 250000 vs - 7PWei worstcase 29.792 ms/op 28.036 ms/op 1.06
altair processEth1Data - 250000 vs - 7PWei normalcase 461.60 us/op 482.26 us/op 0.96
vc - 250000 eb 1 eth1 1 we 0 wn 0 - smpl 15 8.2590 us/op 6.9750 us/op 1.18
vc - 250000 eb 0.95 eth1 0.1 we 0.05 wn 0 - smpl 219 22.928 us/op 20.225 us/op 1.13
vc - 250000 eb 0.95 eth1 0.3 we 0.05 wn 0 - smpl 42 8.4180 us/op 8.4130 us/op 1.00
vc - 250000 eb 0.95 eth1 0.7 we 0.05 wn 0 - smpl 18 6.1360 us/op 6.5940 us/op 0.93
vc - 250000 eb 0.1 eth1 0.1 we 0 wn 0 - smpl 1020 78.237 us/op 74.886 us/op 1.04
vc - 250000 eb 0.03 eth1 0.03 we 0 wn 0 - smpl 11777 659.19 us/op 623.70 us/op 1.06
vc - 250000 eb 0.01 eth1 0.01 we 0 wn 0 - smpl 16384 909.90 us/op 900.82 us/op 1.01
vc - 250000 eb 0 eth1 0 we 0 wn 0 - smpl 16384 899.47 us/op 835.20 us/op 1.08
vc - 250000 eb 0 eth1 0 we 0 wn 0 nocache - smpl 16384 2.3523 ms/op 2.2056 ms/op 1.07
vc - 250000 eb 0 eth1 1 we 0 wn 0 - smpl 16384 1.5103 ms/op 1.5036 ms/op 1.00
vc - 250000 eb 0 eth1 1 we 0 wn 0 nocache - smpl 16384 3.8751 ms/op 3.5767 ms/op 1.08
Tree 40 250000 create 305.03 ms/op 312.68 ms/op 0.98
Tree 40 250000 get(125000) 186.28 ns/op 180.92 ns/op 1.03
Tree 40 250000 set(125000) 934.63 ns/op 905.23 ns/op 1.03
Tree 40 250000 toArray() 17.590 ms/op 16.668 ms/op 1.06
Tree 40 250000 iterate all - toArray() + loop 18.264 ms/op 17.972 ms/op 1.02
Tree 40 250000 iterate all - get(i) 69.589 ms/op 66.058 ms/op 1.05
MutableVector 250000 create 10.867 ms/op 9.9307 ms/op 1.09
MutableVector 250000 get(125000) 6.3770 ns/op 6.6790 ns/op 0.95
MutableVector 250000 set(125000) 265.82 ns/op 245.87 ns/op 1.08
MutableVector 250000 toArray() 3.4402 ms/op 2.7492 ms/op 1.25
MutableVector 250000 iterate all - toArray() + loop 3.2926 ms/op 2.7876 ms/op 1.18
MutableVector 250000 iterate all - get(i) 1.5015 ms/op 1.5071 ms/op 1.00
Array 250000 create 2.6165 ms/op 2.4810 ms/op 1.05
Array 250000 clone - spread 1.2070 ms/op 1.1606 ms/op 1.04
Array 250000 get(125000) 0.61600 ns/op 0.57200 ns/op 1.08
Array 250000 set(125000) 0.70500 ns/op 0.64700 ns/op 1.09
Array 250000 iterate all - loop 84.517 us/op 82.618 us/op 1.02
effectiveBalanceIncrements clone Uint8Array 300000 41.460 us/op 25.300 us/op 1.64
effectiveBalanceIncrements clone MutableVector 300000 397.00 ns/op 364.00 ns/op 1.09
effectiveBalanceIncrements rw all Uint8Array 300000 168.50 us/op 168.53 us/op 1.00
effectiveBalanceIncrements rw all MutableVector 300000 93.452 ms/op 80.976 ms/op 1.15
phase0 afterProcessEpoch - 250000 vs - 7PWei 112.68 ms/op 111.08 ms/op 1.01
phase0 beforeProcessEpoch - 250000 vs - 7PWei 37.294 ms/op 37.764 ms/op 0.99
altair processEpoch - mainnet_e81889 340.37 ms/op 297.27 ms/op 1.14
mainnet_e81889 - altair beforeProcessEpoch 70.708 ms/op 65.775 ms/op 1.07
mainnet_e81889 - altair processJustificationAndFinalization 18.393 us/op 16.224 us/op 1.13
mainnet_e81889 - altair processInactivityUpdates 6.1373 ms/op 5.4026 ms/op 1.14
mainnet_e81889 - altair processRewardsAndPenalties 53.907 ms/op 51.587 ms/op 1.04
mainnet_e81889 - altair processRegistryUpdates 2.4200 us/op 2.8760 us/op 0.84
mainnet_e81889 - altair processSlashings 455.00 ns/op 613.00 ns/op 0.74
mainnet_e81889 - altair processEth1DataReset 444.00 ns/op 646.00 ns/op 0.69
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.3720 ms/op 1.1770 ms/op 1.17
mainnet_e81889 - altair processSlashingsReset 5.0290 us/op 4.8490 us/op 1.04
mainnet_e81889 - altair processRandaoMixesReset 4.4060 us/op 4.4960 us/op 0.98
mainnet_e81889 - altair processHistoricalRootsUpdate 594.00 ns/op 630.00 ns/op 0.94
mainnet_e81889 - altair processParticipationFlagUpdates 2.3780 us/op 2.3550 us/op 1.01
mainnet_e81889 - altair processSyncCommitteeUpdates 766.00 ns/op 608.00 ns/op 1.26
mainnet_e81889 - altair afterProcessEpoch 124.76 ms/op 116.88 ms/op 1.07
phase0 processEpoch - mainnet_e58758 340.26 ms/op 318.34 ms/op 1.07
mainnet_e58758 - phase0 beforeProcessEpoch 119.25 ms/op 124.45 ms/op 0.96
mainnet_e58758 - phase0 processJustificationAndFinalization 17.236 us/op 15.177 us/op 1.14
mainnet_e58758 - phase0 processRewardsAndPenalties 53.882 ms/op 55.598 ms/op 0.97
mainnet_e58758 - phase0 processRegistryUpdates 7.9910 us/op 7.6870 us/op 1.04
mainnet_e58758 - phase0 processSlashings 450.00 ns/op 521.00 ns/op 0.86
mainnet_e58758 - phase0 processEth1DataReset 440.00 ns/op 554.00 ns/op 0.79
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.1632 ms/op 940.52 us/op 1.24
mainnet_e58758 - phase0 processSlashingsReset 3.3820 us/op 2.8900 us/op 1.17
mainnet_e58758 - phase0 processRandaoMixesReset 4.5520 us/op 4.5690 us/op 1.00
mainnet_e58758 - phase0 processHistoricalRootsUpdate 544.00 ns/op 661.00 ns/op 0.82
mainnet_e58758 - phase0 processParticipationRecordUpdates 3.8710 us/op 3.8910 us/op 0.99
mainnet_e58758 - phase0 afterProcessEpoch 96.667 ms/op 95.792 ms/op 1.01
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.2485 ms/op 1.1992 ms/op 1.04
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5657 ms/op 1.3597 ms/op 1.15
altair processInactivityUpdates - 250000 normalcase 20.895 ms/op 19.921 ms/op 1.05
altair processInactivityUpdates - 250000 worstcase 24.073 ms/op 21.324 ms/op 1.13
phase0 processRegistryUpdates - 250000 normalcase 7.3890 us/op 6.1920 us/op 1.19
phase0 processRegistryUpdates - 250000 badcase_full_deposits 270.82 us/op 237.34 us/op 1.14
phase0 processRegistryUpdates - 250000 worstcase 0.5 121.94 ms/op 122.92 ms/op 0.99
altair processRewardsAndPenalties - 250000 normalcase 45.204 ms/op 56.239 ms/op 0.80
altair processRewardsAndPenalties - 250000 worstcase 55.121 ms/op 58.985 ms/op 0.93
phase0 getAttestationDeltas - 250000 normalcase 6.7762 ms/op 6.2636 ms/op 1.08
phase0 getAttestationDeltas - 250000 worstcase 6.8142 ms/op 6.3505 ms/op 1.07
phase0 processSlashings - 250000 worstcase 3.4580 ms/op 3.3943 ms/op 1.02
altair processSyncCommitteeUpdates - 250000 175.87 ms/op 165.68 ms/op 1.06
BeaconState.hashTreeRoot - No change 254.00 ns/op 255.00 ns/op 1.00
BeaconState.hashTreeRoot - 1 full validator 50.427 us/op 50.579 us/op 1.00
BeaconState.hashTreeRoot - 32 full validator 479.41 us/op 488.50 us/op 0.98
BeaconState.hashTreeRoot - 512 full validator 4.9616 ms/op 4.7825 ms/op 1.04
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 67.663 us/op 61.797 us/op 1.09
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 877.10 us/op 902.99 us/op 0.97
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 10.832 ms/op 10.950 ms/op 0.99
BeaconState.hashTreeRoot - 1 balances 47.054 us/op 46.214 us/op 1.02
BeaconState.hashTreeRoot - 32 balances 447.07 us/op 443.60 us/op 1.01
BeaconState.hashTreeRoot - 512 balances 4.2575 ms/op 4.3073 ms/op 0.99
BeaconState.hashTreeRoot - 250000 balances 75.072 ms/op 71.653 ms/op 1.05
aggregationBits - 2048 els - zipIndexesInBitList 17.987 us/op 16.189 us/op 1.11
regular array get 100000 times 32.718 us/op 31.941 us/op 1.02
wrappedArray get 100000 times 32.656 us/op 31.952 us/op 1.02
arrayWithProxy get 100000 times 15.824 ms/op 15.585 ms/op 1.02
ssz.Root.equals 537.00 ns/op 531.00 ns/op 1.01
byteArrayEquals 539.00 ns/op 520.00 ns/op 1.04
shuffle list - 16384 els 7.0644 ms/op 6.6479 ms/op 1.06
shuffle list - 250000 els 99.786 ms/op 97.768 ms/op 1.02
processSlot - 1 slots 8.7940 us/op 9.1530 us/op 0.96
processSlot - 32 slots 1.3132 ms/op 1.2969 ms/op 1.01
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 33.474 ms/op 33.627 ms/op 1.00
getCommitteeAssignments - req 1 vs - 250000 vc 2.9055 ms/op 2.7741 ms/op 1.05
getCommitteeAssignments - req 100 vs - 250000 vc 4.0280 ms/op 3.9442 ms/op 1.02
getCommitteeAssignments - req 1000 vs - 250000 vc 4.3921 ms/op 4.3916 ms/op 1.00
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.3200 ns/op 4.4100 ns/op 0.98
state getBlockRootAtSlot - 250000 vs - 7PWei 872.01 ns/op 906.52 ns/op 0.96
computeProposers - vc 250000 10.676 ms/op 10.733 ms/op 0.99
computeEpochShuffling - vc 250000 104.65 ms/op 103.23 ms/op 1.01
getNextSyncCommittee - vc 250000 183.69 ms/op 177.33 ms/op 1.04
computeSigningRoot for AttestationData 13.379 us/op 13.819 us/op 0.97
hash AttestationData serialized data then Buffer.toString(base64) 2.5232 us/op 2.4484 us/op 1.03
toHexString serialized data 1.1335 us/op 1.1828 us/op 0.96
Buffer.toString(base64) 335.13 ns/op 325.61 ns/op 1.03

by benchmarkbot/action

@dapplion dapplion changed the title refactor!: Drop MetadataController dependency on BeaconChain refactor!: drop MetadataController dependency on BeaconChain May 1, 2023
@wemeetagain wemeetagain merged commit 50e9ca5 into unstable May 1, 2023
11 of 12 checks passed
@wemeetagain wemeetagain deleted the dapplion/metadata-controller branch May 1, 2023 19:08
@wemeetagain
Copy link
Member

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

None yet

2 participants