Skip to content

Commit a9b6e6a

Browse files
authored
Merge pull request #12 from ethereum/describe-dvc-slashing-db
Describe DVC slashing DB
2 parents 4ce9185 + bc4bb46 commit a9b6e6a

File tree

4 files changed

+52
-17
lines changed

4 files changed

+52
-17
lines changed

README.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ The Distributed Validator protocol presents a solution to mitigate the risks & c
1919

2020
### Basic Concepts
2121

22+
**Note**: Refer to the [glossary](glossary.md) for an explanation of new terms introduced in the Distributed Validator specifications.
23+
2224
The two fundamental concepts behind Distributed Validators are:
2325
- **consensus**: the responsibilities of a single validator are split among several co-validators, who must work together to reach agreement on how to vote before signing any message.
2426
- ***M-of-N* threshold signatures**: the validator's staking key is split into *N* pieces and each of the co-validators holds a share. When at least *M* of the co-validators reach consensus on how to vote, they each sign the message with their share and a combined signature can be reconstructed from the shares.
2527

2628
Ethereum proof-of-stake uses the BLS signature scheme, in which the private keys can be *M-of-N* secret-shared to implement *M-of-N* threshold signatures.
2729

28-
**Note**: Refer to the [glossary](glossary.md) for an explanation of new terms introduced in the Distributed Validator specifications.
29-
3030
By combining a suitable (safety-favouring) consensus algorithm with an *M-of-N* threshold signature scheme, the DV protocol ensures that agreement is backed up by cryptography and at least *M* co-validators agree about any decision.
3131

3232
### Resources
3333

3434
#### Implementations
3535

36-
The following are existing implementations of DIstributed Validator technology (but not necessarily implementations of this specification).
36+
The following are existing implementations of Distributed Validator technology (but not necessarily implementations of this specification).
3737

3838
- [`python-ssv`](https://github.com/dankrad/python-ssv): A proof-of-concept implementation of the distributed validator protocol in Python that interacts with the [Prysm Ethereum client](https://github.com/prysmaticlabs/prysm).
3939
- [`ssv`](https://github.com/bloxapp/ssv): An implementation of the distributed validator protocol in Go that interacts with the [Prysm Ethereum client](https://github.com/prysmaticlabs/prysm).
@@ -64,18 +64,6 @@ This specification presents a way to implement Distributed Validator Client soft
6464
- Under the assumption of a synchronous network, the Validator is never slashed unless more than 1/3rd of the Co-Validators are Byzantine.
6565
- **Liveness**: The protocol will eventually produce a new attestation/block under partially synchronous network unless more than 1/3rd of the Co-Validators are Byzantine.
6666

67-
## Spec
68-
69-
The specifications are organized as follows:
70-
- The [distributed validator specification](src/dvspec/spec.py) defines the behavior of a Co-Validator regarding attestation & block production processes.
71-
- The [Ethereum node interface](src/dvspec/eth_node_interface.py) describes the interface to communicate with the associated Beacon Node & Validator Client.
72-
- The [consensus specification](src/dvspec/consensus.py) describes the basic structure for the consensus protocol used between Co-Validators.
73-
- The [networking specification](src/dvspec/networking.py) defines the required networking logic between Distributed Validator Clients.
74-
75-
### Attestation Production Process
76-
77-
![UML for Attestation Production Process](figures/dv-attestation-production-process.png)
78-
79-
### Block Production Process
67+
## Specification
8068

81-
![UML for Block Production Process](figures/dv-block-production-process.png)
69+
Technical details about the specification are described in [`src/dvspec/`](src/dvspec/).

src/dvspec/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Ethereum Distributed Validator Specification
2+
3+
## Organization
4+
5+
The specifications are organized as follows:
6+
- [`spec.py` - distributed validator specification](spec.py) defines the behavior of a Co-Validator regarding attestation & block production processes.
7+
- [`eth_node_interface.py` - Ethereum node interface](eth_node_interface.py) describes the interface to communicate with the associated Beacon Node (BN) & Validator Client (VC).
8+
- [`consensus.py` - consensus specification](consensus.py) describes the basic structure for the consensus protocol used between Co-Validators.
9+
- [`networking.py` - networking specification](networking.py) defines the required networking logic between Distributed Validator Clients.
10+
- [`utils/` - utilities](utils/) contain type definitions and misc. helper functions for the specification.
11+
12+
## Operation of Distributed Validator Client (DVC)
13+
14+
### Communication between DVC and VC
15+
The BN & VC communicate over HTTP in accordance with the [Ethereum Beacon Node API](https://github.com/ethereum/beacon-APIs/). The DV protocol is designed such that the DVC can operate as middleware between the BN & VC. Both the BN & VC are unaware of the presence of the DVC - they communicate with the DVC as they would with each other.
16+
17+
The [interaction between the BN & VC](https://github.com/ethereum/beacon-APIs/blob/master/validator-flow.md) is driven by the VC, i.e., the VC starts the interaction by making the appropriate request at the BN's HTTP server. In this way, the VC never accepts incoming requests and does not host a server. The lack of a server prevents the DVC from instructing the VC to sign data whenever consensus is formed for a duty's data. The DVC instead caches the decided data for the duty, and responds to the VC's request for the duty's data using the cached value. If the DVC has not formed consensus over a duty's data when the VC makes a request for that duty's data, the HTTP request is "hung" until consensus is formed. This can be supported by the VC with appropriate parameter changes in the HTTP request it makes, without any implementation changes.
18+
19+
The basic operation of the DVC is as follows:
20+
1. Request duties from the BN at the start of every epoch
21+
2. Schedule serving of the received duties at the appropriate times
22+
3. Serve a duty when triggered by:
23+
1. Forming consensus with other Co-Validators over the data to be signed
24+
2. Caching the decided data to provide to the VC's request for data to be signed for this duty, and responding to the VC's request using the cached data
25+
3. Capturing the threshold signed data from the VC's response and broadcasting it to other Co-Validators
26+
4. Re-combination of threshold signed data after receiving enough threshold signed data shares
27+
28+
### Anti-Slashing Measures at the DVC
29+
VCs have an in-built slashing protection mechanism called the "slashing database" (a misnomer for "anti-slashing database"). The slashing database stores information about the messages that have been signed by the Validator. When new messages are to be signed, they are first checked against the slashing DB to ensure that a slashable pair of messages will not be produced (see - slashing rules for [attestations](https://github.com/ethereum/consensus-specs/blob/master/specs/phase0/beacon-chain.md#is_slashable_attestation_data) & [blocks](https://github.com/ethereum/consensus-specs/blob/master/specs/phase0/beacon-chain.md#proposer-slashings)).
30+
31+
While forming consensus over data, it is essential for the DVC to check the validity of the data against this slashing DB. However, since the DVC does not have direct access to the VC's slashing DB, it has to maintain a local cache of its state. The slashing DB at the DVC operates as follows:
32+
1. When initializing the setup, the DVC requires input about the state of the VC's slashing DB. When provided, the DVC will initialize a local slashing DB of its own with the given state.
33+
2. While forming consensus, the DVC checks that the proposed consensus value is not slashable against its slashing DB.
34+
3. When a consensus value is decided, the DVC adds the value to its slashing DB.
35+
36+
The initialization process can be carried out without change to the VC: with the VC and DVC shut down, manually export the VC's slashing DB and import it in the DVC. Automatic initialization of the DVC is not possible without changes to the VC implementation (this is a WIP feature in active discussion).
37+
38+
39+
## Sequence Diagrams
40+
41+
### Attestation Production Process
42+
43+
![UML for Attestation Production Process](figures/dv-attestation-production-process.png)
44+
45+
### Block Production Process
46+
47+
![UML for Block Production Process](figures/dv-block-production-process.png)
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)