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

Closed
6 tasks done
jordanschalm opened this issue Jul 12, 2024 · 2 comments
Closed
6 tasks done

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

jordanschalm opened this issue Jul 12, 2024 · 2 comments
Assignees
Labels
Epic Preserve Stale Bot repellent 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

Preview Give feedback
  1. Protocol S-Consensus
    durkmurder
  2. Protocol S-Consensus
    durkmurder
  3. S-BFT S-Consensus
    durkmurder
  4. S-Consensus Tech Debt
    durkmurder
  5. Protocol S-BFT
    durkmurder
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale Label used when marking an issue stale. label Dec 24, 2024
@franklywatson franklywatson added Preserve Stale Bot repellent and removed Stale Label used when marking an issue stale. labels Dec 30, 2024
@jordanschalm
Copy link
Member Author

Only remaining issue is BN testing, closing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Epic Preserve Stale Bot repellent Protocol Team: Issues assigned to the Protocol Pillar.
Projects
None yet
Development

No branches or pull requests

3 participants