-
Notifications
You must be signed in to change notification settings - Fork 408
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
stop unstaked nodes from pushing EpochSlots into the cluster #5141
stop unstaked nodes from pushing EpochSlots into the cluster #5141
Conversation
038f5b2
to
d20ce72
Compare
@gregcusack @bw-solana please take a look if this is what we need to stop unstaked nodes from polluting gossip |
just to confirm and based off of side convo, we are holding off on this until epochslots are ready to be fully removed, right? |
As far as I understand we can do this right away since EpochSlots, when made by unstaked nodes, do not really do much other than pollute gossip (since repair will prioritize staked nodes anyway, and unstaked nodes do not take part in consensus). |
@alessandrod mentioned that FD are happy with EpochSlots gone, can we at least start testing this simple solution that will cut bandwidth by 50%? Waiting for a complete solution can take months. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple comments on the code.
But it sounds like we need to get aligned on direction...
My understanding is EpochSlots are used in repair and ancestor hash repair sampling services. If unstaked nodes stop pushing out EpochSlots, what is the expected behavior change? More concentrated repair/sampling load on the staked nodes?
If we're comfortable with the behavior changes for these services, this seems like high impact gossip bandwidth reduction.
core/src/cluster_slots_service.rs
Outdated
@@ -79,6 +79,14 @@ impl ClusterSlotsService { | |||
cluster_slots_update_receiver: ClusterSlotsUpdateReceiver, | |||
exit: Arc<AtomicBool>, | |||
) { | |||
let node_id = cluster_info.id(); | |||
let my_stake = bank_forks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we need to derive each of these in the loop since they can change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in df0ffb9
core/src/cluster_slots_service.rs
Outdated
&cluster_slots_update_receiver, | ||
&cluster_info, | ||
); | ||
// only staked nodes push EpochSlots into CRDS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be better to include the "why" here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in df0ffb9
Speaking from the consensus angle, one of the conditions for kicking off ancestor hashes repair is when we observe 52%+ on a dead block from EpochSlots. If unstaked nodes do not push EpochSlots this doesn't matter. However when sampling for ancestor hashes repair (unlike normal repair) we select peers purely based on EpochSlots. For correctness it does not matter if we exclude unstaked nodes here, since we must have already seen that enough staked nodes have frozen this slot. It might add latency to only sample from staked nodes, however if we're in a situation that is reliant on ancestor hashes repair the cluster is already temporarily stuck. I think the more important factor is whether we want to restrict regular repair to only staked nodes. |
Regular repair already heavily prefers staked nodes. Basically the weight function is literally just node's stake, and unstaked nodes are given a stake of 1. |
df0ffb9
to
92475ba
Compare
The code changes on this PR LGTM as far as the mechanics of removing It sounds like we are cleared to remove Are we okay from a repair perspective? Any additional code changes we would need to make this work? @behzadnouri ? Any concerns for FD? CC @ptaffet-jump |
core/src/cluster_slots_service.rs
Outdated
let my_stake = bank_forks | ||
.read() | ||
.unwrap() | ||
.root_bank() | ||
.current_epoch_stakes() | ||
.node_id_to_stake(&node_id) | ||
.unwrap_or_default(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably should use EpochSpecs
:
https://github.com/anza-xyz/agave/blob/e12e6fbf7/gossip/src/epoch_specs.rs#L18
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in e3df68e
Further digging - repair weights for unstaked nodes are set to 1, repair weights for staked nodes are in the millions, raw data from https://github.com/alexpyattaev/agave/blob/4a8e72c36ff6f36cdfe712af7b6edf2cc7825f59/core/src/repair/serve_repair.rs#L1087 looks like this:
Similar thing is going on with ancestor hashes
actual odds look like this:
so I think we have very low odds of actually picking any unstaked node even today.... |
this matches my understanding. My takeaway being this change would have immeasurable change to repair concentration on staked nodes or protocol security. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please wait for Ashwin to also approve
It appears @AshwinSekar is only concerned with restricting repair to only staked nodes. I think there is value in getting this in and getting the testing going. We have spilled a lot of ink on epoch slots. |
Ashwin is OOO today, but I did chat with him earlier this week about this change. He thought it should be fine. |
side-note - an unstaked node will push a 3-4 epochslots messages on startup anyway even with this patch applied. it happens in a completely different part of the code that i missed, and only once, so no need to patch it. |
backport to 2.2? |
I support this, but it would be good to make sure we've collected adequate signal for the "remove deprecated values from gossip pull messages" change on testnet to not confuse things. @gregcusack - do we have confirmation yet? I think we're still around 40% Agave stake on testnet.. |
no confirmation yet since we're still waiting for a little more stake on agave on testnet. tbh the believe risk on that backport is very low. but good to make sure. |
Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis. |
* stop unstaked nodes from pushing EpochSlots into the cluster * reload own stake on every epoch in case I become staked * use epoch specs to reduce contention for bank forks --------- Co-authored-by: Alex Pyattaev <[email protected]> Big thanks to Behzad for code suggestions. (cherry picked from commit 145d562)
…ackport of #5141) (#5286) stop unstaked nodes from pushing EpochSlots into the cluster (#5141) * stop unstaked nodes from pushing EpochSlots into the cluster * reload own stake on every epoch in case I become staked * use epoch specs to reduce contention for bank forks --------- Co-authored-by: Alex Pyattaev <[email protected]> Big thanks to Behzad for code suggestions. (cherry picked from commit 145d562) Co-authored-by: Alex Pyattaev <[email protected]>
Problem
Summary of Changes
Fixes #
Partially #5034