Skip to content

Commit a7c52e9

Browse files
feat: incident response improvements
First half of the original incident response improvements PR. Co-authored-by: wildmolasses <[email protected]>
1 parent a622ff3 commit a7c52e9

24 files changed

+956
-514
lines changed

packages/contracts-bedrock/interfaces/dispute/IAnchorStateRegistry.sol

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ import { GameType, Hash, OutputRoot } from "src/dispute/lib/Types.sol";
1010

1111
interface IAnchorStateRegistry {
1212
error InvalidAnchorGame(string reason);
13-
error Unauthorized();
1413

15-
event AnchorNotUpdated(IFaultDisputeGame indexed game, string reason);
1614
event AnchorUpdated(IFaultDisputeGame indexed game);
1715
event Initialized(uint8 version);
1816

@@ -25,11 +23,15 @@ interface IAnchorStateRegistry {
2523
function isGameBlacklisted(IDisputeGame _game) external view returns (bool);
2624
function isGameRespected(IDisputeGame _game) external view returns (bool);
2725
function isGameRetired(IDisputeGame _game) external view returns (bool);
26+
function isGameResolved(IDisputeGame _game) external view returns (bool);
27+
function isGameBeyondAirgap(IDisputeGame _game) external view returns (bool);
2828
function isGameProper(IDisputeGame _game) external view returns (bool, string memory);
29+
function isGameFinalized(IDisputeGame _game) external view returns (bool, string memory);
30+
function isGameClaimValid(IDisputeGame _game) external view returns (bool, string memory);
2931
function portal() external view returns (IOptimismPortal2);
30-
function setAnchorState(IFaultDisputeGame _game) external;
32+
function respectedGameType() external view returns (GameType);
33+
function setAnchorState(IDisputeGame _game) external;
3134
function superchainConfig() external view returns (ISuperchainConfig);
32-
function tryUpdateAnchorState() external;
3335
function version() external view returns (string memory);
3436

3537
function __constructor__() external;

packages/contracts-bedrock/interfaces/dispute/IDelayedWETH.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ interface IDelayedWETH {
1111

1212
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
1313
event Initialized(uint8 version);
14-
event Unwrap(address indexed src, uint256 wad);
1514

1615
fallback() external payable;
1716
receive() external payable;
1817

1918
function config() external view returns (ISuperchainConfig);
2019
function delay() external view returns (uint256);
20+
function hold(address _guy) external;
2121
function hold(address _guy, uint256 _wad) external;
2222
function initialize(address _owner, ISuperchainConfig _config) external;
2323
function owner() external view returns (address);

packages/contracts-bedrock/interfaces/dispute/IDisputeGame.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ interface IDisputeGame is IInitializable {
1414
function gameCreator() external pure returns (address creator_);
1515
function rootClaim() external pure returns (Claim rootClaim_);
1616
function l1Head() external pure returns (Hash l1Head_);
17+
function l2BlockNumber() external pure returns (uint256 l2BlockNumber_);
1718
function extraData() external pure returns (bytes memory extraData_);
1819
function resolve() external returns (GameStatus status_);
1920
function gameData() external view returns (GameType gameType_, Claim rootClaim_, bytes memory extraData_);
21+
function wasRespectedGameTypeWhenCreated() external view returns (bool);
2022
}

packages/contracts-bedrock/interfaces/dispute/IFaultDisputeGame.sol

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { IDelayedWETH } from "interfaces/dispute/IDelayedWETH.sol";
66
import { IAnchorStateRegistry } from "interfaces/dispute/IAnchorStateRegistry.sol";
77
import { IBigStepper } from "interfaces/dispute/IBigStepper.sol";
88
import { Types } from "src/libraries/Types.sol";
9-
import { GameType, Claim, Position, Clock, Hash, Duration } from "src/dispute/lib/Types.sol";
9+
import { GameType, Claim, Position, Clock, Hash, Duration, BondDistributionMode } from "src/dispute/lib/Types.sol";
1010

1111
interface IFaultDisputeGame is IDisputeGame {
1212
struct ClaimData {
@@ -74,13 +74,19 @@ interface IFaultDisputeGame is IDisputeGame {
7474
error UnexpectedRootClaim(Claim rootClaim);
7575
error UnexpectedString();
7676
error ValidStep();
77+
error InvalidBondDistributionMode();
78+
error GameNotFinalized(string reason);
79+
error GameNotResolved();
80+
error ReservedGameType();
7781

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

8085
function absolutePrestate() external view returns (Claim absolutePrestate_);
8186
function addLocalData(uint256 _ident, uint256 _execLeafIdx, uint256 _partOffset) external;
8287
function anchorStateRegistry() external view returns (IAnchorStateRegistry registry_);
8388
function attack(Claim _disputed, uint256 _parentIndex, Claim _claim) external payable;
89+
function bondDistributionMode() external view returns (BondDistributionMode);
8490
function challengeRootL2Block(Types.OutputRootProof memory _outputRootProof, bytes memory _headerRLP) external;
8591
function claimCredit(address _recipient) external;
8692
function claimData(uint256)
@@ -98,18 +104,21 @@ interface IFaultDisputeGame is IDisputeGame {
98104
function claimDataLen() external view returns (uint256 len_);
99105
function claims(Hash) external view returns (bool);
100106
function clockExtension() external view returns (Duration clockExtension_);
107+
function closeGame() external;
101108
function credit(address) external view returns (uint256);
102109
function defend(Claim _disputed, uint256 _parentIndex, Claim _claim) external payable;
103110
function getChallengerDuration(uint256 _claimIndex) external view returns (Duration duration_);
104111
function getNumToResolve(uint256 _claimIndex) external view returns (uint256 numRemainingChildren_);
105112
function getRequiredBond(Position _position) external view returns (uint256 requiredBond_);
113+
function hasUnlockedCredit(address) external view returns (bool);
106114
function l2BlockNumber() external pure returns (uint256 l2BlockNumber_);
107115
function l2BlockNumberChallenged() external view returns (bool);
108116
function l2BlockNumberChallenger() external view returns (address);
109117
function l2ChainId() external view returns (uint256 l2ChainId_);
110118
function maxClockDuration() external view returns (Duration maxClockDuration_);
111119
function maxGameDepth() external view returns (uint256 maxGameDepth_);
112120
function move(Claim _disputed, uint256 _challengeIndex, Claim _claim, bool _isAttack) external payable;
121+
function refundModeCredit(address) external view returns (uint256);
113122
function resolutionCheckpoints(uint256)
114123
external
115124
view
@@ -124,6 +133,7 @@ interface IFaultDisputeGame is IDisputeGame {
124133
function subgames(uint256, uint256) external view returns (uint256);
125134
function version() external view returns (string memory);
126135
function vm() external view returns (IBigStepper vm_);
136+
function wasRespectedGameTypeWhenCreated() external view returns (bool);
127137
function weth() external view returns (IDelayedWETH weth_);
128138

129139
function __constructor__(GameConstructorParams memory _params) external;

packages/contracts-bedrock/interfaces/dispute/IPermissionedDisputeGame.sol

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity ^0.8.0;
33

44
import { Types } from "src/libraries/Types.sol";
5-
import { Claim, Position, Clock, Hash, Duration } from "src/dispute/lib/Types.sol";
5+
import { Claim, Position, Clock, Hash, Duration, BondDistributionMode } from "src/dispute/lib/Types.sol";
66

77
import { IAnchorStateRegistry } from "interfaces/dispute/IAnchorStateRegistry.sol";
88
import { IDelayedWETH } from "interfaces/dispute/IDelayedWETH.sol";
@@ -63,13 +63,19 @@ interface IPermissionedDisputeGame is IDisputeGame {
6363
error UnexpectedRootClaim(Claim rootClaim);
6464
error UnexpectedString();
6565
error ValidStep();
66+
error InvalidBondDistributionMode();
67+
error GameNotFinalized(string reason);
68+
error GameNotResolved();
69+
error ReservedGameType();
6670

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

6974
function absolutePrestate() external view returns (Claim absolutePrestate_);
7075
function addLocalData(uint256 _ident, uint256 _execLeafIdx, uint256 _partOffset) external;
7176
function anchorStateRegistry() external view returns (IAnchorStateRegistry registry_);
7277
function attack(Claim _disputed, uint256 _parentIndex, Claim _claim) external payable;
78+
function bondDistributionMode() external view returns (BondDistributionMode);
7379
function challengeRootL2Block(Types.OutputRootProof memory _outputRootProof, bytes memory _headerRLP) external;
7480
function claimCredit(address _recipient) external;
7581
function claimData(uint256)
@@ -87,18 +93,21 @@ interface IPermissionedDisputeGame is IDisputeGame {
8793
function claimDataLen() external view returns (uint256 len_);
8894
function claims(Hash) external view returns (bool);
8995
function clockExtension() external view returns (Duration clockExtension_);
96+
function closeGame() external;
9097
function credit(address) external view returns (uint256);
9198
function defend(Claim _disputed, uint256 _parentIndex, Claim _claim) external payable;
9299
function getChallengerDuration(uint256 _claimIndex) external view returns (Duration duration_);
93100
function getNumToResolve(uint256 _claimIndex) external view returns (uint256 numRemainingChildren_);
94101
function getRequiredBond(Position _position) external view returns (uint256 requiredBond_);
102+
function hasUnlockedCredit(address) external view returns (bool);
95103
function l2BlockNumber() external pure returns (uint256 l2BlockNumber_);
96104
function l2BlockNumberChallenged() external view returns (bool);
97105
function l2BlockNumberChallenger() external view returns (address);
98106
function l2ChainId() external view returns (uint256 l2ChainId_);
99107
function maxClockDuration() external view returns (Duration maxClockDuration_);
100108
function maxGameDepth() external view returns (uint256 maxGameDepth_);
101109
function move(Claim _disputed, uint256 _challengeIndex, Claim _claim, bool _isAttack) external payable;
110+
function refundModeCredit(address) external view returns (uint256);
102111
function resolutionCheckpoints(uint256)
103112
external
104113
view
@@ -113,6 +122,7 @@ interface IPermissionedDisputeGame is IDisputeGame {
113122
function subgames(uint256, uint256) external view returns (uint256);
114123
function version() external view returns (string memory);
115124
function vm() external view returns (IBigStepper vm_);
125+
function wasRespectedGameTypeWhenCreated() external view returns (bool);
116126
function weth() external view returns (IDelayedWETH weth_);
117127

118128
error BadAuth();

packages/contracts-bedrock/snapshots/abi/AnchorStateRegistry.json

Lines changed: 100 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,25 @@
112112
"stateMutability": "nonpayable",
113113
"type": "function"
114114
},
115+
{
116+
"inputs": [
117+
{
118+
"internalType": "contract IDisputeGame",
119+
"name": "_game",
120+
"type": "address"
121+
}
122+
],
123+
"name": "isGameBeyondAirgap",
124+
"outputs": [
125+
{
126+
"internalType": "bool",
127+
"name": "",
128+
"type": "bool"
129+
}
130+
],
131+
"stateMutability": "view",
132+
"type": "function"
133+
},
115134
{
116135
"inputs": [
117136
{
@@ -131,6 +150,54 @@
131150
"stateMutability": "view",
132151
"type": "function"
133152
},
153+
{
154+
"inputs": [
155+
{
156+
"internalType": "contract IDisputeGame",
157+
"name": "_game",
158+
"type": "address"
159+
}
160+
],
161+
"name": "isGameClaimValid",
162+
"outputs": [
163+
{
164+
"internalType": "bool",
165+
"name": "",
166+
"type": "bool"
167+
},
168+
{
169+
"internalType": "string",
170+
"name": "",
171+
"type": "string"
172+
}
173+
],
174+
"stateMutability": "view",
175+
"type": "function"
176+
},
177+
{
178+
"inputs": [
179+
{
180+
"internalType": "contract IDisputeGame",
181+
"name": "_game",
182+
"type": "address"
183+
}
184+
],
185+
"name": "isGameFinalized",
186+
"outputs": [
187+
{
188+
"internalType": "bool",
189+
"name": "",
190+
"type": "bool"
191+
},
192+
{
193+
"internalType": "string",
194+
"name": "",
195+
"type": "string"
196+
}
197+
],
198+
"stateMutability": "view",
199+
"type": "function"
200+
},
134201
{
135202
"inputs": [
136203
{
@@ -174,6 +241,25 @@
174241
"stateMutability": "view",
175242
"type": "function"
176243
},
244+
{
245+
"inputs": [
246+
{
247+
"internalType": "contract IDisputeGame",
248+
"name": "_game",
249+
"type": "address"
250+
}
251+
],
252+
"name": "isGameResolved",
253+
"outputs": [
254+
{
255+
"internalType": "bool",
256+
"name": "",
257+
"type": "bool"
258+
}
259+
],
260+
"stateMutability": "view",
261+
"type": "function"
262+
},
177263
{
178264
"inputs": [
179265
{
@@ -225,10 +311,23 @@
225311
"stateMutability": "view",
226312
"type": "function"
227313
},
314+
{
315+
"inputs": [],
316+
"name": "respectedGameType",
317+
"outputs": [
318+
{
319+
"internalType": "GameType",
320+
"name": "",
321+
"type": "uint32"
322+
}
323+
],
324+
"stateMutability": "view",
325+
"type": "function"
326+
},
228327
{
229328
"inputs": [
230329
{
231-
"internalType": "contract IFaultDisputeGame",
330+
"internalType": "contract IDisputeGame",
232331
"name": "_game",
233332
"type": "address"
234333
}
@@ -251,13 +350,6 @@
251350
"stateMutability": "view",
252351
"type": "function"
253352
},
254-
{
255-
"inputs": [],
256-
"name": "tryUpdateAnchorState",
257-
"outputs": [],
258-
"stateMutability": "nonpayable",
259-
"type": "function"
260-
},
261353
{
262354
"inputs": [],
263355
"name": "version",
@@ -271,25 +363,6 @@
271363
"stateMutability": "view",
272364
"type": "function"
273365
},
274-
{
275-
"anonymous": false,
276-
"inputs": [
277-
{
278-
"indexed": true,
279-
"internalType": "contract IFaultDisputeGame",
280-
"name": "game",
281-
"type": "address"
282-
},
283-
{
284-
"indexed": false,
285-
"internalType": "string",
286-
"name": "reason",
287-
"type": "string"
288-
}
289-
],
290-
"name": "AnchorNotUpdated",
291-
"type": "event"
292-
},
293366
{
294367
"anonymous": false,
295368
"inputs": [
@@ -326,10 +399,5 @@
326399
],
327400
"name": "InvalidAnchorGame",
328401
"type": "error"
329-
},
330-
{
331-
"inputs": [],
332-
"name": "Unauthorized",
333-
"type": "error"
334402
}
335403
]

0 commit comments

Comments
 (0)