Skip to content

Implement PerasVoteDB #156

@amesgen

Description

@amesgen

We need a PerasVoteDB that stores all votes of the current Peras round, and builds certificates out of votes if possible, submitting them to the

A simple API would look like this:

data PerasVoteDB m blk = PerasVoteDB {
    addVote :: PerasVote blk -> m () -- or a proper result/promise type
  , getVoteSnapshot :: STM m (PerasVoteSnapshot blk)
  }

where PerasVoteSnapshot is defined analogously to PerasCertSnapshot.

Opening a PerasVoteDB should spawn two threads:

  • One thread for garbage collection, removing all votes at the end of every round.
  • One thread for validating votes1 and aggregating them into partial certificates, and finally submitting them to the PerasCertDB (or rather invoking a given callback).

It might make sense to approach this ticket in two steps:

  • Implement just the vote storing + garbage collectiong functionality
  • Implement the maintenance of the (partial) certificate for the current round.

Depends on #151

Footnotes

  1. Maybe we already want to validate votes before (ie when they are received in the inbound mini-protocol thread), causing addVote to take a ValidatedPerasVote.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions