Skip to content

[WIP] Integrate Peras voting committee into BlockSupportsPeras - #2045

Closed
agustinmista wants to merge 69 commits into
peras/degenerate-peras-instancesfrom
peras/voting-committee-in-ledger-state
Closed

[WIP] Integrate Peras voting committee into BlockSupportsPeras#2045
agustinmista wants to merge 69 commits into
peras/degenerate-peras-instancesfrom
peras/voting-committee-in-ledger-state

Conversation

@agustinmista

Copy link
Copy Markdown
Contributor

Description

Please include a meaningful description of the PR and link the relevant issues
this PR might resolve.

Also note that:

  • New code should be properly tested (even if it does not add new features).
  • The fix for a regression should include a test that reproduces said regression.

WARNING

To update your feature branch if it's stale, please rebase it manually on top of main. Don't update your feature branch by merging main into it. Your pull request will not pass CI if you do.

@agustinmista agustinmista self-assigned this May 19, 2026
@agustinmista
agustinmista marked this pull request as draft May 19, 2026 13:48
@agustinmista
agustinmista changed the base branch from main to peras/degenerate-peras-instances May 19, 2026 13:49
agustinmista and others added 4 commits May 19, 2026 17:56
…entations (#1977)

This PR provides:

* Property tests for generic committee helpers (`VotesWithSameTarget`)
* Conformance tests for `WFALS` between the real implementation and:
  + the (Haskell) model, against randomly generated stake distributions,
+ the (Rust) prototype, against its precomputed outputs for the example
stake distribution taken from mainnet.
* Property tests for both `WFALS` and `EveryoneVotes`, asserting that:
+ votes cast by eligible voters are successfully verifiable under the
same voting committee, and
  + fake (illegal) votes are successfully rejected.

NOTES:

* The first two commits reorganize a bit the test suite (originally only
containing WFALS tests), to share definitions and make room for
`EveryoneVotes` tests.
- blockio-uring -> 0.2.0.0
- blockio -> 0.2.0.0
- lsm-trees -> 1.1.0.0

- QuickCheck -> 2.18.0.0
  - quickcheck-state-machine -> 0.10.4
  - fs-sim -> 0.5.0.1
@agustinmista
agustinmista force-pushed the peras/voting-committee-in-ledger-state branch from 5c58bb3 to bd79f29 Compare May 20, 2026 10:11
@agustinmista
agustinmista force-pushed the peras/voting-committee-in-ledger-state branch from bd79f29 to 22a8618 Compare May 21, 2026 14:12
@agustinmista agustinmista changed the title [WIP] Peras voting committee in ShelleyLedgerState [WIP] Peras voting committee adapter May 21, 2026
@agustinmista
agustinmista force-pushed the peras/voting-committee-in-ledger-state branch from 83c605d to 187c468 Compare May 22, 2026 08:39
@agustinmista agustinmista changed the title [WIP] Peras voting committee adapter [WIP] Integrating Peras voting committee into BlockSupportsPeras May 22, 2026
@agustinmista agustinmista changed the title [WIP] Integrating Peras voting committee into BlockSupportsPeras [WIP] Integrate Peras voting committee into BlockSupportsPeras May 22, 2026
@tbagrel1

tbagrel1 commented May 22, 2026

Copy link
Copy Markdown
Contributor

Next steps:

  • Merge PerasVoteStake and VoteWeight (and eliminate the current coerce in implForgePerasVoteIfElligible
  • Make sure eligiblePartyVoteWeight returns a normalized VoteWeight and add corresponding docstring
  • Merge (Peras)SeatIndex and PerasVoterId
  • Unify VotesReachingQuorum and UniqueVotesWithSameTarget
  • Write blk-generic instances for implForgePerasCert, implVerifyPerasVote, implVerifyPerasCert as we did for implForgePerasVoteIfElligible
  • Modify the interface for forgePerasCert, verifyPerasVote, verifyPerasCert and adapt calling code (this should make PerasVoteStakeDistr useless, and we should be able to remove)
  • Make forgePerasVoteIfElligible part of BlockSupportsPeras
  • Include the new type families and corresponding superclass constraints as part of BlockSupportsPeras
  • Add blk phantom type parameter to PerasParams
  • Fix BlockSupportPeras instances after interface changes
  • Remove instance of BlockSupportPeras for RealBlock from Praos/Peras.hs and instead use the code to provide concrete instances for ShelleyBlock proto DijkstraEra and HardForkBlock xs
  • Change binary encoding of V1.Vote/Cert to have some versionning information (need to track it with an issue, probably postpone to Peras-to-mainnet?)
  • Fill out the blanks [TODO EPOCH CONTEXT PLUMBING]
  • Move getStakeDistrWithBLSPublicKeys and perasBLSPublicKeysFromEnv out of Praos/Peras.hs
  • Introduce IsPerasError class to gather the injectXXXError :: XXX -> PerasError blk functions and instance it
  • Add committee target size as part of PerasParams and use it in praosStatePerasVotingCommitteeInput. Also (re)-export the dedicated type from PerasParams

@tbagrel1

tbagrel1 commented May 22, 2026

Copy link
Copy Markdown
Contributor

Future steps for another PR:

  • Have some machinery getCommitteeForRound :: PerasRoundNo -> Maybe (PerasVotingCommittee blk), which involves running Qry/Summary and doing epoch dispatch for the committee (so far it can be simple: just check the supplied PerasRoundNo corresponds to the current epoch, and return the current committee from Praos state)
  • Decide if we want components to interact with getCommitteeForRound and feed the obtained committee into BlockSupportsPeras method, or if we want another layer of abstraction laying near PraosState that would do the resolution for them (exposing methods similar to BlockSupportsPeras, but where the Committee argument is no longer there, and either replaced with PraosState, or capturing a handle to PraosState so dispatch can happen transparently)
  • Decide if PrivateKey (and maybe PoolId) should be part of PerasEpochContext and potentially change signature of forgeVoteIfElligible

@tbagrel1
tbagrel1 force-pushed the peras/voting-committee-in-ledger-state branch from bb24808 to d53051f Compare May 26, 2026 09:02
@agustinmista
agustinmista force-pushed the peras/voting-committee-in-ledger-state branch 2 times, most recently from 606c061 to a9a6415 Compare May 26, 2026 12:47
@tbagrel1
tbagrel1 force-pushed the peras/voting-committee-in-ledger-state branch from a9a6415 to 1f462bb Compare May 26, 2026 15:08
agustinmista and others added 27 commits June 9, 2026 16:04
…ardForkBlock to use concrete V1.Peras{Cert,Vote}
PerasEpochContextResolver/LedgerStateHeaderStateSupportsPerasVoting
design
@agustinmista
agustinmista force-pushed the peras/voting-committee-in-ledger-state branch from 3631a39 to 4410c5d Compare June 9, 2026 14:25
@agustinmista

Copy link
Copy Markdown
Contributor Author

Closed in favor of #2067

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.

Store Peras voting committee composition in the Ledger state

7 participants