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

New governance drep id command #194

Merged
merged 2 commits into from
Aug 21, 2023

Conversation

newhoggy
Copy link
Contributor

@newhoggy newhoggy commented Aug 21, 2023

Changelog

- description: |
    New `governance drep id` command
# 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

Resolves #129

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
  • The changelog section in the PR is updated to describe the change
  • Self-reviewed the diff

@newhoggy newhoggy marked this pull request as ready for review August 21, 2023 15:43
@newhoggy newhoggy force-pushed the newhoggy/new-governance-drep-id-command branch from 5712ce4 to c619393 Compare August 21, 2023 15:49
| PoolIdOutputFormatBech32
data IdOutputFormat
= IdOutputFormatHex
| IdOutputFormatBech32
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 was renamed to remove Pool prefix because it can be used by dreps as well (and possibly others).

Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment explicitly stating what this type is i.e an identifier for SPOs or DReps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment.

@@ -1388,16 +1388,16 @@ pKeyOutputFormat =
, Opt.value KeyOutputFormatTextEnvelope
]

pPoolIdOutputFormat :: Parser PoolIdOutputFormat
pPoolIdOutputFormat :: Parser IdOutputFormat
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 parser retains the Pool prefix however because the help text is pool specific.

@newhoggy newhoggy force-pushed the newhoggy/new-governance-drep-id-command branch from c619393 to 30b068a Compare August 21, 2023 16:01
@newhoggy newhoggy force-pushed the newhoggy/new-governance-drep-id-command branch from 30b068a to fd611a1 Compare August 21, 2023 16:01
@@ -0,0 +1 @@
drep1avya24t2308yyyr5uw2dqtreemvkwst90dx00j5fj5556meyztm
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Golden tests included

@@ -0,0 +1 @@
eb09d5556a8bce421074e394d02c79ced96741657b4cf7ca8995294d
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Golden tests included

"type": "DRepSigningKey_ed25519",
"description": "Delegate Representative Signing Key",
"cborHex": "58201872d334e12a3a062dbdc4f2a22dc77f6e88ba8ecb39d0a2e385375f15ba0005"
}
Copy link
Contributor Author

@newhoggy newhoggy Aug 21, 2023

Choose a reason for hiding this comment

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

It is proposed that test input files are put in a separate directory outside of the golden directory.

These files can be re-used. We don't need to have separate keys of the same type for each test for example. This means there shouldn't be many such files and we can throw them all in the same directory.

| GovernanceDRepGenerateKey
(ConwayEraOnwards era)
(File (VerificationKey ()) Out)
(File (SigningKey ()) Out)
| GovernanceDRepRegistrationCertificateCmd
AnyRegistrationTarget
(File () Out)
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'm just alphabetically sorting the commands.

@newhoggy newhoggy force-pushed the newhoggy/new-governance-drep-id-command branch 2 times, most recently from a71c987 to 2efac9a Compare August 21, 2023 16:07
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.

Looks good, two small changes.

| PoolIdOutputFormatBech32
data IdOutputFormat
= IdOutputFormatHex
| IdOutputFormatBech32
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment explicitly stating what this type is i.e an identifier for SPOs or DReps.

@@ -47,7 +47,10 @@ data LegacyPoolCmds
EpochNo
-- ^ Epoch in which to retire the stake pool.
(File () Out)
| PoolGetId (VerificationKeyOrFile StakePoolKey) PoolIdOutputFormat (Maybe (File () Out))
| PoolGetId
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't add anything else to the legacy commands. We only want to maintain them. Anything new should only go under the new era based 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.

There's no changes to this command.

I've only just done the PoolIdOutputFormat -> IdOutputFormat rename.

This can be verified as there are no golden file changes for this command.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah sorry, misread the diff

@Jimbo4350 Jimbo4350 self-requested a review August 21, 2023 16:14
@newhoggy newhoggy force-pushed the newhoggy/new-governance-drep-id-command branch from 2efac9a to 8be1bae Compare August 21, 2023 16:14
@newhoggy newhoggy added this pull request to the merge queue Aug 21, 2023
Merged via the queue into main with commit 8446431 Aug 21, 2023
19 checks passed
@newhoggy newhoggy deleted the newhoggy/new-governance-drep-id-command branch August 21, 2023 16:54
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.

[FEATURE] - command to get DRep ID
2 participants