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 10, 2020
1 parent a168517 commit 7256c5d
Show file tree
Hide file tree
Showing 15 changed files with 2,149 additions and 1,324 deletions.
438 changes: 292 additions & 146 deletions api/client/service/proto/client.pb.go

Large diffs are not rendered by default.

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 7256c5d

Please sign in to comment.