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

Investigate flaky test cryptographic library #96

Closed
jpraynaud opened this issue Apr 1, 2022 · 2 comments · Fixed by #97
Closed

Investigate flaky test cryptographic library #96

jpraynaud opened this issue Apr 1, 2022 · 2 comments · Fixed by #97
Assignees
Labels
bug ⚠️ Something isn't working

Comments

@jpraynaud
Copy link
Member

It looks like a test from the cryptographic library mithril-core is flaky:

  • First run: the test failed on the stm::tests::test_invalid_proof_path test in cargo test(associated trace)
  • Second run: the test completed successfully
@jpraynaud jpraynaud added the bug ⚠️ Something isn't working label Apr 1, 2022
@iquerejeta
Copy link
Contributor

This error is caused by the automatic generation of signatures (arb_proof_setup), as it generates not enough signatures (4 out of the expected 5). The reason why this test completes successfully in the other rounds is because it is extremely unlikely to happen (we have at least 2 signers that are allowed to run 100 lotteries with a probability of wining of ~0.2 (note that all parties for the test are generated with stake = 1).

That particular test that fails has 5 signers! So 500 lotteries to play, and we don't even win 5, so we don't even win a 1%. Extremely unlikely. However, the goal of this function (arb_proof_setup) is to generate a valid signature to then modify it into an invalid signature. Therefore, we are only testing error messages, not associated with the lotteries.

My suggestion is to make the parameters such that lotteries are always won, so that we do not encounter such a scenario again. (I'll open a PR)

@iquerejeta
Copy link
Contributor

Was just checking, and the key generation is deterministic for tests

https://github.com/input-output-hk/mithril/blob/main/mithril-core/src/stm.rs#L910

which might make us doubt of why it only failed once. However, the 'lottery ticket' depends on the key, the message, the AVK, the party's stake and the total stake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ⚠️ Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants