Skip to content

Dispatch ledger queries in the Dijkstra era - #1310

Open
palas wants to merge 2 commits into
support-dijkstra-pparamsfrom
dispatch-dijkstra-queries
Open

Dispatch ledger queries in the Dijkstra era#1310
palas wants to merge 2 commits into
support-dijkstra-pparamsfrom
dispatch-dijkstra-queries

Conversation

@palas

@palas palas commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Context

Route all Conway-onwards queries (constitution, governance state, DRep/SPO state and stake distributions, committee state, vote delegatees, proposals, ratification and future parameters, default votes and DRep delegations) through
caseShelleyToBabbageOrConwayEraOnwards with obtainCommonConstraints, so they work in Dijkstra as well. Also covers the treasury query in queryStateForBalancedTx, the stability-window constant and the next-epoch nonce computation.

How to trust this PR

One mechanical pattern applied thirteen times inside a single function (toConsensusQueryShelleyBased): each Conway-onwards query's continuation changes from const $ Some … to \w -> obtainCommonConstraints (convert w) $ Some …, which makes the same consensus query available in Dijkstra. The consensus query constructors themselves are untouched — no query logic changes, only the era gate widens. The pre-Conway error arms stay exactly as they were.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff
  • Changelog fragment added in .changes/

Route all Conway-onwards queries (constitution, governance state,
DRep/SPO state and stake distributions, committee state, vote
delegatees, proposals, ratification and future parameters, default
votes and DRep delegations) through
caseShelleyToBabbageOrConwayEraOnwards with obtainCommonConstraints,
so they work in Dijkstra as well.

Co-Authored-By: Mateusz Galazyn <mateusz.galazyn@iohk.io>
Co-Authored-By: Sebastian Nagel <sebastian.nagel@ncoding.at>
Co-Authored-By: John Lotoski <john.lotoski@iohk.io>
Copilot AI lite review requested due to automatic review settings August 22, 2026 01:16
@palas
palas force-pushed the dispatch-dijkstra-queries branch from 6facb43 to befbc55 Compare August 22, 2026 01:16

Copilot AI 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.

Pull request overview

This PR widens the era gate for Conway-onwards ledger queries so they dispatch correctly in the Dijkstra era as well, by routing the Conway-onwards continuations through obtainCommonConstraints (via Convert (convert)).

Changes:

  • Updated toConsensusQueryShelleyBased to wrap Conway-era-onwards query continuations with obtainCommonConstraints (convert w) so the same consensus queries are available in Dijkstra.
  • Added a Herald changelog fragment documenting the newly supported Dijkstra-era behavior for these queries.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs Broadens Conway-onwards query dispatch to include Dijkstra by obtaining common constraints in the Conway-onwards branch.
.changes/20260822_030407_cardano-api_palas_dijkstra_ledger_queries.yml Documents the change as a feature for cardano-api.
Suppressed comments (9)

cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs:665

  • This error message says the query is only available in the Conway era, but the new era gate allows Conway-era-onwards (including Dijkstra). Update the message to match the actual availability.
      (const $ error "toConsensusQueryShelleyBased: QueryRatifyState is only available in the Conway era")
      ( \w ->
          obtainCommonConstraints (convert w) $ Some (consensusQueryInEraInMode era Consensus.GetRatifyState)

cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs:683

  • This error message says the query is only available in the Conway era, but the new continuation supports Conway-era-onwards (including Dijkstra). Update the message to avoid implying it won’t work in Dijkstra.
      (const $ error "toConsensusQueryShelleyBased: QueryDRepState is only available in the Conway era")
      ( \w ->
          obtainCommonConstraints (convert w) $
            Some (consensusQueryInEraInMode era (Consensus.GetDRepState creds))

cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs:692

  • This error message says the query is only available in the Conway era, but the era gate now allows Conway-era-onwards (including Dijkstra). Update the message to match the actual availability.
      ( const $
          error "toConsensusQueryShelleyBased: QueryDRepStakeDistr is only available in the Conway era"
      )
      ( \w ->
          obtainCommonConstraints (convert w) $

cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs:702

  • This error message says the query is only available in the Conway era, but the era gate now allows Conway-era-onwards (including Dijkstra). Update the message to avoid misleading users.
      ( const $
          error "toConsensusQueryShelleyBased: QuerySPOStakeDistr is only available in the Conway era"
      )
      ( \w ->
          obtainCommonConstraints (convert w) $

cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs:712

  • This error message says the query is only available in the Conway era, but the continuation now supports Conway-era-onwards (including Dijkstra). Update the message for accuracy.
      ( const $
          error "toConsensusQueryShelleyBased: QueryCommitteeMembersState is only available in the Conway era"
      )
      ( \w ->
          obtainCommonConstraints (convert w) $

cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs:723

  • This error message says the query is only available in the Conway era, but the continuation now supports Conway-era-onwards (including Dijkstra). Update the message for accuracy.
      ( const $
          error "toConsensusQueryShelleyBased: QueryStakeVoteDelegatees is only available in the Conway era"
      )
      ( \w ->
          obtainCommonConstraints (convert w) $

cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs:740

  • This error message says the query is only available in the Conway era, but the continuation now supports Conway-era-onwards (including Dijkstra). Update the message to match actual availability.
      ( const $
          error "toConsensusQueryShelleyBased: QueryProposals is only available in the Conway era"
      )
      ( \w ->
          obtainCommonConstraints (convert w) $

cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs:754

  • This error message says the query is only available in the Conway era, but the continuation now supports Conway-era-onwards (including Dijkstra). Update the message to avoid misleading users.
      ( const $
          error "toConsensusQueryShelleyBased: QueryStakePoolDefaultVote is only available in the Conway era"
      )
      ( \w ->
          obtainCommonConstraints (convert w) $

cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs:765

  • This error message says the query is only available in the Conway era, but the continuation now supports Conway-era-onwards (including Dijkstra). Update the message for accuracy.
      ( const $
          error "toConsensusQueryShelleyBased: GetDRepDelegations is only available in the Conway era"
      )
      ( \w ->
          obtainCommonConstraints (convert w) $

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs Outdated
These queries now dispatch in Conway and later eras, but the pre-Conway
error arms still claimed "only available in the Conway era"; say
"only available from the Conway era onwards" instead, and align the
QueryFuturePParams message, which had its own variant of the wording.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants