Skip to content
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

cli: Add 'shelley query ledger-state' command #1016

Merged
merged 2 commits into from May 22, 2020

Conversation

erikd
Copy link
Contributor

@erikd erikd commented May 22, 2020

No description provided.

@erikd erikd requested review from dcoutts and Jimbo4350 May 22, 2020 02:14
@erikd erikd force-pushed the erikd/query-ledger-state branch 3 times, most recently from 666051d to 3611e19 Compare May 22, 2020 02:25
@@ -155,27 +192,27 @@ runQueryStakeDistribution network mOutFile = do
let ptclClientInfo = pClientInfoCodecConfig . protocolClientInfo $ mkNodeClientProtocolTPraos
tip <- liftIO $ withIOManager $ \iomgr ->
getLocalTip iomgr ptclClientInfo network sockPath
stakeDistr <- firstExceptT NodeLocalStateQueryError $
stakeDist <- firstExceptT NodeLocalStateQueryError $
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes were required to avoid name shadowing warnings.

@erikd erikd force-pushed the erikd/query-ledger-state branch from 3611e19 to 3bee0d9 Compare May 22, 2020 02:43
@erikd erikd force-pushed the erikd/query-ledger-state branch from 3bee0d9 to d636485 Compare May 22, 2020 04:50
This command queries the node to the LedgerState to be returned as
CBOR-in-CBOR. If the node and the cli are compatible, the LedgerState
will be printed as JSON. If they are incompatible it will be printed
as generic decoded CBOR.
@erikd erikd force-pushed the erikd/query-ledger-state branch from d636485 to ba755ab Compare May 22, 2020 04:57
=> Network
-> SocketPath
-> Point blk
-> ExceptT LocalStateQueryError IO (Either LByteString (Ledger.LedgerState TPraosStandardCrypto))
Copy link
Contributor

@Jimbo4350 Jimbo4350 May 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we move that LByteString error into LocalStateQueryError as a new constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, these really are two different things. If CBOR decoding is successful, the return the LedgerState. If decoding fails, return the ByteString.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one comment.

@erikd
Copy link
Contributor Author

erikd commented May 22, 2020

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented May 22, 2020

@iohk-bors iohk-bors bot merged commit c1b0ab8 into master May 22, 2020
@iohk-bors iohk-bors bot deleted the erikd/query-ledger-state branch May 22, 2020 09:22
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.

None yet

4 participants