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

dispute-game: Sanity check disputed claim index #10520

Merged
merged 8 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 120 additions & 59 deletions op-bindings/bindings/faultdisputegame.go

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions op-challenger/cmd/move.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,18 @@ func Move(ctx *cli.Context) error {
return fmt.Errorf("failed to create dispute game bindings: %w", err)
}

parentClaim, err := contract.GetClaim(ctx.Context, parentIndex)
if err != nil {
return fmt.Errorf("failed to get parent claim: %w", err)
}
var tx txmgr.TxCandidate
if attack {
tx, err = contract.AttackTx(parentIndex, claim)
tx, err = contract.AttackTx(ctx.Context, parentClaim, claim)
if err != nil {
return fmt.Errorf("failed to create attack tx: %w", err)
}
} else if defend {
tx, err = contract.DefendTx(parentIndex, claim)
tx, err = contract.DefendTx(ctx.Context, parentClaim, claim)
if err != nil {
return fmt.Errorf("failed to create defense tx: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions op-challenger/game/fault/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (a *Agent) performAction(ctx context.Context, wg *sync.WaitGroup, action ty
isLocal := containsOracleData && action.OracleData.IsLocal
actionLog = actionLog.New(
"is_attack", action.IsAttack,
"parent", action.ParentIdx,
"parent", action.ParentClaim.ContractIndex,
"prestate", common.Bytes2Hex(action.PreState),
"proof", common.Bytes2Hex(action.ProofData),
"containsOracleData", containsOracleData,
Expand All @@ -130,7 +130,7 @@ func (a *Agent) performAction(ctx context.Context, wg *sync.WaitGroup, action ty
actionLog = actionLog.New("oracleKey", common.Bytes2Hex(action.OracleData.OracleKey))
}
} else if action.Type == types.ActionTypeMove {
actionLog = actionLog.New("is_attack", action.IsAttack, "parent", action.ParentIdx, "value", action.Value)
actionLog = actionLog.New("is_attack", action.IsAttack, "parent", action.ParentClaim.ContractIndex, "value", action.Value)
}

switch action.Type {
Expand Down
Loading