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

Light Client Testing #113

Closed
ebuchman opened this issue Dec 29, 2019 · 3 comments
Closed

Light Client Testing #113

ebuchman opened this issue Dec 29, 2019 · 3 comments
Labels
light-client Issues/features which involve the light client
Milestone

Comments

@ebuchman
Copy link
Member

The light client is coming together well, and has some integration tests starting from JSON data generated from Tendermint in Go to test the verify and check_support functions (see tests/lite.rs).

Now that the abstractions are cleaner, we should be adding unit tests to the lite module that use simple mocks for all the traits. These mocks should look basically like what we find in the TLA+ spec, ie. where validator ids are simply integers and a commits just contain the ids of the validators that signed.

As per #110 and #111, we should simplify the public API and have a single primary public function for trying to update the trusted state without making any intermediate requests. The bisection function should use this function. Then we shouldn't need to test verify and check_support independently, as they'd be covered by this new function. Then we'd have two kinds of tests:

  1. tests of the new function which cover a "single step". this would be effectively what IBC would use. We'd test for errors like expiration, invalid data, not enough voting power, etc, and we'd test various non-error cases
  2. tests for bisection (ie. the current verify_header function). We'd build some mock of a blockchain and instantiate a Requester with it so we can test bisection against different possible existing chains. We'd want to ensure the set of requested headers is correct, as well as all verification results.

In both cases, the tests should map clearly to possible traces from TLC, so that we can generate new tests by running TLC.

We also need a third class of tests:

  1. tests for the specific implementations of the traits, primarily of voting_power_in. This would check various actual instantiations of the Tendermint Commit structure and a Validator Set. Would need to ensure nil-votes don't count towards the voting power, and that we error on invalid signatures and on signatures for the wrong block id.
@liamsi
Copy link
Member

liamsi commented Jan 25, 2020

The context for:

these mocks should look basically like what we find in the TLA+ spec, ie. where validator ids are simply integers and a commits just contain the ids of the validators that signed.

and

In both cases, the tests should map clearly to possible traces from TLC, so that we can generate new tests by running TLC.

seems to be this: https://github.com/interchainio/verification/tree/develop

@romac romac added the light-client Issues/features which involve the light client label May 25, 2020
@ebuchman ebuchman added this to the Light Node milestone Jun 2, 2020
@ebuchman
Copy link
Member Author

ebuchman commented Jun 2, 2020

Some of the description here is obsolete by now, but the general fact that we need the testing is not. Also this is prophetic:

tests for the specific implementations of the traits, primarily of voting_power_in. This would check various actual instantiations of the Tendermint Commit structure and a Validator Set. Would need to ensure nil-votes don't count towards the voting power, and that we error on invalid signatures and on signatures for the wrong block id.

Given #282 is exactly this bug, which of course we're not testing ...

@brapse
Copy link
Contributor

brapse commented Jun 15, 2020

The requirements raised here are better addressed by #320.

@brapse brapse closed this as completed Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
light-client Issues/features which involve the light client
Projects
None yet
Development

No branches or pull requests

4 participants