Skip to content

Commit

Permalink
dispute-game: Sanity check disputed claim index (#10520)
Browse files Browse the repository at this point in the history
* dispute-game: Sanity check disputed claim index

* Fix tests

* update snapshots

* fix docs

* move param

* op-challenger: Supply parent value when performing moves

Also moves calculation of the required bond into the contract bindings so the returned TxCandidate is ready to send.

* op-challenger: Add backwards compatibility with v1.1.1

* op-e2e: Update e2e for new FaultDisputeGame ABI

---------

Co-authored-by: Adrian Sutton <adrian@oplabs.co>
  • Loading branch information
Inphi and ajsutton authored May 14, 2024
1 parent 5e5d3f7 commit 78e1084
Show file tree
Hide file tree
Showing 28 changed files with 1,747 additions and 371 deletions.
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

0 comments on commit 78e1084

Please sign in to comment.