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

Add commands to initialize light client for given chain and start verifying headers #26

Merged
merged 43 commits into from
Mar 20, 2020

Conversation

romac
Copy link
Member

@romac romac commented Mar 10, 2020

Closes: #17

Description

This PR implements the following:

  • Persistent trusted store backed by the sled database library.
  • Relayer light client implementation, backed by a trusted store, which can be initialized from the store and some trust options, as well as pull the latest headers and verify them using the infrastructure provided in the tendermint-rs crate.
  • New light init command which allows to set the trust options for a given chain.
  • New start command which starts a light client per configured chain, which continuously pulls and verify headers. Also starts a dummy thread for the relayer itself.

For contributor use:

  • Wrote tests
  • Updated CHANGELOG_PENDING.md
  • 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

@romac romac added I: CLI Internal: related to the relayer's CLI I: logic Internal: related to the relaying logic work in progress labels Mar 10, 2020
@romac romac requested a review from ancazamfir as a code owner March 10, 2020 20:05
@romac romac force-pushed the romac/light-client-verif branch 2 times, most recently from 6203a0e to a8c4389 Compare March 11, 2020 09:34
@ancazamfir ancazamfir changed the title Add command to initialize light client for given chain and start verifying headers [WIP]Add command to initialize light client for given chain and start verifying headers Mar 11, 2020
@romac romac changed the title [WIP]Add command to initialize light client for given chain and start verifying headers [WIP] Add command to initialize light client for given chain and start verifying headers Mar 11, 2020
@romac romac force-pushed the romac/light-client-verif branch from a8c4389 to 348168e Compare March 12, 2020 13:16
@informalsystems informalsystems deleted a comment from codecov-io Mar 12, 2020
@romac romac force-pushed the romac/light-client-verif branch from 9c3e326 to cf78a1f Compare March 16, 2020 14:18
@codecov-io
Copy link

codecov-io commented Mar 16, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@c67f1fc). Click here to learn what that means.
The diff coverage is 0.9%.

Impacted file tree graph

@@           Coverage Diff           @@
##             master    #26   +/-   ##
=======================================
  Coverage          ?   8.6%           
=======================================
  Files             ?     34           
  Lines             ?    876           
  Branches          ?    114           
=======================================
  Hits              ?     76           
  Misses            ?    773           
  Partials          ?     27
Impacted Files Coverage Δ
relayer/relay/src/query.rs 0% <ø> (ø)
modules/src/ics02_client/client_type.rs 57.1% <ø> (ø)
relayer/cli/src/commands/start.rs 0% <0%> (ø)
relayer/relay/src/store.rs 0% <0%> (ø)
relayer/relay/src/chain/tendermint.rs 0% <0%> (ø)
relayer/cli/src/application.rs 37.2% <0%> (ø)
relayer/cli/src/commands/light.rs 0% <0%> (ø)
relayer/cli/src/commands.rs 20% <0%> (ø)
relayer/relay/src/error.rs 0% <0%> (ø)
relayer/relay/src/chain.rs 0% <0%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c67f1fc...73ce4bf. Read the comment docs.

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 good, let's merge this. As we discussed, the change to call the bisection/ sequential based on config will be added later.

@romac romac changed the title [WIP] Add command to initialize light client for given chain and start verifying headers Add command to initialize light client for given chain and start verifying headers Mar 20, 2020
@romac romac changed the title Add command to initialize light client for given chain and start verifying headers Add commands to initialize light client for given chain and start verifying headers Mar 20, 2020
@romac romac merged commit 96ee56d into master Mar 20, 2020
@romac romac deleted the romac/light-client-verif branch March 20, 2020 10:50
hu55a1n1 pushed a commit to hu55a1n1/hermes that referenced this pull request Sep 13, 2022
…ifying headers (informalsystems#26)

* Add function to initialize lite client without trusted state

* Make LightClient generic over chain type via a generic store

* Add stub to initialize the light client with trust options

* Use custom sum type for store heights

* Rename LiteClient to LightClient

* Add stub command `light init`

* Implement LightClient::init_with_node_trusted_state

* Implement LightClient::init_with_trusted_state

* Refactor light client

* Verify trusted state on light client initialization

* Remove unused file

* Add stub for Client::check_trusted_header

* Fail when needed in Client::update_trusted_state

* Partially implement Client::update

* Implement LightClient::verify_header

* Update comment

* Fix clippy warnings

* Use serde-humantime to parse trusting_period

* Move config defaults into their own module

* Create light client and display last trusted state

* Use checked arithmetic when incrementing height

* Update trusted store in Client::update

* Fix clippy warnings

* Rename StoreHeight:GivenHeight to Given

* Simplify verify_header signature

* Spawn empty relayer, and one client per configured chain

* Update tendermint-rs repository

* Remove dep on tendermint-rs/light_node by copying RpcRequester code over

* Improve reporting a bit

* Fix RpcRequester unit test

* Add persistent trusted store implementation

* Use persistent trusted store in commands

* Ignore database folders in Git

* Fix clippy warnings

* Remove superfluous Tendermint type struct

* Add some doc comments

* Document the relayer::client::Client struct

* More doc comments

* Ignore .db and .sh files in cli folder

* Fix misleading doc comment

* Update README and LICENSE file

* Remove verbose flag in README

* Add status info to `light init` command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: CLI Internal: related to the relayer's CLI I: logic Internal: related to the relaying logic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IBC Relayer with light client verification
3 participants