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 the output of `query stake-address-info #1032

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

CarlosLopezDeLara
Copy link
Contributor

@CarlosLopezDeLara CarlosLopezDeLara commented Jan 24, 2025

Changelog

- description: |
    Add governance action deposits to the output of `query stake-address-info`.  This also renames the field stakeDeposit to stakeRegistrationDeposit in the JSON output. 
    
# 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

@CarlosLopezDeLara CarlosLopezDeLara changed the title Cl/sai Add governance action deposits to the output of `query stake-address-info Jan 24, 2025
@CarlosLopezDeLara CarlosLopezDeLara force-pushed the cl/sai branch 2 times, most recently from 2c01812 to cbdbb30 Compare January 24, 2025 19:32
@smelc
Copy link
Contributor

smelc commented Jan 27, 2025

cc @gitmachtl if you want to have a look at the new output

@gitmachtl
Copy link
Contributor

gitmachtl commented Jan 27, 2025

@smelc so the keynames are different in the output for different eras? -> stakeDelegation vs. delegation
when i do a current stake-address-info query on cli 10.3.0.0 i get stakeDelegation for every era.

@CarlosLopezDeLara
wouldn't it be now time to rename delegationDeposit to stakeDeposit ? breaking

so the entries for the govActionDeposits are showing up as long as the stakeaddress is used in any active gov action as the deposit return address? does it also check the treasury withdrawal payout address?
the entry in the govActionDeposits will be only cleared out once the payout of a proposal has been fulfilled, regardless if its a actionDeposit or treasuryWithdrawal right?

@CarlosLopezDeLara
Copy link
Contributor Author

CarlosLopezDeLara commented Jan 27, 2025

@gitmachtl

so the keynames are different in the output for different eras? -> stakeDelegation vs. delegation
when i do a current stake-address-info query on cli 10.3.0.0 i get stakeDelegation for every era.

If you use babbage query stake-address-info... while the network is in conway, the query is behaves as a conway query and you get something like this:

[
    {
        "address": "stake_test1up3d8ncwksrlw5eazed9lw04ymv48yhmqaxhj5fwdfnhvmcc4s5uy",
        "delegationDeposit": 2000000,
        "rewardAccountBalance": 0,
        "stakeDelegation": "pool1zj33xk9evag9ujkhes86dx9as8exwzt4ju699lffl6e77a23xxd",
        "voteDelegation": null
    }
]

However, if you run babbage query stake-address-info... while in babbage (i.e. in a local cluster)

the query behaves as it was in babbage:

[
   {
       "address": "stake_test1up3d8ncwksrlw5eazed9lw04ymv48yhmqaxhj5fwdfnhvmcc4s5uy",
       "delegation": "pool1zj33xk9evag9ujkhes86dx9as8exwzt4ju699lffl6e77a23xxd",
       "deposit": 2000000,
       "rewardAccountBalance": 0,
   }
]

babbage (and previous) era commands will be deprecated soon, so I don't think we need to makae any changes for babbage era.

wouldn't it be now time to rename delegationDeposit to stakeDeposit ? breaking

This is a good one. It can be stakeDeposit or stakeRegistrationDeposit . The latter seems more accurate.

does it also check the treasury withdrawal payout address?

Not in this PR. That will come in another PR.

the entry in the govActionDeposits will be only cleared out once the payout of a proposal has been fulfilled, regardless if its a actionDeposit or treasuryWithdrawal right?

Yes, the query looks into the live proposals, searches for the reward account, if it finds the credential in the query, it
adds the map of action_ids and deposits to the query stake-address-info result. When the deposits are returned, the query will not find anything, therefore the map will be empty. Like in:

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

@gitmachtl
Copy link
Contributor

gitmachtl commented Jan 27, 2025

@CarlosLopezDeLara

  1. gotcha
  2. sounds good, lets go with stakeRegistrationDeposit 👍 (stakeKeyDeposit would have been an option too 😄)
  3. all good
  4. perfect

@CarlosLopezDeLara CarlosLopezDeLara force-pushed the cl/sai branch 2 times, most recently from efebdb4 to c463b7b Compare January 27, 2025 21:41
@CarlosLopezDeLara
Copy link
Contributor Author

Updating to cardano-api-10.7.0.0 requires https://github.com/IntersectMBO/cardano-cli/pull/1020and then rebased.

@CarlosLopezDeLara CarlosLopezDeLara force-pushed the cl/sai branch 2 times, most recently from bb99dd8 to 9405f7e Compare January 29, 2025 14:11
@CarlosLopezDeLara CarlosLopezDeLara added the next-update Needs a dependency to be updated to be merged label Jan 29, 2025
Add governance action deposits to stake-address-info query
Bump  to cardano-api 10.8
@CarlosLopezDeLara
Copy link
Contributor Author

CarlosLopezDeLara commented Feb 6, 2025

Command running on mainnet, commit b8e2793 :

cardano-cli conway query stake-address-info --address stake1uyguuqwdpexmhgjd07vax5t2ay3f7qvea49ex907g6fmvjclq6l03
[
    {
        "address": "stake1uyguuqwdpexmhgjd07vax5t2ay3f7qvea49ex907g6fmvjclq6l03",
        "govActionDeposits": {
            "8c653ee5c9800e6d31e79b5a7f7d4400c81d44717ad4db633dc18d4c07e4a4fd#0": 100000000000
        },
        "rewardAccountBalance": 429042080677,
        "stakeDelegation": "pool15cy4p3axu0m6sfrmxsp46z5cevx3ruksfwjl48730cgx24j4ydz",
        "stakeRegistrationDeposit": 2000000,
        "voteDelegation": null
    }
]

@CarlosLopezDeLara CarlosLopezDeLara added this pull request to the merge queue Feb 6, 2025
Merged via the queue into master with commit 8e3cb63 Feb 6, 2025
26 checks passed
@CarlosLopezDeLara CarlosLopezDeLara deleted the cl/sai branch February 6, 2025 21:04
{ rewards :: DelegationsAndRewards
, deposits :: Map StakeAddress Lovelace
, delegatees :: Map StakeAddress (L.DRep L.StandardCrypto)
, -- \| deposits: the stake address registration deposit
Copy link
Contributor

Choose a reason for hiding this comment

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

registration*

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you clarify?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next-update Needs a dependency to be updated to be merged
Projects
None yet
5 participants