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 12, 2020
1 parent eca04c2 commit 7e12dc9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 7e12dc9

Please sign in to comment.