Skip to content

[WIP] Proper BlockSupportsPeras instance for ShelleyBlock and HardForkBlock#2044

Draft
tbagrel1 wants to merge 27 commits into
peras/degenerate-peras-instancesfrom
peras/instance-blocksupportsperas-shelley
Draft

[WIP] Proper BlockSupportsPeras instance for ShelleyBlock and HardForkBlock#2044
tbagrel1 wants to merge 27 commits into
peras/degenerate-peras-instancesfrom
peras/instance-blocksupportsperas-shelley

Conversation

@tbagrel1

Copy link
Copy Markdown
Contributor

No description provided.

agustinmista and others added 25 commits May 11, 2026 10:15
This commit implements BLS-based crypto helpers to simplify the
implementation of crypto schemes used for voting committees. It includes
both single and aggregate signature and VRF signing and verification, as
well as swap-attack-resistant aggregate VRF verification via
linearization.

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 commit uses the previously defined BLS-based crypto helpers to
implement a TestCrypto scheme to be used by the upcoming property
tests for WFALS and EveryoneVotes.

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>
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 commit defines some common test helpers used by the upcoming
property and conformance tests for both WFALS and EveryoneVotes.

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 commit reorganizes the existing model and conformance test
infrastructure for WFALS in anticipation to the the tests for the real
implementation implemented in the next commit.

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 commit adds conformance tests for the real WFALS implementation. In
particular, we chech that the real implementation matches both the
precomputed output of the rust prototype as well as the WFALS model
against random stake distributions and target committee sizes.

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 commit implements property tests for the real WFALS
implementation asserting that:

* votes cast by eligible voters are successfully verifiable under the
  same voting committee,
* fake (illegal) votes are successfully rejected, and
* certificates forged by multiple votes can be verifiable under the same
  voting committe

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 commit implements property tests for the EveryoneVotes
implementation asserting that:

* votes cast by eligible voters are successfully verifiable under the
  same voting committee,
* fake (illegal) votes are successfully rejected, and
* certificates forged by multiple votes can be verifiable under the same
  voting committe

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 commit adds property tests to validate the implementation of
checkUniqueVotesWithSameTarget, provided by the generic voting
committee API.

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 commit introduces a specialization of RealPoint for blocks where
the header hash is always 32 bytes long.
This commit implements a compact bitmaps via ByteStrings, adapted from
the Leios voting committee demo package (leios-wfa-ls-demo):

https://github.com/cardano-scaling/leios-wfa-ls-demo/blob/main/leios-wfa-ls-demo/lib/Cardano/Leios/BitMapPV.hs

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 defines concrete data structures for Peras votes and certificates
using BLS signatures to represent vote/cert signatures as well as
non-persistent eligibility proofs.

In addition it defines serialization routines for both types, using a
compact bitmap representation in the case of 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 defines a concrete PerasCrypto scheme using BLS signatures
to instantiate all the voting committee superclasses needed by the WFALS
and EveryoneVotes voting committee implementations.

Note that these instances are heavily inspired by the ones defined for
TestCrypto in the generic voting committee test-suite, albeit with
slightly different types and more documentation.

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 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>
@agustinmista agustinmista force-pushed the peras/degenerate-peras-instances branch 3 times, most recently from 3392b04 to 662ef8e Compare May 19, 2026 12:04
@agustinmista agustinmista force-pushed the peras/degenerate-peras-instances branch from 662ef8e to 1c7aa1a Compare May 19, 2026 13:45
@tbagrel1 tbagrel1 force-pushed the peras/instance-blocksupportsperas-shelley branch from fc13597 to 037eb76 Compare May 19, 2026 15:01
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.

2 participants