Skip to content

Commit

Permalink
[libp2p/consensus] p2p spamming defense
Browse files Browse the repository at this point in the history
This is a big PR merged many small commits together.
We add the message validation function in libp2p layer.

In the validation function, we check the following conditions
1) the p2p message is a valid consensus message
2) the p2p message sender has a valid public key
3) the sender's public key is in the current committee
4) log the number of invalid/valid messages

After the validation, the valid messages will be forward to the network,
while the invalid messages will be filtered out.

The messages intended for the validator will be handled in the consensus layer.

Signed-off-by: Leo Chen <leo@harmony.one>
  • Loading branch information
Leo Chen committed Jul 15, 2020
1 parent 27fe3e3 commit b560f88
Show file tree
Hide file tree
Showing 15 changed files with 1,848 additions and 1,175 deletions.
4 changes: 2 additions & 2 deletions api/proto/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ type MessageCategory byte
const (
Consensus MessageCategory = iota
Node
Client
DRand
Client // deprecated
DRand // not used
)

const (
Expand Down
Loading

0 comments on commit b560f88

Please sign in to comment.