Skip to content

Add preference lookups by height to the consensus interface #2092

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

Merged
merged 8 commits into from
Sep 26, 2023

Conversation

StephenButtolph
Copy link
Contributor

Why this should be merged

The bubbling votes optimization requires the ability to lookup the preferred value at a given height.

How this works

In the same locations that we currently populate the preferredIDs set - we now populate a new map preferredHeights as well.

How this was tested

Added checks to various existing preference unit tests.

@StephenButtolph StephenButtolph added consensus This involves consensus bubble votes labels Sep 24, 2023
@StephenButtolph StephenButtolph added this to the v1.10.12 milestone Sep 24, 2023
@@ -251,7 +271,7 @@ func (ts *Topological) Preference() ids.ID {
// unsuccessful poll on that block and every descendant block.
//
// The complexity of this function is:
// - Runtime = 3 * |live set| + |votes|
// - Runtime = 4 * |live set| + |votes|
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because of the additional map iteration caused by maps.Clear

Copy link
Collaborator

@aaronbuchwald aaronbuchwald left a comment

Choose a reason for hiding this comment

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

LGTM

@StephenButtolph StephenButtolph self-assigned this Sep 26, 2023
Co-authored-by: Dan Laine <daniel.laine@avalabs.org>
Signed-off-by: Stephen Buttolph <stephen@avalabs.org>
@StephenButtolph StephenButtolph added this pull request to the merge queue Sep 26, 2023
Merged via the queue into dev with commit cb6894c Sep 26, 2023
@StephenButtolph StephenButtolph deleted the add-preference-lookup-by-height branch September 26, 2023 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bubble votes consensus This involves consensus
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants