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 ICS07 client upgrade to the MBT tests #1274

Merged
merged 29 commits into from
Aug 24, 2021
Merged

Conversation

jtremback
Copy link
Contributor

@jtremback jtremback commented Aug 10, 2021

Closes #1311

Description

This PR adds capability to model a client upgrade to the TLA+ testing spec. It also makes some modifications to the rust MBT tests to run this capability as an MBT test.

Changes in the spec:

  • Replace the single integer Height with a record containing RevisionHeight and RevisionNumber, as specified in ICS07.
  • Add ICS07_UpgradeClient operator which:
    • Checks if a client exists
    • Checks if the new height has a higher revision number than the old height
    • Updates the client to the new revision number

Changes in the Rust:

  • Replace the single integer Height with ibc::Height.
  • Add boilerplate to translate actions and outcomes from TLA+ traces to Rust
  • Key the IbcTestRunner.contexts hashmap with a chainID that does not include the revision number. This allows tests to keep working when the revision number changes.

Caveats: The state space has become much bigger from the addition of multiple possible revision numbers. Some of the MBT tests now take minutes to run. We may not want to merge this PR until this is fixed. An easy fix that occurs to me is making Modelator cache TLA+ traces and invalidate this cache when the TLA+ file changes. I will also probably spend some time trying to restrict the state space of this model.


For contributor use:

  • Added a changelog entry, using unclog.
  • 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.

- used cleaner LT, GT operators etc
- still having the typeOK problem
(at least as correct as anything can work in this spec)
- Narrowed it down to the fact that chain states are being stored in a map keyed off the revision, but upgrading the chain changes the revision. This will need to be modified and checked to see if it makes sense.
string+revision to stop errors where a chain context cannot be found
because the revision number has changed, making the old key invalid
@jtremback jtremback added O: tests Objective: Test more aspect of the relayer in progress labels Aug 10, 2021
@jtremback jtremback requested a review from cezarad August 10, 2021 23:33
@jtremback
Copy link
Contributor Author

More on the state space / test time thing.

"rust-stable" CI tests on this PR took 13m 43s
Last other PR I checked ran "rust-stable" in 10m 16s

On my local, cargo test on master takes 189.45s, while cargo test on this branch takes 733.33s.

@adizere told me we try not to merge stuff that makes the tests take longer than 10m. I assume he was talking about the tests on Github CI. This PR exceeds that by about 3 minutes, so I will need to try to fix that.

@adizere
Copy link
Member

adizere commented Aug 17, 2021

@adizere told me we try not to merge stuff that makes the tests take longer than 10m. I assume he was talking about the tests on Github CI. This PR exceeds that by about 3 minutes, so I will need to try to fix that.

Yes, the GitHub CI. More context on this: our current CI takes on average 11 minutes; the longest task is the E2E tests and the next most time intensive task is the Rust tests, which can take 10min. This is not very often a bottleneck, but we would prefer to not increase the delay further -- and if it were a low-hanging fruit we would reduce that time.

@jtremback
Copy link
Contributor Author

jtremback commented Aug 18, 2021

CI time for Rust / test-stable (pull_request) is down to 10m 47s- can this be merged? To get any lower, I think I would need to rewrite the TLA+ spec.

@jtremback jtremback changed the title Add ICS07 client upgrade to the MBT tests [draft] Add ICS07 client upgrade to the MBT tests Aug 18, 2021
@hu55a1n1
Copy link
Member

IMHO, we could have a dedicated workflow in the future (for long-running and cross-chain tests) that is only triggered on release -> https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onevent_nametypes
We could also improve it to use something like git bisect to find and report the first commit that caused the tests to fail.

Copy link
Member

@romac romac left a comment

Choose a reason for hiding this comment

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

Great stuff, @jtremback! Test suite running time looks good to me, although we don't have much margin yet wrt the E2E test suite running time, but we can address that in time.

@romac romac merged commit c518e15 into master Aug 24, 2021
@romac romac deleted the jehan/mbt-ics07-client-upgrade branch August 24, 2021 15:57
hu55a1n1 pushed a commit to hu55a1n1/hermes that referenced this pull request Sep 13, 2022
* got rust compiling with new modelator, problems with the spec

* everything works, but I had to delete an assert I don't understand

* WIP using height tuple with fields for block height and revision

* - corrected some small stuff around height comparisons
- used cleaner LT, GT operators etc
- still having the typeOK problem

* correct tendermint height comparisons again

* upgrade tla spec seems to work correctly
(at least as correct as anything can work in this spec)

* WIP starting on upgrade to rust code

* fix TypeOk in spec

* correct apalache type def

* restore original typo

* switch from tuple to record

* Finally fixed confusing "No test trace found" error

* Work towards synchronizing terminology between rust and tla
Fix compile errors

* WIP diagnosing upgrade test not passing
- Narrowed it down to the fact that chain states are being stored in a map keyed off the revision, but upgrading the chain changes the revision. This will need to be modified and checked to see if it makes sense.

* clean up rust todos and dbg's

* correct tla bug where chain height instead of revision is updated

* make chain revision in rust tests always 1

* key self.contexts hashmap off of chain id string instead of
string+revision to stop errors where a chain context cannot be found
because the revision number has changed, making the old key invalid

* getting non-running tests to run

* fix warnings

* cut down state space

* reduce state space further

* bring back a few states

* tweak the state filtering and add a changelog

* Link .changelog entry to issue

* Reorder imports and fix Clippy warning

Co-authored-by: Romain Ruetschi <romain@informal.systems>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O: tests Objective: Test more aspect of the relayer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ICS 07 (Client Upgrade) to the MBT tests
4 participants