Repository navigation
[Peras 27] Split degenerate BlockSupportsPeras instance #2027
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
Closed
agustinmista
wants to merge
22
commits into
peras/concrete-certs-and-votes
from
peras/degenerate-peras-instances
Closed
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
186331b
Introduce Bytes32RealPoint
agustinmista 8ff6384
Introduce O.C.Util.Bitmap
agustinmista 0f23fff
Define concrete Peras certs and votes using BLS signatures
agustinmista 6747d5f
Define PerasCrypto and wire up voting committee instance using BLS
agustinmista e021161
Add conversions between Peras votes/certs and voting committee types
agustinmista 283d68c
Add test helpers for PerasCrypto
agustinmista b69fdc8
Add property tests for Bitmap library
agustinmista 134418b
Add serialization roundtrip tests for PerasCert and PerasVote
agustinmista 7e4cc94
Add conversion roundtrip tests between Peras votes/certs and voting c…
agustinmista a7118cf
Add changelog
agustinmista 54f7b7d
Split base Peras types into separate module
agustinmista 3530deb
Remove PerasCfg type family
agustinmista ea7e49c
Consolidate Peras vote and certificate projection type classes
agustinmista 4b071c2
Introduce O.C.Peras.(Vote|Cert).Mock
agustinmista 66c7984
Split degenerate BlockSupportsPeras instance
agustinmista 1c7aa1a
Tweak TestBlock to use getPerasCertInBlock in tests
agustinmista e2f6e65
Re-change Peras target to use `Point blk` instead of `PerasBoostedBlock`
tbagrel1 b3310a6
Define differentiated BlockSupportsPeras instances for ShelleyBlocks
tbagrel1 e24451e
Revert "Re-change Peras target to use `Point blk` instead of `PerasBo…
agustinmista 1669198
Add WithOrigin to PerasBoostedBlock
agustinmista 328ef8e
Rename Peras.Voting.Committee to Peras.Voting.Adapter
agustinmista e150e7d
Add phantom type parameter to `V1.Peras{Vote,Cert}`
tbagrel1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
changelog.d/20260421_170000_agustin.mista_concrete_certs_and_votes.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <!-- | ||
| A new scriv changelog fragment. | ||
|
|
||
| Uncomment the section that is right (remove the HTML comment wrapper). | ||
| For top level release notes, leave all the headers commented out. | ||
| --> | ||
|
|
||
| <!-- | ||
| ### Breaking | ||
|
|
||
| - A bullet item for the Breaking category. | ||
|
|
||
| --> | ||
|
|
||
| ### Non-Breaking | ||
|
|
||
| - Introduce `Ouroboros.Consensus.Util.Bitmap` providing `ByteString`-based compact bitmaps. | ||
| - Define `PerasBLSCrypto` scheme with support for all the voting committee superclasses. | ||
| - Define concrete `PerasVote` and `PerasCert` types using BLS signatures. | ||
| - Define `PerasVoteCompatibleWithVotingCommittee` and `PerasCertCompatibleWithVotingCommittee` type classes with conversions between concrete Peras types and their abstract voting committee counterparts. | ||
| - Instantiate `VotingCommitteeSupportsPeras` for both `WFALS` and `EveryoneVotes`. | ||
|
|
||
| <!-- | ||
| ### Patch | ||
|
|
||
| - A bullet item for the Patch category. | ||
|
|
||
| --> |
23 changes: 23 additions & 0 deletions
23
changelog.d/20260507_102103_agustin.mista_bytes32realpoint.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <!-- | ||
| A new scriv changelog fragment. | ||
|
|
||
| Uncomment the section that is right (remove the HTML comment wrapper). | ||
| For top level release notes, leave all the headers commented out. | ||
| --> | ||
|
|
||
| <!-- | ||
| ### Breaking | ||
|
|
||
| - A bullet item for the Breaking category. | ||
|
|
||
| --> | ||
| ### Non-Breaking | ||
|
|
||
| - Introduce `Bytes32RealPoint` for real points with 32byte header hashes. | ||
|
|
||
| <!-- | ||
| ### Patch | ||
|
|
||
| - A bullet item for the Patch category. | ||
|
|
||
| --> |
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
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
19 changes: 19 additions & 0 deletions
19
ouroboros-consensus-cardano/src/byron/Ouroboros/Consensus/Byron/Node/Peras.hs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| {-# LANGUAGE FlexibleInstances #-} | ||
| {-# OPTIONS_GHC -Wno-orphans #-} | ||
|
|
||
| -- | Empty Peras support for Byron. | ||
| -- | ||
| -- NOTE: this module exists solely because the orphan module | ||
| -- 'Ouroboros.Consensus.Byron.Node.Serialisation' needs this instance, but | ||
| -- defining it there would be too confusing. | ||
| module Ouroboros.Consensus.Byron.Node.Peras () where | ||
|
|
||
| import Ouroboros.Consensus.Block.SupportsPeras (BlockSupportsPeras) | ||
| import Ouroboros.Consensus.Byron.Ledger.Block (ByronBlock) | ||
|
|
||
| {------------------------------------------------------------------------------- | ||
| BlockSupportsPeras | ||
| -------------------------------------------------------------------------------} | ||
|
|
||
| -- NOTE: Byron does not support Peras, so we can use the empty instance here. | ||
| instance BlockSupportsPeras ByronBlock |
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
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
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
65 changes: 65 additions & 0 deletions
65
ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Node/Peras.hs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| {-# LANGUAGE DerivingStrategies #-} | ||
| {-# LANGUAGE FlexibleContexts #-} | ||
| {-# LANGUAGE FlexibleInstances #-} | ||
| {-# LANGUAGE MultiParamTypeClasses #-} | ||
| {-# LANGUAGE ScopedTypeVariables #-} | ||
| {-# LANGUAGE TypeFamilies #-} | ||
| {-# OPTIONS_GHC -Wno-orphans #-} | ||
|
|
||
| -- | Mocked Peras support for Shelley. | ||
| -- | ||
| -- NOTE: this module exists solely because the orphan module | ||
| -- 'Ouroboros.Consensus.Shelley.Node.Serialisation' needs this instance, but | ||
| -- defining it there would be too confusing. | ||
| module Ouroboros.Consensus.Shelley.Node.Peras () where | ||
|
|
||
| import Cardano.Ledger.Api | ||
| import Ouroboros.Consensus.Block.SupportsPeras | ||
| ( BlockSupportsPeras (..) | ||
| , VoidPerasError | ||
| ) | ||
| import Ouroboros.Consensus.Peras.Cert.Mock | ||
| ( MockPerasCert (..) | ||
| , forgeMockPerasCert | ||
| , validateMockPerasCert | ||
| ) | ||
| import Ouroboros.Consensus.Peras.Vote.Mock | ||
| ( MockPerasVote (..) | ||
| , validateMockPerasVote | ||
| ) | ||
| import Ouroboros.Consensus.Shelley.Ledger.Block | ||
| ( ShelleyBlock | ||
| , ShelleyCompatible | ||
| ) | ||
|
|
||
| {------------------------------------------------------------------------------- | ||
| BlockSupportsPeras | ||
| -------------------------------------------------------------------------------} | ||
|
|
||
| -- Peras support starts with DijkstraEra, so earlier eras use the default void | ||
| -- implementation. | ||
|
|
||
| instance ShelleyCompatible proto ShelleyEra => BlockSupportsPeras (ShelleyBlock proto ShelleyEra) | ||
| instance ShelleyCompatible proto AllegraEra => BlockSupportsPeras (ShelleyBlock proto AllegraEra) | ||
| instance ShelleyCompatible proto MaryEra => BlockSupportsPeras (ShelleyBlock proto MaryEra) | ||
| instance ShelleyCompatible proto AlonzoEra => BlockSupportsPeras (ShelleyBlock proto AlonzoEra) | ||
| instance ShelleyCompatible proto BabbageEra => BlockSupportsPeras (ShelleyBlock proto BabbageEra) | ||
| instance ShelleyCompatible proto ConwayEra => BlockSupportsPeras (ShelleyBlock proto ConwayEra) | ||
|
|
||
| -- NOTE: this is a mocked up implementation without crypto! | ||
| -- TODO: replace this with a concrete implementation using 'Peras.Vote.V1' and | ||
| -- 'Peras.Cert.V1' for era >= DijkstraEra. | ||
| instance | ||
| ShelleyCompatible proto DijkstraEra => | ||
| BlockSupportsPeras (ShelleyBlock proto DijkstraEra) | ||
| where | ||
| type PerasVote (ShelleyBlock proto DijkstraEra) = MockPerasVote (ShelleyBlock proto DijkstraEra) | ||
| type PerasCert (ShelleyBlock proto DijkstraEra) = MockPerasCert (ShelleyBlock proto DijkstraEra) | ||
| type PerasError (ShelleyBlock proto DijkstraEra) = VoidPerasError (ShelleyBlock proto DijkstraEra) | ||
|
|
||
| validatePerasVote = validateMockPerasVote | ||
| validatePerasCert = validateMockPerasCert | ||
| forgePerasCert = forgeMockPerasCert | ||
|
|
||
| -- TODO: extract actual Peras certificates from blocks | ||
| getPerasCertInBlock _ = Nothing | ||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, we need to replace this with concrete
Peras.Vote.V1for >= Djisktra eras, or at least add a TODO that says we need to do it :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a TODO, also:
#needs-a-todo(use real Peras types for Shelley and HFC)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far I updated the bullet list in tweag/cardano-peras#73
I'll let @qnikst decide if we should create subtask with their dedicated issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tbagrel1 item is ok for now, this way we will not lose it. We can spli to a dedicated issue in case if it can be done in later milestone or by another person.