Skip to content

Commit

Permalink
fix: Don't drop message for small cache size
Browse files Browse the repository at this point in the history
fix #2756

Increased route back cache to avoid dropping messages which
are supposed to be routed back. The problem was that when some
nodes are syncing several chunk request are asked, and request
arrive faster than responses, effectively invalidating the cache
most of the  responses are dropped, since the route back hash was
dropped from the cache.

Note: This is a vector of attack if we rely on route-back-messages,
since malicious actor can feed the cache with new information,
effectively invalidating our current cache.

Test plan
=========
Reproduced this scenario locally, and tested with and without the cache.
  • Loading branch information
mfornet committed Jun 18, 2020
1 parent fa8e664 commit 17a5f90
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion chain/network/src/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use crate::{
};

const ANNOUNCE_ACCOUNT_CACHE_SIZE: usize = 10_000;
const ROUTE_BACK_CACHE_SIZE: usize = 10_000;
const ROUTE_BACK_CACHE_SIZE: usize = 1000_000;
const PING_PONG_CACHE_SIZE: usize = 1_000;
const ROUND_ROBIN_MAX_NONCE_DIFFERENCE_ALLOWED: usize = 10;
const ROUND_ROBIN_NONCE_CACHE_SIZE: usize = 10_000;
Expand Down

0 comments on commit 17a5f90

Please sign in to comment.