-
Notifications
You must be signed in to change notification settings - Fork 784
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
IDONTWANT message optimisation to cutoff for smaller messages #6456
Conversation
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.
Nice, thanks for the help.
// traffic and CPU load. This acts as a lower bound cutoff for the message size to which | ||
// IDONTWANT won't be sent to peers. Only works if the peers support Gossipsub1.3 | ||
// (see https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.2.md#idontwant-message) | ||
// default is 1kb |
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.
Might be worth mentioning that the unit for the usize value is bytes.
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 always mess this up. resolved!
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.
Thanks! You need to cargo fmt
to pass the check code
CI job. The tests also need to be updated, and we should probably add another test for this case, i.e. to not send IDONTWANT when the size is inferior to the limit
@@ -2699,6 +2701,10 @@ where | |||
return; | |||
}; | |||
|
|||
if message.raw_protobuf_len() < self.config.idontwant_message_size_threshold(){ |
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.
can we move this check to line 1833
? So that it's explicit that we are only calling send_idontwant
if the message size is inferior to the threshold instead of having the function decide 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.
also the the logic was a little off. I have changed it and written passing test for the same
waiting on #6436 to build the cli docs. I use a mac |
@@ -352,6 +356,7 @@ impl Default for Config { | |||
outbound_rate_limiter_config: None, | |||
invalid_block_storage: None, | |||
inbound_rate_limiter_config: None, | |||
idontwant_message_size_threshold: 1000, |
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.
It'd be good to extract the default value into a IDONTWANT_MESSAGE_SIZE_THRESHOLD
const value.
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.
sounds reasonable. made the requested changes
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.
target_peers
few line above also seems to have inline declaration should I extract it too?
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! cc @AgeManning if you wanna take a final look
aha, i was trying to fix the CI, but getting merge conflicts. You beat me to it. :). Thanks |
haha, Imma ss this! |
@Mergifyio queue |
🛑 The pull request has been removed from the queue
|
@Mergifyio queue |
🛑 The pull request has been removed from the queue
|
@mergify dequeue |
☑️ The pull request is not queued |
some stuff got stuck, so just removing this from the queue for now |
@mergify queue |
🛑 The pull request has been removed from the queue
|
@mergify requeue |
✅ This pull request will be re-embarked automaticallyThe followup |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 606a113 |
addresses #6437