Skip to content

Commit 570dc08

Browse files
DG detection doc (#426)
* DG detection doc * edit dg detection and slashing prevention * remove trailing space * updating submodule to latest * updating submodule to latest * updating submodule to latest Co-authored-by: Alexandra Tran <[email protected]>
1 parent 043e6ce commit 570dc08

File tree

6 files changed

+133
-29
lines changed

6 files changed

+133
-29
lines changed

docs/Concepts/Slashing-Protection.md

+19-14
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
description: Describe how slash protection works in Teku
2+
description: Describe how slashing protection works in Teku
33
---
44

55
# Slashing protection
66

7-
Teku provides slashing protection to prevent validators from signing blocks or attestations
7+
Teku implements slashing protection to prevent validators from signing blocks or attestations
88
based on what it has already signed.
99

1010
By default, Teku also locks keystore files listed in the
@@ -27,11 +27,16 @@ blocks for each validator in the `<data-path>/validator/slashprotection/` direct
2727
Set `<data-path>` using the [`--data-path`](../Reference/CLI/CLI-Syntax.md#data-path) command
2828
line option.
2929

30-
Teku provides command line options to [import] or [export] the slash protection file.
30+
Teku provides command line options to [import] or [export] the slashing protection file.
3131

32-
## Validator slash protection file
32+
!!! tip
33+
Teku also supports [doppelganger detection](../HowTo/Doppelganger-Detection.md) to help prevent
34+
slashing.
35+
This is an early access feature.
3336

34-
The slash protection file records multiple values that protects the validator from incorrectly
37+
## Validator slashing protection file
38+
39+
The slashing protection file records multiple values that protects the validator from incorrectly
3540
signing blocks or attestations.
3641

3742
!!! example
@@ -62,14 +67,14 @@ The following rules apply to the file:
6267

6368
These rules guarantee the validator does not sign anything that is slashable.
6469

65-
## Migrate the slash protection file
70+
## Migrate the slashing protection file
6671

67-
Use the Teku command line options to [import] or [export] the slash protection file.
72+
Use the Teku command line options to [import] or [export] the slashing protection file.
6873
Alternatively you can manually migrate or create the database.
6974

7075
### Between Teku nodes
7176

72-
If moving a validator from one Teku node to another, you can manually migrate the slash protection
77+
If moving a validator from one Teku node to another, you can manually migrate the slashing protection
7378
file.
7479

7580
For example, to manually move the file from node A to node B:
@@ -86,9 +91,9 @@ For example, to manually move the file from node A to node B:
8691

8792
If moving a validator from a different client to Teku, you can either:
8893

89-
* Manually [create a new slash protection file] by setting the values based on the validator's last
94+
* Manually [create a new slashing protection file] by setting the values based on the validator's last
9095
signing details.
91-
* [Import] the slashing-protection file.
96+
* [Import] the slashing protection file.
9297

9398
To manually create the file, stop the other client to ensure it isn't signing, then set
9499
`lastSignedBlockSlot` to the current chain head slot + 1, `lastSignedAttestationSourceEpoch` to the
@@ -97,7 +102,7 @@ current justified checkpoint, and set `lastSignedAttestationTargetEpoch` to the
97102
Start the Teku node with the validator key.
98103

99104
<!-- links -->
100-
[YAML file is stored per validator]: #validator-slash-protection-file
101-
[create a new slash protection file]: #validator-slash-protection-file
102-
[import]: ../HowTo/Prevent-Slashing.md#importing-a-slashing-protection-file
103-
[export]: ../HowTo/Prevent-Slashing.md#exporting-a-slashing-protection-file
105+
[YAML file is stored per validator]: #validator-slashing-protection-file
106+
[create a new slashing protection file]: #validator-slashing-protection-file
107+
[import]: ../HowTo/Prevent-Slashing.md#import-a-slashing-protection-file
108+
[export]: ../HowTo/Prevent-Slashing.md#export-a-slashing-protection-file

docs/HowTo/Doppelganger-Detection.md

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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+
```

docs/HowTo/Prevent-Slashing.md

+15-11
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ title: Import or export a slashing protection file
44

55
# Slashing protection
66

7-
[Teku implements slashing protection] to prevent validators from signing incorrect
7+
Teku implements [slashing protection] to prevent validators from signing incorrect
88
blocks or attestations.
99

10-
You can import and export the slashing-protection file when migrating validator keys between
10+
You can import and export the slashing protection file when migrating validator keys between
1111
validator clients. Teku supports the [validator client interchange format] when importing or
12-
exporting the slashing-protection file.
12+
exporting the slashing protection file.
1313

1414
!!! note
1515

@@ -18,9 +18,13 @@ exporting the slashing-protection file.
1818
[`--validators-external-signer-slashing-protection-enabled`](../Reference/CLI/CLI-Syntax.md#validators-external-signer-slashing-protection-enabled)
1919
command line option.
2020

21-
## Importing a slashing-protection file
21+
!!! tip
22+
You can also [enable doppelganger detection](Doppelganger-Detection.md) to help prevent slashing.
23+
This is an early access feature.
2224

23-
When importing the slashing-protection file, Teku imports the file to the
25+
## Import a slashing protection file
26+
27+
When importing the slashing protection file, Teku imports the file to the
2428
`<data-path>/validators/slashprotection/` directory in the format `<validator-pubkey>.yml`
2529
(with no 0x prefix).
2630

@@ -35,13 +39,13 @@ In the command line:
3539
* [`--data-path`](../Reference/CLI/Subcommands/Slashing-Protection.md#data-path) specifies the
3640
location of the Teku `data` directory.
3741
* [`--from`](../Reference/CLI/Subcommands/Slashing-Protection.md#from) specifies the location of the
38-
slashing-protection file.
42+
slashing protection file.
3943

4044
In this example, Teku imports the file to the `/home/me/me_node/data/validators/slashprotection/` directory.
4145

42-
## Exporting a slashing-protection file
46+
## Export a slashing protection file
4347

44-
Export the slashing-protection file when migrating a validator to a different Teku, or non-Teku
48+
Export the slashing protection file when migrating a validator to a different Teku, or non-Teku
4549
node.
4650

4751
!!! example
@@ -55,12 +59,12 @@ In the command line:
5559
* [`--data-path`](../Reference/CLI/Subcommands/Slashing-Protection.md#data-path_1) specifies the location of the
5660
Teku `data` directory.
5761
* [`--to`](../Reference/CLI/Subcommands/Slashing-Protection.md#to) specifies the file to export the
58-
slashing-protection data to.
62+
slashing protection data to.
5963

60-
You can now import the slashing-protection file in a Teku, or non-Teku node.
64+
You can now import the slashing protection file in a Teku, or non-Teku node.
6165

6266
<!--links -->
63-
[Teku implements slashing protection]: ../Concepts/Slashing-Protection.md
67+
[slashing protection]: ../Concepts/Slashing-Protection.md
6468
[data path directory when starting Teku]: ../Reference/CLI/CLI-Syntax.md#data-path
6569
[validator client interchange format]: https://eips.ethereum.org/EIPS/eip-3076
6670
[Web3Signer]: https://docs.web3signer.consensys.net/en/latest/

docs/Reference/CLI/Subcommands/Slashing-Protection.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ Exports the database in the [validator client interchange format] format.
207207

208208
## `repair`
209209

210-
Repairs corrupted slashing-protection data files used by Teku.
210+
Repairs corrupted slashing protection data files used by Teku.
211211

212212
### `check-only-enabled`
213213

@@ -223,7 +223,7 @@ Repairs corrupted slashing-protection data files used by Teku.
223223
teku slashing-protection repair --checking-only-enabled=false
224224
```
225225

226-
Reads and reports potential slashing-protection file problems, but doesn't update any files.
226+
Reads and reports potential slashing protection file problems, but doesn't update any files.
227227
You can specify which files are checked using [`--config-file`](#config-file_2), [`--data-base-path`](#data-base-path-data-path).
228228

229229
### `config-file`
@@ -351,7 +351,7 @@ slot, or after when the validators stopped performing duties.
351351
teku slashing-protection repair --update-all-enabled=false
352352
```
353353

354-
Enables all slashing-protection records to be updated. The default is `false`.
354+
Enables all slashing protection records to be updated. The default is `false`.
355355

356356
<!-- links -->
357357
[slashing protection data]: ../../../Concepts/Slashing-Protection.md

mkdocs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ nav:
7676
- Configure Teku to use a builder network: HowTo/Configure/Builder-Network.md
7777
- Configure TLS: HowTo/Configure/Configure-TLS.md
7878
- Prevent slashing offences: HowTo/Prevent-Slashing.md
79+
- Enable doppelganger detection: HowTo/Doppelganger-Detection.md
7980
- Find and connect to peers:
8081
- Improve P2P connectivity: HowTo/Find-and-Connect/Improve-Connectivity.md
8182
- Specify NAT methods: HowTo/Find-and-Connect/Specifying-NAT.md

0 commit comments

Comments
 (0)