Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use updateRoundStep to track consensus state changes #1464

Merged
merged 2 commits into from
Aug 28, 2024

Conversation

cmwaters
Copy link
Contributor

We're currently using newStep to indicate whether to write a new trace, however this actually doesn't track when the round and step change happens and thus misses certain steps (like NewRound). This PR fixes it

@cmwaters cmwaters requested a review from a team as a code owner August 27, 2024 13:19
@cmwaters cmwaters requested review from rootulp and rach-id and removed request for a team August 27, 2024 13:19
@@ -1518,6 +1515,7 @@ func (cs *State) enterPrecommitWait(height int64, round int32) {
defer func() {
// Done enterPrecommitWait:
cs.TriggeredTimeoutPrecommit = true
cs.updateRoundStep(round, cstypes.RoundStepPrecommitWait)
cs.newStep()
Copy link
Contributor

@staheri14 staheri14 Aug 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also trace round step changes in newStep(), wouldn't that cause duplicates?

Copy link
Contributor

@staheri14 staheri14 Aug 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I misread the code, the change is fine! I think it causes duplicate entries in the traced data.

@@ -538,6 +538,7 @@ func (cs *State) updateRoundStep(round int32, step cstypes.RoundStepType) {
}
if cs.Step != step {
cs.metrics.MarkStep(cs.Step)
schema.WriteRoundState(cs.traceClient, cs.Height, round, uint8(step))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess my previous question applies here: Isn't updateRoundStep always followed by newStep? Then we already trace changes in newStep which means we will have duplicates?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not always the case. For instance I notice the NewRound steo was never triggered and also the PrecommitWait step

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh and I removed the tracing from newStep

@cmwaters cmwaters merged commit 44dea31 into v0.34.x-celestia Aug 28, 2024
21 checks passed
@cmwaters cmwaters deleted the cal/consensus_state_traces branch August 28, 2024 17:21
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.

4 participants