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 stake address registration and delegation certificate and stake pool delegation certificate to compatible commands #1070

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

carbolymer
Copy link
Contributor

@carbolymer carbolymer commented Feb 19, 2025

Changelog

- description: |
    Add stake address registration and delegation certificate and stake pool delegation certificate to compatible commands
# 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
  # - refactoring    # QoL changes
  # - 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

Adds support for more compatible commands

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

@carbolymer carbolymer changed the title wip Add more compatible commands Feb 19, 2025
@carbolymer carbolymer self-assigned this Feb 19, 2025
@carbolymer carbolymer force-pushed the mgalazyn/feature/add-more-compatible-commands branch from 2e3e4d7 to d1bc917 Compare February 19, 2025 19:17
@carbolymer carbolymer force-pushed the mgalazyn/feature/add-more-compatible-commands branch 2 times, most recently from 52daacd to 48414a5 Compare February 25, 2025 12:23
@carbolymer carbolymer force-pushed the mgalazyn/feature/add-more-compatible-commands branch 8 times, most recently from 859a1fe to 107da6c Compare February 26, 2025 07:46
@carbolymer carbolymer changed the title Add more compatible commands Add stake address registration and delegation certificate and stake pool delegation certificate to compatible commands Feb 26, 2025
@carbolymer carbolymer marked this pull request as ready for review February 26, 2025 07:46
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.

Please break this up into sensible commits

@carbolymer carbolymer force-pushed the mgalazyn/feature/add-more-compatible-commands branch from 107da6c to 9480b1c Compare February 27, 2025 12:35
@carbolymer carbolymer requested a review from Jimbo4350 February 27, 2025 12:37
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.

Nice work 👍 . The commits you split the PR into made reviewing your changes much easier. There are a couple of comments, the one regarding catching exceptions should be addressed but I won't block the PR on this.

throwCliError = throwIO
-- | Wrapper function which allows throwing of types of instance `Error`, attaching call stack
-- from the call site
throwCliError :: (HasCallStack, Show e, Typeable e, Error e, MonadIO m) => e -> m a
Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC this will return a callstack to this module. It's slightly ugly IMO but I wouldn't block the PR on this.


fromEitherCli :: (HasCallStack, MonadIO m, Show e, Typeable e, Error e) => Either e a -> m a
fromEitherCli = withFrozenCallStack $ \case
Left e -> throwCliError $ CustomCliException e
Left e -> throwCliError e
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

-- TODO This needs to be changed in the future to let the top level exception handler handle the
-- exceptions printing.
newExceptT $
runRIO () $
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we catching here? Why not just: runRIO () $ runAnyCompatibleCommand cmd? toplevelExceptionHandler will handle the exceptions.


data CompatibleStakeAddressCmds era
= CompatibleStakeAddressRegistrationCertificateCmd
(ShelleyBasedEra era)
Copy link
Contributor

Choose a reason for hiding this comment

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

Some haddocks here explaining for instance why we have Maybe Coin would be useful.


let regCert = makeStakeAddressRegistrationCertificate req

fromEitherIOCli @_ @(FileError ()) $
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting. We are prevented from specifying @(CIO e) because it is a type synonym. However @(RIO e) works.

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