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
75133521
Commit
75133521
authored
Jul 18, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix agent stepping.
parent
c07d67ab
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
7 deletions
+38
-7
agent.go
op-challenger/fault/agent.go
+11
-0
loader.go
op-challenger/fault/loader.go
+2
-0
loader_test.go
op-challenger/fault/loader_test.go
+18
-6
types.go
op-challenger/fault/types.go
+7
-1
No files found.
op-challenger/fault/agent.go
View file @
75133521
...
@@ -94,6 +94,17 @@ func (a *Agent) step(claim Claim, game Game) error {
...
@@ -94,6 +94,17 @@ func (a *Agent) step(claim Claim, game Game) error {
if
claim
.
Depth
()
!=
a
.
maxDepth
{
if
claim
.
Depth
()
!=
a
.
maxDepth
{
return
nil
return
nil
}
}
if
game
.
AgreeWithClaimLevel
(
claim
)
{
a
.
log
.
Warn
(
"Agree with leaf claim, skipping step"
,
"claim_depth"
,
claim
.
Depth
(),
"maxDepth"
,
a
.
maxDepth
)
return
nil
}
if
claim
.
Countered
{
a
.
log
.
Info
(
"Claim already stepped on"
,
"claim_depth"
,
claim
.
Depth
(),
"maxDepth"
,
a
.
maxDepth
)
return
nil
}
a
.
log
.
Info
(
"Attempting step"
,
"claim_depth"
,
claim
.
Depth
(),
"maxDepth"
,
a
.
maxDepth
)
a
.
log
.
Info
(
"Attempting step"
,
"claim_depth"
,
claim
.
Depth
(),
"maxDepth"
,
a
.
maxDepth
)
step
,
err
:=
a
.
solver
.
AttemptStep
(
claim
)
step
,
err
:=
a
.
solver
.
AttemptStep
(
claim
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
op-challenger/fault/loader.go
View file @
75133521
...
@@ -56,6 +56,8 @@ func (l *loader) fetchClaim(ctx context.Context, arrIndex uint64) (Claim, error)
...
@@ -56,6 +56,8 @@ func (l *loader) fetchClaim(ctx context.Context, arrIndex uint64) (Claim, error)
Value
:
fetchedClaim
.
Claim
,
Value
:
fetchedClaim
.
Claim
,
Position
:
NewPositionFromGIndex
(
fetchedClaim
.
Position
.
Uint64
()),
Position
:
NewPositionFromGIndex
(
fetchedClaim
.
Position
.
Uint64
()),
},
},
Countered
:
fetchedClaim
.
Countered
,
Clock
:
fetchedClaim
.
Clock
.
Uint64
(),
ContractIndex
:
int
(
arrIndex
),
ContractIndex
:
int
(
arrIndex
),
ParentContractIndex
:
int
(
fetchedClaim
.
ParentIndex
),
ParentContractIndex
:
int
(
fetchedClaim
.
ParentIndex
),
}
}
...
...
op-challenger/fault/loader_test.go
View file @
75133521
...
@@ -40,16 +40,22 @@ func newMockClaimFetcher() *mockClaimFetcher {
...
@@ -40,16 +40,22 @@ func newMockClaimFetcher() *mockClaimFetcher {
Clock
*
big
.
Int
Clock
*
big
.
Int
}{
}{
{
{
Claim
:
[
32
]
byte
{
0x00
},
Claim
:
[
32
]
byte
{
0x00
},
Position
:
big
.
NewInt
(
0
),
Position
:
big
.
NewInt
(
0
),
Countered
:
false
,
Clock
:
big
.
NewInt
(
0
),
},
},
{
{
Claim
:
[
32
]
byte
{
0x01
},
Claim
:
[
32
]
byte
{
0x01
},
Position
:
big
.
NewInt
(
0
),
Position
:
big
.
NewInt
(
0
),
Countered
:
false
,
Clock
:
big
.
NewInt
(
0
),
},
},
{
{
Claim
:
[
32
]
byte
{
0x02
},
Claim
:
[
32
]
byte
{
0x02
},
Position
:
big
.
NewInt
(
0
),
Position
:
big
.
NewInt
(
0
),
Countered
:
false
,
Clock
:
big
.
NewInt
(
0
),
},
},
},
},
}
}
...
@@ -101,6 +107,8 @@ func TestLoader_FetchClaims_Succeeds(t *testing.T) {
...
@@ -101,6 +107,8 @@ func TestLoader_FetchClaims_Succeeds(t *testing.T) {
Value
:
expectedClaims
[
0
]
.
Claim
,
Value
:
expectedClaims
[
0
]
.
Claim
,
Position
:
NewPositionFromGIndex
(
expectedClaims
[
0
]
.
Position
.
Uint64
()),
Position
:
NewPositionFromGIndex
(
expectedClaims
[
0
]
.
Position
.
Uint64
()),
},
},
Countered
:
false
,
Clock
:
uint64
(
0
),
ContractIndex
:
0
,
ContractIndex
:
0
,
},
},
{
{
...
@@ -112,6 +120,8 @@ func TestLoader_FetchClaims_Succeeds(t *testing.T) {
...
@@ -112,6 +120,8 @@ func TestLoader_FetchClaims_Succeeds(t *testing.T) {
Value
:
expectedClaims
[
0
]
.
Claim
,
Value
:
expectedClaims
[
0
]
.
Claim
,
Position
:
NewPositionFromGIndex
(
expectedClaims
[
1
]
.
Position
.
Uint64
()),
Position
:
NewPositionFromGIndex
(
expectedClaims
[
1
]
.
Position
.
Uint64
()),
},
},
Countered
:
false
,
Clock
:
uint64
(
0
),
ContractIndex
:
1
,
ContractIndex
:
1
,
},
},
{
{
...
@@ -123,6 +133,8 @@ func TestLoader_FetchClaims_Succeeds(t *testing.T) {
...
@@ -123,6 +133,8 @@ func TestLoader_FetchClaims_Succeeds(t *testing.T) {
Value
:
expectedClaims
[
0
]
.
Claim
,
Value
:
expectedClaims
[
0
]
.
Claim
,
Position
:
NewPositionFromGIndex
(
expectedClaims
[
2
]
.
Position
.
Uint64
()),
Position
:
NewPositionFromGIndex
(
expectedClaims
[
2
]
.
Position
.
Uint64
()),
},
},
Countered
:
false
,
Clock
:
uint64
(
0
),
ContractIndex
:
2
,
ContractIndex
:
2
,
},
},
},
claims
)
},
claims
)
...
...
op-challenger/fault/types.go
View file @
75133521
...
@@ -49,7 +49,13 @@ func (c *ClaimData) ValueBytes() [32]byte {
...
@@ -49,7 +49,13 @@ func (c *ClaimData) ValueBytes() [32]byte {
// and the Parent field is empty & meaningless.
// and the Parent field is empty & meaningless.
type
Claim
struct
{
type
Claim
struct
{
ClaimData
ClaimData
Parent
ClaimData
// WARN: Countered is a mutable field in the FaultDisputeGame contract
// and rely on it for determining whether to step on leaf claims.
// When caching is implemented for the Challenger, this will need
// to be changed/removed to avoid invalid/stale contract state.
Countered
bool
Clock
uint64
Parent
ClaimData
// Location of the claim & it's parent inside the contract. Does not exist
// Location of the claim & it's parent inside the contract. Does not exist
// for claims that have not made it to the contract.
// for claims that have not made it to the contract.
ContractIndex
int
ContractIndex
int
...
...
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