Skip to content

Commit c643792

Browse files
clearer error
1 parent 2256be9 commit c643792

File tree

7 files changed

+22
-8
lines changed

7 files changed

+22
-8
lines changed

op-e2e/faultproofs/output_alphabet_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func TestOutputAlphabetGame_ReclaimBond(t *testing.T) {
121121

122122
// The actor should have no credit available because all its bonds were paid to Alice.
123123
actorCredit := game.AvailableCredit(ctx, disputegame.TestAddress)
124-
require.True(t, actorCredit.Cmp(big.NewInt(0)) == 0, "Expected alice available credit to be zero")
124+
require.True(t, actorCredit.Cmp(big.NewInt(0)) == 0, "Expected actor available credit to be zero")
125125

126126
// Advance the time past the weth unlock delay
127127
sys.TimeTravelClock.AdvanceTime(game.CreditUnlockDuration(ctx))

packages/contracts-bedrock/interfaces/L1/IOptimismPortal2.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ interface IOptimismPortal2 {
3131
error UnexpectedList();
3232
error UnexpectedString();
3333
error Unproven();
34+
error LegacyGame();
3435

3536
event DisputeGameBlacklisted(IDisputeGame indexed disputeGame);
3637
event Initialized(uint8 version);

packages/contracts-bedrock/interfaces/L1/IOptimismPortalInterop.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ interface IOptimismPortalInterop {
3333
error UnexpectedList();
3434
error UnexpectedString();
3535
error Unproven();
36+
error LegacyGame();
3637

3738
event DisputeGameBlacklisted(IDisputeGame indexed disputeGame);
3839
event Initialized(uint8 version);

packages/contracts-bedrock/snapshots/semver-lock.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
"sourceCodeHash": "0x2d21506cc51ebe0b60bcf89883aff5e9b1269567ce44ee779de3d3940e23fb65"
2121
},
2222
"src/L1/OptimismPortal2.sol": {
23-
"initCodeHash": "0xb906cca6c1d2ef7d783f94d502bbf8704f39488bcbe4b1633f21d5a25f39d750",
24-
"sourceCodeHash": "0x2fa2648a82059eb6fc052254678d3bd2bf7952be83ab53c545c9302df3b9d1a0"
23+
"initCodeHash": "0x3f30480b47af0a965af7d38eff673fe1ef0e8704c1776eaef5648d242cfe376d",
24+
"sourceCodeHash": "0x6241a2e1e5b8fae5e17e13abcccd3d013f66317a6d7611d844b10bbb878d38c0"
2525
},
2626
"src/L1/OptimismPortalInterop.sol": {
27-
"initCodeHash": "0x92e46899517ecb927a6fea35995ebf6cc534443351d1f5806a7d34c5696c0648",
27+
"initCodeHash": "0x9e12728cae72a1c701ddc3e09fe9e3b82aa38674ab76e6d9e74f3a384dfe25d2",
2828
"sourceCodeHash": "0xc04a7f9c14a13ec3587f5cc351c8e9f27fbbe9f1291a1aba07de29edbeef418a"
2929
},
3030
"src/L1/ProtocolVersions.sol": {

packages/contracts-bedrock/src/L1/OptimismPortal2.sol

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ import {
2828
Blacklisted,
2929
Unproven,
3030
ProposalNotValidated,
31-
AlreadyFinalized
31+
AlreadyFinalized,
32+
LegacyGame
3233
} from "src/libraries/PortalErrors.sol";
3334
import { GameStatus, GameType, Claim, Timestamp } from "src/dispute/lib/Types.sol";
3435

@@ -309,7 +310,11 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
309310
if (gameType.raw() != respectedGameType.raw()) revert InvalidGameType();
310311

311312
// The game type of the DisputeGame must have been the respected game type at creation.
312-
if (!gameProxy.wasRespectedGameTypeWhenCreated()) revert InvalidGameType();
313+
try gameProxy.wasRespectedGameTypeWhenCreated() returns (bool wasRespected_) {
314+
if (!wasRespected_) revert InvalidGameType();
315+
} catch {
316+
revert LegacyGame();
317+
}
313318

314319
// Creation time must be greater than or equal to the respected game type updated time.
315320
// Games created before this timestamp are not valid and cannot be used to finalize a
@@ -541,7 +546,12 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
541546
// time. We check that the game type is the respected game type at proving time, but it's
542547
// possible that the respected game type has since changed. Users can still use this game
543548
// to finalize a withdrawal as long as it has not been otherwise invalidated.
544-
if (!disputeGameProxy.wasRespectedGameTypeWhenCreated()) revert InvalidGameType();
549+
// The game type of the DisputeGame must have been the respected game type at creation.
550+
try disputeGameProxy.wasRespectedGameTypeWhenCreated() returns (bool wasRespected_) {
551+
if (!wasRespected_) revert InvalidGameType();
552+
} catch {
553+
revert LegacyGame();
554+
}
545555

546556
// The game must have been created after `respectedGameTypeUpdatedAt`. This is to prevent users from creating
547557
// invalid disputes against a deployed game type while the off-chain challenge agents are not watching.

packages/contracts-bedrock/src/libraries/PortalErrors.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ error Unproven();
3838
error ProposalNotValidated();
3939
/// @notice Error for when a withdrawal has already been finalized.
4040
error AlreadyFinalized();
41+
/// @notice Error for when a game is a legacy game.
42+
error LegacyGame();

packages/contracts-bedrock/test/dispute/AnchorStateRegistry.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ contract AnchorStateRegistry_IsGameRetired_Test is AnchorStateRegistry_Init {
235235

236236
contract AnchorStateRegistry_IsGameProper_Test is AnchorStateRegistry_Init {
237237
/// @notice Tests that isGameProper will return true if the game meets all conditions.
238-
function test_isGameProper_meetsAllConditions_succeeds() public {
238+
function test_isGameProper_meetsAllConditions_succeeds() public view {
239239
// Game will meet all conditions by default.
240240
assertTrue(anchorStateRegistry.isGameProper(gameProxy));
241241
}

0 commit comments

Comments
 (0)