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

Add validator grid mapper for neighbor discovery #232

Merged
merged 4 commits into from
Jan 21, 2025

Conversation

bamzedev
Copy link
Contributor

Closes #230

Primarily for the purpose of block announcements, the previous, current, 
and next validator sets are conceptually arranged in a grid structure. 
Two validators are considered neighbours in the grid if:

They are validators in the same epoch and either have the same row (index / W) 
or the same column (index % W). W here is floor(sqrt(V)), where V is the number of validators.
They are validators in different epochs but have the same index.

@bamzedev bamzedev force-pushed the add-validator-grid-mapper branch from b7861cf to f49ced6 Compare January 21, 2025 10:39
@bamzedev bamzedev force-pushed the add-validator-grid-mapper branch from f49ced6 to 2a1fd98 Compare January 21, 2025 10:41
greywolve
greywolve previously approved these changes Jan 21, 2025
Copy link
Contributor

@greywolve greywolve left a comment

Choose a reason for hiding this comment

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

LGTM, only comment would be a randomized test would be nice too, but we can always add that later.

internal/validator/grid.go Outdated Show resolved Hide resolved
internal/validator/grid.go Outdated Show resolved Hide resolved
internal/validator/grid.go Outdated Show resolved Hide resolved
@bamzedev bamzedev requested a review from pantrif January 21, 2025 14:16
@bamzedev bamzedev merged commit 64909d6 into main Jan 21, 2025
3 checks passed
@bamzedev bamzedev deleted the add-validator-grid-mapper branch January 21, 2025 14: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.

Validators grid structure
3 participants