Skip to content

Rename chainwebVersion to networkId in config #2187

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

Open
wants to merge 2 commits into
base: pp/evm
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/Chainweb/Chainweb/Configuration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@ validateChainwebVersion :: ConfigValidation ChainwebVersion []
validateChainwebVersion v = do
unless (isDevelopment || elem v knownVersions) $
throwError $ T.unwords
[ "Specifying version properties is only legal with chainweb-version"
, "set to recap-development or development, but version is set to"
[ "Specifying network properties is only legal with network-id"
, "set to recap-development or development, but network is set to"
, sshow (_versionName v)
]
where
Expand Down Expand Up @@ -580,7 +580,7 @@ defaultChainwebConfiguration v = ChainwebConfiguration

instance ToJSON ChainwebConfiguration where
toJSON o = object
[ "chainwebVersion" .= _versionName (_configChainwebVersion o)
[ "networkId" .= _versionName (_configChainwebVersion o)
, "cuts" .= _configCuts o
, "mining" .= _configMining o
, "headerStream" .= _configHeaderStream o
Expand All @@ -600,7 +600,7 @@ instance FromJSON ChainwebConfiguration where

instance FromJSON (ChainwebConfiguration -> ChainwebConfiguration) where
parseJSON = withObject "ChainwebConfiguration" $ \o -> id
<$< setProperty configChainwebVersion "chainwebVersion"
<$< setProperty configChainwebVersion "networkId"
(findKnownVersion <=< parseJSON) o
<*< configCuts %.: "cuts" % o
<*< configMining %.: "mining" % o
Expand Down Expand Up @@ -649,9 +649,11 @@ parseVersion :: MParser ChainwebVersion
parseVersion = constructVersion
<$> optional
(option (findKnownVersion =<< textReader)
% long "chainweb-version"
<> short 'v'
<> help "the chainweb version that this node is using"
% long "network-id"
<> short 'n'
<> help "the network that this node will communicate with"
<> metavar (T.unpack $
"[" <> T.intercalate "," (getChainwebVersionName . _versionName <$> knownVersions) <> "]")
)
<*> optional (textOption @Fork (long "fork-upper-bound" <> help "(development mode only) the latest fork the node will enable"))
<*> optional (BlockDelay <$> textOption (long "block-delay" <> help "(development mode only) the block delay in seconds per block"))
Expand Down
2 changes: 1 addition & 1 deletion src/Chainweb/Pact/Backend/Compaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ getConfig = do

parser :: O.Parser Config
parser = Config
<$> (parseVersion <$> O.strOption (O.long "chainweb-version" <> O.value "mainnet01"))
<$> (parseVersion <$> O.strOption (O.long "network-id" <> O.value "mainnet01"))
<*> O.strOption (O.long "from" <> O.help "Directory containing SQLite Pact state and RocksDB block data to compact (expected to be in $DIR/0/{sqlite,rocksDb}")
<*> O.strOption (O.long "to" <> O.help "Directory where to place the compacted Pact state and block data. It will place them in $DIR/0/{sqlite,rocksDb}, respectively.")
<*> O.flag SingleChain ManyChainsAtOnce (O.long "parallel" <> O.help "Turn on multi-threaded compaction. The threads are per-chain.")
Expand Down
Loading