-
Notifications
You must be signed in to change notification settings - Fork 629
Conversation
Since there are a lot of changes here, I'd recommend going through the commits separately. The first 2 delete dead code which used |
73d8de6
to
eb060b6
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.
Wanted to point out a couple things that need attention.
core/src/Pos/Core/Conc.hs
Outdated
|
||
-- | This function is analogous to `System.Timeout.timeout`, it's | ||
-- based on `Race` and `Delay`. | ||
-- TODO mhueschen - make sure this is equivalent to the old method |
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.
❗️Since these are important primitives, I think we should ensure equivalence between old & new implementations. I am unsure of the best way to do that, hence the TODO and this comment.
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.
timeout
certainly seems right to me.
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.
Cool. So we will rely on QA & release tests to catch anything that might arise?
infra/src/Pos/Infra/Slotting/Util.hs
Outdated
@@ -113,6 +113,8 @@ type MonadOnNewSlot ctx m = | |||
-- | Run given action as soon as new slot starts, passing SlotId to | |||
-- it. This function uses Mockable and assumes consistency between | |||
-- MonadSlots and Mockable implementations. | |||
-- TODO mhueschen ^ get feedback on what this comment means and what | |||
-- we should do about it. |
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 don't have good insight into this comment, and am confused by the implication that MonadSlots
& Mockable
implement equivalent functionality (they seem fairly different to me), so would appreciate any feedback on this.
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 think the comment you refer to is only relevant for Mockable
instances were the underlying monad is not IO
.
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.
Thanks, I think you're right. I found that the "simple/default implementation" uses currentTime
, which (before this PR) used to be a Mockable
function. So there could be alternative implementations which might not have the appropriate consistency that the comment mentions.
I'll update the comment.
tools/src/dbgen/Main.hs
Outdated
askLoggerName = pure $ LoggerName "dbgen" | ||
modifyLoggerName _ x = x | ||
-- TODO mhueschen get feedback about usage of this module and whether | ||
-- the instance from `Pos.Core.Conc` can eclipse this. |
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 don't have insight into what this module/executable is used for, and whether it's important that the instances be the same. If it's not important, then it's simpler to keep the one instance here and delete this one.
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 in the tools
package which basically just contains tools for the IOHK devops people to do what they need to do.
On top of which, the current logging implementation is being replaced soon.
Not sure if that helps.
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.
Thanks. I'll ask in the devops channel if anyone has advice or opinions on this.
-- | Temporary holding bin for useful functions defined in `Pos.Core.Mockable`. | ||
-- Since we are removing the `Mockable` class, some of the functions defined | ||
-- there will move here. | ||
module Pos.Core.Conc |
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 created this module to avoid laborious changes to the imports of modules which had previously used Mockable
(and the functions exposed from Mockable.Production
). Much of the functionality exported here comes from UnliftIO
or Control.Concurrent
, so we could also dismantle this module and would-be importers use UnliftIO
directly. I think this module is a fairly clean way to encapsulate the functionality, though.
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.
Makes sense!
| DuplicateConnection | ||
deriving (Typeable, Show) | ||
|
||
instance Exception InternalError |
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 would be great to have @avieth confirm deletion of this module. It isn't included in the respective cabal file and seems fairly bitrotten.
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.
Yeah this was just a sketch and shouldn't have been committed at all.
logDebug $ "converseToNeighbors: DONE conversing to node " <> show node | ||
logDebug "converseToNeighbors: sending to nodes done" | ||
where | ||
logErr node e = logWarning $ sformat ("Error in conversation to " % shown % ": " % shown) node e |
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 would be great to have @avieth confirm deletion of this module. It isn't included in the respective cabal file and seems fairly bitrotten.
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.
Yet another rotten file. Ok to delete.
19c4b1a
to
782b17f
Compare
Looking forward to see this get merged into 'develop'. Getting rid of 'Production' will make our life easier! |
LGTM, I am happy to see the change too. As long as @avieth is fine with removing the files, I am fine with it. |
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.
So much deleted code 😄
@@ -43,12 +42,12 @@ loggerName = "auxx" | |||
|
|||
-- 'NodeParams' obtained using 'CLI.getNodeParams' are not perfect for | |||
-- Auxx, so we need to adapt them slightly. | |||
correctNodeParams :: AuxxOptions -> NodeParams -> Production (NodeParams, Bool) | |||
correctNodeParams :: AuxxOptions -> NodeParams -> IO (NodeParams, Bool) |
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.
❤️
@@ -1,167 +0,0 @@ | |||
{-# LANGUAGE BangPatterns #-} |
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.
Why is this file deleted?
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.
abuse
used Mockable
& Production
, and in trying to remove Mockable
from it, I realized abuse
was very bitrotten and contained imports of modules deleted from cardano-sl
months ago. It seemed to me that the cost of updating the code would be significant, and that deleting it might be the best call. @avieth agreed with this, and I believe he was the last one to touch abuse
.
I put a comment in the git commit but should've also written an explanatory comment on the PR.
@@ -1,177 +0,0 @@ | |||
# Backpressure and peer abuse example |
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.
Same question, why is it deleted? Seems to not be tied to the changes in this PR.
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 OK with removing this. It's quite rotten.
This file has occurrences of Mockable but is fairly bit-rotten. After consulting Alex Vieth, I'm deleting it.
These modules are not contained in any cabal files, and they contained occurrences of `Mockable` (and thus would become bitrotten with the new changes), so I opted to delete them.
As a first step, we remove imports of the Mockable family of modules in source code (not tests yet). We do not touch JsonLogT, which imports Mockable, yet. We also do not remove the Mockable family of modules.
782b17f
to
58d7d91
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.
Thanks for doing this!
@@ -1,177 +0,0 @@ | |||
# Backpressure and peer abuse example |
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 OK with removing this. It's quite rotten.
logDebug $ "converseToNeighbors: DONE conversing to node " <> show node | ||
logDebug "converseToNeighbors: sending to nodes done" | ||
where | ||
logErr node e = logWarning $ sformat ("Error in conversation to " % shown % ": " % shown) node e |
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.
Yet another rotten file. Ok to delete.
| DuplicateConnection | ||
deriving (Typeable, Show) | ||
|
||
instance Exception InternalError |
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.
Yeah this was just a sketch and shouldn't have been committed at all.
@@ -142,10 +141,6 @@ newWalletState recreate walletPath = | |||
-- to rebuild the DB, but rather append stuff into it. | |||
liftIO $ openState (not recreate) walletPath | |||
|
|||
instance HasLoggerName IO where |
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 can savely be removed, as with the new logging all 'HasLoggerName' will disappear.
a LoggerName was used as a context name in logging. We will have a new mechanism which will cover this.
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.
Great, thanks @CodiePP.
Description
The Mockable typeclass is a layer of indirection which allows code to be run in different monads without requiring changes to the monadic functions.
Mockable is apparently only executed in IO, and thus provides no benefit and a fair amount of hassle due to indirection & confusion for developers.
Remove the Mockable typeclass and associated instances.
Linked issue
https://iohk.myjetbrains.com/youtrack/issue/CDEC-451
Type of change
Developer checklist
Testing checklist
^ I can see a good argument for tests to ensure the functions of
Pos.Core.Conc
are equivalent to those ofPos.Core.Mockable.Production
. At present I have not added such tests, though.