Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IDisputeGame } from "interfaces/dispute/IDisputeGame.sol";
import { IFaultDisputeGame } from "interfaces/dispute/IFaultDisputeGame.sol";
import { IDisputeGameFactory } from "interfaces/dispute/IDisputeGameFactory.sol";
import { ISuperchainConfig } from "interfaces/L1/ISuperchainConfig.sol";
import { GameType, Hash, OutputRoot } from "src/dispute/lib/Types.sol";
import { GameType, Hash, Proposal } from "src/dispute/lib/Types.sol";

interface IAnchorStateRegistry {
error AnchorStateRegistry_AnchorGameBlacklisted();
Expand All @@ -28,7 +28,7 @@ interface IAnchorStateRegistry {
function initialize(
ISuperchainConfig _superchainConfig,
IDisputeGameFactory _disputeGameFactory,
OutputRoot memory _startingAnchorRoot,
Proposal memory _startingAnchorRoot,
GameType _startingRespectedGameType
)
external;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface IDisputeGame is IInitializable {
function gameCreator() external pure returns (address creator_);
function rootClaim() external pure returns (Claim rootClaim_);
function l1Head() external pure returns (Hash l1Head_);
function l2BlockNumber() external pure returns (uint256 l2BlockNumber_);
function l2SequenceNumber() external pure returns (uint256 l2SequenceNumber_);
function extraData() external pure returns (bytes memory extraData_);
function resolve() external returns (GameStatus status_);
function gameData() external view returns (GameType gameType_, Claim rootClaim_, bytes memory extraData_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ interface IFaultDisputeGame is IDisputeGame {
function resolvedSubgames(uint256) external view returns (bool);
function splitDepth() external view returns (uint256 splitDepth_);
function startingBlockNumber() external view returns (uint256 startingBlockNumber_);
function startingOutputRoot() external view returns (Hash root, uint256 l2BlockNumber); // nosemgrep
function startingOutputRoot() external view returns (Hash root, uint256 l2SequenceNumber); // nosemgrep
function startingRootHash() external view returns (Hash startingRootHash_);
function step(uint256 _claimIndex, bool _isAttack, bytes memory _stateData, bytes memory _proof) external;
function subgames(uint256, uint256) external view returns (uint256);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ interface IPermissionedDisputeGame is IDisputeGame {
function resolvedSubgames(uint256) external view returns (bool);
function splitDepth() external view returns (uint256 splitDepth_);
function startingBlockNumber() external view returns (uint256 startingBlockNumber_);
function startingOutputRoot() external view returns (Hash root, uint256 l2BlockNumber); // nosemgrep
function startingOutputRoot() external view returns (Hash root, uint256 l2SequenceNumber); // nosemgrep
function startingRootHash() external view returns (Hash startingRootHash_);
function step(uint256 _claimIndex, bool _isAttack, bytes memory _stateData, bytes memory _proof) external;
function subgames(uint256, uint256) external view returns (uint256);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { IDisputeGame } from "interfaces/dispute/IDisputeGame.sol";
import { IDelayedWETH } from "interfaces/dispute/IDelayedWETH.sol";
import { IAnchorStateRegistry } from "interfaces/dispute/IAnchorStateRegistry.sol";
import { IBigStepper } from "interfaces/dispute/IBigStepper.sol";
import { GameType, Claim, Position, Clock, Hash, Duration, BondDistributionMode } from "src/dispute/lib/Types.sol";

interface ISuperFaultDisputeGame is IDisputeGame {
struct ClaimData {
uint32 parentIndex;
address counteredBy;
address claimant;
uint128 bond;
Claim claim;
Position position;
Clock clock;
}

struct ResolutionCheckpoint {
bool initialCheckpointComplete;
uint32 subgameIndex;
Position leftmostPosition;
address counteredBy;
}

struct GameConstructorParams {
GameType gameType;
Claim absolutePrestate;
uint256 maxGameDepth;
uint256 splitDepth;
Duration clockExtension;
Duration maxClockDuration;
IBigStepper vm;
IDelayedWETH weth;
IAnchorStateRegistry anchorStateRegistry;
uint256 l2ChainId;
}

error AlreadyInitialized();
error AnchorRootNotFound();
error BondTransferFailed();
error CannotDefendRootClaim();
error ClaimAboveSplit();
error ClaimAlreadyExists();
error ClaimAlreadyResolved();
error ClockNotExpired();
error ClockTimeExceeded();
error DuplicateStep();
error GameDepthExceeded();
error GameNotInProgress();
error IncorrectBondAmount();
error InvalidChallengePeriod();
error InvalidClockExtension();
error InvalidDisputedClaimIndex();
error InvalidLocalIdent();
error InvalidParent();
error InvalidPrestate();
error InvalidSplitDepth();
error MaxDepthTooLarge();
error NoCreditToClaim();
error NoChainIdNeeded();
error OutOfOrderResolution();
error SuperFaultDisputeGameInvalidRootClaim();
error UnexpectedRootClaim(Claim rootClaim);
error ValidStep();
error InvalidBondDistributionMode();
error GameNotFinalized();
error GameNotResolved();
error ReservedGameType();

event Move(uint256 indexed parentIndex, Claim indexed claim, address indexed claimant);
event GameClosed(BondDistributionMode bondDistributionMode);

function absolutePrestate() external view returns (Claim absolutePrestate_);
function addLocalData(uint256 _ident, uint256 _execLeafIdx, uint256 _partOffset) external;
function anchorStateRegistry() external view returns (IAnchorStateRegistry registry_);
function attack(Claim _disputed, uint256 _parentIndex, Claim _claim) external payable;
function bondDistributionMode() external view returns (BondDistributionMode);
function claimCredit(address _recipient) external;
function claimData(uint256)
external
view // nosemgrep
returns (
uint32 parentIndex,
address counteredBy,
address claimant,
uint128 bond,
Claim claim,
Position position,
Clock clock
);
function claimDataLen() external view returns (uint256 len_);
function claims(Hash) external view returns (bool);
function clockExtension() external view returns (Duration clockExtension_);
function closeGame() external;
function credit(address _recipient) external view returns (uint256 credit_);
function defend(Claim _disputed, uint256 _parentIndex, Claim _claim) external payable;
function getChallengerDuration(uint256 _claimIndex) external view returns (Duration duration_);
function getNumToResolve(uint256 _claimIndex) external view returns (uint256 numRemainingChildren_);
function getRequiredBond(Position _position) external view returns (uint256 requiredBond_);
function hasUnlockedCredit(address) external view returns (bool);
function maxClockDuration() external view returns (Duration maxClockDuration_);
function maxGameDepth() external view returns (uint256 maxGameDepth_);
function move(Claim _disputed, uint256 _challengeIndex, Claim _claim, bool _isAttack) external payable;
function normalModeCredit(address) external view returns (uint256);
function l2SequenceNumber() external pure returns (uint256 l2SequenceNumber_);
function refundModeCredit(address) external view returns (uint256);
function resolutionCheckpoints(uint256)
external
view
returns (bool initialCheckpointComplete, uint32 subgameIndex, Position leftmostPosition, address counteredBy); // nosemgrep
function resolveClaim(uint256 _claimIndex, uint256 _numToResolve) external;
function resolvedSubgames(uint256) external view returns (bool);
function splitDepth() external view returns (uint256 splitDepth_);
function startingSequenceNumber() external view returns (uint256 startingSequenceNumber_);
function startingProposal() external view returns (Hash root, uint256 l2SequenceNumber); // nosemgrep
function startingRootHash() external view returns (Hash startingRootHash_);
function step(uint256 _claimIndex, bool _isAttack, bytes memory _stateData, bytes memory _proof) external;
function subgames(uint256, uint256) external view returns (uint256);
function version() external pure returns (string memory);
function vm() external view returns (IBigStepper vm_);
function wasRespectedGameTypeWhenCreated() external view returns (bool);
function weth() external view returns (IDelayedWETH weth_);

function __constructor__(GameConstructorParams memory _params) external;
}
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/scripts/deploy/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { Constants } from "src/libraries/Constants.sol";
import { Types } from "scripts/libraries/Types.sol";
import { Duration } from "src/dispute/lib/LibUDT.sol";
import { StorageSlot, ForgeArtifacts } from "scripts/libraries/ForgeArtifacts.sol";
import { GameType, Claim, GameTypes, OutputRoot, Hash } from "src/dispute/lib/Types.sol";
import { GameType, Claim, GameTypes, Proposal, Hash } from "src/dispute/lib/Types.sol";

// Interfaces
import { IOPContractsManager } from "interfaces/L1/IOPContractsManager.sol";
Expand Down Expand Up @@ -956,7 +956,7 @@ contract Deploy is Deployer {
blobBasefeeScalar: cfg.blobbasefeeScalar(),
l2ChainId: cfg.l2ChainID(),
startingAnchorRoot: abi.encode(
OutputRoot({ root: Hash.wrap(cfg.faultGameGenesisOutputRoot()), l2BlockNumber: cfg.faultGameGenesisBlock() })
Proposal({ root: Hash.wrap(cfg.faultGameGenesisOutputRoot()), l2SequenceNumber: cfg.faultGameGenesisBlock() })
),
saltMixer: saltMixer,
gasLimit: uint64(cfg.l2GenesisBlockGasLimit()),
Expand Down
6 changes: 3 additions & 3 deletions packages/contracts-bedrock/scripts/libraries/Constants.sol
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { OutputRoot, Hash } from "src/dispute/lib/Types.sol";
import { Proposal, Hash } from "src/dispute/lib/Types.sol";

/// @title Constants
/// @notice Constants is a library for storing constants. Simple! Don't put everything in here, just
/// the stuff used in multiple contracts. Constants that only apply to a single contract
/// should be defined in that contract instead.
library Constants {
/// @notice Returns the default starting anchor roots value to be used in a new dispute game.
function DEFAULT_OUTPUT_ROOT() internal pure returns (OutputRoot memory) {
return OutputRoot({ root: Hash.wrap(bytes32(hex"dead")), l2BlockNumber: 0 });
function DEFAULT_OUTPUT_ROOT() internal pure returns (Proposal memory) {
return Proposal({ root: Hash.wrap(bytes32(hex"dead")), l2SequenceNumber: 0 });
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@
},
{
"internalType": "uint256",
"name": "l2BlockNumber",
"name": "l2SequenceNumber",
"type": "uint256"
}
],
"internalType": "struct OutputRoot",
"internalType": "struct Proposal",
"name": "_startingAnchorRoot",
"type": "tuple"
},
Expand Down
15 changes: 14 additions & 1 deletion packages/contracts-bedrock/snapshots/abi/FaultDisputeGame.json
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,19 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "l2SequenceNumber",
"outputs": [
{
"internalType": "uint256",
"name": "l2SequenceNumber_",
"type": "uint256"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "maxClockDuration",
Expand Down Expand Up @@ -805,7 +818,7 @@
},
{
"internalType": "uint256",
"name": "l2BlockNumber",
"name": "l2SequenceNumber",
"type": "uint256"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,19 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "l2SequenceNumber",
"outputs": [
{
"internalType": "uint256",
"name": "l2SequenceNumber_",
"type": "uint256"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "maxClockDuration",
Expand Down Expand Up @@ -841,7 +854,7 @@
},
{
"internalType": "uint256",
"name": "l2BlockNumber",
"name": "l2SequenceNumber",
"type": "uint256"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,11 +476,11 @@
},
{
"inputs": [],
"name": "l2BlockNumber",
"name": "l2SequenceNumber",
"outputs": [
{
"internalType": "uint256",
"name": "l2BlockNumber_",
"name": "l2SequenceNumber_",
"type": "uint256"
}
],
Expand Down Expand Up @@ -704,11 +704,16 @@
},
{
"inputs": [],
"name": "startingBlockNumber",
"name": "startingProposal",
"outputs": [
{
"internalType": "Hash",
"name": "root",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "startingBlockNumber_",
"name": "l2SequenceNumber",
"type": "uint256"
}
],
Expand All @@ -717,30 +722,25 @@
},
{
"inputs": [],
"name": "startingOutputRoot",
"name": "startingRootHash",
"outputs": [
{
"internalType": "Hash",
"name": "root",
"name": "startingRootHash_",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "l2BlockNumber",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "startingRootHash",
"name": "startingSequenceNumber",
"outputs": [
{
"internalType": "Hash",
"name": "startingRootHash_",
"type": "bytes32"
"internalType": "uint256",
"name": "startingSequenceNumber_",
"type": "uint256"
}
],
"stateMutability": "view",
Expand Down
Loading