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 that poll answer index is not negative, to avoid a Prelude.!! error #380

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

smelc
Copy link
Contributor

@smelc smelc commented Oct 17, 2023

Changelog

- description: |
    Check that poll answer index is not negative. This replaces a Prelude.!! error by a regular `GovernanceCmdError` error
# 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

Fixes IntersectMBO/cardano-node#5182

How to trust this PR

Execute before the PR, observe Prelude.!! error:

→ cabal run cardano-cli -- governance answer-poll --poll-file cardano-cli/test/cardano-cli-golden/files/input/governance/polls/basic.json --answer -1

cardano-cli: Prelude.!!: negative index

Execute on this PR, witness it fails with a regular error:

→ cabal run cardano-cli -- governance answer-poll --poll-file cardano-cli/test/cardano-cli-golden/files/input/governance/polls/basic.json --answer -1
Command failed: governance answer-poll  Error: Poll answer out of bounds. Choices are between 0 and 1

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • The change log section in the PR description has been filled in
  • NA 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
  • NA The version bounds in .cabal files are updated
  • CI passes. See note on CI. The following CI checks are required:
  • Self-reviewed the diff

@smelc
Copy link
Contributor Author

smelc commented Oct 17, 2023

Minimalist one to finish my day 😸

Copy link
Contributor

@carlhammann carlhammann left a comment

Choose a reason for hiding this comment

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

LGTM ... and the rendering of the error that's thrown is still correct.

@smelc smelc added this pull request to the merge queue Oct 18, 2023
Merged via the queue into main with commit aff9c46 Oct 18, 2023
23 checks passed
@smelc smelc deleted the smelc/fix-node-issue-5182 branch October 18, 2023 13:38
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.

[BUG] - Unclear / inconsistent error message from governance answer-poll
3 participants