validator: detect a slashed validator, warn loudly, and optionally stop
メンテナーはふだん 6 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 活発
- 技術スタック
- rust
調査の方向性
Start with crates/validator/src/lib.rs around refresh_epoch and trace how resolved validator entries feed duties and fee-recipient preparations; read the DTO and beacon node references named in the issue. The proposal leaves key behavior undecided, including whether to stop the process, how to handle sync committee duties, and how to verify a slashing report. Done would require settling those decisions and covering the proposed DTO, mock beacon node, and stop-flag behavior with tests.
索引モデルが issue の本文から書いたものです。
説明
The validator client never notices that one of its keys has been slashed. It keeps signing for that key, says nothing, and keeps running every other key under the same setup that got the first one slashed. The data that would tell it is already fetched every epoch.
Code references are at bf66e86c.
What happens today
refresh_epochresolves every loaded key once an epoch throughPOST /eth/v1/beacon/states/head/validators(crates/validator/src/lib.rs:986,crates/validator/src/beacon_node/http.rs:670-698). The response carries each validator'sstatusandvalidator.slashed, as the DTO test body shows (crates/validator/src/beacon_node/dto.rs:936-950).ValidatorEntryDtokeepsindex,statusandvalidator.pubkey(dto.rs:282-293), soslashedis dropped on decode.statusreachesValidatorEntry(crates/validator/src/beacon_node/mod.rs:346-351) and is read only byis_registrable, which picks the keys that get builder registrations (lib.rs:1044,:1061-1063). Itsstarts_with("active")letsactive_slashedthrough, so a slashed key is still registered.- On current
main(#804) the duty loop keeps the epoch's resolved entries for the per-slot fee-recipient re-send (resolvedinrunat5d8628e9), so the statuses are in memory for the whole epoch. - Nothing logs a validator's status, a change of status, or a slashing. No metric carries a per-validator label (
crates/validator/src/metrics.rs). - The client subscribes to no beacon node events. An ethlambda beacon node would not send
proposer_slashingorattester_slashingevents anyway: it accepts the topics and never emits them (docs/rpc.md:999-1003). - Duties go on for the slashed key. Its proposals are invalid, since
process_block_headerrefuses a slashed proposer (crates/blockchain/state_transition/src/beacon/stf/block.rs:254-257). Its attestations earn nothing, since attestation rewards count only unslashed participants (get_unslashed_participating_indices,crates/blockchain/state_transition/src/beacon/helpers/altair.rs:242).
Why it matters
The slashed key itself has little left to lose. It cannot be slashed a second time (is_slashable_validator requires !slashed, crates/blockchain/state_transition/src/beacon/helpers/predicates.rs:35-39), and its duties earn nothing.
The other keys are what is at risk. A slashing means the setup is broken: the keys are running in a second place, slashing protection was bypassed (a key started with --init-slashing-protection that had history elsewhere, or a record restored from an old backup), or a key leaked. Whatever caused it usually applies to every key that shares the validators directory or the copied setup, and those keys are next. Each slashed validator's epoch-processing penalty grows with the total slashed in the surrounding window (process_slashings, crates/blockchain/state_transition/src/beacon/stf/epoch/electra.rs:279), so every further key slashed raises the cost for all of them. Stopping when the first is detected bounds that. Today the operator finds out from a block explorer or a falling balance.
What other clients do
| Client | Behavior | Read at |
|---|---|---|
| Teku | --shut-down-when-validator-slashed-enabled, off by default ("If enabled and an owned validator key is detected as slashed, the node will terminate. In this case, the service should not be restarted.") (teku/src/main/java/tech/pegasys/teku/cli/options/ValidatorOptions.java:195-203, default in validator/api/src/main/java/tech/pegasys/teku/validator/api/ValidatorConfig.java:54). When on, an owned key in a proposer or attester slashing event from the beacon node, or with status active_slashed or exited_slashed in a status update, logs a fatal line and exits with the fatal exit code (validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorTimingActions.java:128-176, slashingriskactions/SlashedValidatorShutDown.java:34-39, slashingriskactions/SlashingRiskAction.java:30) |
master @ 62a54b96 |
| Lighthouse | The validator client has no slashed handling (no slashed check anywhere under validator_client/). The beacon node's validator monitor exports validator_monitor_slashed per monitored validator (beacon_node/beacon_chain/src/metrics.rs:972-977) and logs a proposer or attester slashing that names one at crit (beacon_node/beacon_chain/src/validator_monitor.rs:1810-1817, :1864-1869) |
unstable @ 11813cfb |
| Nimbus | The beacon node's validator monitor exports validator_monitor_slashed (beacon_chain/validators/validator_monitor.nim:63) |
unstable @ 9bed158a |
| Prysm | The validator client exports a per-key validator_statuses gauge in which 5 is SLASHING (validator/client/metrics.go:22-31) |
develop @ 0c1e3d24 |
| Lodestar | The validator client folds active_slashed into "active" in its status summary (packages/validator/src/services/indices.ts:20-27) |
unstable @ 77088eb7 |
Teku is the only client read here that stops on a slashed key, and only when asked. Lighthouse and Nimbus surface it on the beacon node.
Proposal
- Read it. Declare
validator.slashedinValidatorEntryDtoand carry it inValidatorEntry.statusalone loses it once a validator reacheswithdrawal_possibleorwithdrawal_done. - Say it. In
refresh_epoch, log every slashed loaded key aterror!(pubkey, index, status) the first time it is seen, and keep a gauge of slashed loaded keys (ethlambda_validator_validators_slashed). - Stop signing for that key. Drop its proposer, attester and aggregation duties: a block from it is invalid and its attestations earn nothing. Leave it out of builder registrations (
is_registrable) and fee-recipient preparations. - Optionally stop the process. A flag (Teku's is
--shut-down-when-validator-slashed-enabled) that exits with a distinct, documented exit code and a message saying not to restart until the cause is found. - Events later. Polling once an epoch works against any beacon node, and a slashing shows in the head state as soon as a block includes it, so detection takes at most an epoch. Subscribing to
proposer_slashingandattester_slashingevents would cut that to seconds, against a node that emits them.
To decide
- The default. Warn, count and drop the slashed key's duties by default, with stopping opt-in as in Teku? Or stop by default, given that the other keys are the ones at risk?
- Restart loops. A supervisor with
Restart=alwayswould restart the client, which would detect the same key and exit again. DocumentRestartPreventExitStatus=with the exit code, or stay up with every key paused instead of exiting. - Trusting one node. With several
--beacon-nodesthe lookup takes the first node that answers (try_each,crates/validator/src/beacon_node/fallback.rs:325-328), so one faulty node reportingslashedwould stop the client. Confirm against a second node, or against the finalized state, before exiting? - The slashed key's sync committee duty. Sync committee rewards have no slashed check (
process_sync_aggregate,crates/blockchain/state_transition/src/beacon/stf/altair.rs:303), so a slashed member still earns them. Keep that duty, or drop every duty for simplicity?
Tests
- A DTO test decoding
"slashed": true. MockBeaconNoderesolving two keys, one slashed: the refresh logs it once, sets the gauge to 1, serves no duties for it and serves the other key's.- With the stop flag:
runreturns the dedicated error, and the binary maps it to its exit code.
- 主要言語
- Rust
- スター
- 86
- フォーク
- 34
- 平均マージ
- 9日 20時間
- マージ済み PR(30日)
- 77
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
lambdaclass/ethlambda のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
lambdaclass/ethlambda#850 ·
メンテナーはふだん 6 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
lambdaclass/ethlambda#777 · リアクション 1 件 ·
メンテナーはふだん 6 日以内に返信
-
Run all gossip validation tests再び着手できるかも @dicethedev が 9 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
lambdaclass/ethlambda#725 · コメント 2 件 ·
メンテナーはふだん 6 日以内に返信
-
Handle malformed DB data再び着手できるかも @dicethedev が 115 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
lambdaclass/ethlambda#529 · コメント 4 件 ·
メンテナーはふだん 6 日以内に返信
-
Document architectural choices再び着手できるかも @dicethedev が 115 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
lambdaclass/ethlambda#521 · コメント 2 件 ·
メンテナーはふだん 6 日以内に返信
lambdaclass/ethlambda の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
antithesishq/bombadil#473 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
libracoder/kiri#669 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 5 日以内に返信
-
autofixer: follow-up
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
tursodatabase/turso#12217 ·
メンテナーはふだん 1 日以内に返信
-
Declare the CMS schema library in the optional recipients extra対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea:python in-progress
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
yhay81/pyropdf#1005 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信