Skip to content

refactor(consensus): remove not needed commit timeout and unused LastPrecommits - #751

Merged
lklimek merged 10 commits into
v0.14-devfrom
refactor/remove-last-precommits
Mar 12, 2024
Merged

lklimek merged 10 commits into
v0.14-devfrom
refactor/remove-last-precommits

Conversation

@lklimek

@lklimek lklimek commented Mar 7, 2024 •

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

We don't need LastPrecommits because they are only used in Tenderdash to construct commit.
In our case, it's enough to just set LastCommit, as we use threshold signatures and don't need these precommits.

It also means we don't need to wait for all precommits to get to our node, so commit timeout is not needed.

What was done?

Removed LastPrecommits.

Removed consensus params: commit timeout and bypass_commit_timeout.

How Has This Been Tested?

GHA + tested during stress tests on ouzo devnet

Breaking Changes

Changed definition of consensus params: removed timeout commit and bypass_commit_timeout.
Affects protobuf and json encoding of these params.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

We don't need LastPrecommits because they are only used in Tenderdash to construct commit.

In our case, it's enough to just set LastCommit, as we use threshold signatures and don't need these precommits.
@lklimek lklimek changed the title refactor: remove unused LastPrecommits refactor(consensus): remove not needed commit timeout and unused LastPrecommits Mar 8, 2024

@shumkov shumkov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍

@lklimek
lklimek merged commit 37870a8 into v0.14-dev Mar 12, 2024
@lklimek
lklimek deleted the refactor/remove-last-precommits branch March 12, 2024 07:33
lklimek added a commit that referenced this pull request Nov 17, 2026
…urrent-height votes (#1601)

* fix(consensus): stop a previous-height precommit marking the peer's current-height bit

getVoteBitArray resolved (PRS.Height-1, LastCommitRound, Precommit) to
PRS.Precommits, the bit array of the peer's current height, after #751
removed the dedicated LastPrecommits array. A late precommit of the height
the peer had just left (reactor Vote handler -> SetHasVote) therefore marked
the same validator index as already held for the current height, and that
validator's current-height precommit was never offered to the peer. A
VoteSetBits answer about the previous height's commit (ApplyVoteSetBitsMessage
with ourVotes == nil) overwrote the whole current-height precommit bit array
the same way.

Previous-height votes are not gossiped individually (the commit is sent
whole), so the lookup now returns nil for them: no tracking, no side effects.
LastCommitRound bookkeeping in ApplyNewRoundStepMessage is unchanged.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* test(consensus): cover VoteSetBits with own votes; drop dead LastPrecommits branch

ApplyVoteSetBitsMessage has two branches (ourVotes nil or not); the
previous-height regression test now exercises both. ApplyNewRoundStepMessage
kept an if/else with identical branches under a "Shift Precommits to
LastPrecommits" comment from before #751 removed that array; collapsed to the
single assignment it performs.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

---------

Co-authored-by: Lukasz Klimek <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
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