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 ticket handling, switch to exponential ticket election #578

Merged
merged 6 commits into from
Aug 24, 2024

Conversation

Kubuxu
Copy link
Contributor

@Kubuxu Kubuxu commented Aug 22, 2024

No description provided.

@Kubuxu Kubuxu force-pushed the test/deny-quality2 branch from 7837fba to 9ff5048 Compare August 22, 2024 13:24
Copy link

codecov bot commented Aug 22, 2024

Codecov Report

Attention: Patch coverage is 83.87097% with 10 lines in your changes missing coverage. Please review.

Project coverage is 79.39%. Comparing base (e90175c) to head (7297962).
Report is 1 commits behind head on main.

Files Patch % Lines
gpbft/gpbft.go 84.21% 2 Missing and 4 partials ⚠️
gpbft/ticket_quality.go 83.33% 2 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #578      +/-   ##
==========================================
- Coverage   79.64%   79.39%   -0.26%     
==========================================
  Files          50       51       +1     
  Lines        4530     4557      +27     
==========================================
+ Hits         3608     3618      +10     
- Misses        565      574       +9     
- Partials      357      365       +8     
Files Coverage Δ
gpbft/ticket_quality.go 83.33% <83.33%> (ø)
gpbft/gpbft.go 88.19% <84.21%> (-0.25%) ⬇️

... and 5 files with indirect coverage changes

@Kubuxu Kubuxu force-pushed the test/deny-quality2 branch 2 times, most recently from 0d7fd74 to 112be82 Compare August 22, 2024 14:00
@Kubuxu Kubuxu marked this pull request as ready for review August 23, 2024 19:00
@Kubuxu Kubuxu requested a review from Stebalien August 23, 2024 19:00
@Kubuxu Kubuxu changed the title Failing quality deny test keeping GST Fix ticket handling, switch to exponential ticket election Aug 23, 2024
Kubuxu added 5 commits August 23, 2024 21:24
Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
c.tickets[key] = append(c.tickets[key], ConvergeTicket{Sender: sender, Ticket: ticket})
senderPower, _ := table.Get(sender)
// Keep only the first justification and best ticket
if v, found := c.values[key]; !found {
Copy link
Member

Choose a reason for hiding this comment

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

Do we even need to keep multiple values? Instead, can we just keep the best ticket value (or, possibly, the best ticket for the best candidate)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, but that will change if we do the audit recommendation.

Copy link
Member

Choose a reason for hiding this comment

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

Wasn't the audit recommendation to skip to the second-best ticket if the best ticket doesn't have a valid candidate? In that case, we can filter candidates up-front. I.e.:

  1. Ignore all CONVERGE messages with values that aren't in our candidate set.
  2. Take the value with the best ticket from the remaining values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, I guess that could work

Copy link
Member

Choose a reason for hiding this comment

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

Quick sanity check: Has the audit recommendation been implemented in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No it has not

maxTicket = weightedTicket
maxValue = value
}
var bestValue ConvergeValue
Copy link
Member

Choose a reason for hiding this comment

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

We can simplify this logic by initializing this value to our own value. Then we can skip the c.HasSelfValue part.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the self-value and did some cleanup; please review the last commit.

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

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

The float logic looks correct (although a bit complex).

Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
@Stebalien
Copy link
Member

(happy to iterate in a new PR)

@Kubuxu Kubuxu added this pull request to the merge queue Aug 24, 2024
This was referenced Aug 24, 2024
Merged via the queue into main with commit 34a186e Aug 24, 2024
13 checks passed
@Kubuxu Kubuxu deleted the test/deny-quality2 branch August 24, 2024 01:08
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.

3 participants