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

Check if stake addresses in proposals are registered onchain #963

Merged
merged 5 commits into from
Nov 15, 2024

Conversation

CarlosLopezDeLara
Copy link
Contributor

@CarlosLopezDeLara CarlosLopezDeLara commented Nov 7, 2024

Changelog

- description: |
    `transaction build` now checks and fails if stake addresses used for deposit return or treasury withdrawals in proposals are NOT registered on-chain. 
# 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 #900

How to trust this PR

Tested locally with a Treasury Withdrawal action where neither the deposit return or funds receiving stake addresses are registered:

cardano-cli conway governance action create-treasury-withdrawal \
--testnet --governance-action-deposit 100000000000 -\
-deposit-return-stake-verification-key-file example/utxo-keys/stake4.vkey \
--anchor-url https://tinyurl.com/3wrwb2as \
--anchor-data-hash 52e69500a92d80f2126c836a4903dc582006709f004cf7a28ed648f732dff8d2 \
--funds-receiving-stake-verification-key-file example/utxo-keys/stake4.vkey \
--transfer 1000000000 \
--constitution-script-hash fa24fb305126805cf2164c161d852a0e7330cf988f1fe558cf7d4a64 \
--out-file example/transactions/treasury.action

cardano-cli conway transaction build \
--proposal-script-file ./guardrailscriptV2/guardrail-script.plutus \
--tx-in-collateral fe7c2bd546dbd9b8d07cb677877842538e8d8695f439460804edcc8dec48b4d6#1 \
--proposal-redeemer-value '{}' \
--tx-in fe7c2bd546dbd9b8d07cb677877842538e8d8695f439460804edcc8dec48b4d6#1 \
--change-address addr_test1qpxswhl4wqx9wz7a2xm22f8kykyltcm9vq7gdh6acjpav0nyf3wxwla9x63vwcdnehthn9queenth86fuhzyy5tv23wqjg8gqx \
--proposal-file example/transactions/treasury.action --out-file example/transactions/treasury-tx.raw

Command failed: transaction build  Error: Stake credential specified in the proposal is not registered on-chain: 
fromList [StakeCredentialByKey "baf951461969b293ae04813af76e15b451c2921bbde53580306d817c"]

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 Check if stake address in proposals are registered onchain Check if stake addresses in proposals are registered onchain Nov 7, 2024
@CarlosLopezDeLara CarlosLopezDeLara force-pushed the cl/checkproposal branch 2 times, most recently from 7b9d4ca to b81a3ea Compare November 7, 2024 17:16
@CarlosLopezDeLara CarlosLopezDeLara marked this pull request as ready for review November 7, 2024 17:50
Copy link
Contributor

@palas palas left a comment

Choose a reason for hiding this comment

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

I haven't tested it, but code looks good to me 👍
I just wrote a suggestion.

cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs Outdated Show resolved Hide resolved
@CarlosLopezDeLara CarlosLopezDeLara added this pull request to the merge queue Nov 15, 2024
Merged via the queue into master with commit 3983bcb Nov 15, 2024
28 of 29 checks passed
@CarlosLopezDeLara CarlosLopezDeLara deleted the cl/checkproposal branch November 15, 2024 19:27
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.

[FR] - Proactive protection against GovAction deposit losses
4 participants