Skip to content

Commit

Permalink
network/tx: Ban peers with tx that fail to decode (#5002)
Browse files Browse the repository at this point in the history
A malicious peer can submit random bytes on transaction protocol.
In this case, the peer is not disconnected or reported back to the
peerstore.

This PR ensures the peer's reputation is properly reported.

Discovered during testing:
- #4977


cc @paritytech/networking

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
  • Loading branch information
lexnv authored Jul 15, 2024
1 parent 4aa29a4 commit d2dff5f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion substrate/client/network/transactions/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ where
{
self.on_transactions(peer, m);
} else {
warn!(target: "sub-libp2p", "Failed to decode transactions list");
warn!(target: "sub-libp2p", "Failed to decode transactions list from peer {peer}");
self.network.report_peer(peer, rep::BAD_TRANSACTION);
}
},
}
Expand Down

0 comments on commit d2dff5f

Please sign in to comment.