Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KIP 8: On the fly headers-proof replacement mechanism #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions kip-0008.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
```
KIP: 8
Title: On the fly headers-proof replacement mechanism
Layer: P2P
Type: Standards Track
Author: Ori Newman <orinewman1@gmail.com>
Status: Draft
```

# Motivation
When a new node joins the network it can start syncing from an out-of-date node, and only after the long sync it'll realize the network has a better tip.
So there's a need to propose better tips in the middle of staging IBD.

# Proposal
While there's an active staging consensus and we get a relay block B from peer P we'll do one of the following steps:

* If B.pruning_point is in the antipast of staging.pruning_point (can be checked with staging.past_pruning_points), request pruning point proof from P and if `staging.validate_pruning_point_proof(P.pruning_point_proof)` is true, delete the current `staging` and start an IBD from P.

**Rationale**: `P.validate_pruning_point_proof` is undeniably better than current proof, so we switch to it.

* If staging consensus is still active, but there's no IBD related to it (for example, syncer has disconnected in the middle), any relay block that will claim to have a better proof will win. If `B.pruning_point` is the same as `staging.pruning_point` we just resume the IBD from where we stopped.

**Rationale**: The syncer that triggered the creation of current staging consensus was unable to prove that the suggested pruning point has `pruning_depth` confirmations. In most cases the disconnect was not done maliciously, so we expect other peers to have the same state and continue to send us headers accordingly. But if some peer claims to have a better state we have to believe it until proven otherwise by a third peer.

# Backward compatibility
This KIP introduces a better decision mechanism to find the best pruning point proof faster. This decision mechanism is relevant only to the upgraded node itself, and should not interrupt any communication with the rest of the network, including non upgraded nodes.