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

Develop a set of model-based tests for the LightClient #414

Closed
andrey-kuprianov opened this issue Jul 7, 2020 · 1 comment · Fixed by #525, #546, #547, #548 or #549
Closed

Develop a set of model-based tests for the LightClient #414

andrey-kuprianov opened this issue Jul 7, 2020 · 1 comment · Fixed by #525, #546, #547, #548 or #549
Assignees
Labels
help wanted Extra attention is needed light-client Issues/features which involve the light client question Further information is requested
Milestone

Comments

@andrey-kuprianov
Copy link
Contributor

Hi everyone!

Model-based testing is coming into shape: Apalache counterexamples can now be automatically translated into LightClient integrations tests: e.g., this spec transforms this counterexample into this test, which then can be used for testing the LightClient implementation using this driver.

The current MBT handles only single-step test cases, but now, when most of the infrastructure is in place, it should be relatively easy to extend it to bisection cases, for example. Besides, the above counterexample was produced from one of the earlier specs, but it should be also relatively easy to adapt the process to the most recent spec.

Now comes the creative part: we need to come up with testing scenarios, that can be encoded as spec invariants, model-checked with Apalache to get counterexamples, which then will be translated into tests. For a motivation about possible invariants, you can look here.

Formulating the invariants can be not an easy task, but if you come up with an interesting scenario to test, more precisely those that potentially can reveal some bugs in the code, please post your ideas here. We will take care of turning plain text ideas into invariants, counterexamples, and, eventually, tests.

Looking forward to your input!

@andrey-kuprianov andrey-kuprianov added help wanted Extra attention is needed question Further information is requested labels Jul 7, 2020
@andrey-kuprianov
Copy link
Contributor Author

Here is the current set of LightClient tests

@andrey-kuprianov andrey-kuprianov added the light-client Issues/features which involve the light client label Jul 8, 2020
@andrey-kuprianov andrey-kuprianov self-assigned this Jul 9, 2020
@andrey-kuprianov andrey-kuprianov changed the title Ideas for model-based testing of the LightClient Develop a set of model-based tests for the LightClient Jul 9, 2020
andrey-kuprianov added a commit that referenced this issue Jul 31, 2020
andrey-kuprianov added a commit that referenced this issue Aug 4, 2020
* defined structure for model-based single-step light client tests
* added a simple driver for such tests modeled after original one in
tests/lite.rs
* add the first auto-generated model-based test
* add symlinks to the TLA+ model

The important change in the test structure is that now each input block
carries with it the expected verdict, not a single expected result for the whole
input array: the latter is unclear how to interpret in case of failures.

Besides, having such more fine-grained verdicts allows to differentialte
between different types of errors returned by the light client.
andrey-kuprianov added a commit that referenced this issue Aug 6, 2020
andrey-kuprianov added a commit that referenced this issue Aug 6, 2020
andrey-kuprianov added a commit that referenced this issue Aug 6, 2020
andrey-kuprianov added a commit that referenced this issue Aug 10, 2020
…implementation

In the current model (Blockchain_A_1.tla) the check InTrustingPeriod
treats the edge case now = header.time + TRUSTING_PERIOD as valid,
while the implementation treats it as invalid.
`
Changed the model to follow the implementation.
andrey-kuprianov added a commit that referenced this issue Aug 10, 2020
andrey-kuprianov added a commit that referenced this issue Sep 24, 2020
See #414 
* changes to TLA+ specs for model-based testing
* Lightclient_A_1.tla: add check for header from the future
* fix testgen tester: wrong dir was removed
* move history out of LightClient.tla into LightTests.tla
* adapt apalache test runner to changes in specs
* account for Igor's naming suggestions
* copy and rename into  Blockchain/Lightclient_002_draft.tla
* restore original  Blockchain/Lightclient_A_1.tla
andrey-kuprianov added a commit that referenced this issue Sep 25, 2020
andrey-kuprianov added a commit that referenced this issue Sep 25, 2020
andrey-kuprianov added a commit that referenced this issue Sep 25, 2020
andrey-kuprianov added a commit that referenced this issue Sep 25, 2020
andrey-kuprianov added a commit that referenced this issue Sep 25, 2020
andrey-kuprianov added a commit that referenced this issue Sep 25, 2020
andrey-kuprianov added a commit that referenced this issue Sep 26, 2020
See #414
* LightTests: more TLA+ tests
* LightTests: store prev(*)' in history to avoid loosing the last history state
* LightTests: store next history state under correct index
* add auto-generated static model-based tests
* cleanup previous model based test run
* update Abstract.md
* update README.md
* update CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment