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 data hash checks to remaining governance action commands #915

Merged
merged 6 commits into from
Sep 25, 2024

Conversation

palas
Copy link
Contributor

@palas palas commented Sep 25, 2024

Changelog

- description: |
    Add anchor data hash checks to all `governance action` commands
  type:
  - feature        # introduces a new feature
  - breaking       # the API has changed in a breaking way
  - test           # fixes/modifies tests

Context

This is another step forward on addressing #882.

Previous related PR: #910

This only adds checks to commands inside governance action. There are several other places where to add the check, but better to go step by step.

How to trust this PR

I have adapted test for all commands but one, to validate the new functionality, and that gives me a lot of confidence. I would try to check that the code style is good, I didn't introduce any bugs, the parameter structure and names make sense, and the help is comprehensive and comprehensible.

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

@palas palas added enhancement New feature or request test Modifies/extends the test suite labels Sep 25, 2024
@palas palas self-assigned this Sep 25, 2024
@palas palas linked an issue Sep 25, 2024 that may be closed by this pull request
@palas palas added this pull request to the merge queue Sep 25, 2024
Merged via the queue into main with commit d61153c Sep 25, 2024
25 checks passed
@palas palas deleted the add-hash-validation2 branch September 25, 2024 19:37
@@ -3569,6 +3569,65 @@ pAnchorDataHash =
, Opt.help "Proposal anchor data hash (obtain it with \"cardano-cli hash anchor-data ...\")"
]

data HashCheckParamInfo anchorData
Copy link
Contributor

Choose a reason for hiding this comment

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

This type has incredibly poor type safety.

]
]

proposalHashCheckInfo :: HashCheckParamInfo ProposalUrl
Copy link
Contributor

Choose a reason for hiding this comment

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

Please turn these into stand alone parsers. You can create a function that creates a parser which is the usual style we have.

@@ -70,8 +70,11 @@ instance Error GovernanceActionsError where
<+> "hash:"
<+> pretty (displayException fetchErr)

data AnchorDataTypeCheck = ProposalCheck
data AnchorDataTypeCheck
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be commented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request test Modifies/extends the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FR] - Add File Hash Validation when Building Transaction
3 participants