Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
Open
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
4 changes: 2 additions & 2 deletions src/Chainweb/Chainweb/Configuration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ parseVersion = constructVersion
)
<*> 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"))
<*> switch (long "disable-pow" <> help "(development mode only) disable proof of work check")
<*> optional (switch (long "disable-pow" <> help "(development mode only) disable proof of work check"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why parseVersion is not following the idiom for command lines parers from configuration-tools that is used everywhere else in Chainweb node? That idiom would prevent bugs like this one.

I guess, and configuration of ChainwebVersion is special and doesn't fit that pattern? Or is it just an oversight?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the weirdness here is that we parse the chainweb version, and then we parse a bunch of options that also alter this chainweb version.

where
constructVersion cliVersion fub bd disablePow' oldVersion = winningVersion
& versionBlockDelay .~ fromMaybe (_versionBlockDelay winningVersion) bd
Expand All @@ -612,6 +612,6 @@ parseVersion = constructVersion
)
(HS.toMap (chainIds winningVersion))
) fub
& versionCheats . disablePow .~ disablePow'
& versionCheats . disablePow %~ flip fromMaybe disablePow'
where
winningVersion = fromMaybe oldVersion cliVersion
Loading