Repository navigation
[Peras 27] Split degenerate BlockSupportsPeras instance - #2027
Closed
agustinmista wants to merge 22 commits into
Closed
agustinmista wants to merge 22 commits into
agustinmista wants to merge 22 commits into
Conversation
agustinmista
force-pushed
the
peras/degenerate-peras-instances
branch
from
May 5, 2026 13:10
821b00a to
37fe870
Compare
agustinmista
force-pushed
the
peras/concrete-certs-and-votes
branch
from
May 5, 2026 13:11
f47be9f to
b084253
Compare
agustinmista
force-pushed
the
peras/degenerate-peras-instances
branch
from
May 5, 2026 14:11
37fe870 to
7fbebad
Compare
agustinmista
force-pushed
the
peras/concrete-certs-and-votes
branch
from
May 5, 2026 14:12
b084253 to
67855ea
Compare
agustinmista
force-pushed
the
peras/degenerate-peras-instances
branch
from
May 5, 2026 15:56
7fbebad to
35a01bc
Compare
agustinmista
force-pushed
the
peras/concrete-certs-and-votes
branch
3 times, most recently
from
May 7, 2026 12:39
8a2bab8 to
10f8c2e
Compare
agustinmista
force-pushed
the
peras/degenerate-peras-instances
branch
3 times, most recently
from
May 8, 2026 15:09
f827bf2 to
c4b4797
Compare
agustinmista
force-pushed
the
peras/concrete-certs-and-votes
branch
from
May 11, 2026 08:37
10f8c2e to
e8a284d
Compare
agustinmista
force-pushed
the
peras/degenerate-peras-instances
branch
9 times, most recently
from
May 13, 2026 12:01
d5d1fd0 to
f7ecea3
Compare
agustinmista
force-pushed
the
peras/concrete-certs-and-votes
branch
from
May 13, 2026 12:01
e8a284d to
00df1fa
Compare
This was
linked to
issues
May 13, 2026
This commit implements conversion routines between the brand-new (concrete) Peras votes and certificates and their corresponding (abstract) voting committee counterparts. This is done by introducing a `VotingCommitteeSupportsPeras` type class to allow us to easily change the underlying voting committee implementation via a proxy type. Co-authored-by: Agustin Mista <agustin.mista@moduscreate.com> Co-authored-by: Thomas BAGREL <thomas.bagrel@tweag.io> Co-authored-by: Nicolas BACQUEY <nicolas.bacquey@tweag.io>
This commit adds test helpers to aid with the definition of the upcoming roundtrip properties for concrete Peras votes and certificates. Co-authored-by: Agustin Mista <agustin.mista@moduscreate.com> Co-authored-by: Thomas BAGREL <thomas.bagrel@tweag.io> Co-authored-by: Nicolas BACQUEY <nicolas.bacquey@tweag.io>
This commit adds property tests for the newly added bitmap library asserting that both conversion from and/to indices as well as serialization roundtrip correctly. Co-authored-by: Agustin Mista <agustin.mista@moduscreate.com> Co-authored-by: Thomas BAGREL <thomas.bagrel@tweag.io> Co-authored-by: Nicolas BACQUEY <nicolas.bacquey@tweag.io>
This commit adds serialization roundtrip tests for the concrete Peras votes and certificate types. Co-authored-by: Agustin Mista <agustin.mista@moduscreate.com> Co-authored-by: Thomas BAGREL <thomas.bagrel@tweag.io> Co-authored-by: Nicolas BACQUEY <nicolas.bacquey@tweag.io>
…ommittee types This commit adds conversion rountrip tests between concrete Peras votes and certificates and their corresponding (abstract) counterparts in the WFALS and EveryoneVotes voting committee implementations. Notably, the roundtrip properties allow testing both total (WFALS) and partial (EveryoneVotes) conversions, generating both good and bad cases and contrasting them against their expected rountrip outcome. Co-authored-by: Agustin Mista <agustin.mista@moduscreate.com> Co-authored-by: Thomas BAGREL <thomas.bagrel@tweag.io> Co-authored-by: Nicolas BACQUEY <nicolas.bacquey@tweag.io>
Co-authored-by: Agustin Mista <agustin.mista@moduscreate.com> Co-authored-by: Thomas BAGREL <thomas.bagrel@tweag.io> Co-authored-by: Nicolas BACQUEY <nicolas.bacquey@tweag.io>
Co-authored-by: Agustin Mista <agustin.mista@moduscreate.com> Co-authored-by: Thomas BAGREL <thomas.bagrel@tweag.io> Co-authored-by: Nicolas BACQUEY <nicolas.bacquey@tweag.io>
Co-authored-by: Agustin Mista <agustin.mista@moduscreate.com> Co-authored-by: Thomas BAGREL <thomas.bagrel@tweag.io> Co-authored-by: Nicolas BACQUEY <nicolas.bacquey@tweag.io>
Co-authored-by: Agustin Mista <agustin.mista@moduscreate.com> Co-authored-by: Thomas BAGREL <thomas.bagrel@tweag.io> Co-authored-by: Nicolas BACQUEY <nicolas.bacquey@tweag.io>
Co-authored-by: Agustin Mista <agustin.mista@moduscreate.com> Co-authored-by: Thomas BAGREL <thomas.bagrel@tweag.io> Co-authored-by: Nicolas BACQUEY <nicolas.bacquey@tweag.io>
Co-authored-by: Agustin Mista <agustin.mista@moduscreate.com> Co-authored-by: Thomas BAGREL <thomas.bagrel@tweag.io> Co-authored-by: Nicolas BACQUEY <nicolas.bacquey@tweag.io>
Co-authored-by: Agustin Mista <agustin.mista@moduscreate.com> Co-authored-by: Thomas BAGREL <thomas.bagrel@tweag.io> Co-authored-by: Nicolas BACQUEY <nicolas.bacquey@tweag.io>
agustinmista
force-pushed
the
peras/degenerate-peras-instances
branch
from
May 19, 2026 13:45
662ef8e to
1c7aa1a
Compare
agustinmista
force-pushed
the
peras/concrete-certs-and-votes
branch
from
May 19, 2026 13:46
45f5251 to
a7118cf
Compare
…ostedBlock`" This reverts commit e2f6e65.
agustinmista
force-pushed
the
peras/concrete-certs-and-votes
branch
3 times, most recently
from
June 19, 2026 11:24
54f6cf4 to
0802d91
Compare
Contributor
Author
|
Closing in favor of #2067 |
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 has the main goal of removing the existing degenerate
forall blk. BlockSupportsPeras blkinstance and replace it with separate, independent ones for the several block types in the codebase that need it.To aid with this process, we have made a couple of preliminary changes:
O.C.Peras.Typesmodule to keepO.C.Block.SupportsPerasas focused on theblk-dependent API as possible.HasPeras(Vote|Cert)Xclasses into two,IsPerasVoteandIsPerasCert, grouping all the necessary non-crypto-related projections needed to operate on Peras votes and certificates.PerasCfg blkassociated type, in favor of keeping things simple and using the monomorphicPerasParamsfor now. These will likely need a major overhaul in the future when on-chain governance of these parameters becomes necessary.MockPeras(Vote|Cert)s, containing the non-crypto mocked Peras votes and certificates that were previously hardcoded everywhere. These will still be used for certain (mostly test) block types.BlockSupportsPerasinstance defined in terms ofVoid, so Peras votes, certs, and errors are uninstantiable and can be discharged viaabsurd.With this in place, the remaining changes mostly encompass the plumbing needed after removing the existing
BlockSupportsPerasinstance and replacing it with dedicated ones. Concretely:ByronBlockuses the "emtpy" instanceShelleyBlock proto erauses a mocked instance (to be replaced with a concrete one using real type forera ~ Dijkstraand empty ones for every otherera.(@tbagrel1 is working on this on a separate PR)HardForkBlock xsuses a mocked instance, but will be replaced with a compositional one defined around the two previous ones (also WIP)On the testing side:
BlockAandBlockBboth use the "empty" instanceDualByronBlockuses the "empty" instanceO.C.Mock.Ledger.Block.SimpleBlock c extuses the "empty" instanceO.C.Storage.TestBlock.TestBlockuses a mocked instance (now with a properly instantiatedgetPerasCertInBlock)Test.Util.TestBlock.TestBlockWith ptypeuses a mocked instance (without any support for certificates in blocks, as it's not needed for any of the existing tests)Finally, some general notes (notice that some of these are already covered by new issues linked in the comments below):
BlockSupportsPerasis still missing aforgePerasVotemethod. This will become evident soon when trying to write ablk-generic voting thread (BlockSupportsPerascurrently misses aforgeVotemethod tweag/cardano-peras#248)BlockSupportsPerasinstances are defined via orphans in dedicated modules. This is because:SerialiseNodeToNodeConstraints blknow requiresSerialiseNodeToNode (PerasVote blk)andSerialiseNodeToNode (PerasCert blk)which are only in scope afterPerasVote blkandPerasCert blkare established when definingBlockSupportsPeras blkSerialiseNodeToNodeConstraintsinstances are already defined as orphans in their own dedicated modules, forcing us to create a new module or to defineBlockSupportsPeras blkin the same one asSerialiseNodeToNodeConstraints blk(confusing!). We might be able to rearrange constraints to avoid this, but that would probably mean addingSerialiseNodeToNode (Peras(Vote|Cert) blk)as superclasses to a type-class higher-up in the chain.MockPerasVotecarries its own stake. Please note this is not the case for real votes, as their stake is retrieved from the stake distribution after validation.Peras...types will become redundant and get removed in a later PR when we start integrating components.