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 anchor to vote-create command #362

Merged
merged 2 commits into from
Oct 12, 2023
Merged

Add anchor to vote-create command #362

merged 2 commits into from
Oct 12, 2023

Conversation

carlhammann
Copy link
Contributor

Changelog

- description: |
    Make it possible to add an anchor to votes
# 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
  # - improvement    # QoL changes e.g. refactoring
  - 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

This PR closes #356 .

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • The change log section in the PR description has been filled in
  • New tests are added if needed and existing tests are updated. These may include:
    • golden tests
    • property tests
    • round trip tests
    • integration tests
      See Running tests for more details
  • The version bounds in .cabal files are updated
  • CI passes. See note on CI. The following CI checks are required:
    • Code is linted with hlint. See .github/workflows/check-hlint.yml to get the hlint version
    • Code is formatted with stylish-haskell. See .github/workflows/stylish-haskell.yml to get the stylish-haskell version
    • Code builds on Linux, MacOS and Windows for ghc-8.10.7 and ghc-9.2.7
  • Self-reviewed the diff

Copy link
Contributor

@smelc smelc left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@carlhammann
Copy link
Contributor Author

carlhammann commented Oct 11, 2023

@CarlosLopezDeLara The interface of the command is now this:

Usage: cardano-cli conway governance vote create

                                                   ...

                                                   [--vote-anchor-url TEXT
                                                     ( --vote-anchor-text TEXT
                                                     | --vote-anchor-file FILE
                                                     )]

  Vote creation.

Available options:

...

  --vote-anchor-url TEXT   vote anchor URL
  --vote-anchor-text TEXT  Input vote anchor contents as UTF-8 encoded text.
  --vote-anchor-file FILE  Input vote anchor contents as a text file.

That is: one can add the complete text behind the anchor through the command, but not the hash (which is what will be included in the vote file). This is the API exposed through cardano-api, which I'm merely wrapping here. If that's insufficient, we'll have to perform a (small) change there first.

@CarlosLopezDeLara
Copy link
Contributor

@carlhammann It looking good, perhpas for consistency with other commands that take anchors it could be

--vote-url 
--vote-text
--vote-file
--vote-hash

Similar to what we have with governance actions, which include:

--proposal-url TEXT      Proposal anchor URL
--proposal-text TEXT     Input proposal as UTF-8 encoded text.
--proposal-file FILE     Input proposal as a text file.
--proposal-hash HASH     Proposal anchor data hash.

@carlhammann
Copy link
Contributor Author

carlhammann commented Oct 11, 2023

@CarlosLopezDeLara With 666490e the options are now exactly similar to the proposal ones you gave above.

@Jimbo4350 to make this work, I had to hack around the function createVotingProcedure from the cardano-api: That function computes the anchor only from the contents to be hashed, and doesn't accept a "simple" anchor composed of an URL and a hash. Does this mean that we should change createVotingProcedure?

@carlhammann carlhammann added this pull request to the merge queue Oct 12, 2023
Merged via the queue into main with commit 4001f53 Oct 12, 2023
19 checks passed
@carlhammann carlhammann deleted the ch/vote-anchor branch October 12, 2023 12:40
@carlhammann carlhammann mentioned this pull request Oct 12, 2023
9 tasks
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.

enhance vote create with the ability to pass an anchor
5 participants