Skip to content

fix(consensus): count hooray only after successful final commit - #5097

Merged
Frozen merged 1 commit into
devfrom
fix/remove-extra-call-for-leader-metrics-on-prepare
Aug 6, 2026
Merged

fix(consensus): count hooray only after successful final commit#5097
Frozen merged 1 commit into
devfrom
fix/remove-extra-call-for-leader-metrics-on-prepare

Conversation

@mur-me

@mur-me mur-me commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Remove the premature UpdateLeaderMetrics call from onPrepare.

The metric is already updated in _finalCommit after the leader successfully commits the block and logs HOORAY!!!!!!! CONSENSUS REACHED!!!!!!!

This prevents hooray and num_commits from being inflated for every received PREPARE message.

Test

Previously it was showing a huge increase of the metrics, because it was counting prepare:

sum by (instance, job) (
  increase(
    hmy_consensus_bingo{
      consensus=~"hooray",
      instance=~"$instance.*",
      job=~"$shard"
    }[1m]
  )
) > 0

Tested fix on the shard 1 devnet, you can see 60 hooray + bingos vs 600 prepare in the shard 0:
image

Remove the premature UpdateLeaderMetrics call from onPrepare.

The metric is already updated in _finalCommit after the leader successfully
commits the block and logs "HOORAY!!!!!!! CONSENSUS REACHED!!!!!!!".

This prevents hooray and num_commits from being inflated for every received
PREPARE message.
@mur-me
mur-me marked this pull request as ready for review August 6, 2026 09:30
@mur-me
mur-me requested review from Frozen and GheisMohammadi August 6, 2026 12:22
@Frozen
Frozen merged commit f78ed92 into dev Aug 6, 2026
11 checks passed
@Frozen
Frozen deleted the fix/remove-extra-call-for-leader-metrics-on-prepare branch August 6, 2026 15:28
@mur-me mur-me self-assigned this Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants