Skip to content

Commit

Permalink
Merge pull request #1004 from Concordium/log-round
Browse files Browse the repository at this point in the history
Log when a round is advanced.
  • Loading branch information
td202 authored Aug 18, 2023
2 parents 556bc4e + e2dcdbf commit bb0d1bf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
- Fix a bug in how the last timeout certificate is recovered at start-up.
- Fix the behaviour of the block last finalized pointer in the `GetBlockInfo` so that it
consistently returns the last finalized block at the time the block was baked.
- Add debug-level logging when a round is advanced, either due to a quorum certificate or a
timeout certificate.

## 6.0.4

Expand Down
13 changes: 11 additions & 2 deletions concordium-consensus/src/Concordium/KonsensusV1/Consensus.hs
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,14 @@ onNewRound = do
advanceRoundWithTimeout ::
( MonadTimeout m,
LowLevel.MonadTreeStateStore m,
MonadState (SkovData (MPV m)) m
MonadState (SkovData (MPV m)) m,
MonadLogger m
) =>
RoundTimeout (MPV m) ->
m ()
advanceRoundWithTimeout roundTimeout@RoundTimeout{..} = do
logEvent Konsensus LLDebug $
"Advancing round: round " ++ show (tcRound rtTimeoutCertificate) ++ " timed out."
onNewRound
roundStatus %=! updateQC . updateTC . (rsRoundEligibleToBake .~ True)
updatePersistentRoundStatus (prsLatestTimeout .~ Present rtTimeoutCertificate)
Expand All @@ -142,12 +145,18 @@ advanceRoundWithTimeout roundTimeout@RoundTimeout{..} = do
-- * The certified block MUST be for a round that is at least the current round.
advanceRoundWithQuorum ::
( MonadTimeout m,
MonadState (SkovData (MPV m)) m
MonadState (SkovData (MPV m)) m,
MonadLogger m
) =>
-- |Certified block
CertifiedBlock (MPV m) ->
m ()
advanceRoundWithQuorum certBlock = do
logEvent Konsensus LLDebug $
"Advancing round: round "
++ show (qcRound (cbQuorumCertificate certBlock))
++ " certified block "
++ show (qcBlock (cbQuorumCertificate certBlock))
onNewRound
roundStatus
%=! (rsCurrentRound .~ 1 + qcRound (cbQuorumCertificate certBlock))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ receiveTimeoutMessage ::
-- |Result of receiving the 'TimeoutMessage'.
m (ReceiveTimeoutMessageResult (MPV m))
receiveTimeoutMessage tm@TimeoutMessage{tmBody = TimeoutMessageBody{..}} skovData
-- Consenus has been shutdown.
-- Consensus has been shutdown.
| skovData ^. isConsensusShutdown = return ConsensusShutdown
-- The round of the 'TimeoutMessage' is obsolete.
| tmRound < currentRound =
Expand Down

0 comments on commit bb0d1bf

Please sign in to comment.