Skip to content

Commit

Permalink
Extend ValidatorAdd with a suspended field
Browse files Browse the repository at this point in the history
  • Loading branch information
drsk committed Dec 16, 2024
1 parent 2dd578f commit 2a48008
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions concordium-consensus/src/Concordium/GlobalState/BakerInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,9 @@ data ValidatorAdd = ValidatorAdd
-- | The metadata URL for the validator.
vaMetadataURL :: !UrlText,
-- | The commission rates for the validator.
vaCommissionRates :: !CommissionRates
-- TODO (drsk) Github issue #1246. Support suspend/resume for ValidatorAdd.
vaCommissionRates :: !CommissionRates,
-- | Whether the validator should be added as suspended.
vaSuspended :: !Bool
}
deriving (Eq, Show)

Expand Down
1 change: 1 addition & 0 deletions concordium-consensus/src/Concordium/Scheduler.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2114,6 +2114,7 @@ handleConfigureBaker
let vaCommissionRates = CommissionRates{..}
vaOpenForDelegation <- cbOpenForDelegation
vaMetadataURL <- cbMetadataURL
let vaSuspended = fromMaybe False cbSuspend
return
CBCAdd
{ cbcRemoveDelegator = removeDelegator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ testAddValidatorAllCases spv = describe "bsoAddValidator" $ do
{ _finalizationCommission = makeAmountFraction $ if vcFinalizationRewardNotInRange then 100 else 300,
_bakingCommission = makeAmountFraction $ if vcBakingRewardNotInRange then 100 else 500,
_transactionCommission = makeAmountFraction $ if vcTransactionFeeNotInRange then 300 else 100
}
},
vaSuspended = False
}
initialAccounts <- mapM makeDummyAccount (addValidatorTestAccounts withCooldown)
initialBS <- mkInitialState initialAccounts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ addBakerWith am (bs, ai) = do
{ _transactionCommission = makeAmountFraction 0,
_finalizationCommission = makeAmountFraction 0,
_bakingCommission = makeAmountFraction 0
}
},
vaSuspended = False
}
res <- bsoAddValidator bs ai conf
return ((,ai) <$> res)
Expand Down

0 comments on commit 2a48008

Please sign in to comment.