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

Milestones: Add simulation based tests #150

Merged
merged 30 commits into from May 11, 2023

Conversation

manav2401
Copy link
Contributor

@manav2401 manav2401 commented Feb 7, 2023

Description

This PR adds automated simulation based tests for milestones. More info available here. There are 2 primary tests.

  1. The base case which tries to perform a network partition of type 3:1 (as per stake) and rely on proposed milestones to follow the correct fork.
  2. Another case which tries to perform an equal network partition of type 1:1 (as per stake) and waits for milestones to get proposed on rejoin.

Note that to reproduce the tests, you'd need a custom branch of milestone on bor (one which fixes the primary validator).

Changes

  • Bugfix (non-breaking change that solves an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)
  • New test case for remote devnet

Checklist

  • I have added at least 2 reviewer or the whole pos-v1 team
  • I have added sufficient documentation in code
  • I will be resolving comments - if any - by pushing each fix in a separate commit and linking the commit hash in the comment reply

Cross repository changes

It should never be the case...

  • This PR requires changes to bor
  • This PR requires changes to heimdall

Testing

  • I have tested this code manually on local environment
  • I have tested this code manually on remote devnet using express-cli
  • I have tested this code manually on mumbai

@manav2401 manav2401 marked this pull request as draft February 7, 2023 19:31
src/express/commands/milestone.js Outdated Show resolved Hide resolved
src/express/commands/milestone.js Outdated Show resolved Hide resolved
src/express/commands/milestone.js Outdated Show resolved Hide resolved
src/express/commands/milestone.js Outdated Show resolved Hide resolved
src/express/commands/milestone.js Outdated Show resolved Hide resolved
@manav2401 manav2401 changed the title add automated tests for milestone feature [WIPadd automated tests for milestone feature Feb 27, 2023
@manav2401 manav2401 changed the title [WIPadd automated tests for milestone feature [WIP] add automated tests for milestone feature Feb 27, 2023
@temaniarpit27 temaniarpit27 marked this pull request as ready for review March 23, 2023 05:55
@manav2401 manav2401 changed the title [WIP] add automated tests for milestone feature add automated tests for milestone feature Mar 23, 2023
@manav2401 manav2401 changed the title add automated tests for milestone feature Milestones: Add simulation based tests Mar 23, 2023
src/express/commands/milestone-base.js Outdated Show resolved Hide resolved
src/express/commands/milestone-base.js Outdated Show resolved Hide resolved
src/express/commands/milestone-base.js Show resolved Hide resolved
src/express/commands/milestone-base.js Show resolved Hide resolved
src/express/common/milestone-utils.js Outdated Show resolved Hide resolved
src/express/common/milestone-utils.js Outdated Show resolved Hide resolved
src/express/common/milestone-utils.js Outdated Show resolved Hide resolved
src/express/common/milestone-utils.js Show resolved Hide resolved
src/express/common/remote-worker.js Outdated Show resolved Hide resolved
src/express/common/milestone-utils.js Outdated Show resolved Hide resolved
@marcello33
Copy link
Contributor

Also, @manav2401 can you include the instructions on how to run such tests in the README? I'll make sure to have them also in the epic description on notion. Thanks.

@manav2401
Copy link
Contributor Author

Have addressed all the comments, refactored the changes by a great extent and updated all the steps in a readme. Looking for review @marcello33. Thanks!

@marcello33
Copy link
Contributor

marcello33 commented May 3, 2023

Thanks @manav2401, LGTM!
I just fixed the linter and pushed the implementation of the --reorg [index] command here
Can you please double check it does what it is supposed to do?
I tested it remotely, but have some doubts on the validateClusters part, around the log
console.log("Peer length mismatch, got: ${peers}, expected: ${expectedPeers}")
Will this work with any custom index the way I implemented it?
Thanks

@marcello33 marcello33 requested a review from a team May 3, 2023 14:19
@manav2401
Copy link
Contributor Author

Thanks for the feature changes @marcello33. Yes given the implementation, it should work for any index as the expected peers is calculated based on that only.

Also, few more things.

  1. Do you think we should quickly add a joinPeers command so that once the reorg is done, one can directly re-connect all the nodes?
  2. I am not fully sure of the wordings used for this command in README. The parameter index does not technically represent the index of the node in list of nodes. It basically represents the number of nodes that one of the clusters will have (with other being total number of nodes - index). Do you think we should change it?

@marcello33
Copy link
Contributor

added the requested changes here @manav2401
Please review.
Thanks!

@manav2401
Copy link
Contributor Author

Thanks @marcello33
LGTM!

@manav2401 manav2401 merged commit 6f49d1d into master May 11, 2023
11 checks passed
@manav2401 manav2401 deleted the manav/POS-1190-milestone-testing branch May 11, 2023 05:19
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

6 participants