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 instance skipping inequality check #437

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion host.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@
// prioritise finality certificates and alarm delivery
select {
case c, ok := <-finalityCertificates:
// We only care about the latest certificate, skip passed old ones.
if len(finalityCertificates) > 0 {
continue

Check warning on line 122 in host.go

View check run for this annotation

Codecov / codecov/patch

host.go#L122

Added line #L122 was not covered by tests
}

if !ok {
finalityCertificates = make(chan *certs.FinalityCertificate, 4)
c, _ = h.certStore.SubscribeForNewCerts(finalityCertificates)
Expand All @@ -136,6 +141,11 @@
// Handle messages, finality certificates, and alarms
select {
case c, ok := <-finalityCertificates:
// We only care about the latest certificate, skip passed old ones.
if len(finalityCertificates) > 0 {
continue

Check warning on line 146 in host.go

View check run for this annotation

Codecov / codecov/patch

host.go#L145-L146

Added lines #L145 - L146 were not covered by tests
}

if !ok {
finalityCertificates = make(chan *certs.FinalityCertificate, 4)
c, _ = h.certStore.SubscribeForNewCerts(finalityCertificates)
Expand Down Expand Up @@ -173,10 +183,13 @@

func (h *gpbftRunner) receiveCertificate(c *certs.FinalityCertificate) error {
nextInstance := c.GPBFTInstance + 1
if h.participant.CurrentInstance() <= nextInstance {
currentInstance := h.participant.CurrentInstance()
if h.participant.CurrentInstance() >= nextInstance {
return nil
}

log.Warnf("skipping from isntance %d to instance %d", currentInstance, nextInstance)

Check warning on line 191 in host.go

View check run for this annotation

Codecov / codecov/patch

host.go#L191

Added line #L191 was not covered by tests

nextInstanceStart := h.computeNextInstanceStart(c)
return h.participant.StartInstanceAt(nextInstance, nextInstanceStart)
}
Expand Down
Loading