Skip to content

feat(code): Implement Solution 1 for the RoundSync #1033

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

Closed
wants to merge 53 commits into from

Conversation

ancazamfir
Copy link
Collaborator

@ancazamfir ancazamfir commented May 16, 2025

Closes: #XXX
From the Round sync spec:

Solution 1 (similar to what we have now and what StarkWare implements)

  • upon entering the round r process broadcast the certificate EnterRoundCertificate (in round=0 this certificate is nil so a process doesn’t broadcast it) and reset lastPrevote and lastPrecommit
  • upon sending PREVOTE message a process trigger timeoutRebroadcastPrevote
    • If timeout timeoutRebroadcastPrevote expires before process triggers timeoutPrevote or send a PRECOMMIT message, a process call REBROADCAST() and starts timeoutRebroadcastPrevote again
  • upon sending PRECOMMIT message a process cancels existing timeoutRebroadcastPrevote and starts timeoutRebroadcastPrecommit
    • If timeout timeoutRebroadcastPrecommit expires before process triggers timeoutPrecommit or receives a roundCertificate for a new round, a process call REBROADCAST() and starts timeoutRebroadcastPrecommit again
  • upon receiving a round certificate for a new round process cancel any existing timeouts
  • Timeouts can be set:
  • timeoutRebroadcastPrevote(r) = timeoutPrevote(r) and
  • timeoutRebroadcastPrecommit(r) = timeoutPrecommit(r)

REBROADCAST() - broadcasts the current non-nil values of EnterRoundCertificate, lastPrevote and lastPrecommit

Summary of the changes compared with parent branch:

  • bring back the two timers TimeoutKind::PrevoteRebroadcast, TimeoutKind::PrecommitRebroadcast
  • cancel the PrevoteRebroadcast timer when a precommit is sent
  • cancel the PrevoteRebroadcast timer when the Prevote timer is started
  • cancel the PrecommitRebroadcast timer when the Precommit timer is started
  • cancel the rebroadcast timers when a round certificate is received
    • Note: Should add check that the certificate is a well formed PrecommitAny or SkipRound type (with correct voting power) and not cancel timers if not (cc @nenadmilosevic95)

The rest of the points in Solution 1 are included in parent branch.


PR author checklist

For all contributors

For external contributors

ancazamfir and others added 30 commits May 1, 2025 15:48
Co-authored-by: nenadmilosevic95 <50905385+nenadmilosevic95@users.noreply.github.com>
Signed-off-by: Anca Zamfir <ancazamfir@users.noreply.github.com>
Co-authored-by: nenadmilosevic95 <50905385+nenadmilosevic95@users.noreply.github.com>
Signed-off-by: Anca Zamfir <ancazamfir@users.noreply.github.com>
Copy link

codecov bot commented May 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (acc180b) to head (259369d).
Report is 4 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@     Coverage Diff      @@
##   main   #1033   +/-   ##
============================
============================

Copy link
Contributor

@nenadmilosevic95 nenadmilosevic95 left a comment

Choose a reason for hiding this comment

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

LGTM, I left some comments!

@ancazamfir ancazamfir marked this pull request as ready for review May 16, 2025 14:27
@ancazamfir ancazamfir requested a review from romac as a code owner May 16, 2025 14:27
@romac
Copy link
Member

romac commented May 16, 2025

I guess we can close this now, right?

Base automatically changed from anca/gossip to main May 16, 2025 17:45
@ancazamfir ancazamfir requested a review from adizere as a code owner May 16, 2025 17:45
@faddat
Copy link

faddat commented May 19, 2025

@romac is that because of the recently-merged networking code, or something else?

Just interested in what makes this pr closable.

@romac
Copy link
Member

romac commented May 19, 2025

@romac is that because of the recently-merged networking code, or something else?

Just interested in what makes this pr closable.

It is because the other solution we had mind was merged instead: #1032

@romac romac closed this May 19, 2025
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