AleoNet / snarkOS

A Decentralized Operating System for ZK Applications
http://snarkos.org
Apache License 2.0
4.07k stars 2.57k forks source link

[Proposal] The bft module's gateway should check block request and block response from peers to avoid spam #3324

Open elderhammer opened 1 week ago

elderhammer commented 1 week ago

💥 Proposal

Issue https://github.com/AleoNet/snarkOS/issues/3315 points out that malicious validator can DDoS other validator by sending block response spam. To solve this problem, in addition to putting the deserialization logic into a separate rayon thread https://github.com/AleoNet/snarkOS/pull/3316, we should also:

  1. Check the request frequency of block request
  2. Check whether the block response has a corresponding block request

In fact, node/router has already implemented the above two checks: https://github.com/AleoNet/snarkOS/blob/5d4de0286964a72ecd2b0c4ace30a938ef269086/node/router/src/inbound.rs#L87-L92 https://github.com/AleoNet/snarkOS/blob/5d4de0286964a72ecd2b0c4ace30a938ef269086/node/router/src/inbound.rs#L111-L114