Skip to content

Commit

Permalink
Address terminology issues in #290
Browse files Browse the repository at this point in the history
  • Loading branch information
abizjak committed Nov 23, 2023
1 parent a56a967 commit 013b002
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
10 changes: 8 additions & 2 deletions src/Concordium/Client/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1712,14 +1712,20 @@ bakerAddCmd =
<$> (option (eitherReader openStatusFromStringInform) (long "open-delegation-for" <> metavar "SELECTION" <> help helpOpenDelegationFor))
<*> bakerOrValidatorUrl
<*> (option (eitherReader amountFractionFromStringInform) (long "delegation-transaction-fee-commission" <> metavar "DECIMAL-FRACTION" <> help ("Fraction the validator takes in commission from delegators on transaction fee rewards. " ++ rangesHelpString "transaction fee commission")))
<*> (option (eitherReader amountFractionFromStringInform) (long "delegation-baking-commission" <> metavar "DECIMAL-FRACTION" <> help ("Fraction the validator takes in commission from delegators on baking rewards. " ++ rangesHelpString "baking reward commission")))
<*> blockCommission
<*> (option (eitherReader amountFractionFromStringInform) (long "delegation-finalization-commission" <> metavar "DECIMAL-FRACTION" <> help ("Fraction the validator takes in commission from delegators on finalization rewards. " ++ rangesHelpString "finalization reward commission")))
)
<*> optional (strOption (long "out" <> metavar "FILE" <> help "File to write the validator credentials to, in case of successful transaction. These can be used to start the node."))
)
(progDesc "Deploy validator credentials to the chain.")
)

-- | Parser for block reward commission. It supports the legacy terminology of "baking-commission" but it is hidden.
blockCommission :: Parser AmountFraction
blockCommission = blockCommissionGen internal "delegation-baking-commission" <|> blockCommissionGen mempty "delegation-block-reward-commission"
where
blockCommissionGen modifier name = option (eitherReader amountFractionFromStringInform) (modifier <> long name <> metavar "DECIMAL-FRACTION" <> help ("Fraction the validator takes in commission from delegators on block rewards. " ++ rangesHelpString "block reward commission"))

allowedValuesOpenDelegationForAsString :: String
allowedValuesOpenDelegationForAsString =
" - 'all' (delegators are allowed to join the pool),\n"
Expand Down Expand Up @@ -1753,7 +1759,7 @@ bakerConfigureCmd =
<*> optional (option (eitherReader openStatusFromStringInform) (long "open-delegation-for" <> metavar "SELECTION" <> help helpOpenDelegationFor))
<*> optional bakerOrValidatorUrl
<*> optional (option (eitherReader amountFractionFromStringInform) (long "delegation-transaction-fee-commission" <> metavar "DECIMAL-FRACTION" <> help ("Fraction the validator takes in commission from delegators on transaction fee rewards. " ++ rangesHelpString "transaction fee commission")))
<*> optional (option (eitherReader amountFractionFromStringInform) (long "delegation-baking-commission" <> metavar "DECIMAL-FRACTION" <> help ("Fraction the validator takes in commission from delegators on baking rewards. " ++ rangesHelpString "baking reward commission")))
<*> optional blockCommission
<*> optional (option (eitherReader amountFractionFromStringInform) (long "delegation-finalization-commission" <> metavar "DECIMAL-FRACTION" <> help ("Fraction the validator takes in commission from delegators on finalization rewards. " ++ rangesHelpString "finalization reward commission")))
<*> optional (strOption (long "keys-in" <> metavar "FILE" <> help "File containing validator credentials."))
<*> optional (strOption (long "keys-out" <> metavar "FILE" <> help "File to write updated validator credentials to, in case of successful transaction. These can be used to start the node."))
Expand Down
22 changes: 11 additions & 11 deletions src/Concordium/Client/Runner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2947,7 +2947,7 @@ processBakerConfigureCmd baseCfgDir verbose backend txOpts isBakerConfigure cbCa
++ (if isNothing inputKeysFile then "\n--keys-in," else "")
++ (if isNothing metadataURL then "\n--validator-url," else "")
++ (if isNothing cbTransactionFeeCommission then "\n--delegation-transaction-fee-commission," else "")
++ (if isNothing cbBakingRewardCommission then "\n--delegation-baking-commission," else "")
++ (if isNothing cbBakingRewardCommission then "\n--delegation-block-reward-commission," else "") b

Check failure on line 2950 in src/Concordium/Client/Runner.hs

View workflow job for this annotation

GitHub Actions / concordium-client-build-and-test

Variable not in scope: b
++ (if isNothing cbFinalizationRewardCommission then "\n--delegation-finalization-commission," else "")
)
++ (if isNothing cbRestakeEarnings then ". \nExactly one of the options --restake and --no-restake must be present" else "")
Expand Down Expand Up @@ -3099,8 +3099,8 @@ processBakerConfigureCmd baseCfgDir verbose backend txOpts isBakerConfigure cbCa
configureRestakeLogMsg =
case cbRestakeEarnings of
Nothing -> []
Just True -> ["rewards will be automatically added to the baking stake"]
Just False -> ["rewards will _not_ be automatically added to the baking stake"]
Just True -> ["rewards will be added to the validator stake automatically"]
Just False -> ["rewards will _not_ be added to the validator stake automatically"]

configureOpenForDelegationLogMsg =
case cbOpenForDelegation of
Expand All @@ -3117,7 +3117,7 @@ processBakerConfigureCmd baseCfgDir verbose backend txOpts isBakerConfigure cbCa
configureBakingRewardCommissionLogMsg =
case cbBakingRewardCommission of
Nothing -> []
Just fee -> [printf "baking reward commission from delegators will be %s" (show fee)]
Just fee -> [printf "block reward commission from delegators will be %s" (show fee)]

configureFinalizationRewardCommissionLogMsg =
case cbFinalizationRewardCommission of
Expand Down Expand Up @@ -3289,8 +3289,8 @@ processBakerAddCmd baseCfgDir verbose backend txOpts abBakingStake abRestakeEarn

configureRestakeLogMsg =
case abRestakeEarnings of
True -> ["rewards will be automatically added to the baking stake"]
False -> ["rewards will _not_ be automatically added to the baking stake"]
True -> ["rewards will be added to the validator stake automatically"]
False -> ["rewards will _not_ be added to the validator stake automatically"]

readInputKeysFile baseCfg = do
encSignData <- getAccountCfgFromTxOpts baseCfg txOpts
Expand Down Expand Up @@ -3677,7 +3677,7 @@ processBakerCmd action baseCfgDir verbose backend =
++ "--open-delegation-for,\n"
++ "--validator-url,\n"
++ "--delegation-transaction-fee-commission,\n"
++ "--delegation-baking-commission,\n"
++ "--delegation-block-reward-commission,\n"
++ "--delegation-finalization-commission\nmust be present"
]
confirmed <- askConfirmation $ Just "This transaction will most likely be rejected by the chain, do you wish to send it anyway"
Expand Down Expand Up @@ -4292,9 +4292,9 @@ printPeerData bootstrapper pInfos Queries.NodeInfo{..} =
Queries.NodeActive cInfo ->
"Node (running, "
<> case Queries.status cInfo of
Queries.PassiveBaker _ -> "not baking)"
Queries.ActiveBaker -> "in current baking committee)"
Queries.ActiveFinalizer -> "in current baking and finalizer committee)"
Queries.PassiveBaker _ -> "not a validator)"
Queries.ActiveBaker -> "a validator but not a finalizer)"
Queries.ActiveFinalizer -> "in validator and in finalization committee)"

printNodeInfo :: (MonadIO m) => Queries.NodeInfo -> m ()
printNodeInfo Queries.NodeInfo{..} =
Expand All @@ -4309,7 +4309,7 @@ printNodeInfo Queries.NodeInfo{..} =
putStrLn $ "Baker running: " ++ show (getBakerRunning details)
putStrLn $ "Consensus running: " ++ show (getConsensusRunning details)
putStrLn $ "Consensus type: " ++ getConsensusType details
putStrLn $ "Baker committee member: " ++ getBakerCommitteeMember details
putStrLn $ "Validator member: " ++ getBakerCommitteeMember details
putStrLn $ "Finalization committee member: " ++ getFinalizerCommitteeMember details
where
showNodeType =
Expand Down

0 comments on commit 013b002

Please sign in to comment.