Skip to content

les: add checkpoint challenge for light client#20807

Closed
rjl493456442 wants to merge 1 commit intoethereum:masterfrom
rjl493456442:checkpoint-challenge-4
Closed

les: add checkpoint challenge for light client#20807
rjl493456442 wants to merge 1 commit intoethereum:masterfrom
rjl493456442:checkpoint-challenge-4

Conversation

@rjl493456442
Copy link
Copy Markdown
Member

Replace #20125

@rjl493456442
Copy link
Copy Markdown
Member Author

This PR is blocked by #20692

@rjl493456442
Copy link
Copy Markdown
Member Author

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

@holiman
Copy link
Copy Markdown
Contributor

holiman commented Nov 10, 2020

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

Comment thread les/client_handler.go
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
Copy Markdown
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
Copy Markdown
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