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

Add slashing protection health check. #131

Merged
merged 6 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/HowTo/Configure-Slashing-Protection.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,17 @@ You can include additional optional pruning configuration options. For example,

Do not use slashing protection database pruning while [importing or exporting the database](#import-or-export-a-slashing-protection-database).

## Slashing protection health check

By default, Web3Signer performs a health check on the slashing protection database every 30000 milliseconds.
To change the default value, configure the [`--slashing-protection-db-health-check-interval-milliseconds`](../Reference/CLI/CLI-Subcommands.md#slashing-protection-db-health-check-interval-milliseconds)
command line option.

The service responds with a `200` message if healthy, and `503` if unhealthy.

You can also configure the health check timeout with the [`--slashing-protection-db-health-check-timeout-milliseconds`](../Reference/CLI/CLI-Subcommands.md#slashing-protection-db-health-check-timeout-milliseconds)
command line option. The timeout defaults to 3000 milliseconds.

<!-- links -->
[slashing protection]: ../Concepts/Slashing-Protection.md
[slashing protection database pruning]: #prune-the-slashing-protection-database
Expand Down
6 changes: 5 additions & 1 deletion docs/HowTo/Get-Started/Start-Web3Signer.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ Start the client, for example [Teku] by specifying the Web3Signer details.

## Confirm Web3Signer is running

Use the [`upcheck`](https://consensys.github.io/web3signer/web3signer-eth2.html#tag/Server-Status) endpoint to confirm Web3Signer is connected and running.
Use the [`upcheck`](https://consensys.github.io/web3signer/web3signer-eth2.html#tag/Server-Status) endpoint
to confirm Web3Signer is connected and running.

!!! example

Expand All @@ -78,6 +79,9 @@ Use the [`upcheck`](https://consensys.github.io/web3signer/web3signer-eth2.html#
200 OK
```

Web3Signer by default also performs a health check on the
[slashing protection database](../../HowTo/Configure-Slashing-Protection.md#slashing-protection-health-check).

<!-- Links -->
[Signing key configuration files]: ../Use-Signing-Keys.md
[Teku]: https://docs.teku.consensys.net/en/latest/HowTo/External-Signer/Use-External-Signer/
Expand Down
61 changes: 61 additions & 0 deletions docs/Reference/CLI/CLI-Subcommands.md
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,67 @@ Possible values are:
| `ropsten` | Consensus layer | Test | Multi-client testnet. |
| `gnosis` | Consensus layer | Test | Multi-client testnet. |

#### `slashing-protection-db-health-check-interval-milliseconds`

=== "Syntax"

```bash
--slashing-protection-db-health-check-interval-milliseconds=<INTERVAL>
```

=== "Example"

```bash
--slashing-protection-db-health-check-interval-milliseconds=20000
```

=== "Environment variable"

```bash
WEB3SIGNER_ETH2_SLASHING_PROTECTION_DB_HEALTH_CHECK_INTERVAL_MILLISECONDS=20000
```

=== "Configuration file"

```bash
eth2.slashing-protection-db-health-check-interval-milliseconds: 20000
```

Milliseconds between the slashing protection database health checks. The default is 30000.

The service responds with a `200` message if healthy, and `503` if unhealthy.

#### `slashing-protection-db-health-check-timeout-milliseconds`

=== "Syntax"

```bash
--slashing-protection-db-health-check-timeout-milliseconds=<INTERVAL>
```

=== "Example"

```bash
--slashing-protection-db-health-check-timeout-milliseconds=2000
```

=== "Environment variable"

```bash
WEB3SIGNER_ETH2_SLASHING_PROTECTION_DB_HEALTH_CHECK_TIMEOUT_MILLISECONDS=2000
```

=== "Configuration file"

```bash
eth2.slashing-protection-db-health-check-timeout-milliseconds: 2000
```

Milliseconds after which to fail the database health check. For example, if the health check
connects to the slashing protection database, but does not report back in a timely manner.

The default is 3000.

#### `slashing-protection-db-password`

=== "Syntax"
Expand Down