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

Make governance action create-protocol-parameters-update Conway onwards only #366

Merged

Conversation

newhoggy
Copy link
Contributor

@newhoggy newhoggy commented Oct 11, 2023

Changelog

- description: |
    Make `governance action create-protocol-parameters-update` 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

This also converts to use command argument types for governance actions commands.

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

@@ -14,7 +13,6 @@ Available options:
Available commands:
create-mir-certificate Create an MIR (Move Instantaneous Rewards)
certificate
action Governance action commands.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change shows the benefit of allowing commands and command groups to decide for themselves if they appear in an era.

All I did was make governance action create-protocol-parameters-update Conway onwards only.

Then the action command figured out that it was empty for all the pre-Conway eras and decided to not appear in those eras.

@newhoggy newhoggy marked this pull request as ready for review October 11, 2023 14:06
@newhoggy newhoggy changed the title Command argument types for governance actions commands Make governance action create-protocol-parameters-update Conway onwards only Oct 11, 2023
@newhoggy newhoggy changed the title Make governance action create-protocol-parameters-update Conway onwards only Make governance action create-protocol-parameters-update Conway onwards only Oct 11, 2023
@@ -24,89 +27,88 @@ import Data.Text (Text)
import Data.Word

data GovernanceActionCmds era
Copy link
Contributor

Choose a reason for hiding this comment

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

I take it this is (part of) the new conventions you allude to here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep

@@ -10,7 +10,7 @@ import Cardano.Api
import Cardano.Api.Ledger
import Cardano.Api.Shelley

import Cardano.CLI.EraBased.Commands.Governance.Actions
import qualified Cardano.CLI.EraBased.Commands.Governance.Actions as Cmd
Copy link
Contributor

Choose a reason for hiding this comment

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

And this qualified import as well, part of the new convention?

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 Cmd qualification allows us to avoid naming conflicts. For example in the records we have an eon field which if imported unqualified will name conflict with a lot of code.

, ucPreviousGovActionId :: Maybe (TxId, Word32)
, ucFilePath :: File () Out
} deriving Show
{ networkId :: !Ledger.Network
Copy link
Contributor

@smelc smelc Oct 11, 2023

Choose a reason for hiding this comment

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

So I take that having multiple fields with the same name in a module is allowed by our coding style now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is okay for command argument types because the qualifications and record field matching allows us to avoid naming conflicts.

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 🍾 Really nice that you have well defined commits, makes it possible to review iteratively.

@newhoggy newhoggy force-pushed the newhoggy/command-arg-types-for-governance-actions-commands branch from d6b3bdf to 42326f9 Compare October 12, 2023 00:35
@newhoggy newhoggy added this pull request to the merge queue Oct 12, 2023
Merged via the queue into main with commit 935d5e8 Oct 12, 2023
19 checks passed
@newhoggy newhoggy deleted the newhoggy/command-arg-types-for-governance-actions-commands branch October 12, 2023 01:29
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.

None yet

4 participants