Skip to content

Commit

Permalink
apply comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fakedev9999 committed Feb 20, 2025
1 parent 287e016 commit 2f630ea
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
6 changes: 1 addition & 5 deletions contracts/src/fp/OPSuccinctFaultDisputeGame.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {AccessManager} from "src/fp/AccessManager.sol";

/// @title OPSuccinctFaultDisputeGame
/// @notice An implementation of the `IFaultDisputeGame` interface.
contract OPSuccinctFaultDisputeGame is Clone, ISemver {
contract OPSuccinctFaultDisputeGame is Clone, ISemver, IDisputeGame {
////////////////////////////////////////////////////////////////
// Enums //
////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -90,10 +90,6 @@ contract OPSuccinctFaultDisputeGame is Clone, ISemver {
/// @param prover The address of the prover.
event Proved(address indexed prover);

/// @notice Emitted when the game is resolved.
/// @param status The status of the game after resolution.
event Resolved(GameStatus indexed status);

/// @notice Emitted when the game is closed.
event GameClosed(BondDistributionMode bondDistributionMode);

Expand Down
21 changes: 14 additions & 7 deletions contracts/src/validity/OPSuccinctDisputeGame.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,13 @@ import {IDisputeGame} from "interfaces/dispute/IDisputeGame.sol";
import {Claim, GameStatus, GameType, GameTypes, Hash, Timestamp} from "@optimism/src/dispute/lib/Types.sol";
import {GameNotInProgress, OutOfOrderResolution} from "@optimism/src/dispute/lib/Errors.sol";

contract OPSuccinctDisputeGame is ISemver, CWIA {
contract OPSuccinctDisputeGame is ISemver, CWIA, IDisputeGame {
using LibBytes for bytes;

////////////////////////////////////////////////////////////////
// Events //
////////////////////////////////////////////////////////////////

/// @notice Emitted when the game is resolved.
/// @param status The status of the game after resolution.
event Resolved(GameStatus indexed status);

/// @notice The address of the L2 output oracle proxy contract.
address internal immutable l2OutputOracle;

Expand All @@ -32,6 +28,9 @@ contract OPSuccinctDisputeGame is ISemver, CWIA {
/// @notice Returns the current status of the game.
GameStatus public status;

/// @notice A boolean for whether or not the game type was respected when the game was created.
bool public wasRespectedGameTypeWhenCreated;

/// @notice Semantic version.
/// @custom:semver v1.0.0-beta
string public constant version = "v1.0.0-beta";
Expand All @@ -47,11 +46,14 @@ contract OPSuccinctDisputeGame is ISemver, CWIA {
function initialize() external payable {
createdAt = Timestamp.wrap(uint64(block.timestamp));
status = GameStatus.IN_PROGRESS;
wasRespectedGameTypeWhenCreated = true;

(uint256 l2BlockNumber, uint256 l1BlockNumber, bytes memory proof) =
(uint256 l2BlockNumber_, uint256 l1BlockNumber_, bytes memory proof_) =
abi.decode(extraData(), (uint256, uint256, bytes));

OPSuccinctL2OutputOracle(l2OutputOracle).proposeL2Output(rootClaim().raw(), l2BlockNumber, l1BlockNumber, proof);
OPSuccinctL2OutputOracle(l2OutputOracle).proposeL2Output(
rootClaim().raw(), l2BlockNumber_, l1BlockNumber_, proof_
);

this.resolve();
}
Expand Down Expand Up @@ -88,6 +90,11 @@ contract OPSuccinctDisputeGame is ISemver, CWIA {
return Hash.wrap(_getArgBytes32(0x34));
}

/// @notice The l2BlockNumber of the disputed output root in the `L2OutputOracle`.
function l2BlockNumber() public pure returns (uint256 l2BlockNumber_) {
l2BlockNumber_ = _getArgUint256(0x54);
}

/// @notice Getter for the extra data.
/// @dev `clones-with-immutable-args` argument #4
/// @return Any extra data supplied to the dispute game contract by the creator.
Expand Down
4 changes: 2 additions & 2 deletions contracts/test/fp/OPSuccinctFaultDisputeGame.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ contract OPSuccinctFaultDisputeGameTest is Test {
Duration maxProveDuration = Duration.wrap(3 days);
Claim rootClaim = Claim.wrap(keccak256("rootClaim"));

// We will use these for the child game creation.
// Child game creation parameters.
uint256 l2BlockNumber = 2000;
uint32 parentIndex = 0;

Expand Down Expand Up @@ -165,7 +165,7 @@ contract OPSuccinctFaultDisputeGameTest is Test {
accessManager
);

// Set the init bond on the factory for our specific GameType.
// Set the init bond on the factory for the OPSuccinctFDG specific GameType.
factory.setInitBond(gameType, 1 ether);

// Register our reference implementation under the specified gameType.
Expand Down

0 comments on commit 2f630ea

Please sign in to comment.