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(code/core-consensus): Only cancel propose timeout on a step change #862

Merged
merged 2 commits into from
Feb 19, 2025

Conversation

romac
Copy link
Member

@romac romac commented Feb 19, 2025

See: #850

@ancazamfir: When a Proposal(h, r, v, vr) is received without a PolkaPrevious, consensus cancels the propose timeout therefore never reaching the Prevote step and starting vote sync. (#850 (comment))

When receiving a proposal ⁠Proposal(h, r, v, vr) with ⁠vr > -1 without a polka for vr, we must:

  1. Stay in the Propose step
  2. Keep the Propose timeout active to either:
    • Collect more votes to form a polka, prevote ⁠v and move to the Prevote step
    • Let the Propose timeout expire, prevote ⁠nil and move to the Prevote step

Previously, we were incorrectly cancelling the Propose timeout in all cases, including that one, violating (2).


PR author checklist

For all contributors

For external contributors

We were previously cancelling the propose timeout unconditionally after receiving a proposal,
but there is a case where we must not do so.

When we receive a proposal `Proposal(h, r, v, vr)` with `vr > -1` and without a polka for `vr`,
then we must stay in the propose step and wait for the timeout to expire so that
we either get more votes in the meantime that form a polka and we can prevote for `v` and
move to step prevote, or the timeout expires and we prevote `nil` and move to step prevote.
@romac romac requested a review from ancazamfir as a code owner February 19, 2025 14:57
Copy link
Collaborator

@ancazamfir ancazamfir left a comment

Choose a reason for hiding this comment

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

👍

Copy link

codecov bot commented Feb 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.39%. Comparing base (b8ff51e) to head (099d611).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #862      +/-   ##
==========================================
+ Coverage   82.10%   82.39%   +0.29%     
==========================================
  Files         187      187              
  Lines       16012    16022      +10     
==========================================
+ Hits        13146    13200      +54     
+ Misses       2866     2822      -44     
Flag Coverage Δ
integration 82.23% <ø> (+0.29%) ⬆️
mbt 8.41% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
core ∅ <ø> (∅)
engine ∅ <ø> (∅)
app ∅ <ø> (∅)
starknet ∅ <ø> (∅)

@romac romac merged commit f3f1268 into main Feb 19, 2025
22 checks passed
@romac romac deleted the romac/fix-proposal-without-polka-previous branch February 19, 2025 15: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.

2 participants