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): abortable doppelganger detection #5665

Merged
merged 1 commit into from
Jun 19, 2023

Conversation

nflaig
Copy link
Member

@nflaig nflaig commented Jun 18, 2023

Motivation

Doppelganger detection should be abortable to be able to gracefully shut down vc process.

Description

Forward abort signal to sleep fn inside pollLiveness to make it abortable.

@nflaig nflaig requested a review from a team as a code owner June 18, 2023 13:02
@github-actions
Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: d31e560 Previous: 483aad7 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 934.22 us/op 739.13 us/op 1.26
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 46.342 us/op 45.357 us/op 1.02
BLS verify - blst-native 1.2354 ms/op 1.2047 ms/op 1.03
BLS verifyMultipleSignatures 3 - blst-native 2.5010 ms/op 2.4485 ms/op 1.02
BLS verifyMultipleSignatures 8 - blst-native 5.3636 ms/op 5.2533 ms/op 1.02
BLS verifyMultipleSignatures 32 - blst-native 19.419 ms/op 19.002 ms/op 1.02
BLS aggregatePubkeys 32 - blst-native 25.830 us/op 25.511 us/op 1.01
BLS aggregatePubkeys 128 - blst-native 101.55 us/op 99.338 us/op 1.02
getAttestationsForBlock 56.949 ms/op 50.441 ms/op 1.13
isKnown best case - 1 super set check 269.00 ns/op 260.00 ns/op 1.03
isKnown normal case - 2 super set checks 263.00 ns/op 249.00 ns/op 1.06
isKnown worse case - 16 super set checks 261.00 ns/op 256.00 ns/op 1.02
CheckpointStateCache - add get delete 4.9740 us/op 4.8840 us/op 1.02
validate gossip signedAggregateAndProof - struct 2.7857 ms/op 2.7509 ms/op 1.01
validate gossip attestation - struct 1.3038 ms/op 1.3143 ms/op 0.99
pickEth1Vote - no votes 1.2371 ms/op 1.2265 ms/op 1.01
pickEth1Vote - max votes 11.791 ms/op 10.347 ms/op 1.14
pickEth1Vote - Eth1Data hashTreeRoot value x2048 8.6990 ms/op 8.6894 ms/op 1.00
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 18.803 ms/op 14.296 ms/op 1.32
pickEth1Vote - Eth1Data fastSerialize value x2048 641.51 us/op 636.44 us/op 1.01
pickEth1Vote - Eth1Data fastSerialize tree x2048 8.9625 ms/op 6.6705 ms/op 1.34
bytes32 toHexString 493.00 ns/op 486.00 ns/op 1.01
bytes32 Buffer.toString(hex) 343.00 ns/op 343.00 ns/op 1.00
bytes32 Buffer.toString(hex) from Uint8Array 540.00 ns/op 549.00 ns/op 0.98
bytes32 Buffer.toString(hex) + 0x 342.00 ns/op 342.00 ns/op 1.00
Object access 1 prop 0.17500 ns/op 0.16400 ns/op 1.07
Map access 1 prop 0.16500 ns/op 0.15600 ns/op 1.06
Object get x1000 7.1760 ns/op 6.7030 ns/op 1.07
Map get x1000 0.61400 ns/op 0.51300 ns/op 1.20
Object set x1000 51.639 ns/op 52.835 ns/op 0.98
Map set x1000 43.535 ns/op 44.072 ns/op 0.99
Return object 10000 times 0.23260 ns/op 0.23880 ns/op 0.97
Throw Error 10000 times 4.1349 us/op 4.2119 us/op 0.98
fastMsgIdFn sha256 / 200 bytes 3.3800 us/op 3.4700 us/op 0.97
fastMsgIdFn h32 xxhash / 200 bytes 292.00 ns/op 281.00 ns/op 1.04
fastMsgIdFn h64 xxhash / 200 bytes 398.00 ns/op 383.00 ns/op 1.04
fastMsgIdFn sha256 / 1000 bytes 11.426 us/op 11.764 us/op 0.97
fastMsgIdFn h32 xxhash / 1000 bytes 417.00 ns/op 420.00 ns/op 0.99
fastMsgIdFn h64 xxhash / 1000 bytes 464.00 ns/op 474.00 ns/op 0.98
fastMsgIdFn sha256 / 10000 bytes 103.98 us/op 103.51 us/op 1.00
fastMsgIdFn h32 xxhash / 10000 bytes 1.8960 us/op 1.9270 us/op 0.98
fastMsgIdFn h64 xxhash / 10000 bytes 1.3570 us/op 1.3640 us/op 0.99
enrSubnets - fastDeserialize 64 bits 1.2900 us/op 1.2750 us/op 1.01
enrSubnets - ssz BitVector 64 bits 486.00 ns/op 478.00 ns/op 1.02
enrSubnets - fastDeserialize 4 bits 174.00 ns/op 165.00 ns/op 1.05
enrSubnets - ssz BitVector 4 bits 490.00 ns/op 480.00 ns/op 1.02
prioritizePeers score -10:0 att 32-0.1 sync 2-0 112.66 us/op 104.64 us/op 1.08
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 132.38 us/op 129.67 us/op 1.02
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 172.35 us/op 169.17 us/op 1.02
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 320.43 us/op 304.98 us/op 1.05
prioritizePeers score 0:0 att 64-1 sync 4-1 362.55 us/op 364.35 us/op 1.00
array of 16000 items push then shift 1.6059 us/op 1.6114 us/op 1.00
LinkedList of 16000 items push then shift 8.7150 ns/op 8.8030 ns/op 0.99
array of 16000 items push then pop 82.516 ns/op 78.051 ns/op 1.06
LinkedList of 16000 items push then pop 8.5860 ns/op 8.5320 ns/op 1.01
array of 24000 items push then shift 2.3298 us/op 2.3406 us/op 1.00
LinkedList of 24000 items push then shift 9.7560 ns/op 8.6430 ns/op 1.13
array of 24000 items push then pop 77.675 ns/op 70.065 ns/op 1.11
LinkedList of 24000 items push then pop 8.4380 ns/op 8.3840 ns/op 1.01
intersect bitArray bitLen 8 13.847 ns/op 13.154 ns/op 1.05
intersect array and set length 8 76.177 ns/op 76.902 ns/op 0.99
intersect bitArray bitLen 128 44.703 ns/op 43.741 ns/op 1.02
intersect array and set length 128 1.0553 us/op 1.0573 us/op 1.00
Buffer.concat 32 items 2.7040 us/op 2.7430 us/op 0.99
Uint8Array.set 32 items 2.6620 us/op 2.5280 us/op 1.05
transfer serialized Status (84 B) 1.9850 us/op 2.0420 us/op 0.97
copy serialized Status (84 B) 1.7420 us/op 1.8190 us/op 0.96
transfer serialized SignedVoluntaryExit (112 B) 2.2040 us/op 2.2260 us/op 0.99
copy serialized SignedVoluntaryExit (112 B) 1.9030 us/op 1.8430 us/op 1.03
transfer serialized ProposerSlashing (416 B) 2.7530 us/op 2.8120 us/op 0.98
copy serialized ProposerSlashing (416 B) 2.5570 us/op 2.8890 us/op 0.89
transfer serialized Attestation (485 B) 3.0770 us/op 3.2780 us/op 0.94
copy serialized Attestation (485 B) 3.2790 us/op 3.2440 us/op 1.01
transfer serialized AttesterSlashing (33232 B) 3.6630 us/op 3.3590 us/op 1.09
copy serialized AttesterSlashing (33232 B) 7.0670 us/op 6.5930 us/op 1.07
transfer serialized Small SignedBeaconBlock (128000 B) 3.2340 us/op 3.6430 us/op 0.89
copy serialized Small SignedBeaconBlock (128000 B) 13.612 us/op 13.825 us/op 0.98
transfer serialized Avg SignedBeaconBlock (200000 B) 3.4320 us/op 3.8560 us/op 0.89
copy serialized Avg SignedBeaconBlock (200000 B) 53.665 us/op 19.844 us/op 2.70
transfer serialized BlobsSidecar (524380 B) 3.1690 us/op 3.6630 us/op 0.87
copy serialized BlobsSidecar (524380 B) 172.58 us/op 97.505 us/op 1.77
transfer serialized Big SignedBeaconBlock (1000000 B) 3.1600 us/op 3.6920 us/op 0.86
copy serialized Big SignedBeaconBlock (1000000 B) 254.40 us/op 246.86 us/op 1.03
pass gossip attestations to forkchoice per slot 2.6731 ms/op 2.6318 ms/op 1.02
forkChoice updateHead vc 100000 bc 64 eq 0 2.1397 ms/op 2.0061 ms/op 1.07
forkChoice updateHead vc 600000 bc 64 eq 0 14.927 ms/op 11.589 ms/op 1.29
forkChoice updateHead vc 1000000 bc 64 eq 0 19.044 ms/op 20.798 ms/op 0.92
forkChoice updateHead vc 600000 bc 320 eq 0 16.686 ms/op 16.820 ms/op 0.99
forkChoice updateHead vc 600000 bc 1200 eq 0 84.674 ms/op 79.254 ms/op 1.07
forkChoice updateHead vc 600000 bc 64 eq 1000 24.781 ms/op 19.974 ms/op 1.24
forkChoice updateHead vc 600000 bc 64 eq 10000 26.251 ms/op 22.211 ms/op 1.18
forkChoice updateHead vc 600000 bc 64 eq 300000 38.307 ms/op 31.183 ms/op 1.23
computeDeltas 3.1609 ms/op 3.9755 ms/op 0.80
computeProposerBoostScoreFromBalances 1.8399 ms/op 1.7596 ms/op 1.05
altair processAttestation - 250000 vs - 7PWei normalcase 2.1932 ms/op 2.0648 ms/op 1.06
altair processAttestation - 250000 vs - 7PWei worstcase 4.1640 ms/op 3.2650 ms/op 1.28
altair processAttestation - setStatus - 1/6 committees join 136.81 us/op 137.68 us/op 0.99
altair processAttestation - setStatus - 1/3 committees join 281.26 us/op 271.45 us/op 1.04
altair processAttestation - setStatus - 1/2 committees join 380.52 us/op 353.89 us/op 1.08
altair processAttestation - setStatus - 2/3 committees join 464.84 us/op 443.78 us/op 1.05
altair processAttestation - setStatus - 4/5 committees join 650.35 us/op 646.53 us/op 1.01
altair processAttestation - setStatus - 100% committees join 768.86 us/op 751.56 us/op 1.02
altair processBlock - 250000 vs - 7PWei normalcase 23.701 ms/op 17.885 ms/op 1.33
altair processBlock - 250000 vs - 7PWei normalcase hashState 26.607 ms/op 28.495 ms/op 0.93
altair processBlock - 250000 vs - 7PWei worstcase 71.554 ms/op 48.210 ms/op 1.48
altair processBlock - 250000 vs - 7PWei worstcase hashState 85.968 ms/op 70.030 ms/op 1.23
phase0 processBlock - 250000 vs - 7PWei normalcase 2.1646 ms/op 1.9028 ms/op 1.14
phase0 processBlock - 250000 vs - 7PWei worstcase 30.249 ms/op 28.549 ms/op 1.06
altair processEth1Data - 250000 vs - 7PWei normalcase 482.60 us/op 466.44 us/op 1.03
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 9.6480 us/op 7.0420 us/op 1.37
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 31.603 us/op 20.375 us/op 1.55
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 11.982 us/op 8.2480 us/op 1.45
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 8.2150 us/op 6.2380 us/op 1.32
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 129.89 us/op 80.180 us/op 1.62
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.0020 ms/op 620.62 us/op 1.61
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.2939 ms/op 905.86 us/op 1.43
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.0432 ms/op 862.36 us/op 1.21
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 2.3662 ms/op 2.1709 ms/op 1.09
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.9396 ms/op 1.7393 ms/op 1.69
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.9813 ms/op 3.8309 ms/op 1.04
Tree 40 250000 create 319.07 ms/op 294.20 ms/op 1.08
Tree 40 250000 get(125000) 191.15 ns/op 169.66 ns/op 1.13
Tree 40 250000 set(125000) 967.03 ns/op 833.68 ns/op 1.16
Tree 40 250000 toArray() 19.325 ms/op 16.574 ms/op 1.17
Tree 40 250000 iterate all - toArray() + loop 18.991 ms/op 16.493 ms/op 1.15
Tree 40 250000 iterate all - get(i) 71.160 ms/op 63.480 ms/op 1.12
MutableVector 250000 create 13.962 ms/op 9.9738 ms/op 1.40
MutableVector 250000 get(125000) 7.8040 ns/op 6.4430 ns/op 1.21
MutableVector 250000 set(125000) 247.16 ns/op 222.80 ns/op 1.11
MutableVector 250000 toArray() 2.8905 ms/op 2.7527 ms/op 1.05
MutableVector 250000 iterate all - toArray() + loop 2.9447 ms/op 2.7444 ms/op 1.07
MutableVector 250000 iterate all - get(i) 1.7515 ms/op 1.4249 ms/op 1.23
Array 250000 create 2.5845 ms/op 2.4018 ms/op 1.08
Array 250000 clone - spread 1.0978 ms/op 1.0316 ms/op 1.06
Array 250000 get(125000) 0.55100 ns/op 0.51200 ns/op 1.08
Array 250000 set(125000) 0.62700 ns/op 0.58500 ns/op 1.07
Array 250000 iterate all - loop 84.931 us/op 101.43 us/op 0.84
effectiveBalanceIncrements clone Uint8Array 300000 26.862 us/op 24.066 us/op 1.12
effectiveBalanceIncrements clone MutableVector 300000 333.00 ns/op 307.00 ns/op 1.08
effectiveBalanceIncrements rw all Uint8Array 300000 173.66 us/op 161.44 us/op 1.08
effectiveBalanceIncrements rw all MutableVector 300000 79.477 ms/op 72.886 ms/op 1.09
phase0 afterProcessEpoch - 250000 vs - 7PWei 115.69 ms/op 110.48 ms/op 1.05
phase0 beforeProcessEpoch - 250000 vs - 7PWei 43.862 ms/op 40.012 ms/op 1.10
altair processEpoch - mainnet_e81889 359.13 ms/op 297.21 ms/op 1.21
mainnet_e81889 - altair beforeProcessEpoch 66.035 ms/op 62.535 ms/op 1.06
mainnet_e81889 - altair processJustificationAndFinalization 27.036 us/op 16.385 us/op 1.65
mainnet_e81889 - altair processInactivityUpdates 5.6564 ms/op 5.0540 ms/op 1.12
mainnet_e81889 - altair processRewardsAndPenalties 76.719 ms/op 66.348 ms/op 1.16
mainnet_e81889 - altair processRegistryUpdates 3.9030 us/op 2.6880 us/op 1.45
mainnet_e81889 - altair processSlashings 696.00 ns/op 524.00 ns/op 1.33
mainnet_e81889 - altair processEth1DataReset 580.00 ns/op 560.00 ns/op 1.04
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.3225 ms/op 1.2330 ms/op 1.88
mainnet_e81889 - altair processSlashingsReset 6.2350 us/op 4.5440 us/op 1.37
mainnet_e81889 - altair processRandaoMixesReset 7.5450 us/op 4.5500 us/op 1.66
mainnet_e81889 - altair processHistoricalRootsUpdate 1.2090 us/op 712.00 ns/op 1.70
mainnet_e81889 - altair processParticipationFlagUpdates 3.6770 us/op 2.0400 us/op 1.80
mainnet_e81889 - altair processSyncCommitteeUpdates 848.00 ns/op 918.00 ns/op 0.92
mainnet_e81889 - altair afterProcessEpoch 133.02 ms/op 121.06 ms/op 1.10
phase0 processEpoch - mainnet_e58758 414.89 ms/op 356.61 ms/op 1.16
mainnet_e58758 - phase0 beforeProcessEpoch 161.57 ms/op 131.21 ms/op 1.23
mainnet_e58758 - phase0 processJustificationAndFinalization 21.633 us/op 17.219 us/op 1.26
mainnet_e58758 - phase0 processRewardsAndPenalties 65.753 ms/op 60.687 ms/op 1.08
mainnet_e58758 - phase0 processRegistryUpdates 11.421 us/op 7.7840 us/op 1.47
mainnet_e58758 - phase0 processSlashings 741.00 ns/op 546.00 ns/op 1.36
mainnet_e58758 - phase0 processEth1DataReset 787.00 ns/op 570.00 ns/op 1.38
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.8994 ms/op 944.91 us/op 2.01
mainnet_e58758 - phase0 processSlashingsReset 6.3240 us/op 3.7570 us/op 1.68
mainnet_e58758 - phase0 processRandaoMixesReset 10.618 us/op 4.6570 us/op 2.28
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.0510 us/op 726.00 ns/op 1.45
mainnet_e58758 - phase0 processParticipationRecordUpdates 5.3870 us/op 4.3760 us/op 1.23
mainnet_e58758 - phase0 afterProcessEpoch 105.37 ms/op 95.123 ms/op 1.11
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.3790 ms/op 1.2173 ms/op 1.13
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5695 ms/op 1.4262 ms/op 1.10
altair processInactivityUpdates - 250000 normalcase 32.386 ms/op 23.758 ms/op 1.36
altair processInactivityUpdates - 250000 worstcase 33.136 ms/op 25.993 ms/op 1.27
phase0 processRegistryUpdates - 250000 normalcase 11.163 us/op 6.9380 us/op 1.61
phase0 processRegistryUpdates - 250000 badcase_full_deposits 489.91 us/op 233.84 us/op 2.10
phase0 processRegistryUpdates - 250000 worstcase 0.5 144.40 ms/op 126.67 ms/op 1.14
altair processRewardsAndPenalties - 250000 normalcase 72.228 ms/op 66.822 ms/op 1.08
altair processRewardsAndPenalties - 250000 worstcase 71.811 ms/op 70.189 ms/op 1.02
phase0 getAttestationDeltas - 250000 normalcase 7.5914 ms/op 6.4507 ms/op 1.18
phase0 getAttestationDeltas - 250000 worstcase 7.0731 ms/op 6.3789 ms/op 1.11
phase0 processSlashings - 250000 worstcase 3.8465 ms/op 3.4635 ms/op 1.11
altair processSyncCommitteeUpdates - 250000 190.78 ms/op 166.68 ms/op 1.14
BeaconState.hashTreeRoot - No change 368.00 ns/op 256.00 ns/op 1.44
BeaconState.hashTreeRoot - 1 full validator 59.414 us/op 52.367 us/op 1.13
BeaconState.hashTreeRoot - 32 full validator 612.29 us/op 516.90 us/op 1.18
BeaconState.hashTreeRoot - 512 full validator 5.8137 ms/op 5.5523 ms/op 1.05
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 71.831 us/op 62.563 us/op 1.15
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 958.50 us/op 874.63 us/op 1.10
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 11.806 ms/op 10.834 ms/op 1.09
BeaconState.hashTreeRoot - 1 balances 52.109 us/op 47.610 us/op 1.09
BeaconState.hashTreeRoot - 32 balances 536.75 us/op 454.32 us/op 1.18
BeaconState.hashTreeRoot - 512 balances 4.8619 ms/op 4.2618 ms/op 1.14
BeaconState.hashTreeRoot - 250000 balances 77.931 ms/op 68.552 ms/op 1.14
aggregationBits - 2048 els - zipIndexesInBitList 17.259 us/op 15.115 us/op 1.14
regular array get 100000 times 34.010 us/op 32.371 us/op 1.05
wrappedArray get 100000 times 34.301 us/op 32.350 us/op 1.06
arrayWithProxy get 100000 times 16.821 ms/op 15.431 ms/op 1.09
ssz.Root.equals 592.00 ns/op 536.00 ns/op 1.10
byteArrayEquals 581.00 ns/op 529.00 ns/op 1.10
shuffle list - 16384 els 7.3729 ms/op 6.7194 ms/op 1.10
shuffle list - 250000 els 105.96 ms/op 98.262 ms/op 1.08
processSlot - 1 slots 9.3530 us/op 8.5480 us/op 1.09
processSlot - 32 slots 1.4193 ms/op 1.3011 ms/op 1.09
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 39.318 ms/op 37.217 ms/op 1.06
getCommitteeAssignments - req 1 vs - 250000 vc 3.0864 ms/op 2.8384 ms/op 1.09
getCommitteeAssignments - req 100 vs - 250000 vc 4.4184 ms/op 4.0267 ms/op 1.10
getCommitteeAssignments - req 1000 vs - 250000 vc 4.8437 ms/op 4.3924 ms/op 1.10
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.5900 ns/op 4.2900 ns/op 1.30
state getBlockRootAtSlot - 250000 vs - 7PWei 758.65 ns/op 919.52 ns/op 0.83
computeProposers - vc 250000 11.609 ms/op 10.158 ms/op 1.14
computeEpochShuffling - vc 250000 112.59 ms/op 99.233 ms/op 1.13
getNextSyncCommittee - vc 250000 186.25 ms/op 176.55 ms/op 1.05
computeSigningRoot for AttestationData 14.284 us/op 13.281 us/op 1.08
hash AttestationData serialized data then Buffer.toString(base64) 2.6793 us/op 2.3358 us/op 1.15
toHexString serialized data 1.2607 us/op 1.0182 us/op 1.24
Buffer.toString(base64) 365.13 ns/op 303.60 ns/op 1.20

by benchmarkbot/action

@nflaig nflaig merged commit 0122664 into unstable Jun 19, 2023
@nflaig nflaig deleted the nflaig/abortable-doppelganger-protection branch June 19, 2023 08:00
@wemeetagain
Copy link
Member

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

3 participants