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

feat: add hot and archive db repositories for blobSidecars #5522

Merged
merged 4 commits into from
May 24, 2023
Merged

Conversation

g11tech
Copy link
Contributor

@g11tech g11tech commented May 23, 2023

Furthering the integration for

this PR add dbs for blobsidecars which opens the way for integrating network changes (req/resp first and then gossip)
The old dbs related to blobs will be cleaned up post migration is complete

@g11tech g11tech requested a review from a team as a code owner May 23, 2023 07:32
@github-actions
Copy link
Contributor

github-actions bot commented May 23, 2023

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: aad96a2 Previous: 4fd72b2 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 550.51 us/op 598.34 us/op 0.92
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 48.989 us/op 62.014 us/op 0.79
BLS verify - blst-native 1.2407 ms/op 1.2757 ms/op 0.97
BLS verifyMultipleSignatures 3 - blst-native 2.5330 ms/op 2.5949 ms/op 0.98
BLS verifyMultipleSignatures 8 - blst-native 5.3713 ms/op 5.6389 ms/op 0.95
BLS verifyMultipleSignatures 32 - blst-native 19.540 ms/op 20.645 ms/op 0.95
BLS aggregatePubkeys 32 - blst-native 26.310 us/op 27.271 us/op 0.96
BLS aggregatePubkeys 128 - blst-native 100.93 us/op 106.25 us/op 0.95
getAttestationsForBlock 54.865 ms/op 81.446 ms/op 0.67
isKnown best case - 1 super set check 254.00 ns/op 288.00 ns/op 0.88
isKnown normal case - 2 super set checks 253.00 ns/op 282.00 ns/op 0.90
isKnown worse case - 16 super set checks 248.00 ns/op 282.00 ns/op 0.88
CheckpointStateCache - add get delete 5.3190 us/op 7.1060 us/op 0.75
validate gossip signedAggregateAndProof - struct 2.8701 ms/op 3.1292 ms/op 0.92
validate gossip attestation - struct 1.3449 ms/op 1.4996 ms/op 0.90
pickEth1Vote - no votes 1.3758 ms/op 1.5036 ms/op 0.92
pickEth1Vote - max votes 11.843 ms/op 13.896 ms/op 0.85
pickEth1Vote - Eth1Data hashTreeRoot value x2048 9.4234 ms/op 11.741 ms/op 0.80
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 16.183 ms/op 20.349 ms/op 0.80
pickEth1Vote - Eth1Data fastSerialize value x2048 823.85 us/op 818.53 us/op 1.01
pickEth1Vote - Eth1Data fastSerialize tree x2048 6.1970 ms/op 6.3891 ms/op 0.97
bytes32 toHexString 549.00 ns/op 789.00 ns/op 0.70
bytes32 Buffer.toString(hex) 469.00 ns/op 494.00 ns/op 0.95
bytes32 Buffer.toString(hex) from Uint8Array 617.00 ns/op 673.00 ns/op 0.92
bytes32 Buffer.toString(hex) + 0x 423.00 ns/op 458.00 ns/op 0.92
Object access 1 prop 0.22100 ns/op 0.22100 ns/op 1.00
Map access 1 prop 0.17100 ns/op 0.17500 ns/op 0.98
Object get x1000 7.2850 ns/op 7.2080 ns/op 1.01
Map get x1000 0.65200 ns/op 0.73300 ns/op 0.89
Object set x1000 66.565 ns/op 72.920 ns/op 0.91
Map set x1000 52.503 ns/op 59.528 ns/op 0.88
Return object 10000 times 0.25090 ns/op 0.28490 ns/op 0.88
Throw Error 10000 times 4.3805 us/op 5.0209 us/op 0.87
fastMsgIdFn sha256 / 200 bytes 3.5800 us/op 4.0810 us/op 0.88
fastMsgIdFn h32 xxhash / 200 bytes 299.00 ns/op 372.00 ns/op 0.80
fastMsgIdFn h64 xxhash / 200 bytes 443.00 ns/op 545.00 ns/op 0.81
fastMsgIdFn sha256 / 1000 bytes 12.029 us/op 12.867 us/op 0.93
fastMsgIdFn h32 xxhash / 1000 bytes 434.00 ns/op 509.00 ns/op 0.85
fastMsgIdFn h64 xxhash / 1000 bytes 492.00 ns/op 615.00 ns/op 0.80
fastMsgIdFn sha256 / 10000 bytes 106.55 us/op 109.54 us/op 0.97
fastMsgIdFn h32 xxhash / 10000 bytes 2.0010 us/op 2.1080 us/op 0.95
fastMsgIdFn h64 xxhash / 10000 bytes 1.4330 us/op 1.6200 us/op 0.88
enrSubnets - fastDeserialize 64 bits 1.4240 us/op 2.0400 us/op 0.70
enrSubnets - ssz BitVector 64 bits 573.00 ns/op 777.00 ns/op 0.74
enrSubnets - fastDeserialize 4 bits 182.00 ns/op 243.00 ns/op 0.75
enrSubnets - ssz BitVector 4 bits 501.00 ns/op 760.00 ns/op 0.66
prioritizePeers score -10:0 att 32-0.1 sync 2-0 109.68 us/op 133.24 us/op 0.82
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 147.98 us/op 191.67 us/op 0.77
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 208.88 us/op 227.07 us/op 0.92
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 395.82 us/op 376.21 us/op 1.05
prioritizePeers score 0:0 att 64-1 sync 4-1 465.01 us/op 440.32 us/op 1.06
array of 16000 items push then shift 1.7560 us/op 1.7967 us/op 0.98
LinkedList of 16000 items push then shift 9.3550 ns/op 10.932 ns/op 0.86
array of 16000 items push then pop 112.94 ns/op 122.51 ns/op 0.92
LinkedList of 16000 items push then pop 9.0600 ns/op 9.7580 ns/op 0.93
array of 24000 items push then shift 2.4411 us/op 2.6249 us/op 0.93
LinkedList of 24000 items push then shift 9.4710 ns/op 9.6670 ns/op 0.98
array of 24000 items push then pop 90.456 ns/op 94.834 ns/op 0.95
LinkedList of 24000 items push then pop 9.8770 ns/op 11.117 ns/op 0.89
intersect bitArray bitLen 8 14.855 ns/op 15.551 ns/op 0.96
intersect array and set length 8 98.190 ns/op 112.29 ns/op 0.87
intersect bitArray bitLen 128 50.009 ns/op 48.210 ns/op 1.04
intersect array and set length 128 1.3579 us/op 1.3537 us/op 1.00
Buffer.concat 32 items 4.2370 us/op 3.0280 us/op 1.40
Uint8Array.set 32 items 2.7560 us/op 3.4520 us/op 0.80
pass gossip attestations to forkchoice per slot 2.8661 ms/op 2.4500 ms/op 1.17
computeDeltas 3.5025 ms/op 3.1721 ms/op 1.10
computeProposerBoostScoreFromBalances 1.8582 ms/op 1.8723 ms/op 0.99
altair processAttestation - 250000 vs - 7PWei normalcase 2.7086 ms/op 3.6862 ms/op 0.73
altair processAttestation - 250000 vs - 7PWei worstcase 4.2726 ms/op 5.2699 ms/op 0.81
altair processAttestation - setStatus - 1/6 committees join 150.09 us/op 155.42 us/op 0.97
altair processAttestation - setStatus - 1/3 committees join 281.62 us/op 300.45 us/op 0.94
altair processAttestation - setStatus - 1/2 committees join 383.03 us/op 396.27 us/op 0.97
altair processAttestation - setStatus - 2/3 committees join 478.37 us/op 490.36 us/op 0.98
altair processAttestation - setStatus - 4/5 committees join 660.76 us/op 692.63 us/op 0.95
altair processAttestation - setStatus - 100% committees join 775.54 us/op 794.40 us/op 0.98
altair processBlock - 250000 vs - 7PWei normalcase 17.473 ms/op 17.834 ms/op 0.98
altair processBlock - 250000 vs - 7PWei normalcase hashState 25.855 ms/op 29.549 ms/op 0.87
altair processBlock - 250000 vs - 7PWei worstcase 56.410 ms/op 49.033 ms/op 1.15
altair processBlock - 250000 vs - 7PWei worstcase hashState 69.310 ms/op 70.714 ms/op 0.98
phase0 processBlock - 250000 vs - 7PWei normalcase 2.4014 ms/op 2.4684 ms/op 0.97
phase0 processBlock - 250000 vs - 7PWei worstcase 31.164 ms/op 32.972 ms/op 0.95
altair processEth1Data - 250000 vs - 7PWei normalcase 560.55 us/op 557.59 us/op 1.01
vc - 250000 eb 1 eth1 1 we 0 wn 0 - smpl 15 8.9670 us/op 12.344 us/op 0.73
vc - 250000 eb 0.95 eth1 0.1 we 0.05 wn 0 - smpl 219 29.813 us/op 31.919 us/op 0.93
vc - 250000 eb 0.95 eth1 0.3 we 0.05 wn 0 - smpl 42 12.170 us/op 14.370 us/op 0.85
vc - 250000 eb 0.95 eth1 0.7 we 0.05 wn 0 - smpl 18 10.241 us/op 11.382 us/op 0.90
vc - 250000 eb 0.1 eth1 0.1 we 0 wn 0 - smpl 1020 116.18 us/op 123.48 us/op 0.94
vc - 250000 eb 0.03 eth1 0.03 we 0 wn 0 - smpl 11777 676.25 us/op 942.59 us/op 0.72
vc - 250000 eb 0.01 eth1 0.01 we 0 wn 0 - smpl 16384 951.36 us/op 1.0626 ms/op 0.90
vc - 250000 eb 0 eth1 0 we 0 wn 0 - smpl 16384 912.73 us/op 954.85 us/op 0.96
vc - 250000 eb 0 eth1 0 we 0 wn 0 nocache - smpl 16384 2.5869 ms/op 2.8456 ms/op 0.91
vc - 250000 eb 0 eth1 1 we 0 wn 0 - smpl 16384 1.5045 ms/op 1.8685 ms/op 0.81
vc - 250000 eb 0 eth1 1 we 0 wn 0 nocache - smpl 16384 4.1883 ms/op 4.2999 ms/op 0.97
Tree 40 250000 create 355.03 ms/op 396.19 ms/op 0.90
Tree 40 250000 get(125000) 193.42 ns/op 200.88 ns/op 0.96
Tree 40 250000 set(125000) 1.0238 us/op 1.1708 us/op 0.87
Tree 40 250000 toArray() 21.790 ms/op 24.856 ms/op 0.88
Tree 40 250000 iterate all - toArray() + loop 22.074 ms/op 25.916 ms/op 0.85
Tree 40 250000 iterate all - get(i) 75.059 ms/op 83.082 ms/op 0.90
MutableVector 250000 create 11.826 ms/op 11.748 ms/op 1.01
MutableVector 250000 get(125000) 6.4150 ns/op 7.0280 ns/op 0.91
MutableVector 250000 set(125000) 265.16 ns/op 483.53 ns/op 0.55
MutableVector 250000 toArray() 3.3068 ms/op 4.8290 ms/op 0.68
MutableVector 250000 iterate all - toArray() + loop 4.0056 ms/op 4.1595 ms/op 0.96
MutableVector 250000 iterate all - get(i) 1.5201 ms/op 1.6026 ms/op 0.95
Array 250000 create 3.4814 ms/op 3.9751 ms/op 0.88
Array 250000 clone - spread 1.2307 ms/op 1.2714 ms/op 0.97
Array 250000 get(125000) 0.59200 ns/op 0.60400 ns/op 0.98
Array 250000 set(125000) 0.66700 ns/op 0.88700 ns/op 0.75
Array 250000 iterate all - loop 90.802 us/op 131.38 us/op 0.69
effectiveBalanceIncrements clone Uint8Array 300000 38.227 us/op 53.190 us/op 0.72
effectiveBalanceIncrements clone MutableVector 300000 366.00 ns/op 363.00 ns/op 1.01
effectiveBalanceIncrements rw all Uint8Array 300000 170.36 us/op 198.74 us/op 0.86
effectiveBalanceIncrements rw all MutableVector 300000 90.042 ms/op 101.37 ms/op 0.89
phase0 afterProcessEpoch - 250000 vs - 7PWei 117.71 ms/op 118.98 ms/op 0.99
phase0 beforeProcessEpoch - 250000 vs - 7PWei 35.216 ms/op 46.524 ms/op 0.76
altair processEpoch - mainnet_e81889 305.90 ms/op 351.95 ms/op 0.87
mainnet_e81889 - altair beforeProcessEpoch 51.521 ms/op 75.198 ms/op 0.69
mainnet_e81889 - altair processJustificationAndFinalization 21.516 us/op 21.252 us/op 1.01
mainnet_e81889 - altair processInactivityUpdates 5.8262 ms/op 7.2319 ms/op 0.81
mainnet_e81889 - altair processRewardsAndPenalties 66.947 ms/op 71.493 ms/op 0.94
mainnet_e81889 - altair processRegistryUpdates 2.9660 us/op 2.4900 us/op 1.19
mainnet_e81889 - altair processSlashings 623.00 ns/op 1.0480 us/op 0.59
mainnet_e81889 - altair processEth1DataReset 661.00 ns/op 635.00 ns/op 1.04
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.2730 ms/op 1.2917 ms/op 0.99
mainnet_e81889 - altair processSlashingsReset 5.1580 us/op 4.3110 us/op 1.20
mainnet_e81889 - altair processRandaoMixesReset 4.5230 us/op 4.6900 us/op 0.96
mainnet_e81889 - altair processHistoricalRootsUpdate 671.00 ns/op 1.2470 us/op 0.54
mainnet_e81889 - altair processParticipationFlagUpdates 2.4900 us/op 5.6810 us/op 0.44
mainnet_e81889 - altair processSyncCommitteeUpdates 604.00 ns/op 1.3780 us/op 0.44
mainnet_e81889 - altair afterProcessEpoch 128.74 ms/op 133.86 ms/op 0.96
phase0 processEpoch - mainnet_e58758 331.80 ms/op 382.12 ms/op 0.87
mainnet_e58758 - phase0 beforeProcessEpoch 133.74 ms/op 142.47 ms/op 0.94
mainnet_e58758 - phase0 processJustificationAndFinalization 18.599 us/op 20.153 us/op 0.92
mainnet_e58758 - phase0 processRewardsAndPenalties 41.128 ms/op 60.280 ms/op 0.68
mainnet_e58758 - phase0 processRegistryUpdates 9.2290 us/op 10.273 us/op 0.90
mainnet_e58758 - phase0 processSlashings 833.00 ns/op 823.00 ns/op 1.01
mainnet_e58758 - phase0 processEth1DataReset 634.00 ns/op 684.00 ns/op 0.93
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.1317 ms/op 1.0465 ms/op 1.08
mainnet_e58758 - phase0 processSlashingsReset 3.8130 us/op 4.6980 us/op 0.81
mainnet_e58758 - phase0 processRandaoMixesReset 5.4920 us/op 4.6720 us/op 1.18
mainnet_e58758 - phase0 processHistoricalRootsUpdate 745.00 ns/op 914.00 ns/op 0.82
mainnet_e58758 - phase0 processParticipationRecordUpdates 7.4390 us/op 4.6230 us/op 1.61
mainnet_e58758 - phase0 afterProcessEpoch 96.488 ms/op 102.58 ms/op 0.94
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.2598 ms/op 1.2902 ms/op 0.98
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5947 ms/op 1.5514 ms/op 1.03
altair processInactivityUpdates - 250000 normalcase 21.866 ms/op 24.961 ms/op 0.88
altair processInactivityUpdates - 250000 worstcase 21.152 ms/op 25.757 ms/op 0.82
phase0 processRegistryUpdates - 250000 normalcase 7.7350 us/op 9.0950 us/op 0.85
phase0 processRegistryUpdates - 250000 badcase_full_deposits 274.21 us/op 274.05 us/op 1.00
phase0 processRegistryUpdates - 250000 worstcase 0.5 111.17 ms/op 135.54 ms/op 0.82
altair processRewardsAndPenalties - 250000 normalcase 50.660 ms/op 68.010 ms/op 0.74
altair processRewardsAndPenalties - 250000 worstcase 56.072 ms/op 70.015 ms/op 0.80
phase0 getAttestationDeltas - 250000 normalcase 6.8911 ms/op 7.2263 ms/op 0.95
phase0 getAttestationDeltas - 250000 worstcase 6.9078 ms/op 6.8478 ms/op 1.01
phase0 processSlashings - 250000 worstcase 3.4946 ms/op 3.7340 ms/op 0.94
altair processSyncCommitteeUpdates - 250000 184.05 ms/op 178.28 ms/op 1.03
BeaconState.hashTreeRoot - No change 281.00 ns/op 280.00 ns/op 1.00
BeaconState.hashTreeRoot - 1 full validator 58.558 us/op 57.335 us/op 1.02
BeaconState.hashTreeRoot - 32 full validator 564.55 us/op 544.13 us/op 1.04
BeaconState.hashTreeRoot - 512 full validator 5.8899 ms/op 5.2832 ms/op 1.11
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 69.334 us/op 66.935 us/op 1.04
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 982.52 us/op 901.88 us/op 1.09
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 12.621 ms/op 12.686 ms/op 0.99
BeaconState.hashTreeRoot - 1 balances 51.554 us/op 53.893 us/op 0.96
BeaconState.hashTreeRoot - 32 balances 480.32 us/op 468.69 us/op 1.02
BeaconState.hashTreeRoot - 512 balances 4.7335 ms/op 4.5352 ms/op 1.04
BeaconState.hashTreeRoot - 250000 balances 76.206 ms/op 79.662 ms/op 0.96
aggregationBits - 2048 els - zipIndexesInBitList 17.964 us/op 19.093 us/op 0.94
regular array get 100000 times 33.641 us/op 34.106 us/op 0.99
wrappedArray get 100000 times 33.653 us/op 34.744 us/op 0.97
arrayWithProxy get 100000 times 16.268 ms/op 15.998 ms/op 1.02
ssz.Root.equals 590.00 ns/op 580.00 ns/op 1.02
byteArrayEquals 581.00 ns/op 575.00 ns/op 1.01
shuffle list - 16384 els 7.1705 ms/op 7.0875 ms/op 1.01
shuffle list - 250000 els 104.66 ms/op 103.42 ms/op 1.01
processSlot - 1 slots 9.6450 us/op 10.166 us/op 0.95
processSlot - 32 slots 1.4179 ms/op 1.4170 ms/op 1.00
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 32.314 ms/op 35.660 ms/op 0.91
getCommitteeAssignments - req 1 vs - 250000 vc 3.0381 ms/op 2.9831 ms/op 1.02
getCommitteeAssignments - req 100 vs - 250000 vc 4.2309 ms/op 4.2190 ms/op 1.00
getCommitteeAssignments - req 1000 vs - 250000 vc 4.5763 ms/op 4.5429 ms/op 1.01
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.4100 ns/op 5.0100 ns/op 1.08
state getBlockRootAtSlot - 250000 vs - 7PWei 639.79 ns/op 675.54 ns/op 0.95
computeProposers - vc 250000 11.544 ms/op 11.068 ms/op 1.04
computeEpochShuffling - vc 250000 107.01 ms/op 104.61 ms/op 1.02
getNextSyncCommittee - vc 250000 183.43 ms/op 181.89 ms/op 1.01
computeSigningRoot for AttestationData 13.552 us/op 14.533 us/op 0.93
hash AttestationData serialized data then Buffer.toString(base64) 2.4620 us/op 2.5943 us/op 0.95
toHexString serialized data 1.1113 us/op 1.1352 us/op 0.98
Buffer.toString(base64) 310.52 ns/op 347.19 ns/op 0.89

by benchmarkbot/action

}

if (!blobSidecars) {
throw Error("Not found in db");
Copy link
Contributor

Choose a reason for hiding this comment

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

we may want to add block slot/root to error message to help debug later

/**
* blobSidecarsWrapper by slot
*
* Used to store unfinalized BlobsSidecar
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Used to store unfinalized BlobsSidecar
* Used to store finalized BlobsSidecar

Copy link
Contributor

@twoeths twoeths left a comment

Choose a reason for hiding this comment

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

@g11tech I dropped 2 minor points, could be fixed in upcoming PRs

@g11tech
Copy link
Contributor Author

g11tech commented May 24, 2023

@g11tech I dropped 2 minor points, could be fixed in upcoming PRs

sounds good, thanks will update

@g11tech g11tech merged commit 1f1ef67 into unstable May 24, 2023
@g11tech g11tech deleted the ftb/dbs branch May 24, 2023 07:57
@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.

4 participants