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

Drop messages that exceeds local message size limit #7507

Merged
merged 7 commits into from
Aug 29, 2024

Conversation

rodionlim
Copy link
Contributor

@rodionlim rodionlim commented Aug 22, 2024

PR description

This PR is raised to add the following behaviour whenever sending messages across the network:

  1. Ensure that block messages are within the local configured limit before creating them
  2. Drop messages instead of sending them through the p2p network if it exceeds the local configured limit

Fixed Issue(s)

fixes #5455

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests

return new NewBlockMessage(out.encoded());
final Bytes data = out.encoded();
if (data.size() > maxMessageSize) {
throw new IllegalArgumentException("Block message is larger than allowed message size");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice to include the sizes in the message
Block message size 500Mb is larger than allowed message size 200Mb

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amended to reflect the size, let's stick with the original size in bytes, rounding in terms of MB might result in error messages of the following -> Block message size 10Mb is larger than allowed message size 10Mb

} catch (final IllegalArgumentException e) {
LOG.error("Failed to create block", e);
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are the implications of catching this here

Copy link

@rodion-lim-partior rodion-lim-partior Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@macfarla Original send in EthPeers catches the error (when message size > limit) instead of throwing it up. Would it better to throw the error? I wasn't too sure on the original intention when they caught the error instead of throwing it.

@rodionlim rodionlim force-pushed the comply-with-message-limit branch 4 times, most recently from e606b3d to c790598 Compare August 23, 2024 04:34
@macfarla macfarla requested a review from pinges August 26, 2024 03:05
Copy link
Contributor

@pinges pinges left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment, please have a look.

@rodion-lim-partior
Copy link

@pinges, do the tests re-run on their own? Are the failures due to the code changes made in this PR or these are intermittent errors that will be resolved on a re-run?

@macfarla macfarla enabled auto-merge (squash) August 27, 2024 23:29
@macfarla macfarla merged commit 03cdd45 into hyperledger:main Aug 29, 2024
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sending message that exceeds local message size limit
4 participants