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

Closed
wants to merge 17 commits into from

Conversation

CarlosLopezDeLara
Copy link
Contributor

@CarlosLopezDeLara CarlosLopezDeLara commented Jan 17, 2025

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"
    }
]

BABBAGE: With the latest chantes the query still works in Babbage era:

cardano-cli babbage query stake-address-info --address $(< example/utxo-keys/stake1.addr)
WARNING: Selected era is deprecated and will be removed in the future.
[
    {
        "address": "stake_test1uq07mnmf838hdlu9qpnwjnntrrtvsa6448ud0g32qkm0kecusq4sd",
        "delegation": "pool1xj26f4rqk2t049yu6n4mmg5zstr6sarv63nc5fuw60rx7u0jxef",
        "delegationDeposit": 2000000,
        "rewardAccountBalance": 0
    }
]

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

cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs Outdated Show resolved Hide resolved
cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs Outdated Show resolved Hide resolved
cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs Outdated Show resolved Hide resolved
cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs Outdated Show resolved Hide resolved
@CarlosLopezDeLara CarlosLopezDeLara marked this pull request as draft January 22, 2025 14:58
CarlosLopezDeLara and others added 16 commits January 22, 2025 09:53
* Added reference test for `compatible conway transaction singed-transaction`
removing all use of the ScriptWitnessFiles type
therefore we can remove the ShelleyBasedEra era parameter

Notice that as a result of factoring out the spending script witness
related code we have gained a simplification i.e we no longer have to
pollute several functions with the ShelleyBasedEra era parameter
WitCtxStake in compatibility transaction build command
Comment on lines +2038 to +2043
<*> ( optional
( pPlutusReferenceSpendScriptWitness balance
<|> pSimpleReferenceSpendingScriptWitess
<|> pOnDiskSimpleOrPlutusScriptWitness
)
)

Check notice

Code scanning / HLint

Redundant bracket Note

cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs:(2038,9)-(2043,9): Suggestion: Redundant bracket
  
Found:
  (,)
    <$>
      Opt.option
        (readerFromParsecParser parseTxIn)
        (Opt.long "tx-in" <> Opt.metavar "TX-IN" <> Opt.help "TxId#TxIx")
    <>
      (optional
         (pPlutusReferenceSpendScriptWitness balance
            <|> pSimpleReferenceSpendingScriptWitess
            <|> pOnDiskSimpleOrPlutusScriptWitness))
  
Perhaps:
  (,)
    <$>
      Opt.option
        (readerFromParsecParser parseTxIn)
        (Opt.long "tx-in" <> Opt.metavar "TX-IN" <> Opt.help "TxId#TxIx")
    <>
      optional
        (pPlutusReferenceSpendScriptWitness balance
           <|> pSimpleReferenceSpendingScriptWitess
           <|> pOnDiskSimpleOrPlutusScriptWitness)
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.

[FEATURE] - Update stake-address-info to show gov action deposits
3 participants