github.com/ethereum-optimism/optimism@v1.7.2/packages/contracts-bedrock/src/dispute/interfaces/IFaultDisputeGame.sol (about) 1 // SPDX-License-Identifier: MIT 2 pragma solidity ^0.8.0; 3 4 import { IDisputeGame } from "./IDisputeGame.sol"; 5 6 import "src/libraries/DisputeTypes.sol"; 7 8 /// @title IFaultDisputeGame 9 /// @notice The interface for a fault proof backed dispute game. 10 interface IFaultDisputeGame is IDisputeGame { 11 /// @notice The `ClaimData` struct represents the data associated with a Claim. 12 struct ClaimData { 13 uint32 parentIndex; 14 address counteredBy; 15 address claimant; 16 uint128 bond; 17 Claim claim; 18 Position position; 19 Clock clock; 20 } 21 22 /// @notice Emitted when a new claim is added to the DAG by `claimant` 23 /// @param parentIndex The index within the `claimData` array of the parent claim 24 /// @param claim The claim being added 25 /// @param claimant The address of the claimant 26 event Move(uint256 indexed parentIndex, Claim indexed claim, address indexed claimant); 27 28 /// @notice Attack a disagreed upon `Claim`. 29 /// @param _parentIndex Index of the `Claim` to attack in the `claimData` array. 30 /// @param _claim The `Claim` at the relative attack position. 31 function attack(uint256 _parentIndex, Claim _claim) external payable; 32 33 /// @notice Defend an agreed upon `Claim`. 34 /// @param _parentIndex Index of the claim to defend in the `claimData` array. 35 /// @param _claim The `Claim` at the relative defense position. 36 function defend(uint256 _parentIndex, Claim _claim) external payable; 37 38 /// @notice Perform an instruction step via an on-chain fault proof processor. 39 /// @dev This function should point to a fault proof processor in order to execute 40 /// a step in the fault proof program on-chain. The interface of the fault proof 41 /// processor contract should adhere to the `IBigStepper` interface. 42 /// @param _claimIndex The index of the challenged claim within `claimData`. 43 /// @param _isAttack Whether or not the step is an attack or a defense. 44 /// @param _stateData The stateData of the step is the preimage of the claim at the given 45 /// prestate, which is at `_stateIndex` if the move is an attack and `_claimIndex` if 46 /// the move is a defense. If the step is an attack on the first instruction, it is 47 /// the absolute prestate of the fault proof VM. 48 /// @param _proof Proof to access memory nodes in the VM's merkle state tree. 49 function step(uint256 _claimIndex, bool _isAttack, bytes calldata _stateData, bytes calldata _proof) external; 50 51 /// @notice Posts the requested local data to the VM's `PreimageOralce`. 52 /// @param _ident The local identifier of the data to post. 53 /// @param _execLeafIdx The index of the leaf claim in an execution subgame that requires the local data for a step. 54 /// @param _partOffset The offset of the data to post. 55 function addLocalData(uint256 _ident, uint256 _execLeafIdx, uint256 _partOffset) external; 56 57 /// @notice Resolves the subgame rooted at the given claim index. 58 /// @dev This function must be called bottom-up in the DAG 59 /// A subgame is a tree of claims that has a maximum depth of 1. 60 /// A subgame root claims is valid if, and only if, all of its child claims are invalid. 61 /// At the deepest level in the DAG, a claim is invalid if there's a successful step against it. 62 /// @param _claimIndex The index of the subgame root claim to resolve. 63 function resolveClaim(uint256 _claimIndex) external payable; 64 65 /// @notice A block hash on the L1 that contains the disputed output root. 66 function l1Head() external view returns (Hash l1Head_); 67 68 /// @notice The l2BlockNumber of the disputed output root in the `L2OutputOracle`. 69 function l2BlockNumber() external view returns (uint256 l2BlockNumber_); 70 71 /// @notice Starting output root and block number of the game. 72 function startingOutputRoot() external view returns (Hash startingRoot_, uint256 l2BlockNumber_); 73 74 /// @notice Only the starting block number of the game. 75 function startingBlockNumber() external view returns (uint256 startingBlockNumber_); 76 77 /// @notice Only the starting output root of the game. 78 function startingRootHash() external view returns (Hash startingRootHash_); 79 }