|
| 1 | +--- |
| 2 | +description: How to enable doppelganger detection |
| 3 | +--- |
| 4 | + |
| 5 | +# Enable doppelganger detection |
| 6 | + |
| 7 | +Doppelganger detection checks if the validators keys are already active before scheduling any of |
| 8 | +their duties (the validators stay inactive for at most two epochs). |
| 9 | +This can help prevent slashing offences. |
| 10 | + |
| 11 | +When enabled, doppelganger detection is triggered from two entry points: |
| 12 | + |
| 13 | +1. At [validator client startup](Get-Started/Run-Teku.md#start-teku): If at least one |
| 14 | + doppelganger is detected, the validator client shuts down after it finishes the check. |
| 15 | +1. When importing keys via the [key manager API](https://ethereum.github.io/keymanager-APIs/): Any |
| 16 | + detected doppelganger's keys are ignored (not imported). |
| 17 | + The other keys are imported and the validators start performing their duties after it finishes |
| 18 | + the check. |
| 19 | + |
| 20 | +!!! warning |
| 21 | + |
| 22 | + Doppelganger detection is an early access feature. |
| 23 | + This feature is imperfect and might fail to detect doppelgangers. |
| 24 | + Use this as a last resort option that might prevent validators from being slashed. |
| 25 | + |
| 26 | +## Enable doppelganger detection |
| 27 | + |
| 28 | +Enable doppelganger detection by setting the `--Xdoppelganger-detection-enabled` option to `true`. |
| 29 | + |
| 30 | +Your validator client must be connected to a beacon node with liveness tracking enabled. |
| 31 | +Enable liveness tracking by setting the `--Xbeacon-liveness-tracking-enabled` option to `true`. |
| 32 | + |
| 33 | +## Side effects |
| 34 | + |
| 35 | +Doppelganger detection runs until one of the following occurs: |
| 36 | + |
| 37 | +- All the loaded keys are detected as active. |
| 38 | +- The check runs for two epochs. |
| 39 | + |
| 40 | +This means that the validators being checked are inactive for at most two epochs. |
| 41 | + |
| 42 | +!!! warning |
| 43 | + |
| 44 | + Keeping the validators inactive might cause: |
| 45 | + |
| 46 | + - Missed attestations. |
| 47 | + - Missed sync committee contributions. |
| 48 | + - Missed block proposals. |
| 49 | + |
| 50 | + These side effects result in penalties and missed rewards. |
| 51 | + |
| 52 | +You might still consider these side effects a worthwhile trade-off of doppelganger detection, since |
| 53 | +it can prevent slashing. |
| 54 | + |
| 55 | +## Logs |
| 56 | + |
| 57 | +When running, doppelganger detection prints various logs. |
| 58 | + |
| 59 | +!!! example "Example startup logs" |
| 60 | + |
| 61 | + ```bash |
| 62 | + Starting doppelganger detection for public keys: b28ab22, c2bab15, cd26f5e |
| 63 | + ``` |
| 64 | + |
| 65 | +!!! example "Example logs when a check is performed (every 12 seconds)" |
| 66 | + |
| 67 | + ```bash |
| 68 | + Performing doppelganger check. Epoch 148220, Public keys b28ab22, c2bab15, cd26f5e |
| 69 | + ``` |
| 70 | + |
| 71 | +!!! example "Example logs when a doppelganger is detected" |
| 72 | + |
| 73 | + ```bash |
| 74 | + Detected 2 validators doppelganger: |
| 75 | + Index: xxxxxx, Public key: 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 |
| 76 | + Index: xxxxxx, Public key: 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002 |
| 77 | + ``` |
| 78 | + |
| 79 | +!!! example "Example logs: list of detected doppelgangers" |
| 80 | + |
| 81 | + ```bash |
| 82 | + Detected 5 validators doppelganger: |
| 83 | + Index: xxxxxx, Public key: 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 |
| 84 | + Index: xxxxxx, Public key: 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002 |
| 85 | + Index: xxxxxx, Public key: 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003 |
| 86 | + Index: xxxxxx, Public key: 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004 |
| 87 | + Index: xxxxxx, Public key: 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005 |
| 88 | + ``` |
| 89 | + |
| 90 | +!!! example "Example logs when doppelganger detection ends" |
| 91 | + |
| 92 | + ```bash |
| 93 | + Doppelganger detection check finished. Stopping doppelganger detection for public keys b28ab22, c2bab15, cd26f5e |
| 94 | + ``` |
0 commit comments