Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/main' into update-rust-h…
Browse files Browse the repository at this point in the history
…askell
  • Loading branch information
td202 committed Nov 20, 2024
2 parents 554a0da + ecbca49 commit e3e0496
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Support node version 8 and protocol version 8.
- Support for suspend/resume in validator update transactions.
- Add command `consensus detailed-status` for getting detailed consensus status (from protocol
version 6).
- Add `raw GetConsensusDetailedStatus` that presents the detailed consensus status as JSON.
Expand Down
5 changes: 5 additions & 0 deletions src/Concordium/Client/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ data BakerCmd
bcTransactionFeeCommission :: !(Maybe AmountFraction),
bcBakingRewardCommission :: !(Maybe AmountFraction),
bcFinalizationRewardCommission :: !(Maybe AmountFraction),
bcSuspend :: !(Maybe Bool),
bcInputKeyFile :: !(Maybe FilePath),
bcOutputKeyFile :: !(Maybe FilePath)
}
Expand Down Expand Up @@ -1800,6 +1801,10 @@ bakerConfigureCmd =
<*> 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 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
( flag' True (long "suspend" <> help "Suspend the validator. The validator will not participate in the consensus anymore.")
<|> flag' False (long "resume" <> help "Resume the validator.")
)
<*> 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
24 changes: 12 additions & 12 deletions src/Concordium/Client/Runner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3009,12 +3009,14 @@ processBakerConfigureCmd ::
Maybe Types.AmountFraction ->
-- | Finalization commission.
Maybe Types.AmountFraction ->
-- | Whether to suspend/resume baker.
Maybe Bool ->
-- | File to read baker keys from.
Maybe FilePath ->
-- | File to write baker keys to.
Maybe FilePath ->
IO ()
processBakerConfigureCmd baseCfgDir verbose backend txOpts isBakerConfigure cbCapital cbRestakeEarnings cbOpenForDelegation metadataURL cbTransactionFeeCommission cbBakingRewardCommission cbFinalizationRewardCommission inputKeysFile outputKeysFile = do
processBakerConfigureCmd baseCfgDir verbose backend txOpts isBakerConfigure cbCapital cbRestakeEarnings cbOpenForDelegation metadataURL cbTransactionFeeCommission cbBakingRewardCommission cbFinalizationRewardCommission cbSuspend inputKeysFile outputKeysFile = do
let intOpts = toInteractionOpts txOpts
let outFile = toOutFile txOpts
(bakerKeys, txCfg, pl) <- transactionForBakerConfigure (ioConfirm intOpts)
Expand Down Expand Up @@ -3180,8 +3182,6 @@ processBakerConfigureCmd baseCfgDir verbose backend txOpts isBakerConfigure cbCa
putStrLn ""
let cbMetadataURL = fmap (Types.UrlText . Text.pack) metadataURL
(bakerKeys, cbKeysWithProofs) <- readInputKeysFile baseCfg
-- TODO: support setting the suspend flag. Issue #326
let cbSuspend = Nothing
let payload = Types.encodePayload Types.ConfigureBaker{..}
nrgCost _ = case cbKeysWithProofs of
Nothing -> return . Just $ bakerConfigureEnergyCostWithoutKeys (Types.payloadSize payload)
Expand Down Expand Up @@ -3744,7 +3744,7 @@ processBakerUpdateStakeCmd baseCfgDir verbose backend txOpts newStake = do
askConfirmation $ Just "confirm that you want to remove validator"
else return True
when ok $
processBakerConfigureCmd baseCfgDir verbose backend txOpts False (Just newStake) Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
processBakerConfigureCmd baseCfgDir verbose backend txOpts False (Just newStake) Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing

-- | Process a 'baker ...' command.
processBakerCmd :: BakerCmd -> Maybe FilePath -> Verbose -> Backend -> IO ()
Expand Down Expand Up @@ -3807,23 +3807,23 @@ processBakerCmd action baseCfgDir verbose backend =
transactionFeeCommission = ebadTransactionFeeCommission <$> extraData
bakingRewardCommission = ebadBakingRewardCommission <$> extraData
finalizationRewardCommission = ebadFinalizationRewardCommission <$> extraData
processBakerConfigureCmd baseCfgDir verbose backend txOpts False (Just initialStake) (Just autoRestake) openForDelegation metadataURL transactionFeeCommission bakingRewardCommission finalizationRewardCommission (Just bakerKeysFile) outputFile
BakerConfigure txOpts capital restake openForDelegation metadataURL transactionFeeCommission bakingRewardCommission finalizationRewardCommission inputKeysFile outputKeysFile ->
processBakerConfigureCmd baseCfgDir verbose backend txOpts True capital restake openForDelegation metadataURL transactionFeeCommission bakingRewardCommission finalizationRewardCommission inputKeysFile outputKeysFile
processBakerConfigureCmd baseCfgDir verbose backend txOpts False (Just initialStake) (Just autoRestake) openForDelegation metadataURL transactionFeeCommission bakingRewardCommission finalizationRewardCommission Nothing (Just bakerKeysFile) outputFile
BakerConfigure txOpts capital restake openForDelegation metadataURL transactionFeeCommission bakingRewardCommission finalizationRewardCommission suspend inputKeysFile outputKeysFile ->
processBakerConfigureCmd baseCfgDir verbose backend txOpts True capital restake openForDelegation metadataURL transactionFeeCommission bakingRewardCommission finalizationRewardCommission suspend inputKeysFile outputKeysFile
BakerSetKeys file txOpts outfile -> do
pv <- withClient backend $ do
cs <- getResponseValueOrDie =<< getConsensusInfo
return $ Queries.csProtocolVersion cs
if pv < Types.P4
then processBakerSetKeysCmd baseCfgDir verbose backend txOpts file outfile
else processBakerConfigureCmd baseCfgDir verbose backend txOpts False Nothing Nothing Nothing Nothing Nothing Nothing Nothing (Just file) outfile
else processBakerConfigureCmd baseCfgDir verbose backend txOpts False Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing (Just file) outfile
BakerRemove txOpts -> do
pv <- withClient backend $ do
cs <- getResponseValueOrDie =<< getConsensusInfo
return $ Queries.csProtocolVersion cs
if pv < Types.P4
then processBakerRemoveCmd baseCfgDir verbose backend txOpts
else processBakerConfigureCmd baseCfgDir verbose backend txOpts False (Just 0) Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
else processBakerConfigureCmd baseCfgDir verbose backend txOpts False (Just 0) Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
BakerUpdateStake newStake txOpts -> do
pv <- withClient backend $ do
cs <- getResponseValueOrDie =<< getConsensusInfo
Expand All @@ -3837,11 +3837,11 @@ processBakerCmd action baseCfgDir verbose backend =
return $ Queries.csProtocolVersion cs
if pv < Types.P4
then processBakerUpdateRestakeCmd baseCfgDir verbose backend txOpts restake
else processBakerConfigureCmd baseCfgDir verbose backend txOpts False Nothing (Just restake) Nothing Nothing Nothing Nothing Nothing Nothing Nothing
else processBakerConfigureCmd baseCfgDir verbose backend txOpts False Nothing (Just restake) Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
BakerUpdateMetadataURL url txOpts ->
processBakerConfigureCmd baseCfgDir verbose backend txOpts False Nothing Nothing Nothing (Just url) Nothing Nothing Nothing Nothing Nothing
processBakerConfigureCmd baseCfgDir verbose backend txOpts False Nothing Nothing Nothing (Just url) Nothing Nothing Nothing Nothing Nothing Nothing
BakerUpdateOpenDelegationStatus status txOpts ->
processBakerConfigureCmd baseCfgDir verbose backend txOpts False Nothing Nothing (Just status) Nothing Nothing Nothing Nothing Nothing Nothing
processBakerConfigureCmd baseCfgDir verbose backend txOpts False Nothing Nothing (Just status) Nothing Nothing Nothing Nothing Nothing Nothing Nothing
BakerGetEarliestWinTime bakerId useLocalTime doPoll -> do
winTimestamp <- getWinTimestamp
putStrLn [i|Validator #{bakerId} is expected to produce a block no sooner than:|]
Expand Down

0 comments on commit e3e0496

Please sign in to comment.