les: add checkpoint challenge for light client#20807
les: add checkpoint challenge for light client#20807rjl493456442 wants to merge 1 commit intoethereum:masterfrom
Conversation
|
This PR is blocked by #20692 |
|
I should rebase it and @zsfelfoldi Please take a look. |
|
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 { |
There was a problem hiding this comment.
Simplify it by checking the reqid
|
@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:
And after the verification, we will firstly sync the checkpoint and then the remaining headers. 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. |
Replace #20125