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

Use a stateless light client #783

Merged
merged 10 commits into from
Apr 1, 2021
Merged

Use a stateless light client #783

merged 10 commits into from
Apr 1, 2021

Conversation

romac
Copy link
Member

@romac romac commented Mar 29, 2021

See: #673

Description

This PR introduces a stateless light client implementation, where we do not use a persistent store to hold the latest trusted block but rather supply the trusted block height at each use site.

The light client security parameters are now derived from the client state supplied to the light client at each request.

Moreover, this PR makes use of the light client instance directly instead of spawning a supervisor runtime. The latter is indeed redundant since misbehavior monitoring and evidence submission are now the direct responsibility of the relayer (cf. #632).


For contributor use:

  • Updated the Unreleased section of CHANGELOG.md with the issue.
  • If applicable: Unit tests written, added test to CI.
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Updated relevant documentation (docs/) and code comments.
  • Re-reviewed Files changed in the Github PR explorer.

@codecov-io

This comment has been minimized.

@romac romac marked this pull request as ready for review March 30, 2021 11:17
@romac romac requested a review from ancazamfir as a code owner March 30, 2021 11:17
@romac romac changed the title Use stateless light client API Use a stateless light client Mar 30, 2021
@ancazamfir ancazamfir mentioned this pull request Mar 30, 2021
9 tasks
Copy link
Collaborator

@ancazamfir ancazamfir left a comment

Choose a reason for hiding this comment

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

Looks great! Also tested with the hub to make sure, all good!

operations,
state::State as LightClientState,
store::{memory::MemoryStore, LightStore},
types::Height as TMHeight,
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: why don't we get a clippy on TMHeight?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because it's a type alias (I think), will fix it in #793.

@romac romac merged commit cfbb766 into master Apr 1, 2021
@romac romac deleted the romac/lighter-client branch April 1, 2021 15:06
@romac romac mentioned this pull request Apr 6, 2021
15 tasks
hu55a1n1 pushed a commit to hu55a1n1/hermes that referenced this pull request Sep 13, 2022
* Use stateless light client API

* Use peer id and timeout for light client config

* Update changelog

* Add LightClient::fetch method

* Remove LightClient::verify_to_latest

* Simply mock light client types

* Allow specifying a client state to derive light client security params for each request

* Fix mock light client

* Fix import name
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.

3 participants