Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Inbound peer eviction method - Closes #3721 #3824

Merged
merged 16 commits into from
Jun 26, 2019

Conversation

mitsuaki-u
Copy link
Contributor

@mitsuaki-u mitsuaki-u commented Jun 14, 2019

What was the problem?

In the current implementation, when the maximum number of inbound peers are connected and a new peer attempts to connect to the node, we randomly select and remove an ongoing inbound peer connection.

How did I fix it?

In the new protocol, we use the strategy of protecting a number of peers for several distinct characteristics for increased security.

Netgroups: We calculate a randomized value keyedNetgroup based on IP group for each eviction candidate. We protect 4 peers with the smallest keyedNetgroup values. An attacker cannot predict which netgroups will be protected.

  • To be started in bucket system milestone
  • Peer latency: We protect a number of peers with optimal latency. An attacker cannot manipulate this metric without physically moving nodes closer to the target.

  • Useful work: We protect peers who perform useful work, such as peers who have recently sent blocks and transactions. An attacker cannot manipulate this metric without performing useful work.

  • Connection time: We protect half of the remaining nodes who have been connected the longest. This precludes attacks that start later.

Review checklist

elements/lisk-p2p/src/peer/base.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/src/peer_pool.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/src/p2p.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/src/peer/inbound.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/src/peer/inbound.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/src/peer/outbound.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/src/peer_pool.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/src/peer/base.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/src/peer/inbound.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/src/peer/inbound.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/src/p2p.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/src/peer/base.ts Show resolved Hide resolved
elements/lisk-p2p/src/peer/base.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/src/peer/inbound.ts Show resolved Hide resolved
elements/lisk-p2p/src/peer_pool.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/test/integration/p2p.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/test/integration/p2p.ts Outdated Show resolved Hide resolved
shuse2
shuse2 previously requested changes Jun 25, 2019
elements/lisk-p2p/src/peer_pool.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/src/peer_pool.ts Show resolved Hide resolved
elements/lisk-p2p/src/peer_pool.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/src/p2p_request.ts Show resolved Hide resolved
elements/lisk-p2p/src/peer/outbound.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/src/p2p.ts Show resolved Hide resolved
elements/lisk-p2p/src/p2p.ts Show resolved Hide resolved
elements/lisk-p2p/test/integration/p2p.ts Show resolved Hide resolved
elements/lisk-p2p/src/p2p.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/src/peer/inbound.ts Outdated Show resolved Hide resolved
elements/lisk-p2p/src/peer/inbound.ts Outdated Show resolved Hide resolved
@jondubois jondubois merged commit f885b17 into feature/implement-lip-p2p Jun 26, 2019
@shuse2 shuse2 deleted the 3721_peer_eviction branch July 29, 2019 10:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants