diff --git a/concordium-consensus/src/Concordium/GlobalState/BlockState.hs b/concordium-consensus/src/Concordium/GlobalState/BlockState.hs index 3be3935afa..2a7e90bb92 100644 --- a/concordium-consensus/src/Concordium/GlobalState/BlockState.hs +++ b/concordium-consensus/src/Concordium/GlobalState/BlockState.hs @@ -1105,7 +1105,7 @@ class (BlockStateQuery m) => BlockStateOperations m where -- is (preferentially) reactivated from the inactive stake, updating the global indices -- accordingly. -- - -- 8. If the suspended/resumed flag is set and (>= P8): + -- 8. (>= P8) If the suspended/resumed flag is set: -- (1) Suspend/resume the validator according to the flag. diff --git a/concordium-consensus/src/Concordium/GlobalState/Persistent/BlockState.hs b/concordium-consensus/src/Concordium/GlobalState/Persistent/BlockState.hs index 5ce202a984..df960f795d 100644 --- a/concordium-consensus/src/Concordium/GlobalState/Persistent/BlockState.hs +++ b/concordium-consensus/src/Concordium/GlobalState/Persistent/BlockState.hs @@ -41,7 +41,8 @@ module Concordium.GlobalState.Persistent.BlockState ( SupportsPersistentState, loadPBS, storePBS, -) where +) +where import qualified Concordium.Crypto.SHA256 as H import qualified Concordium.Genesis.Data.P6 as P6 @@ -1518,8 +1519,7 @@ addValidatorChecks :: MTL.ExceptT ValidatorConfigureFailure m () addValidatorChecks bsp ValidatorAdd{..} = do chainParams <- lookupCurrentParameters (bspUpdates bsp) - let - poolParams = chainParams ^. cpPoolParameters + let poolParams = chainParams ^. cpPoolParameters capitalMin = poolParams ^. ppMinimumEquityCapital ranges = poolParams ^. ppCommissionBounds -- Check if the equity capital is below the minimum threshold. @@ -1681,8 +1681,7 @@ updateValidatorChecks :: MTL.ExceptT ValidatorConfigureFailure m () updateValidatorChecks bsp baker ValidatorUpdate{..} = do chainParams <- lookupCurrentParameters (bspUpdates bsp) - let - poolParams = chainParams ^. cpPoolParameters + let poolParams = chainParams ^. cpPoolParameters capitalMin = poolParams ^. ppMinimumEquityCapital ranges = poolParams ^. ppCommissionBounds -- Check if the aggregation key is fresh (or the same as the baker's existing one). @@ -1807,7 +1806,7 @@ updateValidatorChecks bsp baker ValidatorUpdate{..} = do -- index by adding the difference between the new and old capital) and append -- @BakerConfigureStakeIncreased capital@ to @events@. --- 9. If the suspended/resumed flag is set and (>= P8): +-- 9. (>= P8) If the suspended/resumed flag is set: -- (1) Suspend/resume the validator according to the flag. @@ -2737,8 +2736,7 @@ doRewardAccount pbs ai reward = do let tot = adDelegatorTotalCapital $ activeBkrs ^. passiveDelegators return $! activeBkrs - & passiveDelegators %~ \dlgs -> - dlgs{adDelegatorTotalCapital = tot + reward} + & passiveDelegators %~ \dlgs -> dlgs{adDelegatorTotalCapital = tot + reward} updateDelegationPoolCapital activeBkrs (Transactions.DelegateToBaker bid) = do let activeBkrsMap = activeBkrs ^. activeBakers adj Nothing = error "Invariant violation: active baker account is not in active bakers map" @@ -2825,8 +2823,8 @@ doMint pbs mint = do bspBank bsp & unhashed %~ (Rewards.totalGTU +~ mintTotal mint) - . (Rewards.bakingRewardAccount +~ mintBakingReward mint) - . (Rewards.finalizationRewardAccount +~ mintFinalizationReward mint) + . (Rewards.bakingRewardAccount +~ mintBakingReward mint) + . (Rewards.finalizationRewardAccount +~ mintFinalizationReward mint) let updAcc = addAccountAmount $ mintDevelopmentCharge mint foundationAccount <- (^. cpFoundationAccount) <$> lookupCurrentParameters (bspUpdates bsp) newAccounts <- Accounts.updateAccountsAtIndex' updAcc foundationAccount (bspAccounts bsp) diff --git a/concordium-consensus/tests/globalstate/GlobalStateTests/ConfigureValidator.hs b/concordium-consensus/tests/globalstate/GlobalStateTests/ConfigureValidator.hs index 5c5d725200..bf7dca59d3 100644 --- a/concordium-consensus/tests/globalstate/GlobalStateTests/ConfigureValidator.hs +++ b/concordium-consensus/tests/globalstate/GlobalStateTests/ConfigureValidator.hs @@ -555,8 +555,7 @@ runUpdateValidatorTest spv commissionRanges ValidatorUpdateConfig{vucValidatorUp chainParams = DummyData.dummyChainParameters @(ChainParametersVersionFor pv) & cpPoolParameters . ppMinimumEquityCapital .~ minEquity - & cpPoolParameters - . ppCommissionBounds + & cpPoolParameters . ppCommissionBounds .~ commissionRanges mkInitialState accounts = hpbsPointers diff --git a/concordium-consensus/tests/scheduler/SchedulerTests/ConfigureBaker.hs b/concordium-consensus/tests/scheduler/SchedulerTests/ConfigureBaker.hs index af0496a174..c774ffbece 100644 --- a/concordium-consensus/tests/scheduler/SchedulerTests/ConfigureBaker.hs +++ b/concordium-consensus/tests/scheduler/SchedulerTests/ConfigureBaker.hs @@ -883,8 +883,7 @@ testUpdateBakerOk _spv pvString = . accountBaker %~ (stakedAmount .~ stakeAmount) . (stakeEarnings .~ True) - . ( accountBakerInfo - . bieBakerPoolInfo + . ( accountBakerInfo . bieBakerPoolInfo %~ (poolCommissionRates . transactionCommission .~ makeAmountFraction 1_000) . (poolMetadataUrl .~ emptyUrlText) ) @@ -1127,9 +1126,7 @@ testUpdateBakerRemoveOk spv pvString = updatedAccount1 updateStaking = case sSupportsFlexibleCooldown (sAccountVersionFor spv) of SFalse -> - Transient.accountStaking - . accountBaker - . bakerPendingChange + Transient.accountStaking . accountBaker . bakerPendingChange .~ RemoveStake (PendingChangeEffectiveV1 86400000) STrue -> (Transient.accountStaking .~ AccountStakeNone) @@ -1230,9 +1227,7 @@ testUpdateBakerReduceStakeOk spv pvString = (Transient.accountStakeCooldown . unconditionally .~ emptyCooldowns{prePreCooldown = Present 200_000_000_000}) . (Transient.accountStaking . accountBaker . stakedAmount .~ stakeAmount) ) - . ( Transient.accountStaking - . accountBaker - . accountBakerInfo + . ( Transient.accountStaking . accountBaker . accountBakerInfo %~ (poolCommissionRates . bakingCommission .~ makeAmountFraction 1_000) . (poolCommissionRates . finalizationCommission .~ makeAmountFraction 1_000) . (bakerElectionVerifyKey .~ bkwpElectionVerifyKey keysWithProofs) @@ -1315,9 +1310,10 @@ testUpdateBakerSuspendResumeOk spv pvString suspendOrResume accM = accountBaker f (AccountStakeBaker b) = AccountStakeBaker <$> f b accountBaker _ x = pure x events = - [ BakerResumed{ebrBakerId = 4} | suspendOrResume == Resume + [ if suspendOrResume == Suspend + then BakerSuspended{ebsBakerId = 4} + else BakerResumed{ebrBakerId = 4} ] - ++ [BakerSuspended{ebsBakerId = 4} | suspendOrResume == Suspend] tests :: Spec tests =