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

les: add checkpoint challenge for light client #20807

Closed

Conversation

rjl493456442
Copy link
Member

Replace #20125

@rjl493456442
Copy link
Member Author

This PR is blocked by #20692

@rjl493456442
Copy link
Member Author

I should rebase it and @zsfelfoldi Please take a look.

@holiman
Copy link
Contributor

holiman commented Nov 10, 2020

Discussion: instead of matching wildcard responses, use the request-id / response id for matching.

return errResp(ErrUselessPeer, "msg %v: %v", msg, err)
}
// If we are still waiting the checkpoint response.
if len(resp.Headers) == 1 && p.syncDrop != nil {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify it by checking the reqid

@rjl493456442
Copy link
Member Author

rjl493456442 commented Nov 18, 2020

@zsfelfoldi Think about this PR for a while, now I am inclined to close this PR.

The main purpose of the checkpoint challenge is we want to ensure the remote peer is in the same chain as us before we run the sync protocol. It's super useful for ETH protocol because we sync from the local head anyway and it will take a very long time to finish the sync(usually).

However, for LES, the checkpoint challenge seems unnecessary. Light client syncs from the checkpoint anyway and the checkpoint is verified in two ways:

  • It's the hardcoded checkpoint, trust it anyway, no verification
  • It's the signed checkpoint by Geth devs, verify the signature

And after the verification, we will firstly sync the checkpoint and then the remaining headers.
So it means before the real sync, we already ensure the remote peer is on the same side as us.

It might be useful in the future if we implement the flexible light sync that can start in any specified CHT. In this case, users want the legacy headers but still want to sync the correct chain. So the checkpoint challenge can help.
But really not sure whether it's worthwhile to add this complexity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants