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: check that clients and connections match those in the model #721

Merged
merged 4 commits into from
Mar 11, 2021

Conversation

vitorenesduarte
Copy link
Contributor

Closes: #629

Description


For contributor use:

  • Updated the Unreleased section of CHANGELOG.md with the issue.
  • 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.

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! One minor comment.

Comment on lines 212 to 219
// check that clients match
let clients_match = chain.clients.into_iter().all(|(client_id, client)| {
client.heights.into_iter().all(|height| {
// check that each consensus state from the model exists
ctx.consensus_state(&Self::client_id(client_id), Self::height(height))
.is_some()
})
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we also check that the client states and consensus states are the same in model and chain?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We were already checking that each consensus state that exists in the model (a consensus state is simply a height in the model) also exists in the implementation. I've extended this to also check that the client state height in the implementation is the highest height in the model: 0f06d1f

Do you think that this is enough @ancazamfir?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We were already checking that each consensus state that exists in the model (a consensus state is simply a height in the model)

Ok, I thought it's the same as in the mock context which was recently extended to include a timestamp. I think it's fine for now. Thanks!

@codecov-io
Copy link

codecov-io commented Mar 10, 2021

Codecov Report

Merging #721 (0f06d1f) into master (b1b37f5) will increase coverage by 30.4%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #721      +/-   ##
=========================================
+ Coverage    13.6%   44.1%   +30.4%     
=========================================
  Files          69     156      +87     
  Lines        3752   10393    +6641     
  Branches     1374       0    -1374     
=========================================
+ Hits          513    4584    +4071     
- Misses       2618    5809    +3191     
+ Partials      621       0     -621     
Impacted Files Coverage Δ
modules/src/address.rs 100.0% <ø> (ø)
...application/ics20_fungible_token_transfer/error.rs 0.0% <ø> (ø)
...ion/ics20_fungible_token_transfer/msgs/transfer.rs 0.0% <ø> (ø)
..._transfer/relay_application_logic/send_transfer.rs 0.0% <ø> (ø)
modules/src/events.rs 0.0% <ø> (ø)
modules/src/handler.rs 100.0% <ø> (ø)
modules/src/ics02_client/client_def.rs 47.3% <ø> (ø)
modules/src/ics02_client/client_type.rs 79.1% <ø> (+31.5%) ⬆️
modules/src/ics02_client/context.rs 100.0% <ø> (ø)
modules/src/ics02_client/error.rs 100.0% <ø> (ø)
... and 261 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 bfd3d8e...0f06d1f. Read the comment docs.

@vitorenesduarte vitorenesduarte merged commit 280e03a into master Mar 11, 2021
@vitorenesduarte vitorenesduarte deleted the vitor/mbt_match branch March 11, 2021 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MBT: check that the chain state (height, clients, connections, ...) matches the one in the model
3 participants