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

feat(shred-network): minimize dependencies #462

Merged
merged 18 commits into from
Jan 2, 2025
Merged

Conversation

dnut
Copy link
Contributor

@dnut dnut commented Dec 19, 2024

This is an alternative implementation for #423. It accomplishes the same goals, except that it implements the interface between shred-network and an epoch context provider with shared memory instead of a vtable.

The static context of an epoch is defined by EpochContext, which contains staked nodes and a leader schedule.

The storage of relevant EpochContexts is managed by EpochContextManager. This specialized struct is needed because it must be aware of the epoch schedule.

Depending on the run mode, the initial EpochContext may be created from the bank or from rpc. There is currently only one way to update the EpochContextManager during the runtime of the validator, which is via rpc.

There is a limitation where RPC cannot be used to access epoch staked nodes. This can only be acquired from the bank. So the bank is used when available, otherwise the data is not populated.

@dnut dnut requested a review from yewman December 19, 2024 12:55
@dnut dnut marked this pull request as ready for review December 19, 2024 12:56
yewman
yewman previously approved these changes Dec 29, 2024
@dnut dnut force-pushed the dnut/roots/mindeps2 branch from c66fc19 to 882c162 Compare December 31, 2024 12:13
@dnut dnut changed the base branch from dnut/roots/mindeps2 to main December 31, 2024 12:16
@dnut dnut dismissed yewman’s stale review December 31, 2024 12:16

The base branch was changed.

dnut added 2 commits January 2, 2025 10:22
the list of all nodes should be large enough to fit all staked nodes + gossip nodes + 1 for self. the bug was that it wasn't including 1 for itself, and it would hit an error on appendAssumeCapacity.

normally this is not a problem because nodes get filtered out in the for loop, so it doesn't use the full capacity. but if no nodes are filtered out, then you get an error from having a capacity 1 less than necessary.

this also refactors the stake calculation if-statement for clarity
@dnut dnut merged commit e7495af into main Jan 2, 2025
8 checks passed
@dnut dnut deleted the dnut/refactor/mindeps2 branch January 2, 2025 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
2 participants