Skip to content

Commit

Permalink
add check,attack root, non-zero branch returns an error
Browse files Browse the repository at this point in the history
  • Loading branch information
JustXxx committed Nov 29, 2024
1 parent d7f7e67 commit 4ba3d10
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion op-challenger2/game/fault/solver/game_solver.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (s *GameSolver) calculateMove(ctx context.Context, game types.Game, claim t
return nil, nil
}
if claim.IsRoot() && branch != 0 {
return nil, nil
return nil, fmt.Errorf("cannot attack root claim with branch %v", branch)
}
move, err := s.claimSolver.NextMove(ctx, claim, game, honestClaims, uint64(branch))
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions op-challenger2/game/fault/test/claim_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,6 @@ func (c *ClaimBuilder) claim(pos types.Position, opts ...ClaimOpt) types.Claim {
} else {
values = append(values, c.CorrectClaimAtPosition(pos))
}
for i := uint64(0); i < c.MaxAttackBranch()-1; i++ {
values = append(values, common.Hash{})
}
} else if pos.Depth() == c.splitDepth+types.Depth(c.nbits) {
values = append(values, c.CorrectClaimAtPosition(pos))
for i := uint64(0); i < c.MaxAttackBranch()-1; i++ {
Expand Down

0 comments on commit 4ba3d10

Please sign in to comment.