Skip to content

snap - diagnostic logging for malformed RLP messages#10038

Open
macfarla wants to merge 2 commits intobesu-eth:mainfrom
macfarla:rlp-malformed-logging
Open

snap - diagnostic logging for malformed RLP messages#10038
macfarla wants to merge 2 commits intobesu-eth:mainfrom
macfarla:rlp-malformed-logging

Conversation

@macfarla
Copy link
Contributor

PR description

extra logging (at DEBUG) to include message code when incoming RLP is malformed

Fixed Issue(s)

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:

  • spotless: ./gradlew spotlessApply
  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests
  • hive tests: Engine or other RPCs modified?

@macfarla macfarla added the dev experience The build system, things that enable easier development etc. label Mar 12, 2026
Copilot AI review requested due to automatic review settings March 12, 2026 23:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds more diagnostic context to DEBUG logs when malformed RLP is received, specifically including the message code to aid troubleshooting before disconnecting peers.

Changes:

  • Include message code alongside message data in malformed-RLP DEBUG logs for Snap and Eth request/response paths
  • Switch EthProtocolManager malformed-RLP logging to use a throwable cause (setCause(e)) for stack traces

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/snap/SnapProtocolManager.java Adds message code to malformed RLP debug log before disconnect
ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/RequestManager.java Adds message code to malformed RLP debug log for responses
ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManager.java Logs message code + data and attaches exception cause in debug logging

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +83 to 87
"Received malformed message code={} data={} (BREACH_OF_PROTOCOL), disconnecting: {}",
ethMessage.getData().getCode(),
ethMessage.getData(),
peer,
e);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev experience The build system, things that enable easier development etc. snapsync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants