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

fix(validator): lock keystores when loading from cache file #5474

Merged
merged 2 commits into from May 14, 2023

Conversation

nflaig
Copy link
Member

@nflaig nflaig commented May 9, 2023

Motivation

Closes #5374

Description

  • Lock keystores when loading from cache file (this will also check if lockfiles already exist)
  • Update tests to run with and without existing keystore cache

@nflaig nflaig requested a review from a team as a code owner May 9, 2023 13:27
@github-actions
Copy link
Contributor

github-actions bot commented May 9, 2023

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 3a44862 Previous: ae3fda6 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 631.76 us/op 910.44 us/op 0.69
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 77.482 us/op 58.273 us/op 1.33
BLS verify - blst-native 1.2918 ms/op 1.4803 ms/op 0.87
BLS verifyMultipleSignatures 3 - blst-native 2.6310 ms/op 2.9992 ms/op 0.88
BLS verifyMultipleSignatures 8 - blst-native 5.6865 ms/op 6.3097 ms/op 0.90
BLS verifyMultipleSignatures 32 - blst-native 22.012 ms/op 23.132 ms/op 0.95
BLS aggregatePubkeys 32 - blst-native 27.396 us/op 31.519 us/op 0.87
BLS aggregatePubkeys 128 - blst-native 108.07 us/op 123.56 us/op 0.87
getAttestationsForBlock 69.319 ms/op 71.060 ms/op 0.98
isKnown best case - 1 super set check 265.00 ns/op 308.00 ns/op 0.86
isKnown normal case - 2 super set checks 251.00 ns/op 309.00 ns/op 0.81
isKnown worse case - 16 super set checks 255.00 ns/op 311.00 ns/op 0.82
CheckpointStateCache - add get delete 5.8690 us/op 6.5720 us/op 0.89
validate gossip signedAggregateAndProof - struct 2.8382 ms/op 3.4604 ms/op 0.82
validate gossip attestation - struct 1.3574 ms/op 1.6546 ms/op 0.82
pickEth1Vote - no votes 1.3762 ms/op 1.6203 ms/op 0.85
pickEth1Vote - max votes 11.949 ms/op 12.016 ms/op 0.99
pickEth1Vote - Eth1Data hashTreeRoot value x2048 10.027 ms/op 11.135 ms/op 0.90
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 17.375 ms/op 17.261 ms/op 1.01
pickEth1Vote - Eth1Data fastSerialize value x2048 769.88 us/op 897.02 us/op 0.86
pickEth1Vote - Eth1Data fastSerialize tree x2048 7.7514 ms/op 6.0434 ms/op 1.28
bytes32 toHexString 727.00 ns/op 750.00 ns/op 0.97
bytes32 Buffer.toString(hex) 434.00 ns/op 499.00 ns/op 0.87
bytes32 Buffer.toString(hex) from Uint8Array 647.00 ns/op 733.00 ns/op 0.88
bytes32 Buffer.toString(hex) + 0x 438.00 ns/op 476.00 ns/op 0.92
Object access 1 prop 0.20900 ns/op 0.23400 ns/op 0.89
Map access 1 prop 0.17300 ns/op 0.19200 ns/op 0.90
Object get x1000 6.9120 ns/op 9.6600 ns/op 0.72
Map get x1000 0.65800 ns/op 0.67100 ns/op 0.98
Object set x1000 56.153 ns/op 73.455 ns/op 0.76
Map set x1000 53.021 ns/op 62.081 ns/op 0.85
Return object 10000 times 0.25920 ns/op 0.30140 ns/op 0.86
Throw Error 10000 times 4.5143 us/op 5.3549 us/op 0.84
fastMsgIdFn sha256 / 200 bytes 3.6840 us/op 4.4110 us/op 0.84
fastMsgIdFn h32 xxhash / 200 bytes 341.00 ns/op 375.00 ns/op 0.91
fastMsgIdFn h64 xxhash / 200 bytes 498.00 ns/op 556.00 ns/op 0.90
fastMsgIdFn sha256 / 1000 bytes 12.197 us/op 14.985 us/op 0.81
fastMsgIdFn h32 xxhash / 1000 bytes 477.00 ns/op 533.00 ns/op 0.89
fastMsgIdFn h64 xxhash / 1000 bytes 576.00 ns/op 669.00 ns/op 0.86
fastMsgIdFn sha256 / 10000 bytes 108.07 us/op 129.84 us/op 0.83
fastMsgIdFn h32 xxhash / 10000 bytes 2.0760 us/op 2.4620 us/op 0.84
fastMsgIdFn h64 xxhash / 10000 bytes 1.4720 us/op 1.7640 us/op 0.83
enrSubnets - fastDeserialize 64 bits 1.8580 us/op 1.9640 us/op 0.95
enrSubnets - ssz BitVector 64 bits 649.00 ns/op 703.00 ns/op 0.92
enrSubnets - fastDeserialize 4 bits 226.00 ns/op 231.00 ns/op 0.98
enrSubnets - ssz BitVector 4 bits 688.00 ns/op 709.00 ns/op 0.97
prioritizePeers score -10:0 att 32-0.1 sync 2-0 131.10 us/op 149.13 us/op 0.88
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 182.68 us/op 182.65 us/op 1.00
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 220.95 us/op 218.53 us/op 1.01
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 418.36 us/op 427.55 us/op 0.98
prioritizePeers score 0:0 att 64-1 sync 4-1 476.44 us/op 516.55 us/op 0.92
array of 16000 items push then shift 1.8406 us/op 2.0831 us/op 0.88
LinkedList of 16000 items push then shift 9.9180 ns/op 11.580 ns/op 0.86
array of 16000 items push then pop 124.26 ns/op 118.86 ns/op 1.05
LinkedList of 16000 items push then pop 9.9060 ns/op 10.749 ns/op 0.92
array of 24000 items push then shift 2.5333 us/op 2.9338 us/op 0.86
LinkedList of 24000 items push then shift 10.739 ns/op 11.503 ns/op 0.93
array of 24000 items push then pop 104.07 ns/op 101.47 ns/op 1.03
LinkedList of 24000 items push then pop 10.112 ns/op 11.227 ns/op 0.90
intersect bitArray bitLen 8 14.420 ns/op 17.914 ns/op 0.80
intersect array and set length 8 113.48 ns/op 116.16 ns/op 0.98
intersect bitArray bitLen 128 48.207 ns/op 57.645 ns/op 0.84
intersect array and set length 128 1.5124 us/op 1.5749 us/op 0.96
Buffer.concat 32 items 3.3850 us/op 3.8010 us/op 0.89
Uint8Array.set 32 items 2.7880 us/op 3.3260 us/op 0.84
pass gossip attestations to forkchoice per slot 4.0129 ms/op 4.5011 ms/op 0.89
computeDeltas 4.4653 ms/op 3.7422 ms/op 1.19
computeProposerBoostScoreFromBalances 2.2534 ms/op 2.1442 ms/op 1.05
altair processAttestation - 250000 vs - 7PWei normalcase 4.0822 ms/op 3.6835 ms/op 1.11
altair processAttestation - 250000 vs - 7PWei worstcase 6.2754 ms/op 5.5239 ms/op 1.14
altair processAttestation - setStatus - 1/6 committees join 184.02 us/op 196.15 us/op 0.94
altair processAttestation - setStatus - 1/3 committees join 370.26 us/op 385.14 us/op 0.96
altair processAttestation - setStatus - 1/2 committees join 464.39 us/op 473.83 us/op 0.98
altair processAttestation - setStatus - 2/3 committees join 582.80 us/op 564.30 us/op 1.03
altair processAttestation - setStatus - 4/5 committees join 833.97 us/op 854.93 us/op 0.98
altair processAttestation - setStatus - 100% committees join 1.5579 ms/op 970.31 us/op 1.61
altair processBlock - 250000 vs - 7PWei normalcase 26.512 ms/op 20.059 ms/op 1.32
altair processBlock - 250000 vs - 7PWei normalcase hashState 37.575 ms/op 36.580 ms/op 1.03
altair processBlock - 250000 vs - 7PWei worstcase 72.535 ms/op 71.446 ms/op 1.02
altair processBlock - 250000 vs - 7PWei worstcase hashState 110.41 ms/op 88.829 ms/op 1.24
phase0 processBlock - 250000 vs - 7PWei normalcase 3.5010 ms/op 2.9190 ms/op 1.20
phase0 processBlock - 250000 vs - 7PWei worstcase 37.054 ms/op 42.589 ms/op 0.87
altair processEth1Data - 250000 vs - 7PWei normalcase 659.17 us/op 772.37 us/op 0.85
vc - 250000 eb 1 eth1 1 we 0 wn 0 - smpl 15 14.018 us/op 7.3370 us/op 1.91
vc - 250000 eb 0.95 eth1 0.1 we 0.05 wn 0 - smpl 219 42.121 us/op 22.358 us/op 1.88
vc - 250000 eb 0.95 eth1 0.3 we 0.05 wn 0 - smpl 42 17.695 us/op 9.7650 us/op 1.81
vc - 250000 eb 0.95 eth1 0.7 we 0.05 wn 0 - smpl 18 15.241 us/op 6.6850 us/op 2.28
vc - 250000 eb 0.1 eth1 0.1 we 0 wn 0 - smpl 1020 113.53 us/op 80.427 us/op 1.41
vc - 250000 eb 0.03 eth1 0.03 we 0 wn 0 - smpl 11777 1.0306 ms/op 905.23 us/op 1.14
vc - 250000 eb 0.01 eth1 0.01 we 0 wn 0 - smpl 16384 934.82 us/op 1.0430 ms/op 0.90
vc - 250000 eb 0 eth1 0 we 0 wn 0 - smpl 16384 919.63 us/op 1.0142 ms/op 0.91
vc - 250000 eb 0 eth1 0 we 0 wn 0 nocache - smpl 16384 2.4838 ms/op 3.6817 ms/op 0.67
vc - 250000 eb 0 eth1 1 we 0 wn 0 - smpl 16384 1.7841 ms/op 2.5152 ms/op 0.71
vc - 250000 eb 0 eth1 1 we 0 wn 0 nocache - smpl 16384 6.2366 ms/op 7.4058 ms/op 0.84
Tree 40 250000 create 780.23 ms/op 412.32 ms/op 1.89
Tree 40 250000 get(125000) 323.73 ns/op 237.88 ns/op 1.36
Tree 40 250000 set(125000) 2.5780 us/op 1.1489 us/op 2.24
Tree 40 250000 toArray() 46.440 ms/op 24.104 ms/op 1.93
Tree 40 250000 iterate all - toArray() + loop 43.955 ms/op 22.976 ms/op 1.91
Tree 40 250000 iterate all - get(i) 137.81 ms/op 87.166 ms/op 1.58
MutableVector 250000 create 15.121 ms/op 13.291 ms/op 1.14
MutableVector 250000 get(125000) 7.8130 ns/op 8.1820 ns/op 0.95
MutableVector 250000 set(125000) 652.57 ns/op 338.98 ns/op 1.93
MutableVector 250000 toArray() 4.7669 ms/op 3.7486 ms/op 1.27
MutableVector 250000 iterate all - toArray() + loop 4.7353 ms/op 4.0314 ms/op 1.17
MutableVector 250000 iterate all - get(i) 1.8547 ms/op 1.9208 ms/op 0.97
Array 250000 create 4.7581 ms/op 3.3140 ms/op 1.44
Array 250000 clone - spread 4.1558 ms/op 1.5466 ms/op 2.69
Array 250000 get(125000) 2.1040 ns/op 0.75100 ns/op 2.80
Array 250000 set(125000) 1.8260 ns/op 0.83700 ns/op 2.18
Array 250000 iterate all - loop 99.904 us/op 106.33 us/op 0.94
effectiveBalanceIncrements clone Uint8Array 300000 152.28 us/op 40.202 us/op 3.79
effectiveBalanceIncrements clone MutableVector 300000 341.00 ns/op 493.00 ns/op 0.69
effectiveBalanceIncrements rw all Uint8Array 300000 181.80 us/op 207.00 us/op 0.88
effectiveBalanceIncrements rw all MutableVector 300000 111.87 ms/op 106.54 ms/op 1.05
phase0 afterProcessEpoch - 250000 vs - 7PWei 128.77 ms/op 148.13 ms/op 0.87
phase0 beforeProcessEpoch - 250000 vs - 7PWei 37.080 ms/op 37.778 ms/op 0.98
altair processEpoch - mainnet_e81889 307.58 ms/op 356.42 ms/op 0.86
mainnet_e81889 - altair beforeProcessEpoch 49.745 ms/op 52.739 ms/op 0.94
mainnet_e81889 - altair processJustificationAndFinalization 17.740 us/op 19.084 us/op 0.93
mainnet_e81889 - altair processInactivityUpdates 7.2217 ms/op 5.8403 ms/op 1.24
mainnet_e81889 - altair processRewardsAndPenalties 68.579 ms/op 74.165 ms/op 0.92
mainnet_e81889 - altair processRegistryUpdates 3.7620 us/op 3.1090 us/op 1.21
mainnet_e81889 - altair processSlashings 983.00 ns/op 601.00 ns/op 1.64
mainnet_e81889 - altair processEth1DataReset 1.0750 us/op 1.0790 us/op 1.00
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.3603 ms/op 1.4364 ms/op 0.95
mainnet_e81889 - altair processSlashingsReset 6.5690 us/op 5.3520 us/op 1.23
mainnet_e81889 - altair processRandaoMixesReset 7.9030 us/op 4.8920 us/op 1.62
mainnet_e81889 - altair processHistoricalRootsUpdate 798.00 ns/op 597.00 ns/op 1.34
mainnet_e81889 - altair processParticipationFlagUpdates 2.4060 us/op 3.6690 us/op 0.66
mainnet_e81889 - altair processSyncCommitteeUpdates 499.00 ns/op 1.2470 us/op 0.40
mainnet_e81889 - altair afterProcessEpoch 131.94 ms/op 155.59 ms/op 0.85
phase0 processEpoch - mainnet_e58758 366.76 ms/op 402.49 ms/op 0.91
mainnet_e58758 - phase0 beforeProcessEpoch 143.43 ms/op 140.00 ms/op 1.02
mainnet_e58758 - phase0 processJustificationAndFinalization 26.032 us/op 20.551 us/op 1.27
mainnet_e58758 - phase0 processRewardsAndPenalties 64.211 ms/op 65.685 ms/op 0.98
mainnet_e58758 - phase0 processRegistryUpdates 9.1030 us/op 8.6620 us/op 1.05
mainnet_e58758 - phase0 processSlashings 496.00 ns/op 607.00 ns/op 0.82
mainnet_e58758 - phase0 processEth1DataReset 771.00 ns/op 495.00 ns/op 1.56
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.5375 ms/op 1.1372 ms/op 1.35
mainnet_e58758 - phase0 processSlashingsReset 3.6750 us/op 3.4910 us/op 1.05
mainnet_e58758 - phase0 processRandaoMixesReset 4.6710 us/op 4.5710 us/op 1.02
mainnet_e58758 - phase0 processHistoricalRootsUpdate 719.00 ns/op 686.00 ns/op 1.05
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.1200 us/op 5.4770 us/op 0.75
mainnet_e58758 - phase0 afterProcessEpoch 99.807 ms/op 114.45 ms/op 0.87
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.2447 ms/op 1.2664 ms/op 0.98
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5085 ms/op 1.5241 ms/op 0.99
altair processInactivityUpdates - 250000 normalcase 27.182 ms/op 25.637 ms/op 1.06
altair processInactivityUpdates - 250000 worstcase 26.171 ms/op 27.194 ms/op 0.96
phase0 processRegistryUpdates - 250000 normalcase 7.8850 us/op 6.7310 us/op 1.17
phase0 processRegistryUpdates - 250000 badcase_full_deposits 306.92 us/op 258.42 us/op 1.19
phase0 processRegistryUpdates - 250000 worstcase 0.5 131.97 ms/op 133.41 ms/op 0.99
altair processRewardsAndPenalties - 250000 normalcase 69.559 ms/op 71.124 ms/op 0.98
altair processRewardsAndPenalties - 250000 worstcase 66.512 ms/op 75.591 ms/op 0.88
phase0 getAttestationDeltas - 250000 normalcase 7.1606 ms/op 6.7709 ms/op 1.06
phase0 getAttestationDeltas - 250000 worstcase 7.0764 ms/op 6.7128 ms/op 1.05
phase0 processSlashings - 250000 worstcase 3.9018 ms/op 3.4498 ms/op 1.13
altair processSyncCommitteeUpdates - 250000 179.96 ms/op 186.02 ms/op 0.97
BeaconState.hashTreeRoot - No change 321.00 ns/op 366.00 ns/op 0.88
BeaconState.hashTreeRoot - 1 full validator 54.281 us/op 58.014 us/op 0.94
BeaconState.hashTreeRoot - 32 full validator 550.05 us/op 522.71 us/op 1.05
BeaconState.hashTreeRoot - 512 full validator 6.1701 ms/op 5.8558 ms/op 1.05
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 71.666 us/op 61.891 us/op 1.16
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.0211 ms/op 915.60 us/op 1.12
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 12.172 ms/op 11.741 ms/op 1.04
BeaconState.hashTreeRoot - 1 balances 49.826 us/op 49.530 us/op 1.01
BeaconState.hashTreeRoot - 32 balances 483.65 us/op 468.68 us/op 1.03
BeaconState.hashTreeRoot - 512 balances 4.4731 ms/op 4.6765 ms/op 0.96
BeaconState.hashTreeRoot - 250000 balances 82.234 ms/op 78.941 ms/op 1.04
aggregationBits - 2048 els - zipIndexesInBitList 21.749 us/op 15.962 us/op 1.36
regular array get 100000 times 47.876 us/op 34.167 us/op 1.40
wrappedArray get 100000 times 35.461 us/op 34.316 us/op 1.03
arrayWithProxy get 100000 times 17.138 ms/op 17.295 ms/op 0.99
ssz.Root.equals 606.00 ns/op 556.00 ns/op 1.09
byteArrayEquals 601.00 ns/op 547.00 ns/op 1.10
shuffle list - 16384 els 7.1566 ms/op 7.1112 ms/op 1.01
shuffle list - 250000 els 104.08 ms/op 103.81 ms/op 1.00
processSlot - 1 slots 10.176 us/op 8.9840 us/op 1.13
processSlot - 32 slots 1.4643 ms/op 1.3854 ms/op 1.06
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 43.281 ms/op 40.480 ms/op 1.07
getCommitteeAssignments - req 1 vs - 250000 vc 3.5261 ms/op 3.1384 ms/op 1.12
getCommitteeAssignments - req 100 vs - 250000 vc 4.7809 ms/op 4.3899 ms/op 1.09
getCommitteeAssignments - req 1000 vs - 250000 vc 5.1439 ms/op 4.7509 ms/op 1.08
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.5900 ns/op 4.7100 ns/op 1.19
state getBlockRootAtSlot - 250000 vs - 7PWei 916.79 ns/op 944.34 ns/op 0.97
computeProposers - vc 250000 12.385 ms/op 11.047 ms/op 1.12
computeEpochShuffling - vc 250000 124.66 ms/op 105.33 ms/op 1.18
getNextSyncCommittee - vc 250000 228.49 ms/op 185.03 ms/op 1.23
computeSigningRoot for AttestationData 16.840 us/op 14.270 us/op 1.18
hash AttestationData serialized data then Buffer.toString(base64) 2.8166 us/op 2.5381 us/op 1.11
toHexString serialized data 1.6448 us/op 1.1313 us/op 1.45
Buffer.toString(base64) 435.97 ns/op 336.20 ns/op 1.30

by benchmarkbot/action

@nflaig nflaig changed the title fix(cli): lock keystores when loading from cache file fix(validator): lock keystores when loading from cache file May 9, 2023
Copy link
Contributor

@dapplion dapplion left a comment

Choose a reason for hiding this comment

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

LGTM!

@nflaig nflaig merged commit 6c10dbe into unstable May 14, 2023
12 checks passed
@nflaig nflaig deleted the nflaig/lock-keystores-if-cache branch May 14, 2023 10:26
@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.

Lockfiles are not created/checked when loading from keystore cache
3 participants