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

IDONTWANT message optimisation to cutoff for smaller messages #6456

Merged
merged 9 commits into from
Oct 17, 2024

Conversation

hopinheimer
Copy link
Contributor

addresses #6437

@hopinheimer hopinheimer changed the title idontwant message optimisation IDONTWANT message optimisation to cutoff for smaller messages Oct 2, 2024
@jimmygchen jimmygchen requested review from AgeManning and jxs and removed request for AgeManning October 3, 2024 01:03
@jimmygchen jimmygchen requested a review from AgeManning October 3, 2024 01:03
@jimmygchen jimmygchen added the ready-for-review The code is ready for review label Oct 3, 2024
Copy link
Member

@AgeManning AgeManning left a 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
Copy link
Member

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.

Copy link
Contributor Author

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!

@hopinheimer hopinheimer requested a review from AgeManning October 3, 2024 05:06
Copy link
Member

@jxs jxs left a 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(){
Copy link
Member

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.

Copy link
Contributor Author

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

beacon_node/lighthouse_network/gossipsub/src/config.rs Outdated Show resolved Hide resolved
beacon_node/lighthouse_network/gossipsub/src/config.rs Outdated Show resolved Hide resolved
@hopinheimer
Copy link
Contributor Author

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,
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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?

Copy link
Member

@jxs jxs left a 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

@AgeManning
Copy link
Member

aha, i was trying to fix the CI, but getting merge conflicts. You beat me to it. :). Thanks

@hopinheimer
Copy link
Contributor Author

haha, Imma ss this!

@AgeManning
Copy link
Member

@Mergifyio queue

Copy link

mergify bot commented Oct 15, 2024

queue

🛑 The pull request has been removed from the queue default

The merge conditions cannot be satisfied due to failing checks.

You can take a look at Queue: Embarked in merge queue check runs for more details.

In case of a failure due to a flaky test, you should first retrigger the CI.
Then, re-embark the pull request into the merge queue by posting the comment
@mergifyio refresh on the pull request.

mergify bot added a commit that referenced this pull request Oct 15, 2024
@jxs
Copy link
Member

jxs commented Oct 16, 2024

@Mergifyio queue

Copy link

mergify bot commented Oct 16, 2024

queue

🛑 The pull request has been removed from the queue default

The merge conditions cannot be satisfied due to checks timeout.

You can take a look at Queue: Embarked in merge queue check runs for more details.

In case of a failure due to a flaky test, you should first retrigger the CI.
Then, re-embark the pull request into the merge queue by posting the comment
@mergifyio refresh on the pull request.

mergify bot added a commit that referenced this pull request Oct 16, 2024
@michaelsproul michaelsproul added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels Oct 17, 2024
@michaelsproul
Copy link
Member

@mergify dequeue

Copy link

mergify bot commented Oct 17, 2024

dequeue

☑️ The pull request is not queued

@michaelsproul
Copy link
Member

some stuff got stuck, so just removing this from the queue for now

@michaelsproul
Copy link
Member

@mergify queue

Copy link

mergify bot commented Oct 17, 2024

queue

🛑 The pull request has been removed from the queue default

The merge conditions cannot be satisfied due to checks timeout.

You can take a look at Queue: Embarked in merge queue check runs for more details.

In case of a failure due to a flaky test, you should first retrigger the CI.
Then, re-embark the pull request into the merge queue by posting the comment
@mergifyio refresh on the pull request.

@michaelsproul
Copy link
Member

@mergify requeue

Copy link

mergify bot commented Oct 17, 2024

requeue

✅ This pull request will be re-embarked automatically

The followup queue command will be automatically executed to re-embark the pull request

Copy link

mergify bot commented Oct 17, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at 606a113

mergify bot added a commit that referenced this pull request Oct 17, 2024
@mergify mergify bot merged commit 606a113 into sigp:unstable Oct 17, 2024
29 checks passed
chong-he pushed a commit to chong-he/lighthouse that referenced this pull request Nov 26, 2024
)

* idontwant message opitmising

* requested changes and linter appeasing

* added the config cli flag

* Merge branch 'unstable' into fix/idontwant-optimise

* cli docs generated

* const declaration

* Hide extra technical cli flag

* passing ci

* Merge branch 'unstable' into fix/idontwant-optimise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Networking ready-for-merge This PR is ready to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants