-
Notifications
You must be signed in to change notification settings - Fork 201
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
v1.17: Treat super low staked as unstaked in streamer QOS (backport of #701) #732
Conversation
* Treat super low staked with QOS of unstaked * simplify * address some comment from Pankaj (cherry picked from commit 92ebf0f) # Conflicts: # streamer/src/nonblocking/quic.rs # streamer/src/nonblocking/stream_throttle.rs
Cherry-pick of 92ebf0f has failed:
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
streamer/src/nonblocking/quic.rs
Outdated
@@ -495,6 +495,16 @@ async fn setup_connection( | |||
stats.clone(), | |||
), | |||
|(pubkey, stake, total_stake, max_stake, min_stake)| { | |||
// The heuristic is that the stake should be large engouh to have 1 stream pass throuh within one throttle | |||
// interval during which we allow max (MAX_STREAMS_PER_100MS * 100) streams. | |||
let min_stake_ratio = 1_f64 / (MAX_STREAMS_PER_100MS * 100) as f64; |
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.
We should not multiply with 100 here. The constant MAX_STREAMS_PER_100MS
already accounts for that.
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.
Oh right. Silly me!
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v1.17 #732 +/- ##
=======================================
Coverage 81.6% 81.6%
=======================================
Files 806 806
Lines 219284 219290 +6
=======================================
+ Hits 179014 179058 +44
+ Misses 40270 40232 -38 |
Problem
staked nodes with low stakes can abuse the system to get disproportional bandwidth.
Summary of Changes
Treat it as unstaked node for the with stake ratio stake/total_stake < 1 / (max packet per 100 ms)
Fixes #
This is an automatic backport of pull request #701 done by [Mergify](https://mergify.com).