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

Enable MBT on master #686

Merged
merged 6 commits into from
Nov 19, 2020
Merged

Enable MBT on master #686

merged 6 commits into from
Nov 19, 2020

Conversation

Shivani912
Copy link
Contributor

@Shivani912 Shivani912 commented Nov 19, 2020

This PR enables model based testing on master. Some tests had to be disabled as they fail to parse because of more restrictive data structure construction and this will be addressed in a follow up PR. All of the other tests were fixed simply by adding the new total_voting_power field to validator set in testing :)

And with this, I think we're in good shape to close issue #567
(closes #567 )

  • Referenced an issue explaining the need for the change
  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGELOG.md

@codecov-io
Copy link

Codecov Report

Merging #686 (cc21652) into master (fa415e3) will increase coverage by 2.8%.
The diff coverage is 90.9%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master    #686     +/-   ##
========================================
+ Coverage    39.2%   42.1%   +2.8%     
========================================
  Files         190     191      +1     
  Lines       12552   12600     +48     
  Branches     3237    3232      -5     
========================================
+ Hits         4927    5305    +378     
+ Misses       7381    6949    -432     
- Partials      244     346    +102     
Impacted Files Coverage Δ
testgen/src/tester.rs 65.7% <ø> (+16.8%) ⬆️
light-client/tests/model_based.rs 21.4% <90.9%> (+21.1%) ⬆️
rpc/src/id.rs 90.6% <0.0%> (ø)
rpc/src/error.rs 50.0% <0.0%> (ø)
rpc/src/event.rs 10.9% <0.0%> (ø)
rpc/src/client.rs 8.5% <0.0%> (ø)
testgen/src/time.rs 44.4% <0.0%> (ø)
testgen/src/vote.rs 78.3% <0.0%> (ø)
light-node/src/rpc.rs 53.5% <0.0%> (ø)
rpc-probe/src/main.rs 4.5% <0.0%> (ø)
... and 73 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 fa415e3...cc21652. Read the comment docs.

@@ -446,18 +447,33 @@ fn single_step_test(
let trusting_period: Duration = tc.initial.trusting_period.into();
for (i, input) in tc.input.iter().enumerate() {
output_env.logln(&format!(" > step {}, expecting {:?}", i, input.verdict));

// ------------------->
// Below is a temporary work around to get rid of bug-gy validator sorting
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there an issue for this sorting bug? Could you point us to any specific line where the bug occurs or you don't know?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, but yes there should be one. I think the problem is somewhere with ser/de, it somehow changes the sequence of validators in the set which then produces a wrong valset hash. I'm not sure how this is happening. But I'm sure this is not coming from Testgen at least. Currently, these tests were disabled on master because of this and re-sorting seemed to be a quick solution. I need to dig further to know where this problem is coming from.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Issue for this: #687

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I think I know what is happening here. When we transform tests from Apalache counterexamples, the validators are in no particular order. At the same time new deserialization requires them to be sorted according to the power, and then lexicographically. Therefore the validation fails. One more point for implementing #665.

Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

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

👍

@Shivani912
Copy link
Contributor Author

Thanks for reviewing @melekes :) I'll wait for one more approval from @romac or @andrey-kuprianov before merging!

Copy link
Contributor

@andrey-kuprianov andrey-kuprianov 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 to me! Thanks, @Shivani912 for fixing the tests!

We need to rethink the model-based testing for Tendermint-rs in general, besides fixing the current issues, and automate it further, to reduce such manual work as much as possible. Let's address this in the near future.

@andrey-kuprianov andrey-kuprianov merged commit aa36b33 into master Nov 19, 2020
@andrey-kuprianov andrey-kuprianov deleted the shivani/enable-mbt branch November 19, 2020 12:49
@Shivani912
Copy link
Contributor Author

Looks good to me! Thanks, @Shivani912 for fixing the tests!

We need to rethink the model-based testing for Tendermint-rs in general, besides fixing the current issues, and automate it further, to reduce such manual work as much as possible. Let's address this in the near future.

Awesome, that's exactly where my thoughts were going!

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.

Fix tests for v0.34 upgrade
4 participants