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: only check doppelganger liveness for relevant epochs #5991

Merged
merged 1 commit into from
Sep 29, 2023

Conversation

nflaig
Copy link
Member

@nflaig nflaig commented Sep 25, 2023

Motivation

Noticed that we run doppelganger liveness check for a validator even if next epoch to check is current epoch + 1.

The doppelganger check would be skipped either way but we can avoid the liveness request to the beacon node

if (state.nextEpochToCheck <= epoch) {

if (!response.isLive && state.nextEpochToCheck <= previousEpoch) {

Description

Only run doppelganger liveness check for validators with nextEpochToCheck <= currentEpoch

@nflaig nflaig requested a review from a team as a code owner September 25, 2023 08:36
currentEpoch: this.clock.currentEpoch,
detectionEpochs: DEFAULT_REMAINING_DETECTION_EPOCHS,
});
this.logger.info("Doppelganger protection enabled", {detectionEpochs: DEFAULT_REMAINING_DETECTION_EPOCHS});
Copy link
Member Author

Choose a reason for hiding this comment

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

I added epoch to the log in #5987 but noticed we only want the epoch information when registering a validator. Better to only log doppelganger related configuration here.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 25, 2023

Performance Report

✔️ no performance regression detected

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: 8e92353 Previous: 1397834 Ratio
getAttestationsForBlock 34.304 ms/op 105.10 ms/op 0.33
Full benchmark results
Benchmark suite Current: 8e92353 Previous: 1397834 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 705.17 us/op 828.51 us/op 0.85
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 54.092 us/op 128.68 us/op 0.42
BLS verify - blst-native 1.1382 ms/op 1.5866 ms/op 0.72
BLS verifyMultipleSignatures 3 - blst-native 2.2903 ms/op 3.0682 ms/op 0.75
BLS verifyMultipleSignatures 8 - blst-native 4.9861 ms/op 6.7124 ms/op 0.74
BLS verifyMultipleSignatures 32 - blst-native 18.355 ms/op 23.545 ms/op 0.78
BLS verifyMultipleSignatures 64 - blst-native 36.088 ms/op 45.354 ms/op 0.80
BLS verifyMultipleSignatures 128 - blst-native 71.594 ms/op 95.974 ms/op 0.75
BLS deserializing 10000 signatures 762.78 ms/op 946.52 ms/op 0.81
BLS deserializing 100000 signatures 7.8521 s/op 9.7745 s/op 0.80
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.1480 ms/op 1.5306 ms/op 0.75
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.2959 ms/op 1.6814 ms/op 0.77
BLS verifyMultipleSignatures - same message - 32 - blst-native 2.0408 ms/op 2.7240 ms/op 0.75
BLS verifyMultipleSignatures - same message - 64 - blst-native 3.0457 ms/op 3.8760 ms/op 0.79
BLS verifyMultipleSignatures - same message - 128 - blst-native 5.0232 ms/op 6.9272 ms/op 0.73
BLS aggregatePubkeys 32 - blst-native 22.742 us/op 30.980 us/op 0.73
BLS aggregatePubkeys 128 - blst-native 89.229 us/op 115.05 us/op 0.78
getAttestationsForBlock 34.304 ms/op 105.10 ms/op 0.33
isKnown best case - 1 super set check 434.00 ns/op 1.0820 us/op 0.40
isKnown normal case - 2 super set checks 358.00 ns/op 944.00 ns/op 0.38
isKnown worse case - 16 super set checks 323.00 ns/op 923.00 ns/op 0.35
CheckpointStateCache - add get delete 4.3110 us/op 10.801 us/op 0.40
validate api signedAggregateAndProof - struct 2.4392 ms/op 3.4226 ms/op 0.71
validate gossip signedAggregateAndProof - struct 2.4467 ms/op 3.3552 ms/op 0.73
validate gossip attestation - vc 640000 1.1617 ms/op 1.5228 ms/op 0.76
batch validate gossip attestation - vc 640000 - chunk 32 139.50 us/op 221.22 us/op 0.63
batch validate gossip attestation - vc 640000 - chunk 64 127.49 us/op 183.34 us/op 0.70
batch validate gossip attestation - vc 640000 - chunk 128 119.92 us/op 165.57 us/op 0.72
batch validate gossip attestation - vc 640000 - chunk 256 117.46 us/op 144.67 us/op 0.81
pickEth1Vote - no votes 909.40 us/op 1.3427 ms/op 0.68
pickEth1Vote - max votes 6.3484 ms/op 10.995 ms/op 0.58
pickEth1Vote - Eth1Data hashTreeRoot value x2048 19.108 ms/op 18.569 ms/op 1.03
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 21.443 ms/op 27.534 ms/op 0.78
pickEth1Vote - Eth1Data fastSerialize value x2048 424.13 us/op 691.28 us/op 0.61
pickEth1Vote - Eth1Data fastSerialize tree x2048 3.8244 ms/op 8.2330 ms/op 0.46
bytes32 toHexString 440.00 ns/op 631.00 ns/op 0.70
bytes32 Buffer.toString(hex) 299.00 ns/op 310.00 ns/op 0.96
bytes32 Buffer.toString(hex) from Uint8Array 423.00 ns/op 555.00 ns/op 0.76
bytes32 Buffer.toString(hex) + 0x 321.00 ns/op 326.00 ns/op 0.98
Object access 1 prop 0.20100 ns/op 0.20600 ns/op 0.98
Map access 1 prop 0.18900 ns/op 0.15400 ns/op 1.23
Object get x1000 5.5400 ns/op 7.9840 ns/op 0.69
Map get x1000 0.53300 ns/op 0.67400 ns/op 0.79
Object set x1000 27.034 ns/op 65.025 ns/op 0.42
Map set x1000 16.892 ns/op 49.129 ns/op 0.34
Return object 10000 times 0.23590 ns/op 0.25030 ns/op 0.94
Throw Error 10000 times 2.7493 us/op 3.9370 us/op 0.70
fastMsgIdFn sha256 / 200 bytes 2.0220 us/op 3.4240 us/op 0.59
fastMsgIdFn h32 xxhash / 200 bytes 306.00 ns/op 325.00 ns/op 0.94
fastMsgIdFn h64 xxhash / 200 bytes 352.00 ns/op 378.00 ns/op 0.93
fastMsgIdFn sha256 / 1000 bytes 6.2780 us/op 11.672 us/op 0.54
fastMsgIdFn h32 xxhash / 1000 bytes 432.00 ns/op 454.00 ns/op 0.95
fastMsgIdFn h64 xxhash / 1000 bytes 434.00 ns/op 450.00 ns/op 0.96
fastMsgIdFn sha256 / 10000 bytes 55.008 us/op 106.62 us/op 0.52
fastMsgIdFn h32 xxhash / 10000 bytes 1.9120 us/op 2.0450 us/op 0.93
fastMsgIdFn h64 xxhash / 10000 bytes 1.3120 us/op 1.4150 us/op 0.93
send data - 1000 256B messages 11.463 ms/op 21.634 ms/op 0.53
send data - 1000 512B messages 15.028 ms/op 29.872 ms/op 0.50
send data - 1000 1024B messages 23.836 ms/op 45.085 ms/op 0.53
send data - 1000 1200B messages 20.823 ms/op 34.476 ms/op 0.60
send data - 1000 2048B messages 25.270 ms/op 39.902 ms/op 0.63
send data - 1000 4096B messages 26.845 ms/op 39.309 ms/op 0.68
send data - 1000 16384B messages 64.219 ms/op 80.061 ms/op 0.80
send data - 1000 65536B messages 231.51 ms/op 297.29 ms/op 0.78
enrSubnets - fastDeserialize 64 bits 914.00 ns/op 1.3630 us/op 0.67
enrSubnets - ssz BitVector 64 bits 432.00 ns/op 483.00 ns/op 0.89
enrSubnets - fastDeserialize 4 bits 216.00 ns/op 194.00 ns/op 1.11
enrSubnets - ssz BitVector 4 bits 452.00 ns/op 457.00 ns/op 0.99
prioritizePeers score -10:0 att 32-0.1 sync 2-0 71.930 us/op 114.67 us/op 0.63
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 96.765 us/op 139.84 us/op 0.69
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 135.88 us/op 194.59 us/op 0.70
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 221.88 us/op 341.80 us/op 0.65
prioritizePeers score 0:0 att 64-1 sync 4-1 228.02 us/op 372.49 us/op 0.61
array of 16000 items push then shift 1.3351 us/op 1.7216 us/op 0.78
LinkedList of 16000 items push then shift 6.0780 ns/op 10.233 ns/op 0.59
array of 16000 items push then pop 75.854 ns/op 112.72 ns/op 0.67
LinkedList of 16000 items push then pop 5.7970 ns/op 9.7800 ns/op 0.59
array of 24000 items push then shift 1.9507 us/op 2.4651 us/op 0.79
LinkedList of 24000 items push then shift 6.2340 ns/op 10.731 ns/op 0.58
array of 24000 items push then pop 101.21 ns/op 167.62 ns/op 0.60
LinkedList of 24000 items push then pop 6.5430 ns/op 10.111 ns/op 0.65
intersect bitArray bitLen 8 5.5010 ns/op 6.8320 ns/op 0.81
intersect array and set length 8 43.276 ns/op 72.088 ns/op 0.60
intersect bitArray bitLen 128 26.090 ns/op 33.380 ns/op 0.78
intersect array and set length 128 583.54 ns/op 950.42 ns/op 0.61
bitArray.getTrueBitIndexes() bitLen 128 1.3250 us/op 1.7040 us/op 0.78
bitArray.getTrueBitIndexes() bitLen 248 2.1470 us/op 3.0530 us/op 0.70
bitArray.getTrueBitIndexes() bitLen 512 3.8580 us/op 6.2470 us/op 0.62
Buffer.concat 32 items 912.00 ns/op 1.0450 us/op 0.87
Uint8Array.set 32 items 2.0930 us/op 2.0830 us/op 1.00
Set add up to 64 items then delete first 1.7949 us/op 4.7453 us/op 0.38
OrderedSet add up to 64 items then delete first 2.6419 us/op 6.0750 us/op 0.43
Set add up to 64 items then delete last 1.9462 us/op 5.1108 us/op 0.38
OrderedSet add up to 64 items then delete last 2.8863 us/op 5.8796 us/op 0.49
Set add up to 64 items then delete middle 1.9807 us/op 4.9476 us/op 0.40
OrderedSet add up to 64 items then delete middle 4.0739 us/op 7.6051 us/op 0.54
Set add up to 128 items then delete first 3.8528 us/op 10.356 us/op 0.37
OrderedSet add up to 128 items then delete first 6.0095 us/op 13.891 us/op 0.43
Set add up to 128 items then delete last 3.7290 us/op 10.195 us/op 0.37
OrderedSet add up to 128 items then delete last 5.5525 us/op 13.721 us/op 0.40
Set add up to 128 items then delete middle 3.7054 us/op 10.188 us/op 0.36
OrderedSet add up to 128 items then delete middle 10.564 us/op 18.833 us/op 0.56
Set add up to 256 items then delete first 7.4938 us/op 20.752 us/op 0.36
OrderedSet add up to 256 items then delete first 11.854 us/op 27.985 us/op 0.42
Set add up to 256 items then delete last 7.2706 us/op 20.300 us/op 0.36
OrderedSet add up to 256 items then delete last 10.990 us/op 27.826 us/op 0.39
Set add up to 256 items then delete middle 7.2265 us/op 20.253 us/op 0.36
OrderedSet add up to 256 items then delete middle 30.816 us/op 50.698 us/op 0.61
transfer serialized Status (84 B) 1.3510 us/op 2.0880 us/op 0.65
copy serialized Status (84 B) 1.2060 us/op 1.7470 us/op 0.69
transfer serialized SignedVoluntaryExit (112 B) 1.7120 us/op 2.0630 us/op 0.83
copy serialized SignedVoluntaryExit (112 B) 1.5040 us/op 1.7230 us/op 0.87
transfer serialized ProposerSlashing (416 B) 2.6360 us/op 2.4110 us/op 1.09
copy serialized ProposerSlashing (416 B) 1.9400 us/op 2.6710 us/op 0.73
transfer serialized Attestation (485 B) 1.6010 us/op 2.4080 us/op 0.66
copy serialized Attestation (485 B) 1.8440 us/op 2.4490 us/op 0.75
transfer serialized AttesterSlashing (33232 B) 1.9620 us/op 2.6500 us/op 0.74
copy serialized AttesterSlashing (33232 B) 4.0280 us/op 9.3130 us/op 0.43
transfer serialized Small SignedBeaconBlock (128000 B) 2.6970 us/op 3.1820 us/op 0.85
copy serialized Small SignedBeaconBlock (128000 B) 14.345 us/op 22.289 us/op 0.64
transfer serialized Avg SignedBeaconBlock (200000 B) 2.6950 us/op 3.2040 us/op 0.84
copy serialized Avg SignedBeaconBlock (200000 B) 23.007 us/op 33.244 us/op 0.69
transfer serialized BlobsSidecar (524380 B) 2.8410 us/op 4.1740 us/op 0.68
copy serialized BlobsSidecar (524380 B) 81.183 us/op 164.49 us/op 0.49
transfer serialized Big SignedBeaconBlock (1000000 B) 2.7740 us/op 5.4120 us/op 0.51
copy serialized Big SignedBeaconBlock (1000000 B) 134.97 us/op 192.39 us/op 0.70
pass gossip attestations to forkchoice per slot 2.5705 ms/op 4.5761 ms/op 0.56
forkChoice updateHead vc 100000 bc 64 eq 0 559.04 us/op 756.51 us/op 0.74
forkChoice updateHead vc 600000 bc 64 eq 0 3.6281 ms/op 5.2527 ms/op 0.69
forkChoice updateHead vc 1000000 bc 64 eq 0 4.5938 ms/op 8.4244 ms/op 0.55
forkChoice updateHead vc 600000 bc 320 eq 0 2.8566 ms/op 5.3494 ms/op 0.53
forkChoice updateHead vc 600000 bc 1200 eq 0 2.8974 ms/op 4.7779 ms/op 0.61
forkChoice updateHead vc 600000 bc 7200 eq 0 3.5335 ms/op 6.0353 ms/op 0.59
forkChoice updateHead vc 600000 bc 64 eq 1000 10.388 ms/op 11.952 ms/op 0.87
forkChoice updateHead vc 600000 bc 64 eq 10000 10.288 ms/op 13.228 ms/op 0.78
forkChoice updateHead vc 600000 bc 64 eq 300000 12.110 ms/op 27.170 ms/op 0.45
computeDeltas 500000 validators 300 proto nodes 3.0749 ms/op 6.9671 ms/op 0.44
computeDeltas 500000 validators 1200 proto nodes 2.9797 ms/op 6.9986 ms/op 0.43
computeDeltas 500000 validators 7200 proto nodes 2.9702 ms/op 6.8772 ms/op 0.43
computeDeltas 750000 validators 300 proto nodes 4.4441 ms/op 10.049 ms/op 0.44
computeDeltas 750000 validators 1200 proto nodes 4.3803 ms/op 10.003 ms/op 0.44
computeDeltas 750000 validators 7200 proto nodes 4.4620 ms/op 10.168 ms/op 0.44
computeDeltas 1400000 validators 300 proto nodes 8.1746 ms/op 20.538 ms/op 0.40
computeDeltas 1400000 validators 1200 proto nodes 8.1341 ms/op 20.998 ms/op 0.39
computeDeltas 1400000 validators 7200 proto nodes 8.6068 ms/op 21.379 ms/op 0.40
computeDeltas 2100000 validators 300 proto nodes 12.784 ms/op 29.434 ms/op 0.43
computeDeltas 2100000 validators 1200 proto nodes 12.611 ms/op 29.961 ms/op 0.42
computeDeltas 2100000 validators 7200 proto nodes 12.775 ms/op 29.121 ms/op 0.44
computeProposerBoostScoreFromBalances 500000 validators 2.7484 ms/op 3.6451 ms/op 0.75
computeProposerBoostScoreFromBalances 750000 validators 2.7143 ms/op 3.7563 ms/op 0.72
computeProposerBoostScoreFromBalances 1400000 validators 2.6748 ms/op 3.7417 ms/op 0.71
computeProposerBoostScoreFromBalances 2100000 validators 2.7580 ms/op 3.6235 ms/op 0.76
altair processAttestation - 250000 vs - 7PWei normalcase 1.3879 ms/op 3.1421 ms/op 0.44
altair processAttestation - 250000 vs - 7PWei worstcase 2.1327 ms/op 4.3240 ms/op 0.49
altair processAttestation - setStatus - 1/6 committees join 82.553 us/op 224.94 us/op 0.37
altair processAttestation - setStatus - 1/3 committees join 150.05 us/op 353.56 us/op 0.42
altair processAttestation - setStatus - 1/2 committees join 228.63 us/op 515.41 us/op 0.44
altair processAttestation - setStatus - 2/3 committees join 317.58 us/op 635.66 us/op 0.50
altair processAttestation - setStatus - 4/5 committees join 423.19 us/op 907.56 us/op 0.47
altair processAttestation - setStatus - 100% committees join 502.75 us/op 1.0572 ms/op 0.48
altair processBlock - 250000 vs - 7PWei normalcase 6.1033 ms/op 9.6032 ms/op 0.64
altair processBlock - 250000 vs - 7PWei normalcase hashState 24.392 ms/op 37.180 ms/op 0.66
altair processBlock - 250000 vs - 7PWei worstcase 30.640 ms/op 49.435 ms/op 0.62
altair processBlock - 250000 vs - 7PWei worstcase hashState 75.483 ms/op 122.50 ms/op 0.62
phase0 processBlock - 250000 vs - 7PWei normalcase 2.5313 ms/op 3.7449 ms/op 0.68
phase0 processBlock - 250000 vs - 7PWei worstcase 26.830 ms/op 35.576 ms/op 0.75
altair processEth1Data - 250000 vs - 7PWei normalcase 282.46 us/op 671.65 us/op 0.42
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 7.9220 us/op 16.589 us/op 0.48
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 61.832 us/op 83.131 us/op 0.74
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 18.377 us/op 31.937 us/op 0.58
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 16.952 us/op 18.251 us/op 0.93
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 165.10 us/op 200.24 us/op 0.82
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.0909 ms/op 1.8173 ms/op 0.60
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.3060 ms/op 1.8878 ms/op 0.69
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.2476 ms/op 1.8931 ms/op 0.66
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.4482 ms/op 4.7054 ms/op 0.73
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.8441 ms/op 3.5388 ms/op 0.52
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.4725 ms/op 8.6424 ms/op 0.52
Tree 40 250000 create 283.03 ms/op 612.16 ms/op 0.46
Tree 40 250000 get(125000) 123.70 ns/op 256.78 ns/op 0.48
Tree 40 250000 set(125000) 933.50 ns/op 2.7537 us/op 0.34
Tree 40 250000 toArray() 20.433 ms/op 31.202 ms/op 0.65
Tree 40 250000 iterate all - toArray() + loop 11.500 ms/op 29.589 ms/op 0.39
Tree 40 250000 iterate all - get(i) 42.857 ms/op 90.211 ms/op 0.48
MutableVector 250000 create 6.0166 ms/op 12.321 ms/op 0.49
MutableVector 250000 get(125000) 5.8920 ns/op 7.1340 ns/op 0.83
MutableVector 250000 set(125000) 197.70 ns/op 286.53 ns/op 0.69
MutableVector 250000 toArray() 2.1446 ms/op 4.1770 ms/op 0.51
MutableVector 250000 iterate all - toArray() + loop 2.4072 ms/op 3.5924 ms/op 0.67
MutableVector 250000 iterate all - get(i) 1.3453 ms/op 1.6053 ms/op 0.84
Array 250000 create 2.2970 ms/op 3.6538 ms/op 0.63
Array 250000 clone - spread 847.39 us/op 1.1270 ms/op 0.75
Array 250000 get(125000) 0.47100 ns/op 0.53500 ns/op 0.88
Array 250000 set(125000) 0.53800 ns/op 0.59500 ns/op 0.90
Array 250000 iterate all - loop 75.096 us/op 114.58 us/op 0.66
effectiveBalanceIncrements clone Uint8Array 300000 17.800 us/op 43.954 us/op 0.40
effectiveBalanceIncrements clone MutableVector 300000 264.00 ns/op 261.00 ns/op 1.01
effectiveBalanceIncrements rw all Uint8Array 300000 169.15 us/op 180.53 us/op 0.94
effectiveBalanceIncrements rw all MutableVector 300000 56.078 ms/op 87.111 ms/op 0.64
phase0 afterProcessEpoch - 250000 vs - 7PWei 76.851 ms/op 117.62 ms/op 0.65
phase0 beforeProcessEpoch - 250000 vs - 7PWei 30.031 ms/op 45.211 ms/op 0.66
altair processEpoch - mainnet_e81889 334.40 ms/op 539.26 ms/op 0.62
mainnet_e81889 - altair beforeProcessEpoch 50.105 ms/op 73.030 ms/op 0.69
mainnet_e81889 - altair processJustificationAndFinalization 12.542 us/op 26.734 us/op 0.47
mainnet_e81889 - altair processInactivityUpdates 4.6630 ms/op 9.2618 ms/op 0.50
mainnet_e81889 - altair processRewardsAndPenalties 60.135 ms/op 72.098 ms/op 0.83
mainnet_e81889 - altair processRegistryUpdates 2.3340 us/op 3.5140 us/op 0.66
mainnet_e81889 - altair processSlashings 528.00 ns/op 483.00 ns/op 1.09
mainnet_e81889 - altair processEth1DataReset 542.00 ns/op 616.00 ns/op 0.88
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.5643 ms/op 1.2717 ms/op 1.23
mainnet_e81889 - altair processSlashingsReset 4.1140 us/op 3.0380 us/op 1.35
mainnet_e81889 - altair processRandaoMixesReset 3.9870 us/op 5.4130 us/op 0.74
mainnet_e81889 - altair processHistoricalRootsUpdate 663.00 ns/op 675.00 ns/op 0.98
mainnet_e81889 - altair processParticipationFlagUpdates 1.3480 us/op 2.1690 us/op 0.62
mainnet_e81889 - altair processSyncCommitteeUpdates 456.00 ns/op 566.00 ns/op 0.81
mainnet_e81889 - altair afterProcessEpoch 80.719 ms/op 127.72 ms/op 0.63
capella processEpoch - mainnet_e217614 1.0996 s/op 1.4948 s/op 0.74
mainnet_e217614 - capella beforeProcessEpoch 184.50 ms/op 248.44 ms/op 0.74
mainnet_e217614 - capella processJustificationAndFinalization 5.9870 us/op 13.190 us/op 0.45
mainnet_e217614 - capella processInactivityUpdates 15.147 ms/op 20.880 ms/op 0.73
mainnet_e217614 - capella processRewardsAndPenalties 235.90 ms/op 267.86 ms/op 0.88
mainnet_e217614 - capella processRegistryUpdates 17.991 us/op 21.471 us/op 0.84
mainnet_e217614 - capella processSlashings 647.00 ns/op 488.00 ns/op 1.33
mainnet_e217614 - capella processEth1DataReset 508.00 ns/op 686.00 ns/op 0.74
mainnet_e217614 - capella processEffectiveBalanceUpdates 3.1034 ms/op 4.1244 ms/op 0.75
mainnet_e217614 - capella processSlashingsReset 1.0430 us/op 2.6250 us/op 0.40
mainnet_e217614 - capella processRandaoMixesReset 2.8180 us/op 3.8080 us/op 0.74
mainnet_e217614 - capella processHistoricalRootsUpdate 577.00 ns/op 820.00 ns/op 0.70
mainnet_e217614 - capella processParticipationFlagUpdates 982.00 ns/op 3.5180 us/op 0.28
mainnet_e217614 - capella afterProcessEpoch 191.01 ms/op 305.07 ms/op 0.63
phase0 processEpoch - mainnet_e58758 355.10 ms/op 457.66 ms/op 0.78
mainnet_e58758 - phase0 beforeProcessEpoch 103.39 ms/op 105.88 ms/op 0.98
mainnet_e58758 - phase0 processJustificationAndFinalization 10.890 us/op 24.355 us/op 0.45
mainnet_e58758 - phase0 processRewardsAndPenalties 52.372 ms/op 50.684 ms/op 1.03
mainnet_e58758 - phase0 processRegistryUpdates 7.9300 us/op 10.551 us/op 0.75
mainnet_e58758 - phase0 processSlashings 586.00 ns/op 602.00 ns/op 0.97
mainnet_e58758 - phase0 processEth1DataReset 503.00 ns/op 593.00 ns/op 0.85
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.2777 ms/op 1.0484 ms/op 1.22
mainnet_e58758 - phase0 processSlashingsReset 1.8060 us/op 3.5800 us/op 0.50
mainnet_e58758 - phase0 processRandaoMixesReset 2.4520 us/op 5.7860 us/op 0.42
mainnet_e58758 - phase0 processHistoricalRootsUpdate 574.00 ns/op 405.00 ns/op 1.42
mainnet_e58758 - phase0 processParticipationRecordUpdates 2.5880 us/op 4.0090 us/op 0.65
mainnet_e58758 - phase0 afterProcessEpoch 67.437 ms/op 106.61 ms/op 0.63
phase0 processEffectiveBalanceUpdates - 250000 normalcase 900.57 us/op 1.2626 ms/op 0.71
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.0533 ms/op 1.9395 ms/op 0.54
altair processInactivityUpdates - 250000 normalcase 14.162 ms/op 22.712 ms/op 0.62
altair processInactivityUpdates - 250000 worstcase 13.910 ms/op 21.091 ms/op 0.66
phase0 processRegistryUpdates - 250000 normalcase 7.4580 us/op 9.6820 us/op 0.77
phase0 processRegistryUpdates - 250000 badcase_full_deposits 372.89 us/op 340.64 us/op 1.09
phase0 processRegistryUpdates - 250000 worstcase 0.5 104.26 ms/op 129.89 ms/op 0.80
altair processRewardsAndPenalties - 250000 normalcase 43.548 ms/op 65.411 ms/op 0.67
altair processRewardsAndPenalties - 250000 worstcase 53.243 ms/op 64.909 ms/op 0.82
phase0 getAttestationDeltas - 250000 normalcase 5.2005 ms/op 9.5013 ms/op 0.55
phase0 getAttestationDeltas - 250000 worstcase 5.2823 ms/op 9.5946 ms/op 0.55
phase0 processSlashings - 250000 worstcase 1.5291 ms/op 2.5712 ms/op 0.59
altair processSyncCommitteeUpdates - 250000 97.703 ms/op 153.09 ms/op 0.64
BeaconState.hashTreeRoot - No change 354.00 ns/op 385.00 ns/op 0.92
BeaconState.hashTreeRoot - 1 full validator 135.22 us/op 177.07 us/op 0.76
BeaconState.hashTreeRoot - 32 full validator 1.0284 ms/op 1.8060 ms/op 0.57
BeaconState.hashTreeRoot - 512 full validator 9.8608 ms/op 13.170 ms/op 0.75
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 140.06 us/op 147.54 us/op 0.95
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.8153 ms/op 1.9974 ms/op 0.91
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 32.631 ms/op 33.619 ms/op 0.97
BeaconState.hashTreeRoot - 1 balances 141.10 us/op 125.59 us/op 1.12
BeaconState.hashTreeRoot - 32 balances 995.47 us/op 1.1438 ms/op 0.87
BeaconState.hashTreeRoot - 512 balances 9.7370 ms/op 9.7644 ms/op 1.00
BeaconState.hashTreeRoot - 250000 balances 175.84 ms/op 177.21 ms/op 0.99
aggregationBits - 2048 els - zipIndexesInBitList 11.243 us/op 15.743 us/op 0.71
regular array get 100000 times 29.520 us/op 43.631 us/op 0.68
wrappedArray get 100000 times 29.909 us/op 33.569 us/op 0.89
arrayWithProxy get 100000 times 9.8868 ms/op 15.936 ms/op 0.62
ssz.Root.equals 233.00 ns/op 224.00 ns/op 1.04
byteArrayEquals 220.00 ns/op 221.00 ns/op 1.00
shuffle list - 16384 els 4.4901 ms/op 7.1860 ms/op 0.62
shuffle list - 250000 els 65.164 ms/op 106.29 ms/op 0.61
processSlot - 1 slots 16.279 us/op 16.702 us/op 0.97
processSlot - 32 slots 3.4913 ms/op 4.1911 ms/op 0.83
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 46.358 ms/op 61.869 ms/op 0.75
getCommitteeAssignments - req 1 vs - 250000 vc 2.9857 ms/op 2.6481 ms/op 1.13
getCommitteeAssignments - req 100 vs - 250000 vc 4.0080 ms/op 3.8053 ms/op 1.05
getCommitteeAssignments - req 1000 vs - 250000 vc 3.9570 ms/op 4.2163 ms/op 0.94
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 6.1900 ns/op 5.1500 ns/op 1.20
state getBlockRootAtSlot - 250000 vs - 7PWei 496.86 ns/op 725.73 ns/op 0.68
computeProposers - vc 250000 6.9908 ms/op 9.7152 ms/op 0.72
computeEpochShuffling - vc 250000 83.540 ms/op 109.02 ms/op 0.77
getNextSyncCommittee - vc 250000 123.17 ms/op 164.06 ms/op 0.75
computeSigningRoot for AttestationData 27.353 us/op 29.969 us/op 0.91
hash AttestationData serialized data then Buffer.toString(base64) 1.6185 us/op 2.4455 us/op 0.66
toHexString serialized data 1.1670 us/op 1.2606 us/op 0.93
Buffer.toString(base64) 262.38 ns/op 240.19 ns/op 1.09

by benchmarkbot/action

@@ -103,7 +100,7 @@ export class DoppelgangerService {
const indicesToCheckMap = new Map<ValidatorIndex, PubkeyHex>();

for (const [pubkeyHex, state] of this.doppelgangerStateByPubkey.entries()) {
if (state.remainingEpochs > 0) {
if (state.remainingEpochs > 0 && state.nextEpochToCheck <= currentEpoch) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it not redundant condition? Is notremainingEpochs already related to currentEpoch?

Copy link
Member Author

@nflaig nflaig Sep 29, 2023

Choose a reason for hiding this comment

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

There is a difference, if a validator is registered first time state.remainingEpochs will always be > 0 (unless pre-genesis)

const remainingEpochs = currentEpoch <= 0 ? 0 : DEFAULT_REMAINING_DETECTION_EPOCHS;

and state.nextEpochToCheck will always be current epoch + 1.

const nextEpochToCheck = currentEpoch + 1;

This means that the first time we check liveness for a validator it is for a epoch that is not relevant because it will be skipped anyways (see PR description).

The main goal of checking the epoch here is to skip earlier, this avoids unnecessary liveness requests to the beacon node.

@nflaig nflaig force-pushed the nflaig/doppelganger-liveness-check branch from 26cc38e to 4ad6603 Compare September 29, 2023 12:49
@nflaig nflaig merged commit 4288f8c into unstable Sep 29, 2023
14 of 15 checks passed
@nflaig nflaig deleted the nflaig/doppelganger-liveness-check branch September 29, 2023 13:18
@wemeetagain
Copy link
Member

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