diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManager.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManager.java index 3956ce1cf2..1dc80b1023 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManager.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManager.java @@ -257,7 +257,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver { } else if (!ethPeer.statusHasBeenReceived()) { // Peers are required to send status messages before any other message type LOG.debug( - "{} requires a Status ({}) message to be sent first. Instead, received message {}. Disconnecting from {}.", + "{} requires a Status ({}) message to be sent first. Instead, received message {} (BREACH_OF_PROTOCOL). Disconnecting from {}.", this.getClass().getSimpleName(), EthPV62.STATUS, code, @@ -277,7 +277,9 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver { final EthMessage ethMessage = new EthMessage(ethPeer, messageData); if (!ethPeer.validateReceivedMessage(ethMessage, getSupportedProtocol())) { - LOG.debug("Unsolicited message received, disconnecting from EthPeer: {}", ethPeer); + LOG.debug( + "Unsolicited message received (BREACH_OF_PROTOCOL), disconnecting from EthPeer: {}", + ethPeer); ethPeer.disconnect(DisconnectReason.BREACH_OF_PROTOCOL); return; } @@ -308,7 +310,10 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver { } } catch (final RLPException e) { LOG.debug( - "Received malformed message {} , disconnecting: {}", messageData.getData(), ethPeer, e); + "Received malformed message {} (BREACH_OF_PROTOCOL), disconnecting: {}", + messageData.getData(), + ethPeer, + e); ethPeer.disconnect(DisconnectMessage.DisconnectReason.BREACH_OF_PROTOCOL); } diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/RequestManager.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/RequestManager.java index 800836df9a..989af18781 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/RequestManager.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/RequestManager.java @@ -29,7 +29,12 @@ import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public class RequestManager { + + private static final Logger LOG = LoggerFactory.getLogger(RequestManager.class); private final AtomicLong requestIdCounter = new AtomicLong(0); private final Map responseStreams = new ConcurrentHashMap<>(); private final EthPeer peer; @@ -73,7 +78,10 @@ public class RequestManager { .ifPresentOrElse( responseStream -> responseStream.processMessage(requestIdAndEthMessage.getValue()), // disconnect on incorrect requestIds - () -> peer.disconnect(DisconnectMessage.DisconnectReason.BREACH_OF_PROTOCOL)); + () -> { + LOG.debug("Request ID incorrect (BREACH_OF_PROTOCOL), disconnecting peer {}", peer); + peer.disconnect(DisconnectMessage.DisconnectReason.BREACH_OF_PROTOCOL); + }); } else { // otherwise iterate through all of them streams.forEach(stream -> stream.processMessage(ethMessage.getData())); diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/AbstractGetHeadersFromPeerTask.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/AbstractGetHeadersFromPeerTask.java index 0fec6bf980..58d5800f11 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/AbstractGetHeadersFromPeerTask.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/task/AbstractGetHeadersFromPeerTask.java @@ -109,7 +109,8 @@ public abstract class AbstractGetHeadersFromPeerTask final BlockHeader child = reverse ? prevBlockHeader : header; if (!parent.getHash().equals(child.getParentHash())) { LOG.debug( - "Sequential headers must form a chain through hashes, disconnecting peer: {}", peer); + "Sequential headers must form a chain through hashes (BREACH_OF_PROTOCOL), disconnecting peer: {}", + peer); peer.disconnect(DisconnectMessage.DisconnectReason.BREACH_OF_PROTOCOL); return Optional.empty(); } diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/BlockPropagationManager.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/BlockPropagationManager.java index eec2c4b45a..1370b80589 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/BlockPropagationManager.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/BlockPropagationManager.java @@ -296,7 +296,7 @@ public class BlockPropagationManager implements ForkchoiceMessageListener { importOrSavePendingBlock(block, message.getPeer().nodeId()); } catch (final RLPException e) { LOG.debug( - "Malformed NEW_BLOCK message received from peer, disconnecting: {}", + "Malformed NEW_BLOCK message received from peer (BREACH_OF_PROTOCOL), disconnecting: {}", message.getPeer(), e); message.getPeer().disconnect(DisconnectReason.BREACH_OF_PROTOCOL); @@ -359,7 +359,7 @@ public class BlockPropagationManager implements ForkchoiceMessageListener { } } catch (final RLPException e) { LOG.debug( - "Malformed NEW_BLOCK_HASHES message received from peer, disconnecting: {}", + "Malformed NEW_BLOCK_HASHES message received from peer (BREACH_OF_PROTOCOL), disconnecting: {}", message.getPeer(), e); message.getPeer().disconnect(DisconnectReason.BREACH_OF_PROTOCOL); diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/PipelineChainDownloader.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/PipelineChainDownloader.java index bedf5ea2ce..6d3abe3d5b 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/PipelineChainDownloader.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/PipelineChainDownloader.java @@ -119,7 +119,7 @@ public class PipelineChainDownloader implements ChainDownloader { pipelineErrorCounter.inc(); if (ExceptionUtils.rootCause(error) instanceof InvalidBlockException) { LOG.warn( - "Invalid block detected. Disconnecting from sync target. {}", + "Invalid block detected (BREACH_OF_PROTOCOL). Disconnecting from sync target. {}", ExceptionUtils.rootCause(error).getMessage()); syncState.disconnectSyncTarget(DisconnectReason.BREACH_OF_PROTOCOL); } diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/tasks/DownloadHeaderSequenceTask.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/tasks/DownloadHeaderSequenceTask.java index 2923605ca4..066e489859 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/tasks/DownloadHeaderSequenceTask.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/tasks/DownloadHeaderSequenceTask.java @@ -219,10 +219,10 @@ public class DownloadHeaderSequenceTask extends AbstractRetryingPeerTask