nimbus-eth2/docs/nbc_audit_2020/validator_core/slash_prevention_mechanisms.md

3.4 KiB
Raw Blame History

title code_owner round category repositories
Slash Prevention Mechanisms Mamy André-Ratsimbazafy (mratsim) Audit round 3 Validator Core Audit nim-beacon-chain

Note: Slashing Protection is a very new feature and not merged/enabled by default yet in the codebase.

For the moment it leaves in the PR: https://github.com/status-im/nim-beacon-chain/pull/1643


Resources

Overview of slashing and how it ties in with the rest of Eth2.0

Phase 0 for humans - Validator responsibilities:

Phase 0 spec - Honest Validator - how to avoid slashing

In-depth reading on slashing conditions

Reading on weak subjectivity

Reading of interop serialization format

Implementation

In validator_slashing_protection.nim (TODO merge PR and tag an audit branch) and used in validator_duties.nim (no VC/BN split) or validator_clients.nim (with Validator Client/Beacon Node split)

For slashing protection (in contrast to slashing detection) we only care about our own validators. We also assume that before signing a block or an attestation, the node is "synced" to the chain, i.e. it knows last finalized epoch of the whole blockchain.

The isSynced function has a naive heuristic for now and will be changed in the future to properly handle weak subjectivity period.

https://github.com/status-im/nim-beacon-chain/blob/nbc-audit-2020-1/beacon_chain/validator_duties.nim#L87-L111