-
Notifications
You must be signed in to change notification settings - Fork 224
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
Light Client: Fork Detection v1 #285
Conversation
TODO: - verification - better errors
Right. In the latest it iteration The we haven't solidified the API on the |
I have a very much WIP implementation of fork detection roughly based on the draft spec here: tendermint-rs/light-client/src/fork_detector.rs Lines 33 to 75 in c1b6755
I currently just expose the I also added the ability to specify a Let's try to sync up tomorrow to discuss the current state of things, as well as the discrepancies between this PR's implementation and the specification? PS: Great job by the way :) |
In the prior version managing the store was a more external responsibility, so all the internal bisection/verification functions didn't depend on it - ie. the |
I guess both solutions would work, but I would perhaps favor the one where we pass the store explicitly as it's a bit simpler and more versatile. That's basically what we are doing now in the supervisor branch, but for now we are still keeping the internal store around, hence the need for the Nonetheless, I think it's still worth giving your second solution more thought. For example, we could keep a log of the operations performed on it so that we can reapply them in order on the disk-based store. But this wouldn't solve the issue of supplying the light client with a pre-populated store, like the fork detector requires. |
Why does the fork detector require a prepopulated store? |
For fork detection, each witness needs a custom light store which only contains the trusted state (marked as verified) and the light block to verify (marked as unverified), you can see the relevant code here. As you can see in the code, since my comment above I changed the light client to not maintain its own state at all, but to rather have it passed as an argument to |
I think we can close this PR since it's been integrated within the supervisor PR. The one difference between both the two implementation is that this PR's version compares header hashes, while the supervisor one compares header for equality, as per the fork detection spec. We should discuss which is best somewhere. |
thanks @romac! |
TODO: