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

Add governance action deposits to stake-address-info query #1024

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CarlosLopezDeLara
Copy link
Contributor

Changelog

- description: |
    Add governance action deposits to the output of `query stake-address-info` 
    
# uncomment types applicable to the change:
  type:
   - feature        # introduces a new feature
  # - breaking       # the API has changed in a breaking way
   - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  # - refactoring    # QoL changes
  # - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...

Context

Resolves #954
Requires IntersectMBO/cardano-api#730

How to trust this PR

The query now includes a map of (GovActionIds, Deposit) assocoated to the stake address:

❯ cardano-cli conway query stake-address-info --address stake_test1upumkxq6k4th9wtp4zp69gjwwwj5zmskxd6czlyf3xflzgq8yk95h
[
    {
        "address": "stake_test1upumkxq6k4th9wtp4zp69gjwwwj5zmskxd6czlyf3xflzgq8yk95h",
        "delegationDeposit": 2000000,
        "govActionDeposits": [
            {
                "1166b7591577807470bd527edf2a5fac938b8d56842a67684b682b1e8e76d198#0": 100000000000,
                "2f1be5c1aa824dac76b98acb35176defa6357e529cd297ae24353943b46a0cde#0": 100000000000,
                "d098afe0db98605c243c13c8a537a3eb51e6ded5e3a48acca83e7082a0086428#0": 100000000000
            }
        ],
        "rewardAccountBalance": 1194509145192,
        "stakeDelegation": "pool18pn6p9ef58u4ga3wagp44qhzm8f6zncl57g6qgh0pk3yytwz54h",
        "voteDelegation": "keyHash-74519ac5359c003a7ace69c475ae55a86eb8f9fec6cf6feaada1debf"
    }
]

or empty if it is not associated to any

❯ cardano-cli conway query stake-address-info --address $(< stake.addr)
[
    {
        "address": "stake_test1upfpm2244k8jf00l357t3adp2hzfsuqrwqvleheqjj08uhswme5cn",
        "delegationDeposit": 2000000,
        "govActionDeposits": [
            {}
        ],
        "rewardAccountBalance": 300000000000,
        "stakeDelegation": "pool1l9u9ss9xtww8qkt4zqda84z945f6tgq4753jqhtdr4r8yaw7d6g",
        "voteDelegation": "scriptHash-59aa3f091b3bcef254abfb89aea64973a61b78fdb2ac44839c7ccba8"
    }
]

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

stakeVoteDelegatees <- monoidForEraInEonA era $ \ceo ->
easyRunQuery (queryStakeVoteDelegatees ceo stakeAddr)
govActionStates :: (Seq.Seq (L.GovActionState (ShelleyLedgerEra era))) <-
easyRunQuery $ queryProposals ceo $ Set.empty

Check notice

Code scanning / HLint

Redundant $ Note

cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs:980:45: Suggestion: Redundant $
  
Found:
  queryProposals ceo $ Set.empty
  
Perhaps:
  queryProposals ceo Set.empty
@@ -970,17 +971,30 @@ callQueryStakeAddressInfoCmd
(stakeRewardAccountBalances, stakePools) <-
easyRunQuery (queryStakeAddresses sbe stakeAddr networkId)

beo <- requireEon BabbageEra era
ceo <- requireEon ConwayEra era
Copy link
Contributor

@carbolymer carbolymer Jan 17, 2025

Choose a reason for hiding this comment

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

So this will throw an error when we're in era < Conway. I think we should hide the command for eras < Conway in pQueryStakeAddressInfoCmd parser and add ConwayEraOnwards era field to QueryStakeAddressInfoCmdArgs.
(I'm not sure why it wasn't hidden for < Babbage in the first place 🤔)

I'm also wondering if it's not used in hardforking tests, may be worth double checking with @mkoura .


stakeVoteDelegatees <- monoidForEraInEonA era $ \ceo ->
easyRunQuery (queryStakeVoteDelegatees ceo stakeAddr)
govActionStates :: (Seq.Seq (L.GovActionState (ShelleyLedgerEra era))) <-
Copy link
Contributor

Choose a reason for hiding this comment

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

This field could be made optional and only show up in eras > Conway. This way the query would still be usable in Babbage.

@@ -1028,6 +1043,7 @@ writeStakeAddressInfo
, "voteDelegation" .= fmap friendlyDRep mDRep
, "rewardAccountBalance" .= mBalance
, "delegationDeposit" .= mDeposit
, "govActionDeposits" .= [gaDeposits]
Copy link
Contributor

@carbolymer carbolymer Jan 17, 2025

Choose a reason for hiding this comment

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

why a map is wrapped in a list?

@@ -1028,6 +1043,7 @@ writeStakeAddressInfo
, "voteDelegation" .= fmap friendlyDRep mDRep
, "rewardAccountBalance" .= mBalance
, "delegationDeposit" .= mDeposit
, "govActionDeposits" .= [gaDeposits]
Copy link
Contributor

Choose a reason for hiding this comment

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

the caseShelleyToBabbageOrConwayEraOnwards now becomes useless, because babbage branch becomes dead code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants