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

NET-111-fixing-flaky-tests #70

Merged
merged 2 commits into from
Apr 5, 2022
Merged

Conversation

JosiahBull
Copy link
Contributor

@JosiahBull JosiahBull commented Apr 5, 2022

Fixed flaky tests:

  • should distribute scan results amongst stakees proportionally - all equal
  • should distribute scan results amongst stakees proportionally - varied stake amounts

Previous random generation method had a failure rate of 6.44%. New method does not fail.

Test Logs: output.zip

@JosiahBull
Copy link
Contributor Author

Ah, I see the CI uses 10000 iterations, will increase the number of keys to 10k to allow this.

test/keys.json Outdated
{"publicKey":"PHAo3MImPpuEhb8XZahF22Qk_J16XlTIAouOiRaFD-U","privateKey":"UxuhttBGSOBKEJxDsFY_0ypD1n4S4-gGOm56LQ1UfH08cCjcwiY-m4SFvxdlqEXbZCT8nXpeVMgCi46JFoUP5Q"},
{"publicKey":"qOXEjFdugVUycDSAiPvZdwEd0T2xN2UW7c0xxUuvolc","privateKey":"6yNkzVxrq5zFDukUXGnqd5TF7y7P7RRh_KokP6tLE9So5cSMV26BVTJwNICI-9l3AR3RPbE3ZRbtzTHFS6-iVw"},
{"publicKey":"y8jnrlMMwqxkWraxr40-xVJfWyszdh4Cxwa4fI-YxaA","privateKey":"IzqVzUrDx_fzWb-B8uZr3N0YMnkB2aHGWtv0Jpqp4R7LyOeuUwzCrGRatrGvjT7FUl9bKzN2HgLHBrh8j5jFoA"}
]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of storing this json file, you can just quickly generate 1000 keys in memory using the same mnemonic each time.

Something like

const mnemonic = "search topple trouble similar sorry just around connect hello range predict ahead";
  const accs = [];
  for (let i = 0; i < 1000; i++) {
    accs.push(ethers.Wallet.fromMnemonic(mnemonic, `m/44'/60'/0'/${i}`));
  }

Copy link
Collaborator

Choose a reason for hiding this comment

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

Then it's easier to change the number of keys to use

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do

@JosiahBull JosiahBull self-assigned this Apr 5, 2022
Altered test key generation method from pure random to be from mnemonic.
@JosiahBull JosiahBull force-pushed the NET-111-goodness-of-fit-flaky-test branch from bb059f5 to ace214a Compare April 5, 2022 01:23
@JosiahBull JosiahBull changed the title test: created fixed list of known-good keys to read from for testing … NET-111-fixing-flaky-tests Apr 5, 2022
Copy link
Contributor

@teinnt teinnt left a comment

Choose a reason for hiding this comment

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

Perfect!

@teinnt teinnt merged commit 06a5a9a into master Apr 5, 2022
@teinnt teinnt deleted the NET-111-goodness-of-fit-flaky-test branch April 5, 2022 04:44
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.

None yet

3 participants