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

Committee-based consensus #42

Merged
merged 83 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
b8f6b6e
Init SIP
MatheusFranco99 Mar 6, 2024
e35a109
Add open questions
MatheusFranco99 Mar 6, 2024
b9580d8
Add to list files
MatheusFranco99 Mar 6, 2024
d00a09e
Add message validation concern
MatheusFranco99 Mar 6, 2024
d677fb3
Detail partial signature message change
MatheusFranco99 Mar 11, 2024
c58400e
Cryptography pre-requisites
MatheusFranco99 Mar 12, 2024
52c6be0
cluster_changes
GalRogozinski Apr 1, 2024
e474c91
delete post-consensus section in improvements
GalRogozinski Apr 2, 2024
69b33bf
comments
GalRogozinski Apr 2, 2024
6da43fb
review
GalRogozinski Apr 2, 2024
75902d5
type
GalRogozinski Apr 2, 2024
4ef9f88
Cluster based consensus changes (#48)
GalRogozinski Apr 2, 2024
6bdc74f
cluster runner
GalRogozinski Apr 7, 2024
af469ea
decides
GalRogozinski Apr 7, 2024
5be12f8
ClusterShare
GalRogozinski Apr 7, 2024
f7ffc3f
change cluster Share to interface
GalRogozinski Apr 8, 2024
318b9cb
Fis merge
GalRogozinski Apr 8, 2024
4eedf65
Cluster based consensus changes (#49)
GalRogozinski Apr 8, 2024
2c6541e
P2P - Network topology
MatheusFranco99 Apr 8, 2024
abe2e37
new partial message
GalRogozinski Apr 8, 2024
b01cd4e
P2P - Scoring
MatheusFranco99 Apr 8, 2024
81c552e
P2P - Scoring - Drawback
MatheusFranco99 Apr 8, 2024
17d3305
Update sips/cluster_consensus.md
moshe-blox Apr 8, 2024
ec812ac
omitting post-consensus
GalRogozinski Apr 8, 2024
e1a81ce
Merge branch 'cluster-consensus' into cluster-based-consensus-changes
GalRogozinski Apr 8, 2024
a3f9140
new partial sigs
GalRogozinski Apr 8, 2024
de817a7
Merge pull request #50 from GalRogozinski/cluster-based-consensus-cha…
moshe-blox Apr 8, 2024
20354ff
change design description
GalRogozinski Apr 8, 2024
a5c9955
PartialSigProcessing
GalRogozinski Apr 8, 2024
59f173a
Update sips/cluster_consensus.md
GalRogozinski Apr 8, 2024
9a53571
Update message validation
MatheusFranco99 Apr 9, 2024
fe48861
clusterID
GalRogozinski Apr 9, 2024
dde2a57
Roles
GalRogozinski Apr 9, 2024
932866b
change partial sig message
GalRogozinski Apr 9, 2024
3d1d752
fix clusterID
GalRogozinski Apr 9, 2024
87c3aa4
Update message validation according to latest changes
MatheusFranco99 Apr 9, 2024
c25ca01
add message ID
GalRogozinski Apr 9, 2024
2c7ac70
small message validation change
GalRogozinski Apr 9, 2024
3ddb431
adds cluster duty
GalRogozinski Apr 9, 2024
2876ed8
fix latex
GalRogozinski Apr 10, 2024
d5180e8
change type
GalRogozinski Apr 10, 2024
ca86b0c
Fix formula. Add 2/D
MatheusFranco99 Apr 15, 2024
a6433d0
partial sig
GalRogozinski Apr 14, 2024
acd194a
allign
GalRogozinski Apr 17, 2024
8c9ed09
rename cluster to committe
GalRogozinski Apr 17, 2024
2571a10
update sip
GalRogozinski Apr 18, 2024
bc2fc43
delete extra partial signature
GalRogozinski Apr 18, 2024
1d4ec7b
small fixes
GalRogozinski Apr 18, 2024
a35c5da
Update sips/cluster_consensus.md
MatheusFranco99 May 1, 2024
85cf052
Revert "Update sips/cluster_consensus.md"
MatheusFranco99 May 1, 2024
247f1ca
Update role name
MatheusFranco99 May 1, 2024
291af78
fix wording
GalRogozinski May 2, 2024
570dc4e
Fix subnet count
MatheusFranco99 May 6, 2024
aa75840
value-check
GalRogozinski May 13, 2024
41b8431
add value check
GalRogozinski May 13, 2024
814a41c
fix comments
GalRogozinski May 13, 2024
ceae4fa
delete comment
GalRogozinski May 13, 2024
abd9691
Merge branch 'cluster-consensus' of github.com:bloxapp/SIPs into clus…
GalRogozinski May 13, 2024
6b472d6
-1 -> max
GalRogozinski May 13, 2024
806020f
move code and add ShareMember
GalRogozinski May 16, 2024
d82418e
remove duplicate filter duty
GalRogozinski May 16, 2024
db9e3d6
delete todo
GalRogozinski May 16, 2024
0dfdd57
change names
GalRogozinski May 16, 2024
dd75a85
no interface and no stopping
GalRogozinski May 16, 2024
e474584
cutoff round and better comment
GalRogozinski May 16, 2024
2434e70
better wording
GalRogozinski May 16, 2024
8df6b0d
Add paragraph on partial signature message validation
MatheusFranco99 Jun 3, 2024
e98127d
remove sszs and add quorum
GalRogozinski Jun 9, 2024
803cee2
Merge branch 'cluster-consensus' of github.com:bloxapp/SIPs into clus…
GalRogozinski Jun 9, 2024
59ec82d
remove duplicate
GalRogozinski Jun 24, 2024
32859d0
Adjust msg rate computation for p2p scoring
MatheusFranco99 Jul 3, 2024
840b01d
add domain
GalRogozinski Jul 4, 2024
57ad4b3
small fix
GalRogozinski Jul 4, 2024
4abb15e
Make statistics code more verbose
MatheusFranco99 Jul 9, 2024
57e0613
fix empty space
GalRogozinski Jul 14, 2024
a632ebe
Merge branch 'main' into cluster-consensus
GalRogozinski Jul 14, 2024
f656f40
Update sips/committee_consensus.md
GalRogozinski Jul 14, 2024
370f82a
Update sips/committee_consensus.md
GalRogozinski Jul 14, 2024
a98f481
fix comment
GalRogozinski Jul 14, 2024
c323d01
Merge branch 'main' into cluster-consensus
GalRogozinski Jul 14, 2024
e3c1a29
core.md
GalRogozinski Jul 14, 2024
2720bdf
remove network topology
GalRogozinski Jul 14, 2024
0b30a5e
cutoff round
GalRogozinski Jul 14, 2024
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
21 changes: 11 additions & 10 deletions all.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
## All SIPS

| SIP # | Title | Status |
|---------------------------------------|-----------------------------|--------|
| [1](./sips/dkg.md) | DKG | open-for-discussion |
| [2](./sips/msg_struct_encoding.md) | Message struct and encoding | open-for-discussion |
| [3](./sips/qbft_sync.md) | QBFT Sync | open-for-discussion |
| [4](./sips/change_operator.md) | Change operators set | open-for-discussion |
| [5](./sips/ecies_share_encryption.md) | ECIES Share Encryption | open-for-discussion |
| [6](./sips/constant_qbft_timeout.md) | Constant QBFT timeout | open-for-discussion |
| [7](./sips/fork_support.md) | Fork Support | open-for-discussion |
| [8](./sips/pre_consensus_livness.md) | Pre-Consensus livness fix | open-for-discussion |
| SIP # | Title | Status |
|---------------------------------------|-----------------------------|---------------------|
| [1](./sips/dkg.md) | DKG | open-for-discussion |
| [2](./sips/msg_struct_encoding.md) | Message struct and encoding | open-for-discussion |
| [3](./sips/qbft_sync.md) | QBFT Sync | open-for-discussion |
| [4](./sips/change_operator.md) | Change operators set | open-for-discussion |
| [5](./sips/ecies_share_encryption.md) | ECIES Share Encryption | open-for-discussion |
| [6](./sips/constant_qbft_timeout.md) | Constant QBFT timeout | open-for-discussion |
| [7](./sips/fork_support.md) | Fork Support | open-for-discussion |
| [8](./sips/pre_consensus_livness.md) | Pre-Consensus livness fix | open-for-discussion |
| [9](./sips/cluster_consensus.md) | Cluster-based consensus | open-for-discussion |
21 changes: 11 additions & 10 deletions core.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
## Core

| SIP # | Title | Status |
|------------------------------------|-----------------------------|--------|
| [1](./sips/dkg.md) | DKG | open-for-discussion |
| [2](./sips/msg_struct_encoding.md) | Message struct and encoding | open-for-discussion |
| [3](./sips/qbft_sync.md) | QBFT Sync | open-for-discussion |
| [4](./sips/change_operator.md) | Change operators set | open-for-discussion |
| [5](./sips/ecies_share_encryption.md) | ECIES Share Encryption | open-for-discussion |
| [6](./sips/constant_qbft_timeout.md) | Constant QBFT timeout | open-for-discussion |
| [7](./sips/fork_support.md) | Fork Support | open-for-discussion |
| [8](./sips/pre_consensus_livness.md) | Pre-Consensus livness fix | open-for-discussion |
| SIP # | Title | Status |
|---------------------------------------|-----------------------------|---------------------|
| [1](./sips/dkg.md) | DKG | open-for-discussion |
| [2](./sips/msg_struct_encoding.md) | Message struct and encoding | open-for-discussion |
| [3](./sips/qbft_sync.md) | QBFT Sync | open-for-discussion |
| [4](./sips/change_operator.md) | Change operators set | open-for-discussion |
| [5](./sips/ecies_share_encryption.md) | ECIES Share Encryption | open-for-discussion |
| [6](./sips/constant_qbft_timeout.md) | Constant QBFT timeout | open-for-discussion |
| [7](./sips/fork_support.md) | Fork Support | open-for-discussion |
| [8](./sips/pre_consensus_livness.md) | Pre-Consensus livness fix | open-for-discussion |
| [9](./sips/cluster_consensus.md) | Cluster-based consensus | open-for-discussion |
127 changes: 127 additions & 0 deletions sips/cluster_consensus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
| Author | Title | Category | Status | Date |
| -------------- | -------------------------- | ---------- | ------------------- | ---------- |
| Matheus Franco | Cluster consensus | Core | open-for-discussion | 2024-03-05 |

## Summary

Aggregate `Attestation` and `Sync Committee` duties based on the cluster of operators and the duties' slot. Also, merge the post-consensus partial signature messages for such duties into a single message.
GalRogozinski marked this conversation as resolved.
Show resolved Hide resolved

## Motivation

With the current design, a cluster of operators associated with several validators may end up performing more than one attestation or sync committee duties on equivalent data.

## Rationale

The aggregation of duties is possible because the data that must be agreed on is independent of the validator.

For example, take a look at the `AttestationData` type.
```go
type AttestationData struct {
Slot Slot
Index CommitteeIndex
BeaconBlockRoot Root `ssz-size:"32"`
Source *Checkpoint
Target *Checkpoint
}
```
The only validator-dependent field is `CommitteeIndex` and it does not have to be agreed on.

For the `Sync Committee` duty, operators agree on a `phase0.Root` data which is also independent of the validator.

On the other hand, a post-consensus phase is still required for each duty that was previously aggregated. Thus, the partial signatures for each validator must still be shared between parties.

## Improvement

This proposal helps to decrease the number of messages exchanged in the network and the processing cost.

According to Monte Carlo simulations using a dataset based on the Mainnet, this proposal reduces to $21.60$% the current number of messages exchanged in the network. Note that this result includes aggregating the post-consensus messages into a single message.

Regarding the number of bits exchanged, we estimate that this proposal will reduce the current value to, at least, $52.96$%. Notice that this reduction is not as significant as the number of messages reduction due to the larger post-consensus messages.

Again with Monte Carlo simulations using the Mainnet dataset, the number of attestation duties aggregated presented the following distribution (notice that it also represents the number of partial signature messages merged into a single message).

<p align="center">
<img src="./images/cluster_consensus/aggregated_duties.png" width="50%" height="10%">
</p>

## Spec changes

### Design

Currently, an operator manages many `Validator` objects. Each has a `DutyRunner` for a duty type, each with its own `QBFTController` with its unique ID (that is also inserted in its associated messages).

<p align="center">
<img src="./images/cluster_consensus/previous_scheme.drawio.png" width="50%" height="10%">
</p>

For the proposed change to take place, different `Validator` objects should use the same `QBFT Instance`. For that, we propose decoupling the `QBFTController` object from the `DutyRunner`.

<p align="center">
<img src="./images/cluster_consensus/new_scheme.drawio.png" width="50%" height="10%">
</p>

### New IDs

Since a single `QBFT instance` will be responsible for several validator duties, its ID must not be dependent on a validator key but rather on a cluster of operators. For that, we propose changing the `MessageID` from

```mermaid
flowchart RL
subgraph MessageID
Domain
ValidatorPublicKey
Role
end
```

to


```mermaid
flowchart RL
subgraph MessageID
Domain
OperatorCluster
Role
end
```

### QBFT Controller

The current `QBFTController` structure allows only one consensus instance at a time. This must change, extending the `QBFTController` into a router of messages for the different instances.
GalRogozinski marked this conversation as resolved.
Show resolved Hide resolved

### DutyRunner & QBFT Controller

Since the `DutyRunner` will not have its specific `QBFTController`, it must have a way to start a consensus instance and receive its decided value. For that, we propose applying the observer design pattern by which the `DutyRunner` (observer) can be updated upon a `QBFT Instance` (observable) termination.

We suggest that the `DutyRunner` holds a reference to the operator's `QBFTController` to start a `QBFT Instance` and observe it.

```go
func (r *DutyRunner) execute() {
r.QBFTController.StartConsensus(r.committee, r.duty, r)
}

func (c *QBFTController) StartConsensus(committee []types.Operator, duty types.Duty, observer Observer) {
instance := c.StartInstance(committee, duty)
instance.registerObserver(observer)
}
```
GalRogozinski marked this conversation as resolved.
Show resolved Hide resolved

## Drawbacks

- Several duties will depend on the same consensus execution. Thus, its failure will imply many attestation misses. Nonetheless, this will also make the operator more scalable due to the overall reduction in exchanged messages and processing costs.

## Extra improvements

- If multiple partial signatures contained in a merged message refer to the same root (i.e. validators in the same Ethereum committee), the signatures can be verified using batch verification.
GalRogozinski marked this conversation as resolved.
Show resolved Hide resolved

## Message Validation

This duties transformation requires similar changes in message validation, namely:
- Different consensus executions are tagged by the `MessageID`. This change would be propagated with no further issues. However, the `MessageID` is used to get the validator's public key and the duty's role which are used as an ID to store the consensus state. This must be changed to use the operators' committee and the duty's role, or even simply the `MessageID`.
- Message validation limits the number of attestation duties per validator by using the validator's public key contained in the `MessageID`. This is no longer possible. A new limitation can be accomplished by checking the number of validators a cluster of operators is assigned to. If this number is less than 32 (the number of slots in an epoch), then we can limit the number of attestation duties of such cluster per epoch. The only exception would be if such a cluster is assigned to a sync committee duty (considering that we will indeed merge attestations and sync committee duties altogether in the same consensus execution).
GalRogozinski marked this conversation as resolved.
Show resolved Hide resolved

## Open questions

- What should be the maximum number of signatures a post-consensus message can contain? The trade-off here refers to reducing the number of exchanged messages versus reducing the impact of a DoS buffer attack attempt.
GalRogozinski marked this conversation as resolved.
Show resolved Hide resolved
- Though the number of consensus instances could be reduced to 1 (per unique operators cluster), the number of post-consensus phases is still defined by the number of validators. It remains open if it's possible to share partial signatures and re-construct all validator signatures in constant time per unique clusters.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.