Remove GetCBOR wrapper from QueryLedgerPeerSnapshot#1160
Merged
Conversation
Return LedgerPeerSnapshot directly instead of Serialised LedgerPeerSnapshot, as there is no reason to keep the result serialized.
Contributor
There was a problem hiding this comment.
Pull request overview
Removes the GetCBOR wrapper from the QueryLedgerPeerSnapshot query so callers receive a LedgerPeerSnapshot directly (instead of a Serialised LedgerPeerSnapshot), reflecting the fact that consumers always need the deserialized value.
Changes:
- Adjust
QueryLedgerPeerSnapshotresult type to returnLedgerPeerSnapshotdirectly. - Update consensus query construction to remove
Consensus.GetCBOR. - Update query result pattern matches and the
queryLedgerPeerSnapshottype signature accordingly.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs | Removes GetCBOR from the query type/result mapping and consensus-query construction/result handling. |
| cardano-api/src/Cardano/Api/Query/Internal/Expr.hs | Updates the public query helper’s type signature to return LedgerPeerSnapshot directly. |
palas
approved these changes
Mar 27, 2026
Contributor
palas
left a comment
There was a problem hiding this comment.
Looks good. One thought: I am not sure of how users use this, but it may make sense to do one of two things:
- Either deprecating/removing
decodeLedgerPeerSnapshot - Or adding an
encodeLedgerPeerSnapshotfunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog
Context
There is no reason to keep the
LedgerPeerSnapshotresult serialized — callers always need the deserialized value. This removes theGetCBORwrapper so the query returnsLedgerPeerSnapshotdirectly instead ofSerialised LedgerPeerSnapshot.Replaces #930.
How to trust this PR
2-file, 5-line change. The
GetCBORwrapper is removed from:QueryLedgerPeerSnapshotresult typetoConsensusQueryShelleyBasedfromConsensusQueryResultShelleyBasedqueryLedgerPeerSnapshottype signature inExpr.hsBuilds cleanly (lib + gen + both test suites).
Checklist