Skip to content

consensus: stricter on LastCommitRound check#4970

Merged
melekes merged 8 commits intomasterfrom
2737
Jun 10, 2020
Merged

consensus: stricter on LastCommitRound check#4970
melekes merged 8 commits intomasterfrom
2737

Conversation

@melekes
Copy link
Contributor

@melekes melekes commented Jun 5, 2020

Closes #2737

cuonglm and others added 5 commits January 3, 2020 16:01
LastCommitRound should always be >= 0 for heights > 1.

In State.updateToState, last precommit is computed  only when round
greater than -1 and has votes. But "LastCommit" is always updated
regardless of the condition. If there's no last precommit, "LastCommit"
is set to (*types.VoteSet)(nil). That's why "LastCommit" can be -1 for
heights > 1.

To fix it, only update State.RoundState.LastCommit when there is last
precommit.

Fixes #2737
@auto-comment
Copy link

auto-comment bot commented Jun 5, 2020

👋 Thanks for creating a PR!

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Wrote tests
  • Updated CHANGELOG_PENDING.md
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Updated relevant documentation (docs/) and code comments
  • Re-reviewed Files changed in the Github PR explorer
  • Applied Appropriate Labels

Thank you for your contribution to Tendermint! 🚀

@melekes
Copy link
Contributor Author

melekes commented Jun 5, 2020

conR.conS.reconstructLastCommit(state)
line does not make any sense since we (before this PR) override cs.LastCommit in any case with another value...

@melekes melekes added the R:minor Release: Minor label Jun 5, 2020
@melekes melekes self-assigned this Jun 5, 2020
@codecov
Copy link

codecov bot commented Jun 5, 2020

Codecov Report

Merging #4970 into master will decrease coverage by 0.15%.
The diff coverage is 44.44%.

@@            Coverage Diff             @@
##           master    #4970      +/-   ##
==========================================
- Coverage   63.38%   63.22%   -0.16%     
==========================================
  Files         181      181              
  Lines       19080    19088       +8     
==========================================
- Hits        12093    12069      -24     
- Misses       5963     5986      +23     
- Partials     1024     1033       +9     
Impacted Files Coverage Δ
consensus/reactor.go 72.61% <33.33%> (-2.85%) ⬇️
consensus/state.go 70.78% <46.66%> (-0.56%) ⬇️
consensus/ticker.go 91.66% <0.00%> (-4.17%) ⬇️
consensus/replay.go 71.72% <0.00%> (-0.85%) ⬇️
blockchain/v1/reactor.go 71.73% <0.00%> (-0.36%) ⬇️
blockchain/v0/pool.go 79.29% <0.00%> (+0.63%) ⬆️
p2p/pex/pex_reactor.go 82.01% <0.00%> (+1.05%) ⬆️

@melekes melekes marked this pull request as ready for review June 5, 2020 14:29
@melekes melekes requested a review from tessr as a code owner June 5, 2020 14:29
Copy link
Contributor

@cmwaters cmwaters left a comment

Choose a reason for hiding this comment

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

LGTM

@melekes melekes merged commit 65909a1 into master Jun 10, 2020
@melekes melekes deleted the 2737 branch June 10, 2020 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

R:minor Release: Minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LastCommitRound can be -1 for heights > 1

3 participants