-
Notifications
You must be signed in to change notification settings - Fork 721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify tip cardano-cli query to also return the current epoch #2440
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will be better to do entirely in the CLI in the short term. I don't think we want to change the getLocalChainTip
, since it changes it from being a single chain sync query to being two protocols, with a possibility of failure. It doesn't make for a nice API.
In the CLI we can use the existing getLocalChainTip
, and then use the existing queryNodeLocalState
with the QueryEpoch
query. That would not need any API changes.
Now it's true that this is imperfect, since it needs two queries that are not guaranteed to be synchronised (which is the root of the "Maybe" problem in the API in the current version of the patch).
What would be better here, in the medium term, would be to properly make use of the ability of the query to supply no point and implicitly acquire the current point. Then we can use QueryChainPoint
and QueryEpoch
. The only thing we're missing to make this perfect is QueryChainBlockNo
. If we add that query to the consensus, and expose it in the API, then we can do this all as a single query (or rather a single atomic batch of queries).
da4b3ea
to
659dee5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks much better.
Two minor comments below.
Lets squash down to one patch again, and clean up the unnecessary changes in whitespace and comments (that are just there as a result of us going back and forth on things).
659dee5
to
ecb418e
Compare
7aff1e1
to
2237ff3
Compare
bors r+ |
2440: Modify tip cardano-cli query to also return the current epoch r=Jimbo4350 a=Jimbo4350 ``` > cabal exec cardano-cli -- query tip --shelley-era --shelley-mode --testnet-magic 42 { "epoch": 0, "hash": "19fdfc54e7a1e2fb7ff45254a6aa0aa88ea7a80de4b48297924c9abf353f9cb7", "slot": 42, "block": 3 } ``` Co-authored-by: Jordan Millar <jordan.millar@iohk.io>
Build failed: |
bors r+ |
2440: Modify tip cardano-cli query to also return the current epoch r=Jimbo4350 a=Jimbo4350 Closes #1737 ``` > cabal exec cardano-cli -- query tip --shelley-era --shelley-mode --testnet-magic 42 { "epoch": 0, "hash": "19fdfc54e7a1e2fb7ff45254a6aa0aa88ea7a80de4b48297924c9abf353f9cb7", "slot": 42, "block": 3 } ``` Co-authored-by: Jordan Millar <jordan.millar@iohk.io>
Build failed: |
a3dec68
to
3aebb51
Compare
3aebb51
to
627f97a
Compare
bors r+ |
2440: Modify tip cardano-cli query to also return the current epoch r=Jimbo4350 a=Jimbo4350 Closes #1737 ``` > cabal exec cardano-cli -- query tip --shelley-era --shelley-mode --testnet-magic 42 { "epoch": 0, "hash": "19fdfc54e7a1e2fb7ff45254a6aa0aa88ea7a80de4b48297924c9abf353f9cb7", "slot": 42, "block": 3 } ``` Co-authored-by: Jordan Millar <jordan.millar@iohk.io>
bors r+ |
2440: Modify tip cardano-cli query to also return the current epoch r=Jimbo4350 a=Jimbo4350 Closes #1737 ``` > cabal exec cardano-cli -- query tip --shelley-era --shelley-mode --testnet-magic 42 { "epoch": 0, "hash": "19fdfc54e7a1e2fb7ff45254a6aa0aa88ea7a80de4b48297924c9abf353f9cb7", "slot": 42, "block": 3 } ``` Co-authored-by: Jordan Millar <jordan.millar@iohk.io>
Minor edits.
bors r+ |
Build succeeded: |
with cardano-node v1.26.1 the query tip returns a different JSON schema, see IntersectMBO/cardano-node#2440
Closes #1737