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

[EFM] Protocol State represents DKG key vectors as mapping #6214

Open
5 of 7 tasks
jordanschalm opened this issue Jul 12, 2024 · 0 comments
Open
5 of 7 tasks

[EFM] Protocol State represents DKG key vectors as mapping #6214

jordanschalm opened this issue Jul 12, 2024 · 0 comments
Assignees
Labels
Epic Protocol Team: Issues assigned to the Protocol Pillar.

Comments

@jordanschalm
Copy link
Member

jordanschalm commented Jul 12, 2024

Problem Definition

General Context

Currently DKG committees are stored and represented in most places in our codebase as an ordered list of keys $K$ corresponding to a consensus committee $C$. There are equal numbers of keys and consensus committee members, and if $C$ is ordered according to canonical ordering, then $K[i]$ is the key for $C[i]$. The index of a node in the consensus committee is always equal to the index of that node's key in the DKG key list.

Let $D$ be the set of nodes that participated in the DKG yielding $K$. Our model works when $D=C$, but does not work in any other case.

  • This representation does not map well to the underlying DKG index concept, where indices are meaningful and not necessarily consecutive.
  • This representation cannot represent cases where:
    • $\exists n : n \in D, n \notin C$ - there is a node that participated in the DKG, but isn't in the committee
    • $\exists n : n \in C, n \notin D$ - there is a node that is in the committee, but didn't participate in the DKG

We would like to change the way DKG committees are represented to support the above cases.

New DKG Data Model

The updated data model should include the following fields:

  • PubKeys - A list of all individual public keys, ordered by DKG index.
    • []crypto.PublicKey in Go
    • [String] in Cadence, each element being a hex-encoded string
  • IndexMap - A mapping from node ID to DKG index (includes node IDs that do not exist in the consensus committee)
    • map[flow.Identifier]int in Go
    • {String:Int} in Cadence, keys being hex-encoded identifiers
  • GroupKey - The single group public key. crypto.PublicKey in Go, String (hex-encoded) in Cadence.

It has the invariants:

  • len(PubKeys) = len(IndexMap)
  • IndexMap values form the set {0, 1, ..., n-1} where n=len(PubKeys)

Specifics for this Issue

Update the Protocol State's internal representation of DKG committees, its interactions with the crypto layer, and its interactions with the FlowDKG smart contract, to be compatible with the cases above.

Proposed Solution

Definition of Done

The existing epoch integration tests should pass, after implementing this and #6213. We will test the cases of mismatched consensus committee and DKG committee as part of #5945.

Ideally we also create an integration test for the case where the committees are mismatched, in particular the case where a node is ejected/un-staked before the RecoveryEpoch.

Tasks

  1. Protocol S-Consensus
    durkmurder
  2. Protocol S-Consensus
    durkmurder
  3. S-BFT S-Consensus
    durkmurder
  4. Integration testing Protocol
    jordanschalm
  5. S-Consensus Tech Debt
    durkmurder
  6. Protocol S-BFT
    durkmurder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Epic Protocol Team: Issues assigned to the Protocol Pillar.
Projects
None yet
Development

No branches or pull requests

2 participants