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

stake-address registration-certificate: do not allow key-reg-deposit-amt before conway #509

Merged

Conversation

smelc
Copy link
Contributor

@smelc smelc commented Dec 6, 2023

Changelog

- description: |
    `stake-address registration-certificate`: remove flag `--key-reg-deposit-amt` from all eras except conway
# 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

Fixes #504

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

@smelc smelc force-pushed the smelc/babbage-stake-address-reg-cert-no-key-reg-deposit-amt branch 2 times, most recently from 68bd79c to d0f4c75 Compare December 7, 2023 09:52
@smelc smelc marked this pull request as ready for review December 7, 2023 10:01
Copy link
Contributor

@carlhammann carlhammann left a comment

Choose a reason for hiding this comment

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

If I understand #504, and the function createRegistrationCertRequirements correctly, we can (should!) go even further. The --key-reg-deposit-amt flag should be present only on the Conway command line (and the legacy one, where we can't avoid it...), shouldn't it?

Copy link
Contributor

@carbolymer carbolymer left a comment

Choose a reason for hiding this comment

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

Couple of code style comments.

Comment on lines 97 to 108
(\babbageOnwards ->
let babbageOrConway = babbageEraOnwardsToShelleyBasedEra babbageOnwards
babbageBuilder si = StakeAddressRegistrationCertificateCmd babbageOrConway si Nothing
conwayBuilder si lovelace = StakeAddressRegistrationCertificateCmd babbageOrConway si (Just lovelace)
in make $ case babbageOnwards of
BabbageEraOnwardsBabbage -> babbageBuilder <$> pStakeIdentifier <*> pOutputFile
BabbageEraOnwardsConway -> conwayBuilder <$> pStakeIdentifier <*> pKeyRegistDeposit <*> pOutputFile
)
sbe
where
desc = Opt.progDesc "Create a stake address registration certificate"
make parser = subParser "registration-certificate" (Opt.info parser desc)
Copy link
Contributor

Choose a reason for hiding this comment

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

This code is a bit hard to follow and reason about. How about something simpler, using forEraInEonMaybe:

Suggested change
(\babbageOnwards ->
let babbageOrConway = babbageEraOnwardsToShelleyBasedEra babbageOnwards
babbageBuilder si = StakeAddressRegistrationCertificateCmd babbageOrConway si Nothing
conwayBuilder si lovelace = StakeAddressRegistrationCertificateCmd babbageOrConway si (Just lovelace)
in make $ case babbageOnwards of
BabbageEraOnwardsBabbage -> babbageBuilder <$> pStakeIdentifier <*> pOutputFile
BabbageEraOnwardsConway -> conwayBuilder <$> pStakeIdentifier <*> pKeyRegistDeposit <*> pOutputFile
)
sbe
where
desc = Opt.progDesc "Create a stake address registration certificate"
make parser = subParser "registration-certificate" (Opt.info parser desc)
(\_babbageOnwards -> do
let mpKeyRegistDeposit =
sequenceA $ forEraInEonMaybe
@ConwayEraOnwards
era
(const pKeyRegistDeposit)
make $ StakeAddressRegistrationCertificateCmd sbe
<$> pStakeIdentifier
<*> mpKeyRegistDeposit
<*> pOutputFile
)
sbe
where
desc = Opt.progDesc "Create a stake address registration certificate"
make parser = subParser "registration-certificate" (Opt.info parser desc)

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 went for something simpler in the new version, can you have another look?

@smelc smelc force-pushed the smelc/babbage-stake-address-reg-cert-no-key-reg-deposit-amt branch from d0f4c75 to ba5b5e6 Compare December 11, 2023 13:49
@CarlosLopezDeLara
Copy link
Contributor

legacy

That's correct. It's a conway only flag.

@smelc smelc force-pushed the smelc/babbage-stake-address-reg-cert-no-key-reg-deposit-amt branch from ba5b5e6 to 8abc774 Compare December 11, 2023 19:24
@smelc smelc changed the title babbage: stake-address registration-certificate: do not allow key-reg-deposit-amt stake-address registration-certificate: do not allow key-reg-deposit-amt before conway Dec 11, 2023
@smelc smelc force-pushed the smelc/babbage-stake-address-reg-cert-no-key-reg-deposit-amt branch from 8abc774 to d2b4c76 Compare December 11, 2023 19:26
$ Opt.info
( StakeAddressRegistrationCertificateCmd (shelleyToBabbageEraToShelleyBasedEra shelleyToBabbage)
<$> pStakeIdentifier
<*> optional pKeyRegistDeposit
Copy link
Contributor

@Jimbo4350 Jimbo4350 Dec 11, 2023

Choose a reason for hiding this comment

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

Why not pure Nothing for Shelley to Babbage??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hum yeah really smart, I hadn't thought of lifting over the value type rather than the Parser type 👍

Done the change.

@smelc smelc force-pushed the smelc/babbage-stake-address-reg-cert-no-key-reg-deposit-amt branch from d2b4c76 to ae880fc Compare December 11, 2023 19:42
@Jimbo4350 Jimbo4350 self-requested a review December 11, 2023 19:52
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.

LGTM! Just squash the commits.

@smelc smelc force-pushed the smelc/babbage-stake-address-reg-cert-no-key-reg-deposit-amt branch from ae880fc to f4b67ed Compare December 11, 2023 19:56
@smelc
Copy link
Contributor Author

smelc commented Dec 11, 2023

image

@smelc smelc enabled auto-merge December 11, 2023 19:57
@smelc smelc added this pull request to the merge queue Dec 11, 2023
Merged via the queue into main with commit a16da62 Dec 11, 2023
19 checks passed
@smelc smelc deleted the smelc/babbage-stake-address-reg-cert-no-key-reg-deposit-amt branch December 11, 2023 20:25
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.

stake-address registration-certificate has the flag --key-reg-deposit-amt, it should not.
5 participants