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

Fix query protocol-state #4102

Merged
merged 1 commit into from
Jun 27, 2022
Merged

Conversation

newhoggy
Copy link
Contributor

@newhoggy newhoggy commented Jun 27, 2022

Fixes one of the commands in #3883

@newhoggy
Copy link
Contributor Author

For Alonzo:

CARDANO_NODE_SOCKET_PATH=example/main.sock cardano-cli query protocol-state --cardano-mode --testnet-magic 42


{
    "chainDepState": {
        "csLabNonce": {
            "contents": "f0dc1ec610b6be842a892c24fe5b4a59b0b93494fd40177aef444299fea94ac1",
            "tag": "Nonce"
        },
        "csProtocol": [
            {
                "5b34625dfd65a3734e20d4389207d3b50047fcfacb0bb12c554b66bd": 1,
                "c921170865471ecd443ae3d0600749568c67b7e2fd9150f56bd434d0": 1
            },
            {
                "contents": "c272db989e2a582796917d721247fef17707c8b9b2f433bad2701df3465de6c0",
                "tag": "Nonce"
            },
            {
                "contents": "c272db989e2a582796917d721247fef17707c8b9b2f433bad2701df3465de6c0",
                "tag": "Nonce"
            }
        ],
        "csTickn": {
            "ticknStateEpochNonce": {
                "contents": "1779ef55edb987ab38e64c7a8aa7839e44cbdb41ff73a2f3b9e5c06f5f8bb0a2",
                "tag": "Nonce"
            },
            "ticknStatePrevHashNonce": {
                "tag": "NeutralNonce"
            }
        }
    },
    "lastSlot": 42
}

@newhoggy
Copy link
Contributor Author

For Babbage:

CARDANO_NODE_SOCKET_PATH=example/main.sock cardano-cli query protocol-state --cardano-mode --testnet-magic 42


{
    "candidateNonce": {
        "contents": "bb35f00ef3867227367142df3f296d9fb579701cad7f6eb1a488965a0ed19dc6",
        "tag": "Nonce"
    },
    "epochNonce": {
        "contents": "8745878ee66a004c9476e9f972c70af5b20d32e42831afab0cd3acf0f59a74c6",
        "tag": "Nonce"
    },
    "evolvingNonce": {
        "contents": "4e7db806ca023ffeb6b85cec68c9de5b14aa0c0550033b99a329aad83da8f262",
        "tag": "Nonce"
    },
    "labNonce": {
        "contents": "4fd0b9aea702fa10f216b9e4d2c7a67cd571b0d7b93d07d4654324b5c39680bb",
        "tag": "Nonce"
    },
    "lastEpochBlockNonce": {
        "tag": "NeutralNonce"
    },
    "lastSlot": 269,
    "oCertCounters": {
        "4f6a7786b181dc8192e3643e13b8c5424e5a501d4ba9d803f3d9a8f8": 0,
        "6211474ccb03e8537f810d10520ac37e2822b0ace5bbda346ef6f0aa": 0,
        "84c3e438c497b20a12aa5e7ad394db6aa751ecd2cbad5a5b104540b5": 0
    }
}

@newhoggy newhoggy marked this pull request as ready for review June 27, 2022 06:33
@newhoggy newhoggy force-pushed the newhoggy/fix-query-protocol-state branch from b70bfc7 to 37b2a92 Compare June 27, 2022 06:53
@mkoura
Copy link
Contributor

mkoura commented Jun 27, 2022

Verified the behavior in both Alonzo and Babbage, LGTM 👍

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.

Couple of small change but LGTM otherwise

import Cardano.Api.Orphans ()

import Cardano.Ledger.AuxiliaryData (AuxiliaryDataHash (..))
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you undo the import changes to follow the style in other modules?

Copy link
Contributor Author

@newhoggy newhoggy Jun 27, 2022

Choose a reason for hiding this comment

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

I re-organised the imports, but any chance we could use ImportQualifiedPost language extension like we do in plutus-apps so I could just do a line sort to keep my imports tidy?

Copy link
Contributor

Choose a reason for hiding this comment

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

We would need to make a decision to use ImportQualifiedPost in the repo. Having a mix of some modules using it and others not is not ideal. I personally don't see justification for this aesthetic change.

@@ -58,9 +59,9 @@ deriving newtype instance ToJSON ByronHash
-- This instance is temporarily duplicated in cardano-config

instance ToJSON (HeaderHash blk) => ToJSON (Tip blk) where
toJSON TipGenesis = object [ "genesis" .= True ]
toJSON TipGenesis = J.object [ "genesis" .= True ]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the qualified import? If you are going to qualify aeson imports we do it via Aeson. In this case I think its overkill to qualify object as it is fairly obvious already that it comes from the aeson library.

Copy link
Contributor Author

@newhoggy newhoggy Jun 27, 2022

Choose a reason for hiding this comment

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

I've switched it to Aeson. I'm trying to avoid non-explicit imports and at the same time keep the qualified import short so it doesn't wrap.

@newhoggy newhoggy force-pushed the newhoggy/fix-query-protocol-state branch from 37b2a92 to 8557561 Compare June 27, 2022 15:30
@newhoggy newhoggy force-pushed the newhoggy/fix-query-protocol-state branch from 8557561 to 4590123 Compare June 27, 2022 15:34
@newhoggy newhoggy dismissed Jimbo4350’s stale review June 27, 2022 15:39

Addressed some comments.

@newhoggy newhoggy requested a review from Jimbo4350 June 27, 2022 15:39
@newhoggy
Copy link
Contributor Author

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 27, 2022

Build succeeded:

@iohk-bors iohk-bors bot merged commit df183aa into master Jun 27, 2022
@iohk-bors iohk-bors bot deleted the newhoggy/fix-query-protocol-state branch June 27, 2022 17:28
@CarlosLopezDeLara CarlosLopezDeLara mentioned this pull request Aug 2, 2022
12 tasks
mkoura added a commit to IntersectMBO/cardano-node-tests that referenced this pull request Aug 25, 2022
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.

3 participants