Skip to content

Commit

Permalink
rename updateMissedBlocks -> updateMissedRounds
Browse files Browse the repository at this point in the history
  • Loading branch information
drsk committed Oct 22, 2024
1 parent 1518482 commit 94c9f4a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions concordium-consensus/src/Concordium/GlobalState/BlockState.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1510,10 +1510,10 @@ class (BlockStateQuery m) => BlockStateOperations m where
bsoIsProtocolUpdateEffective :: UpdatableBlockState m -> m Bool

-- | Update the count of missed rounds for a given validator
bsoUpdateMissedBlocks :: (PVSupportsDelegation (MPV m)) => UpdatableBlockState m -> (BakerId, Word16) -> m (UpdatableBlockState m)
bsoUpdateMissedRounds :: (PVSupportsDelegation (MPV m)) => UpdatableBlockState m -> (BakerId, Word16) -> m (UpdatableBlockState m)

-- | Clear the missed round count for a given validator
bsoClearMissedBlocks :: (PVSupportsDelegation (MPV m)) => UpdatableBlockState m -> BakerId -> m (UpdatableBlockState m)
bsoClearMissedRounds :: (PVSupportsDelegation (MPV m)) => UpdatableBlockState m -> BakerId -> m (UpdatableBlockState m)

-- | A snapshot of the block state that can be used to roll back to a previous state.
type StateSnapshot m
Expand Down Expand Up @@ -1826,8 +1826,8 @@ instance (Monad (t m), MonadTrans t, BlockStateOperations m) => BlockStateOperat
bsoGetBankStatus = lift . bsoGetBankStatus
bsoSetRewardAccounts s = lift . bsoSetRewardAccounts s
bsoIsProtocolUpdateEffective = lift . bsoIsProtocolUpdateEffective
bsoUpdateMissedBlocks s = lift . bsoUpdateMissedBlocks s
bsoClearMissedBlocks s = lift . bsoClearMissedBlocks s
bsoUpdateMissedRounds s = lift . bsoUpdateMissedRounds s
bsoClearMissedRounds s = lift . bsoClearMissedRounds s
type StateSnapshot (MGSTrans t m) = StateSnapshot m
bsoSnapshotState = lift . bsoSnapshotState
bsoRollback s = lift . bsoRollback s
Expand Down Expand Up @@ -1884,8 +1884,8 @@ instance (Monad (t m), MonadTrans t, BlockStateOperations m) => BlockStateOperat
{-# INLINE bsoSetRewardAccounts #-}
{-# INLINE bsoGetCurrentEpochBakers #-}
{-# INLINE bsoIsProtocolUpdateEffective #-}
{-# INLINE bsoUpdateMissedBlocks #-}
{-# INLINE bsoClearMissedBlocks #-}
{-# INLINE bsoUpdateMissedRounds #-}
{-# INLINE bsoClearMissedRounds #-}
{-# INLINE bsoSnapshotState #-}
{-# INLINE bsoRollback #-}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3464,8 +3464,8 @@ doGetProtocolUpdateStatus = protocolUpdateStatus . bspUpdates <=< loadPBS
doIsProtocolUpdateEffective :: (SupportsPersistentState pv m) => PersistentBlockState pv -> m Bool
doIsProtocolUpdateEffective = isProtocolUpdateEffective . bspUpdates <=< loadPBS

doUpdateMissedBlocks :: (PVSupportsDelegation pv, SupportsPersistentState pv m) => PersistentBlockState pv -> (BakerId, Word16) -> m (PersistentBlockState pv)
doUpdateMissedBlocks pbs (bId, newMissedRounds) = do
doUpdateMissedRounds :: (PVSupportsDelegation pv, SupportsPersistentState pv m) => PersistentBlockState pv -> (BakerId, Word16) -> m (PersistentBlockState pv)
doUpdateMissedRounds pbs (bId, newMissedRounds) = do
bsp <- loadPBS pbs
bsp' <-
modifyBakerPoolRewardDetailsInPoolRewards
Expand All @@ -3474,8 +3474,8 @@ doUpdateMissedBlocks pbs (bId, newMissedRounds) = do
(\bprd -> bprd{missedRounds = missedRounds bprd + newMissedRounds})
storePBS pbs bsp'

doClearMissedBlocks :: (PVSupportsDelegation pv, SupportsPersistentState pv m) => PersistentBlockState pv -> BakerId -> m (PersistentBlockState pv)
doClearMissedBlocks pbs bId = do
doClearMissedRounds :: (PVSupportsDelegation pv, SupportsPersistentState pv m) => PersistentBlockState pv -> BakerId -> m (PersistentBlockState pv)
doClearMissedRounds pbs bId = do
bsp <- loadPBS pbs
bsp' <- modifyBakerPoolRewardDetailsInPoolRewards bsp bId (\bprd -> bprd{missedRounds = 0})
storePBS pbs bsp'
Expand Down Expand Up @@ -4357,8 +4357,8 @@ instance (IsProtocolVersion pv, PersistentState av pv r m) => BlockStateOperatio
bsoGetBankStatus = doGetBankStatus
bsoSetRewardAccounts = doSetRewardAccounts
bsoIsProtocolUpdateEffective = doIsProtocolUpdateEffective
bsoUpdateMissedBlocks = doUpdateMissedBlocks
bsoClearMissedBlocks = doClearMissedBlocks
bsoUpdateMissedRounds = doUpdateMissedRounds
bsoClearMissedRounds = doClearMissedRounds
type StateSnapshot (PersistentBlockStateMonad pv r m) = BlockStatePointers pv
bsoSnapshotState = loadPBS
bsoRollback = storePBS
Expand Down
4 changes: 2 additions & 2 deletions concordium-consensus/src/Concordium/KonsensusV1/Scheduler.hs
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ executeBlockPrologue BlockExecutionData{..} = do
theState5 <- doUpdateSeedStateForBlock bedTimestamp bedBlockNonce theState4
-- update the missed rounds count for each active baker
theState6 <- if isJust mPaydayParms
then foldM bsoClearMissedBlocks theState5 activeBakers
else foldM bsoUpdateMissedBlocks theState5 bedMissedRounds
then foldM bsoClearMissedRounds theState5 activeBakers
else foldM bsoUpdateMissedRounds theState5 bedMissedRounds
return
PrologueResult
{ prologueBlockState = theState6,
Expand Down

0 comments on commit 94c9f4a

Please sign in to comment.