@@ -11,9 +11,13 @@ import {
1111
1212// https://github.com/ethereum-optimism/optimism/issues/11269
1313
14- // https://github.com/ethereum-optimism/optimism/blob/v1.13.7/packages/contracts-bedrock/src/dispute/lib/Types.sol
15- uint256 constant CHALLENGER_WINS = 1 ;
16- uint256 constant DEFENDER_WINS = 2 ;
14+ // https://github.com/ethereum-optimism/optimism/blob/v1.18.1/packages/contracts-bedrock/src/dispute/lib/Types.sol
15+ uint256 constant GAME_STATUS_IN_PROGRESS = 0 ;
16+ uint256 constant GAME_STATUS_CHALLENGER_WINS = 1 ;
17+ uint256 constant GAME_STATUS_DEFENDER_WINS = 2 ;
18+
19+ uint256 constant GAME_TYPE_AGGREGATE_VERIFIER = 621 ;
20+ uint256 constant GAME_TYPE_SUCCINCT = 42 ;
1721
1822error GameNotFound ();
1923
@@ -106,9 +110,9 @@ contract OPFaultGameFinder {
106110 if (! params.asr.isGameProper (gameProxy)) return false ;
107111 if (params.minAgeSec > 0 ) {
108112 if (created > block .timestamp - params.minAgeSec) return false ;
109- if (_isUnchallenged (gameProxy, params, state)) return true ;
113+ if (_isUnchallenged (gameProxy, gameType, params, state)) return true ;
110114 }
111- return gameProxy.status () == DEFENDER_WINS ; // require resolved
115+ return gameProxy.status () == GAME_STATUS_DEFENDER_WINS ; // require resolved
112116 }
113117
114118 function _isAllowedGameType (
@@ -134,22 +138,13 @@ contract OPFaultGameFinder {
134138 /// @dev Attempt to determine if the game is challenged in any sense.
135139 function _isUnchallenged (
136140 IDisputeGame gameProxy ,
141+ uint256 gameType ,
137142 OPFaultParams memory params ,
138143 FinderState memory state
139144 ) internal view returns (bool ) {
140- try
141- IFaultDisputeGame (address (gameProxy)).l2BlockNumberChallenged ()
142- returns (bool challenged ) {
143- // this challenge is independent of the game resolution
144- if (challenged) return false ;
145- } catch {}
146- // if supportsInterface(IFaultDisputeGame)
147- try IFaultDisputeGame (address (gameProxy)).claimDataLen () returns (
148- uint256 claims
149- ) {
150- if (claims == 1 ) return true ;
151- } catch {
152- // else if supportsInterface(IOPSuccinctFaultDisputeGame)
145+ if (gameType == GAME_TYPE_AGGREGATE_VERIFIER) {
146+ return gameProxy.status () != GAME_STATUS_CHALLENGER_WINS;
147+ } else if (gameType == GAME_TYPE_SUCCINCT) {
153148 try
154149 IOPSuccinctFaultDisputeGame (address (gameProxy)).claimData ()
155150 returns (IOPSuccinctFaultDisputeGame.ClaimData memory data ) {
@@ -161,16 +156,16 @@ contract OPFaultGameFinder {
161156 if (gameIndex == type (uint32 ).max) return true ; // anchor state is resolved
162157 if (gameIndex >= state.succinctGameIndex) return false ; // already checked
163158 (
164- uint256 gameType ,
159+ uint256 gameType1 ,
165160 uint256 created ,
166161 IDisputeGame parentGame
167162 ) = dgf.gameAtIndex (gameIndex);
168- if (gameType != gameType0) {
163+ if (gameType1 != gameType0) {
169164 // this is a different game type
170165 return
171166 _isGameUsable (
172167 parentGame,
173- gameType ,
168+ gameType1 ,
174169 created,
175170 params,
176171 state
@@ -187,12 +182,24 @@ contract OPFaultGameFinder {
187182 IOPSuccinctFaultDisputeGame
188183 .ProposalStatus
189184 .Resolved &&
190- parentGame.status () == DEFENDER_WINS ;
185+ parentGame.status () == GAME_STATUS_DEFENDER_WINS ;
191186 }
192187 }
193188 }
194189 } catch {}
195190 }
191+ try
192+ IFaultDisputeGame (address (gameProxy)).l2BlockNumberChallenged ()
193+ returns (bool challenged ) {
194+ // this challenge is independent of the game resolution
195+ if (challenged) return false ;
196+ } catch {}
197+ // if supportsInterface(IFaultDisputeGame)
198+ try IFaultDisputeGame (address (gameProxy)).claimDataLen () returns (
199+ uint256 claims
200+ ) {
201+ if (claims == 1 ) return true ;
202+ } catch {}
196203 // unknown type
197204 // assume challenged and require resolved
198205 return false ;
0 commit comments