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

MBT: Use modelator crate #724

Merged
merged 25 commits into from
Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6146e6e
MBT: check that clients and connections match those in the model
vitorenesduarte Mar 3, 2021
90288fd
Fix clippy
vitorenesduarte Mar 3, 2021
c5f3f01
Merge branch 'master' into vitor/modelator
vitorenesduarte Mar 8, 2021
13ab560
Use modelador crate
vitorenesduarte Mar 8, 2021
6a91fff
Merge branch 'master' into vitor/mbt_match
vitorenesduarte Mar 8, 2021
7561cf8
Merge branch 'vitor/mbt_match' into vitor/modelator
vitorenesduarte Mar 8, 2021
0f06d1f
MBT: check that the client state matches the one in the model
vitorenesduarte Mar 10, 2021
e1eff60
Merge branch 'vitor/mbt_match' into vitor/modelator
vitorenesduarte Mar 10, 2021
52e9706
bump modelator
vitorenesduarte Mar 10, 2021
984fdab
bump modelator
vitorenesduarte Mar 10, 2021
a7b3c5d
bump modelator
vitorenesduarte Mar 11, 2021
78e379d
merge master
vitorenesduarte Mar 11, 2021
751be12
bump modelator
vitorenesduarte Mar 11, 2021
fa75cde
remove gen_tests.py
vitorenesduarte Mar 12, 2021
62985c9
bump modelator
vitorenesduarte Mar 12, 2021
0338b9e
bump modelator
vitorenesduarte Mar 12, 2021
f30b0fc
bump modelator
vitorenesduarte Mar 17, 2021
e698134
bump modelator
vitorenesduarte Mar 17, 2021
577f42a
bump modelator
vitorenesduarte Mar 17, 2021
d11f9e7
Update README
vitorenesduarte Mar 22, 2021
75ba43a
Bump modelator
vitorenesduarte Mar 22, 2021
19cccea
merge master
vitorenesduarte Mar 22, 2021
efe88b2
Allow the TLA model to be parsed by Apalache
vitorenesduarte Mar 23, 2021
5a02c33
update CHANGELOG
vitorenesduarte Mar 23, 2021
2cd920d
merge master
vitorenesduarte Mar 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- [ibc]
- Follow Rust guidelines naming conventions ([#689])
- Per client structure modules ([#740])
- MBT: use modelator crate ([#761])

- [ibc-relayer]
- [nothing yet]
Expand Down Expand Up @@ -74,6 +75,7 @@
[#736]: https://github.com/informalsystems/ibc-rs/issues/736
[#740]: https://github.com/informalsystems/ibc-rs/issues/740
[#752]: https://github.com/informalsystems/ibc-rs/issues/752
[#761]: https://github.com/informalsystems/ibc-rs/issues/761

## v0.1.1
*February 17, 2021*
Expand Down
184 changes: 179 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion modules/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ version = "=0.18.1"
optional = true

[dev-dependencies]
tokio = { version = "1.0", features = ["macros"] }
modelator = { git = "https://github.com/informalsystems/modelator", rev = "99f656fa8b3cf46a2aa0b6513e4e140d1778c4bd" }
tendermint-rpc = { version = "=0.18.1", features = ["http-client", "websocket-client"] }
tendermint-testgen = { version = "=0.18.1" } # Needed for generating (synthetic) light blocks.
sha2 = { version = "0.9.3" }
Expand Down
18 changes: 9 additions & 9 deletions modules/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Then, we can ask [`TLC`](https://github.com/tlaplus/tlaplus), a model checker fo

```bash
wget https://github.com/tlaplus/tlaplus/releases/download/v1.8.0/tla2tools.jar
java -cp tla2tools.jar tlc2.TLC IBC.tla -tool -modelcheck -config IBC.cfg -workers auto
java -cp tla2tools.jar tlc2.TLC IBC.tla -modelcheck -config IBC.cfg -workers auto
```

### The tests
Expand All @@ -43,14 +43,6 @@ ICS02UpdateOKTestNeg == ~ICS02UpdateOKTest

Then, we ask `TLC`, to prove it. Because the invariant is wrong, `TLC` will find a counterexample showing that it is indeed possible that a client is sucessfully updated to a new height. This counterexample is our test.

The [`gen_tests.py`](support/model_based/gen_tests.py) script can be used to generate the tests. This script assumes the existence of [`tlc-json`](https://github.com/vitorenesduarte/tlc-json), which can be installed with the following commands:

```bash
git clone https://github.com/vitorenesduarte/tlc-json
cd tlc-json/
cargo install --path .
```

### Running the model-based tests

The model-based tests can be run with the following command:
Expand All @@ -59,3 +51,11 @@ The model-based tests can be run with the following command:
cd modules/
cargo test --features mocks -- mbt
```

The above uses [`modelator`](https://github.com/informalsystems/modelator), a model-based testing tool.
One of the steps automated by `modelator` is the negation of TLA+ tests assertions mentioned earlier.

To debug possible issues with `modelator`, run instead:
```bash
RUST_LOG=modelator=trace cargo test --features mocks -- mbt
```
Loading