[Peras 15] State-machine tests for PerasVoteDB#1809
Merged
agustinmista merged 1 commit intomainfrom Mar 5, 2026
Merged
Conversation
2baa738 to
2a042da
Compare
7dab848 to
6b35d34
Compare
8127942 to
748f5a4
Compare
748f5a4 to
9019813
Compare
d690be1 to
0c8ce7c
Compare
9019813 to
f937cb5
Compare
0c8ce7c to
1def8ad
Compare
1def8ad to
c5b60c6
Compare
tbagrel1
approved these changes
Jan 19, 2026
Contributor
tbagrel1
left a comment
There was a problem hiding this comment.
Looks good to me! I've left a few questions about some non-crucial code choices :)
ouroboros-consensus/test/storage-test/Test/Ouroboros/Storage/PerasVoteDB/Model.hs
Show resolved
Hide resolved
ouroboros-consensus/test/storage-test/Test/Ouroboros/Storage/PerasVoteDB/Model.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/test/storage-test/Test/Ouroboros/Storage/PerasVoteDB/Model.hs
Show resolved
Hide resolved
ouroboros-consensus/test/storage-test/Test/Ouroboros/Storage/PerasVoteDB/StateMachine.hs
Show resolved
Hide resolved
ouroboros-consensus/test/storage-test/Test/Ouroboros/Storage/PerasVoteDB/StateMachine.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus/test/storage-test/Test/Ouroboros/Storage/PerasVoteDB/StateMachine.hs
Show resolved
Hide resolved
ouroboros-consensus/test/storage-test/Test/Ouroboros/Storage/PerasVoteDB/StateMachine.hs
Outdated
Show resolved
Hide resolved
b434a16 to
ba755b8
Compare
f937cb5 to
7917f6b
Compare
ba755b8 to
d71274e
Compare
9fa47c0 to
77d474b
Compare
5be3ab8 to
14c6744
Compare
9e25257 to
70f7391
Compare
1860284 to
a827b36
Compare
2335e29 to
73512ec
Compare
ce71257 to
cb15a80
Compare
73512ec to
9bdf301
Compare
cb15a80 to
1a3a058
Compare
9bdf301 to
8f5d17f
Compare
1a3a058 to
109a836
Compare
8f5d17f to
2d39a99
Compare
bc855a0 to
023456f
Compare
30c6f5c to
0f9fd8e
Compare
023456f to
cc3b2fd
Compare
0f9fd8e to
b44c169
Compare
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 23, 2026
This PR introduces the API and implementation of an in-memory database to store Peras votes received from other peers via ObjectDiffusion. NOTES; * To keep things compartmentalized, `O.C.Peras.Vote.Aggregation` implements the tricky parts of the vote aggregation logic within a given round, exposing only the interesting event of having _just_ reached quorum via the `VoteGeneratedCert` and `VoteDidntGenerateCert` pattern synonyms. * Having multiple winners in the same round should, in principle, be impossible under the right parameterization (i.e. quorum threshold >= 75%). Since this will be ultimately become a tunable parameter, we resort to throw a `MultipleWinnersInRound` exception instead of a bare call to `error`. In addition, selecting the committee via Local Sortition in the future will add an extra level of statistical uncertainty that needs to be accounted for. This is because the _actual_ size of voting committee might differ from the _expected_ one, so one needs to end up asking for a stronger quorum to be reached before declaring a round winner. This is now kept as a separate `PerasQuorumStakeSafetyMargin` parameter. * This PR is already rather large, so state-machine testing is implemented separately in [Peras 15](#1809).
jasagredo
approved these changes
Mar 4, 2026
Contributor
jasagredo
left a comment
There was a problem hiding this comment.
Changes look good, but remove the changelog fragment
ouroboros-consensus/changelog.d/20251231_104054_agustin.mista_vote_db_tests.md
Outdated
Show resolved
Hide resolved
b44c169 to
c4b3eb7
Compare
This commit implements state-machine tests for the PerasVoteDB using quickcheck-dynamic. Notably, we define rather constrained generators to increase the chances of (among others): * Voting for the same target more than once (normal behavior), * Voting more than once per round (PerasVoteAlreadyInDB), * Two voting targets becoming winners (MultipleWinnersInRound) Co-authored-by: Nicolas BACQUEY <nicolas.bacquey@tweag.io> Co-authored-by: Thomas BAGREL <thomas.bagrel@tweag.io> Co-authored-by: Agustin Mista <agustin.mista@moduscreate.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements state-machine tests for the PerasVoteDB using
quickcheck-dynamic. Notably, we define rather constrained generators to increase the chances of (among others):