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

David/adversary test2 #786

Merged
merged 9 commits into from
Jul 11, 2022
Merged

David/adversary test2 #786

merged 9 commits into from
Jul 11, 2022

Conversation

druiz0992
Copy link
Contributor

@druiz0992 druiz0992 commented Jun 30, 2022

Multiple minor changes to adversary and optimist to increase testing functionality

  • Configure adversary as challenger
  • Add new adversary test adversary-test-all that tests all possible challenges
  • Modified adversary-test so that one can pass the type of challenge we want to test. CHALLENGE_TYPE=IncorrectTreeRoot npm run adversary-test will test IncorrectTreeRoot. If CHALLENGE_TYPE is undefined, then challenges are configured in adversary code
  • Enable configuration of different challeges via env variable BAD_BLOCK_SEQUENCE and BAD_TX_SEQUENCE and also via POST end point /block/gen-block {blockType: [sequence of blocks]}

Changes are tested in regular adversary test.

@druiz0992 druiz0992 marked this pull request as draft June 30, 2022 18:24
@druiz0992 druiz0992 added DNM Do not merge and removed DNM Do not merge labels Jun 30, 2022
@druiz0992 druiz0992 marked this pull request as ready for review June 30, 2022 20:53
@druiz0992 druiz0992 requested a review from daveroga July 1, 2022 16:30
Copy link
Contributor

@daveroga daveroga left a comment

Choose a reason for hiding this comment

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

LGTM

@daveroga daveroga added the One more approval needed One reviewer has approved this PR but another is needed label Jul 4, 2022
@druiz0992 druiz0992 requested a review from ChaitanyaKonda July 5, 2022 14:31
@ChaitanyaKonda
Copy link
Contributor

All the new features added are very helpful features and look good to me.

One thing to discuss is making adversary a challenger.
This will be a problem if we want to test with more L2 blocks on top of a bad L2 block because optimist (with it goes adversary too) stops assembling blocks today if a bad block is on L2. Until this is challenged, new L2 blocks are not assembled. If adversary is both the bad proposer and challenger, then we can't use the adversary to test deeper rollbacks (more blocks produced on top a bad block) because adversary can't produce more good/bad blocks on top of a bad L2 block. For this reason, it would be useful to run a challenger with a different optimist than the adversary's optimist.
For this test, which tests challenging the bad block which is always the top most block an adversary being the challenger does the job but if we are setting up a different challenger for deeper adversary tests then, we could reuse the same challenger here too?

@druiz0992
Copy link
Contributor Author

@ChaitanyaKonda, thanks for the feedback. We have currently prioritized the fact of having few actors and thus having an adversary + challenger. There is an additional functionality implemented in eb229bf that allows us to maintain adversary producing blocks even in the event of a rollback to test deep rollbacks. Let me know if this satisfies your concerns.

expectedBalance += value2;
}
await new Promise(resolve => setTimeout(resolve, TX_WAIT)); // this may need to be longer on a real blockchain
console.log(`Completed ${i + 1} pings`);
}

// TODO:_ how can i check that queue 2 is empty
await waitForSufficientBalance(nf3User, expectedBalance);
Copy link
Contributor

Choose a reason for hiding this comment

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

This line seems to be a duplicate of line 217 ?

@ChaitanyaKonda ChaitanyaKonda merged commit 45a9a7f into master Jul 11, 2022
@ChaitanyaKonda ChaitanyaKonda deleted the david/adversary-test2 branch July 11, 2022 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
One more approval needed One reviewer has approved this PR but another is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants