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 Jan 7, 2025
1 parent f265d3f commit 582d052
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 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
Original file line number Diff line number Diff line change
Expand Up @@ -1632,7 +1632,7 @@ newAddValidator pbs ai va@ValidatorAdd{..} = do
BaseAccounts.BakerInfoExV1
{ _bieBakerPoolInfo = poolInfo,
_bieBakerInfo = bakerInfo,
_bieIsSuspended = conditionally hasValidatorSuspension False
_bieIsSuspended = conditionally hasValidatorSuspension vaSuspended
}
-- The precondition guaranties that the account exists
acc <- fromJust <$> Accounts.indexedAccount ai (bspAccounts bsp)
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 582d052

Please sign in to comment.