-
Notifications
You must be signed in to change notification settings - Fork 15
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
Share code in parsers of committee commands #816
Conversation
36bb1a8
to
e8e94d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice refactoring. Just some ideas to bring it even further
] | ||
deserialiseHotCCKeyHashFromHex :: ReadM (Hash CommitteeHotKey) | ||
deserialiseHotCCKeyHashFromHex = | ||
pHexHash AsCommitteeHotKey (Just "Invalid Consitutional Committee hot key hash") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pHexHash AsCommitteeHotKey (Just "Invalid Consitutional Committee hot key hash") | |
pHexHash AsCommitteeHotKey (Just "Invalid Constituional Committee hot key hash") |
Consitutional -> Constitutional
The typo was already there before the PR, but it would be good to do a search and replace since you are at it
:: SerialiseAsRawBytes (Hash a) => AsType a -> ReadM (Hash a) | ||
pHexHash a = | ||
:: SerialiseAsRawBytes (Hash a) => AsType a -> Maybe String -> ReadM (Hash a) | ||
pHexHash a mErrPrefix = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, you could also use this function in:
pAddCommitteeColdVerificationKeyHash
, pGenesisVerificationKeyHash
, pGenesisDelegateVerificationKeyHash
, pVrfVerificationKeyHash
, and pStakePoolMetadataHash
, I think.
. BSC.pack | ||
|
||
deserialiseColdCCKeyFromHex :: String -> Either String (VerificationKey CommitteeColdKey) | ||
deserialiseColdCCKeyFromHex = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would also be nice to have also something like pHexHash
for verification keys (or even generalize it further, not sure if it is possble), and that could also be used in several places in this file: pGenesisDelegateVerificationKey
, pAddCommitteeColdVerificationKey
, deserialiseColdCCKeyFromHex
, deserialiseHotCCKeyFromHex
, and pGenesisVerificationKey
.
Thanks @palas, I'll look at your suggestions in another PR, I don't like big PRs 😉 |
e8e94d3
to
a11c529
Compare
pHexHash | ||
:: SerialiseAsRawBytes (Hash a) => AsType a -> ReadM (Hash a) | ||
pHexHash a = | ||
:: SerialiseAsRawBytes (Hash a) => AsType a -> Maybe String -> ReadM (Hash a) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a haddock for Maybe String
. It takes a moment to understand its purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a top-level haddock, changed to be attached to the parameter 👍
@@ -8,6 +8,7 @@ | |||
{- HLINT ignore "Move brackets to avoid $" -} | |||
{- HLINT ignore "Use <$>" -} | |||
{- HLINT ignore "Move brackets to avoid $" -} | |||
{- HLINT ignore "Use section" -} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's wrong with sections?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It yields this suggestion:
cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs:538:26-36: Suggestion: Use section
Found:
((<>) ": ")
Perhaps:
(": " <>)
which I personally don't find a really good change. But no strong opinion. I can leave it back if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're fine imo. My problem is with per-module level hlint rules. I think we should agree together on a set of them, put them into the top level config and enforce those rules everywhere.
a11c529
to
daddf0d
Compare
Changelog
Context
More sharing is possible (e.g. hot VS cold), but I don't want to stack too much in one PR.
How to trust this PR
Checklist