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

The vote-file and proposal-file options are Conway onwards only #373

Conversation

newhoggy
Copy link
Contributor

@newhoggy newhoggy commented Oct 13, 2023

Changelog

- description: |
    The `vote-file` and `proposal-file` options are Conway onwards only
# 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

Use the Featured type to declare the --vote-files and --proposal-files flags in transaction build and transaction build-raw commands should only exist from Conway era onwards.

Because TxBody also uses Featured in the same way, the code that links the CLI types to the TxBody type is streamlined.

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

@newhoggy newhoggy marked this pull request as ready for review October 13, 2023 10:55
Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

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

Sorry I disagree here.

(pure emptyVotingProcedures)
(\w -> firstExceptT TxCmdVoteError $ ExceptT (readVotingProceduresFiles w voteFiles))
eon
case mfVoteFiles of
Copy link
Contributor

@Jimbo4350 Jimbo4350 Oct 13, 2023

Choose a reason for hiding this comment

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

So we're now essentially pattern matching twice based on whether or not a feature is in an era.

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 what you mean? Is the problem the case match n the Maybe, once for voting procedures and once for proposals?

@newhoggy newhoggy force-pushed the newhoggy/vote-file-and-proposal-file-options-are-conway-onwards-only branch 2 times, most recently from e5755e7 to ca06a7c Compare October 14, 2023 05:27
inEonForEra
(pure emptyVotingProcedures)
(\w -> firstExceptT TxCmdVoteError $ ExceptT (readVotingProceduresFiles w voteFiles))
eon
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The use of inEonForEra is made unnecessary by using the Featured type.

@newhoggy newhoggy dismissed Jimbo4350’s stale review October 14, 2023 05:33

Tidied up the code some more.

@newhoggy newhoggy force-pushed the newhoggy/vote-file-and-proposal-file-options-are-conway-onwards-only branch from ca06a7c to 3dfb7f0 Compare October 14, 2023 05:33
@newhoggy newhoggy requested a review from Jimbo4350 October 14, 2023 05:35
eon
liftMaybeFeatured mfVoteFiles $ \w voteFiles ->
lift (readVotingProceduresFiles w voteFiles)
& onLeft (left . TxCmdVoteError)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using the new liftMaybeFeatured function to make it easy to manipulate the value within the Featured type.

readVotingProceduresFiles takes a [VoteFile In] and returns a VotingProcedures era

liftMaybeFeatured takes that computation to convert a Maybe (Featured ConwayEraOnwards [VoteFile In]) to a Maybe (Featured ConwayEraOnwards [VotingProcedures era])

@newhoggy newhoggy force-pushed the newhoggy/vote-file-and-proposal-file-options-are-conway-onwards-only branch from 3dfb7f0 to 42313e9 Compare October 14, 2023 05:42
@newhoggy newhoggy force-pushed the newhoggy/vote-file-and-proposal-file-options-are-conway-onwards-only branch from 42313e9 to 83ec504 Compare October 21, 2023 06:31
@newhoggy newhoggy changed the title The vote-file and proposal-file options are Conway onwards only The vote-file and proposal-file options are Shelley to Babbage only Oct 21, 2023
@newhoggy newhoggy changed the title The vote-file and proposal-file options are Shelley to Babbage only The vote-file and proposal-file options are Conway era onwards only Oct 21, 2023
@newhoggy newhoggy changed the title The vote-file and proposal-file options are Conway era onwards only The vote-file and proposal-file options Conway onwards only Oct 21, 2023
@newhoggy newhoggy changed the title The vote-file and proposal-file options Conway onwards only The vote-file and proposal-file options are Conway onwards only Oct 21, 2023
@newhoggy newhoggy closed this Oct 22, 2023
@newhoggy newhoggy force-pushed the newhoggy/vote-file-and-proposal-file-options-are-conway-onwards-only branch from 83ec504 to 4def5e6 Compare October 22, 2023 05:33
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.

2 participants