Skip to content

cardano-crypto-peras: add base types - #701

Open
gdeest wants to merge 15 commits into
IntersectMBO:masterfrom
gdeest:gdeest/peras-cert-types
Open

gdeest wants to merge 15 commits into
IntersectMBO:masterfrom
gdeest:gdeest/peras-cert-types

Conversation

@gdeest

@gdeest gdeest commented Sep 24, 2026 •

Copy link
Copy Markdown

Description

Replace stub Peras base types base real types (taken from ouroboros-consensus). cc @agustinmista

This moves the Peras certificate and vote types out of ouroboros-consensus and into cardano-crypto-peras, so that the ledger can keep certificates typed in the Dijkstra block body instead of as opaque bytes.

CBOR instances removed from initial draft (these will go in cardano-ledger-binary as per the Leios example).

The voters bitmap is built on Data.Bitmap from (unmerged) #700, so this PR includes #700's commits for now.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated
  • All visible changes are prepended to the latest section of a CHANGELOG.md for the affected packages.
    New section is never added with the code changes. (See RELEASING.md)
  • When applicable, versions are updated in .cabal and CHANGELOG.md files according to the
    versioning process.
  • The version bounds in .cabal files for all affected packages are updated.
    If you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md)
  • Self-reviewed the diff

@agustinmista agustinmista left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Nice job!

I have a couple of comments, mostly around serialization and documentation.

In addition:

  • for consistency I think we should also bring the PerasVote definitions here.

  • we recently introduces a size upper bound for certs here and here. We might want to bring those definitions along with these changes (CC @nbacquey).

Comment thread cardano-crypto-peras/src/Cardano/Crypto/Peras.hs Outdated
Comment thread cardano-crypto-peras/src/Cardano/Crypto/Peras.hs
Comment thread cardano-crypto-peras/src/Cardano/Crypto/Peras.hs Outdated
Comment thread cardano-crypto-peras/src/Cardano/Crypto/Peras.hs Outdated
Comment thread cardano-crypto-peras/src/Cardano/Crypto/Peras.hs
Comment thread cardano-crypto-peras/src/Cardano/Crypto/Peras/Cert.hs Outdated
Comment thread cardano-crypto-peras/src/Cardano/Crypto/Peras.hs Outdated
Comment thread cardano-crypto-peras/src/Cardano/Crypto/Peras/Cert.hs Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please look into cardano-crypto-leios package to see if there an opportunity for deduplication of logic, there is also a custom implementation of bitmaps

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have a look at #700 . The bitmap there should be usable by Leios as well.

@gdeest
gdeest force-pushed the gdeest/peras-cert-types branch from 2186787 to c417a9b Compare September 30, 2026 09:52
@gdeest gdeest mentioned this pull request Oct 7, 2026
6 tasks done
@gdeest
gdeest force-pushed the gdeest/peras-cert-types branch from c417a9b to 1e0fc3c Compare October 7, 2026 09:07
@gdeest
gdeest marked this pull request as ready for review October 7, 2026 10:59
@gdeest
gdeest requested a review from a team as a code owner October 7, 2026 10:59

@agustinmista agustinmista left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

Some questions:

  • Should we change the base of this PR to sit on top of #700? It should be possible to create a PR stack from there and merge all in one go if needed.

  • Do you anticipate any issue when replacing the types in consensus with these?

Comment thread cardano-crypto-peras/src/Cardano/Crypto/Peras/Cert.hs Outdated
perasVotersBitmapFromSeats,
perasVotersBitmapSeats,
perasVotersBitmapSize,
PerasCertVoters (UnsafePerasCertVoters, perasCertVotersBitmap, perasCertNonPersistentVRFOutputs),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: is this intentionally different from (..)?

Comment thread cardano-crypto-peras/src/Cardano/Crypto/Peras/Cert.hs
@gdeest

gdeest commented Oct 13, 2026

Copy link
Copy Markdown
Author
* Should we change the base of this PR to sit on top of #700? It should be possible to create a PR stack from there and merge all in one go if needed.

That would make definitely make sense (I am not too familar with the GitHub PR stack feature yet and it did not come to mind).

* Do you anticipate any issue when replacing the types in consensus with these?

None at all: I already have a prototype for the changes.

@gdeest
gdeest force-pushed the gdeest/peras-cert-types branch from 84cd3f3 to 15580ce Compare October 14, 2026 08:53

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants