IntersectMBO / cardano-cli

This repository contains sources for the command-line interface (CLI) tool for interacting with the Cardano blockchain.
Apache License 2.0
43 stars 15 forks source link

cardano-cli `query drep-state` issues with `--include-stake` #623

Closed gitmachtl closed 7 months ago

gitmachtl commented 8 months ago
$ ./cardano-cli-latest version
cardano-cli 8.20.1.0 - linux-x86_64 - ghc-8.10
git rev 7f49f394d364f8a0b6533051114a63a54cd47a81

Doing a query for a specific --drep-key-hash does not return the stake even if the flag --include-stake is set:

$ ./cardano-cli-latest conway query drep-state --drep-key-hash 7fb3e519ac284cd198e8e403d97b5b3ff58aa798ef85faf39d95971b --include-stake
[
    [
        {
            "keyHash": "7fb3e519ac284cd198e8e403d97b5b3ff58aa798ef85faf39d95971b"
        },
        {
            "anchor": null,
            "deposit": 2000000,
            "expiry": 269
        }
    ]
]

However, doing a query for --all-dreps not only autoincludes(should be off by default) the stake query but when you look at the data for the example drep-key-hash above the output is:

$ ./cardano-cli-latest conway query drep-state --all-dreps
...
[
        {
            "keyHash": "7fb3e519ac284cd198e8e403d97b5b3ff58aa798ef85faf39d95971b"
        },
        {
            "anchor": null,
            "deposit": 2000000,
            "expiry": 269,
            "stake": 37992188702
        }
    ],
...

@carlhammann @smelc

gitmachtl commented 8 months ago

@smelc any updates on that front? thx!

gitmachtl commented 7 months ago

@carlhammann @smelc

hmm... something is wrong with cli version 8.20.3.0. looks like the --include-stake logic is inverted.

doing a query for a specific drep-id/hash with the --include-stake flag does NOT return the state with the stake:

./cardano-cli conway query drep-state --drep-key-hash a8eb0fa2b5c0fcc5014fb74a162c6ee0c0e89199ed939ab97432c71a --include-stake
[
    [
        {
            "keyHash": "a8eb0fa2b5c0fcc5014fb74a162c6ee0c0e89199ed939ab97432c71a"
        },
        {
            "anchor": null,
            "deposit": 2000000,
            "expiry": 273
        }
    ]
]

On the other hand, leaving the --include-stake flag out returns the state WITH the stake:

$ ./cardano-cli conway query drep-state --drep-key-hash a8eb0fa2b5c0fcc5014fb74a162c6ee0c0e89199ed939ab97432c71a
[
    [
        {
            "keyHash": "a8eb0fa2b5c0fcc5014fb74a162c6ee0c0e89199ed939ab97432c71a"
        },
        {
            "anchor": null,
            "deposit": 2000000,
            "expiry": 273,
            "stake": 95472917
        }
    ]
]