snarkOS icon indicating copy to clipboard operation
snarkOS copied to clipboard

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

Open elderhammer opened this issue 1 year ago • 2 comments

💥 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

elderhammer avatar Jun 23 '24 04:06 elderhammer

Thanks for bringing this up @elderhammer, I believe that this is something we should address, and should in theory be fairly straightforward to do so. The changes should resolve https://github.com/AleoNet/snarkOS/issues/3315.

@vicsn It may be easier for you to tackle the rayon thread for deserialization in the block deserialization since you already did it for the Router - https://github.com/AleoNet/snarkOS/pull/3304.

I can tackle the cache checks here, which hopefully should also be pretty simple.

raychu86 avatar Jul 17 '24 23:07 raychu86

@vicsn It may be easier for you to tackle the rayon thread for deserialization in the block deserialization since you already did it for the Router - #3304.

There is already a pull request to tackle this part of the issue: https://github.com/AleoNet/snarkOS/pull/3316

elderhammer avatar Jul 18 '24 01:07 elderhammer

@ljedrz @niklaslong May be better if you guys tackle the cache updates. We may also want to consider if we can unify the caches down the line.

raychu86 avatar Jul 24 '24 16:07 raychu86