Dispatch ledger queries in the Dijkstra era - #1310
Conversation
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>
6facb43 to
befbc55
Compare
There was a problem hiding this comment.
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
toConsensusQueryShelleyBasedto wrap Conway-era-onwards query continuations withobtainCommonConstraints (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.
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.
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
caseShelleyToBabbageOrConwayEraOnwardswithobtainCommonConstraints, so they work in Dijkstra as well. Also covers the treasury query inqueryStateForBalancedTx, 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 fromconst $ 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
.changes/