-
Notifications
You must be signed in to change notification settings - Fork 631
WIP [CDEC-369] Remove HasProtocolConstants in favour of parameters #3133
Conversation
7b630f1
to
325b1a5
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.
This is kinda huge and I see a commit was pushed while I was reviewing. Ping me when you're ready for a review?
@@ -113,6 +116,7 @@ createCommandProcs mpm hasAuxxMode printAction mDiffusion = rights . fix $ \comm | |||
}, | |||
|
|||
let name = "addr-hd" in | |||
needsProtocolConstants name >>= \pc -> |
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.
is someone afraid of do notation? 🤔
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.
Good point - I might leave this for another PR though, because this whole function is a mess!
auxx/src/Command/Proc.hs
Outdated
instance MonadAuxxMode m => ToLeft m Address PublicKey where | ||
toLeft = either return makePubKeyAddressAuxx | ||
-- instance MonadAuxxMode m => ToLeft m Address PublicKey where | ||
-- toLeft = either return makePubKeyAddressAuxx |
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.
Should be deleted?
e45a837
to
5bb83d3
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.
Sorry, too many semantically null changes in this as it is. Its already a large PR.
auxx/Main.hs
Outdated
|
||
cArgs@CLI.CommonNodeArgs {..} = aoCommonNodeArgs | ||
conf = CLI.configurationOptions (CLI.commonArgs cArgs) | ||
nArgs = | ||
CLI.NodeArgs {behaviorConfigPath = Nothing} | ||
nArgs = CLI.NodeArgs {behaviorConfigPath = Nothing} |
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.
Up above there was:
sscParams = CLI.gtSscParams cArgs vssSK (npBehaviorConfig nodeParams)
which was wibbled onto two lines and here we have two lines wibbled onto one.
Both changes are just noise with zero semantic change. We should try to keep these semantically null changes out of our PRs.
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.
Hmm - so I was working on the function and it needed formatting both because of my changes and it was poorly laid out before. I know that the change isn't semantic but this seems like the best time to make this kind of change. I'm not going to go through and change the whole codebase, but while I'm already touching a function it seems reasonable to format the whole thing, no?
auxx/src/Command/Rollback.hs
Outdated
printTipDifficulty = do | ||
tipDifficulty <- view difficultyL <$> DB.getTipHeader | ||
logInfo $ sformat ("Our tip's difficulty is "%build) tipDifficulty | ||
logInfo $ sformat ("Our tip's difficulty is " % build) tipDifficulty |
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.
I personally don't like the lack of whitespace around the %
operator, but Serokell's coding guidelines explicit state that the original version is the right one and the existing code base complies. If we decide to change this it should probably be something enforced by stylish-haskell.
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.
This is fair enough. It's not something that we can enforce using stylish-haskell
as far as I'm aware, but I'm happy to revert it if we want to keep it consistent.
auxx/src/Command/Tx.hs
Outdated
def | ||
(NE.fromList allAddresses) | ||
(map TxOutAux outputs) | ||
curPk |
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.
The original line was obvious too long because we can't see the end of the line in the Github diff.
I would probably have formatted that as:
(txAux, _) <- lift $ prepareMTx pm epochSlots getSigner mempty def
NE.fromList allAddresses) (map TxOutAux outputs) curPk
which is still under 100 chars wide.
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.
Not sure see the problem here!
auxx/src/Command/Tx.hs
Outdated
Right tx -> logInfo $ sformat ("Submitted transaction: "%txaF) tx | ||
Left err -> logError | ||
$ sformat ("Error: " % stext) (toText $ displayException err) | ||
Right tx -> logInfo $ sformat ("Submitted transaction: " % txaF) tx |
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.
If this change was simply to get the max line width under 80 chars, i would suggest this is a perfect example of why the line width should stay at 100.
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.
I'm not sure that's a valid argument. The line width wasn't supposed to be 100 anyway, so this is just a change to conform to the style guide. Had the line been incorrectly as 102 when we wanted 100, the fact we have to change it isn't an argument for col width 102!
5bb83d3
to
e7bfffc
Compare
a32025e
to
da9fc0f
Compare
Fixing it and taking over this PR because @ruhatch is on leave.
This has been revived as this PR |
Description
Remove the
HasProtocolConstants
constraint and replace it with explicit parameters. For testing code we use thedummyProtocolConstants
defined inTest.Pos.Core.Dummy
.Reviewers please keep a keen eye out for
minBound
andmaxBound
changes!Spent the day rebasing and cleaning this up. Still not ready for review.
Linked issue
CDEC-369
Type of change
Developer checklist
Testing checklist
QA Steps
Screenshots (if available)