Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
8306b53f
Unverified
Commit
8306b53f
authored
Jul 16, 2023
by
OptimismBot
Committed by
GitHub
Jul 16, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6307 from ethereum-optimism/jg/remove_dead_code
op-challenger: Remove dead code from game.go
parents
72c9e7a2
ea0d4bdb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
90 deletions
+0
-90
game.go
op-challenger/fault/game.go
+0
-50
game_test.go
op-challenger/fault/game_test.go
+0
-40
No files found.
op-challenger/fault/game.go
View file @
8306b53f
...
@@ -26,14 +26,6 @@ type Game interface {
...
@@ -26,14 +26,6 @@ type Game interface {
// IsDuplicate returns true if the provided [Claim] already exists in the game state.
// IsDuplicate returns true if the provided [Claim] already exists in the game state.
IsDuplicate
(
claim
Claim
)
bool
IsDuplicate
(
claim
Claim
)
bool
// PreStateClaim gets the claim which commits to the pre-state of this specific claim.
// This will return an error if it is called with a non-leaf claim.
PreStateClaim
(
claim
Claim
)
(
Claim
,
error
)
// PostStateClaim gets the claim which commits to the post-state of this specific claim.
// This will return an error if it is called with a non-leaf claim.
PostStateClaim
(
claim
Claim
)
(
Claim
,
error
)
// AgreeWithLevel returns if the game state agrees with the provided claim level.
// AgreeWithLevel returns if the game state agrees with the provided claim level.
AgreeWithClaimLevel
(
claim
Claim
)
bool
AgreeWithClaimLevel
(
claim
Claim
)
bool
}
}
...
@@ -140,45 +132,3 @@ func (g *gameState) getParent(claim Claim) (Claim, error) {
...
@@ -140,45 +132,3 @@ func (g *gameState) getParent(claim Claim) (Claim, error) {
return
parent
.
self
,
nil
return
parent
.
self
,
nil
}
}
}
}
func
(
g
*
gameState
)
PreStateClaim
(
claim
Claim
)
(
Claim
,
error
)
{
// Do checks in PreStateClaim because these do not hold while walking the tree
if
claim
.
Depth
()
!=
int
(
g
.
depth
)
{
return
Claim
{},
errors
.
New
(
"Only leaf claims have pre or post state"
)
}
// If the claim is the far left most claim, the pre-state is pulled from the contracts & we can supply at contract index.
if
claim
.
IndexAtDepth
()
==
0
{
return
Claim
{
ContractIndex
:
-
1
,
},
nil
}
return
g
.
preStateClaim
(
claim
)
}
// preStateClaim is the internal tree walker which does not do error handling
func
(
g
*
gameState
)
preStateClaim
(
claim
Claim
)
(
Claim
,
error
)
{
parent
,
_
:=
g
.
getParent
(
claim
)
if
claim
.
DefendsParent
()
{
return
parent
,
nil
}
else
{
return
g
.
preStateClaim
(
parent
)
}
}
func
(
g
*
gameState
)
PostStateClaim
(
claim
Claim
)
(
Claim
,
error
)
{
// Do checks in PostStateClaim because these do not hold while walking the tree
if
claim
.
Depth
()
!=
int
(
g
.
depth
)
{
return
Claim
{},
errors
.
New
(
"Only leaf claims have pre or post state"
)
}
return
g
.
postStateClaim
(
claim
)
}
// postStateClaim is the internal tree walker which does not do error handling
func
(
g
*
gameState
)
postStateClaim
(
claim
Claim
)
(
Claim
,
error
)
{
parent
,
_
:=
g
.
getParent
(
claim
)
if
claim
.
DefendsParent
()
{
return
g
.
postStateClaim
(
parent
)
}
else
{
return
parent
,
nil
}
}
op-challenger/fault/game_test.go
View file @
8306b53f
...
@@ -195,46 +195,6 @@ func TestGame_ClaimPairs(t *testing.T) {
...
@@ -195,46 +195,6 @@ func TestGame_ClaimPairs(t *testing.T) {
require
.
ElementsMatch
(
t
,
expected
,
claims
)
require
.
ElementsMatch
(
t
,
expected
,
claims
)
}
}
// TestPrePostStateOnlyOnLeafClaim tests that if PreStateClaim or PostStateClaim is called with an non-leaf claim
// those functions return an error.
func
TestPrePostStateOnlyOnLeafClaim
(
t
*
testing
.
T
)
{
root
,
top
,
middle
,
bottom
:=
createTestClaims
()
g
:=
NewGameState
(
false
,
root
,
testMaxDepth
)
require
.
NoError
(
t
,
g
.
PutAll
([]
Claim
{
top
,
middle
,
bottom
}))
_
,
err
:=
g
.
PreStateClaim
(
middle
)
require
.
Error
(
t
,
err
)
_
,
err
=
g
.
PostStateClaim
(
middle
)
require
.
Error
(
t
,
err
)
}
func
TestPreStateClaim
(
t
*
testing
.
T
)
{
root
,
top
,
middle
,
bottom
:=
createTestClaims
()
g
:=
NewGameState
(
false
,
root
,
testMaxDepth
)
require
.
NoError
(
t
,
g
.
Put
(
top
))
require
.
NoError
(
t
,
g
.
Put
(
middle
))
require
.
NoError
(
t
,
g
.
Put
(
bottom
))
// Bottom trace index is 4. Pre trace index is then 3
pre
,
err
:=
g
.
PreStateClaim
(
bottom
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
top
,
pre
)
}
func
TestPostStateClaim
(
t
*
testing
.
T
)
{
root
,
top
,
middle
,
bottom
:=
createTestClaims
()
g
:=
NewGameState
(
false
,
root
,
testMaxDepth
)
require
.
NoError
(
t
,
g
.
Put
(
top
))
require
.
NoError
(
t
,
g
.
Put
(
middle
))
require
.
NoError
(
t
,
g
.
Put
(
bottom
))
// Bottom trace index is 4. Post trace index is then 5
post
,
err
:=
g
.
PostStateClaim
(
bottom
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
middle
,
post
)
}
func
TestAgreeWithClaimLevelDisagreeWithOutput
(
t
*
testing
.
T
)
{
func
TestAgreeWithClaimLevelDisagreeWithOutput
(
t
*
testing
.
T
)
{
// Setup the game state.
// Setup the game state.
root
,
top
,
middle
,
bottom
:=
createTestClaims
()
root
,
top
,
middle
,
bottom
:=
createTestClaims
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment