forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 0
Test a challenge game in the docker devnet #228
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
dfd3f4d
Add test for devnet challenge game
jbearer 7d23eb8
Fixes
jbearer b107158
Ensures that the deployment files are deleted before building a new d…
philippecamacho b86a0fa
Run devnet tests on CI again.
philippecamacho 4938d41
Ensure deployment files are not written by the root user.
philippecamacho 5abbdf5
Ignore rotate batcher key and change batch inbox owmer tests.
philippecamacho 4ca1182
Clean way of setting UID and GID.
philippecamacho 81be5b7
Ignore devnet tests for now so that we can merge.
philippecamacho e74623b
Add fallback values for UID and GID.
philippecamacho 9e7fec3
Pinpoint forge version in CI as the linter is complaining.
philippecamacho 79c1227
Add comment regarding the number of claims.
philippecamacho 9373be8
Add comment to function TaggedWriter.Write.
philippecamacho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| package devnet_tests | ||
|
|
||
| import ( | ||
| "context" | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestChallengeGame(t *testing.T) { | ||
| ctx, cancel := context.WithCancel(context.Background()) | ||
| defer cancel() | ||
|
|
||
| d := NewDevnet(ctx, t) | ||
| require.NoError(t, d.Up()) | ||
| defer func() { | ||
| require.NoError(t, d.Down()) | ||
| }() | ||
|
|
||
| // Wait for the proposer to make a claim. | ||
| var games []ChallengeGame | ||
| for len(games) == 0 { | ||
| var err error | ||
| t.Logf("waiting for a challenge game") | ||
| time.Sleep(5 * time.Second) | ||
| games, err = d.ListChallengeGames() | ||
| require.NoError(t, err) | ||
| } | ||
| t.Logf("game created: %v", games[0]) | ||
| require.Equal(t, uint64(1), games[0].Claims) | ||
|
|
||
| // Attack the first claimed state. | ||
| t.Logf("attacking game") | ||
| require.NoError(t, d.OpChallenger("move", "--attack", "--game-address", games[0].Address.Hex())) | ||
|
|
||
| // Check that the proposer correctly responds. | ||
| CLAIMS_NUMBER := uint64(3) // First claim by the proposer + attack + response | ||
| for { | ||
| updatedGames, err := d.ListChallengeGames() | ||
| require.NoError(t, err) | ||
| if updatedGames[0].Claims == CLAIMS_NUMBER { | ||
| require.Equal(t, updatedGames[0].OutputRoot, games[0].OutputRoot) | ||
| break | ||
| } | ||
|
|
||
| t.Logf("waiting for a response") | ||
| time.Sleep(time.Second) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this function do? Where does it write and why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the generic
goio writer interface. This type is just a wrapper around an inner IO stream that prepends output with a tag (e.g.op-challenger | ...). I'll add commenetsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment added in 9373be8.