-
Notifications
You must be signed in to change notification settings - Fork 632
[DDW-380] Configure launcher to read/write safe mode parameter #3421
[DDW-380] Configure launcher to read/write safe mode parameter #3421
Conversation
7192f06
to
ead549f
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.
LGTM
there is work underway to remove 'RecordWildCards'
@@ -280,7 +281,7 @@ main = | |||
setEnv "LC_ALL" "en_GB.UTF-8" | |||
setEnv "LANG" "en_GB.UTF-8" | |||
|
|||
LO {..} <- getLauncherOptions | |||
lo@LO {..} <- getLauncherOptions |
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.
'RecordWildCards' will be gone..
can the field accessed in LO be named?
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.
@cleverca22 I would actually leave that as it is for now.
What we are currently doing is moving RecordWildCards
from the default language extensions to a LANGUAGE
pragma at the top of the files that need it.
While that is being done we are recording how RCWs are being used and removing the ones that are the most difficult to read (ie using RCW for types in an upstream package).
In this case LauncherOptions
is in the same package and hence probably does not need to change.
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, the code was also looking much worse after removing it, so i put it back in
@@ -453,33 +442,28 @@ clientScenario | |||
:: (HasCompileInfo, HasConfigurations) | |||
=> ProtocolMagic | |||
-> NodeDbPath | |||
-> Maybe FilePath -- ^ Log prefix |
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.
red is my preferred colour! :-)
great, it gets lighter.
tools/src/launcher/Main.hs
Outdated
-> Maybe FilePath -- ^ Node log file | ||
-> LauncherOptions -- ^ Launcher Options | ||
-> M ExitCode | ||
runWallet shouldLog nd nLogPath lo = do | ||
runWallet nd nLogPath lo = do | ||
safeMode <- readSafeMode lo | ||
let wpath = ndPath nd | ||
wargs = (ndArgs nd) <> (if safeMode then [ "--safe-mode", "--disable-gpu", "--disable-d3d11" ] else []) |
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.
more options turned off.
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.
nikola requested that safemode send more flags
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.
There are some style issues but nothing that will hold the PR up. All behavior stuff looks fine to me.
@@ -11,6 +11,7 @@ | |||
{-# LANGUAGE RankNTypes #-} | |||
{-# LANGUAGE TemplateHaskell #-} | |||
{-# LANGUAGE TypeSynonymInstances #-} | |||
{-# LANGUAGE RecordWildCards #-} |
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.
stylish-haskell
@@ -630,31 +618,70 @@ spawnNode nd doesWalletLogToConsole = do | |||
Just ph -> do | |||
logInfo "Node has started" | |||
return (ph, asc) | |||
data SafeModeConfig = SafeModeConfig { smcSafeMode :: ! Bool } deriving Generic |
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 should be a newtype
instead of a data
decoded <- liftIO $ Y.decodeFileEither safeModeConfigFile | ||
case decoded of | ||
Right value -> pure $ smcSafeMode value | ||
Left _ -> pure False |
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.
Please put whitespace in between declarations to make it easier to read
Description
This adds safe mode parameter daedalus team requested.
Linked issue
Type of change
Developer checklist
Testing checklist
QA Steps
Screenshots (if available)