-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Fix determination of staked QUIC connections #34760
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #34760 +/- ##
=========================================
- Coverage 81.8% 81.8% -0.1%
=========================================
Files 824 824
Lines 223051 223049 -2
=========================================
- Hits 182474 182465 -9
- Misses 40577 40584 +7 |
params.stake, | ||
params.total_stake, | ||
stream_load_ema.clone(), | ||
); | ||
let staked_stream = matches!(peer_type, ConnectionPeerType::Staked) && params.stake > 0; |
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 can reduce some of this change by defining:
let staked_stream = params.stake > 0;
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.
Isn't it better to have this check than declaring a new stack variable? The change is only three lines. So review should be simple.
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 think i'd have preferred resolving the enum once and using that throughout. the Staked
variant just needs to be Staked { lamports: u64 }
Yes, that's more idiomatic. Will update the PR. |
9edeb8b
to
c094688
Compare
Done |
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.
lgtm
* Fix determination of staked QUIC connections * address review comments * review comments * treat connections with zero stake as unstaked
Problem
The usage of
ConnectionPeerType
to determine if a connection is staked is incorrect. Thepeer_type
is an attribute of theconnection_table
where a QUIC connection gets stored. We maintain two tables, one for staked connections, and the other for unstaked connections. But if the staked connection is full, the new connections get stored in the unstaked connection table, even if the peer is a staked client. SoConnectionPeerType
can incorrectly mark a staked connection as unstaked.Peer's stake correctly identifies if the connection is from a staked client or not.
Summary of Changes
Update code to use peer's stake to determine if the connection is from a staked client.
Remove
ConnectionPeerType
and its usage.Fixes #