diff --git a/packages/contracts-bedrock/interfaces/dispute/IFaultDisputeGame.sol b/packages/contracts-bedrock/interfaces/dispute/IFaultDisputeGame.sol index 86ace4d527077..80b41bc958b68 100644 --- a/packages/contracts-bedrock/interfaces/dispute/IFaultDisputeGame.sol +++ b/packages/contracts-bedrock/interfaces/dispute/IFaultDisputeGame.sol @@ -41,7 +41,6 @@ interface IFaultDisputeGame is IDisputeGame { error AlreadyInitialized(); error AnchorRootNotFound(); - error BadExtraData(); error BlockNumberMatches(); error BondTransferFailed(); error CannotDefendRootClaim(); diff --git a/packages/contracts-bedrock/interfaces/dispute/IPermissionedDisputeGame.sol b/packages/contracts-bedrock/interfaces/dispute/IPermissionedDisputeGame.sol index 788c65790c030..aa174ddaa1d39 100644 --- a/packages/contracts-bedrock/interfaces/dispute/IPermissionedDisputeGame.sol +++ b/packages/contracts-bedrock/interfaces/dispute/IPermissionedDisputeGame.sol @@ -30,7 +30,6 @@ interface IPermissionedDisputeGame is IDisputeGame { error AlreadyInitialized(); error AnchorRootNotFound(); - error BadExtraData(); error BlockNumberMatches(); error BondTransferFailed(); error CannotDefendRootClaim(); diff --git a/packages/contracts-bedrock/interfaces/dispute/ISuperFaultDisputeGame.sol b/packages/contracts-bedrock/interfaces/dispute/ISuperFaultDisputeGame.sol index 276551af7a740..390f09e537a90 100644 --- a/packages/contracts-bedrock/interfaces/dispute/ISuperFaultDisputeGame.sol +++ b/packages/contracts-bedrock/interfaces/dispute/ISuperFaultDisputeGame.sol @@ -40,7 +40,6 @@ interface ISuperFaultDisputeGame is IDisputeGame { error AlreadyInitialized(); error AnchorRootNotFound(); - error BadExtraData(); error BondTransferFailed(); error CannotDefendRootClaim(); error ClaimAboveSplit(); diff --git a/packages/contracts-bedrock/interfaces/dispute/ISuperPermissionedDisputeGame.sol b/packages/contracts-bedrock/interfaces/dispute/ISuperPermissionedDisputeGame.sol index 7e2b5e73aa446..2a2fed003635d 100644 --- a/packages/contracts-bedrock/interfaces/dispute/ISuperPermissionedDisputeGame.sol +++ b/packages/contracts-bedrock/interfaces/dispute/ISuperPermissionedDisputeGame.sol @@ -41,7 +41,6 @@ interface ISuperPermissionedDisputeGame is IDisputeGame { error AlreadyInitialized(); error AnchorRootNotFound(); - error BadExtraData(); error BondTransferFailed(); error CannotDefendRootClaim(); error ClaimAboveSplit(); diff --git a/packages/contracts-bedrock/snapshots/abi/FaultDisputeGame.json b/packages/contracts-bedrock/snapshots/abi/FaultDisputeGame.json index 26a1351d53d79..e19ce9e2812a4 100644 --- a/packages/contracts-bedrock/snapshots/abi/FaultDisputeGame.json +++ b/packages/contracts-bedrock/snapshots/abi/FaultDisputeGame.json @@ -1016,11 +1016,6 @@ "name": "AnchorRootNotFound", "type": "error" }, - { - "inputs": [], - "name": "BadExtraData", - "type": "error" - }, { "inputs": [], "name": "BlockNumberMatches", diff --git a/packages/contracts-bedrock/snapshots/abi/PermissionedDisputeGame.json b/packages/contracts-bedrock/snapshots/abi/PermissionedDisputeGame.json index 8bb88f4663986..7548b6d348473 100644 --- a/packages/contracts-bedrock/snapshots/abi/PermissionedDisputeGame.json +++ b/packages/contracts-bedrock/snapshots/abi/PermissionedDisputeGame.json @@ -1057,11 +1057,6 @@ "name": "BadAuth", "type": "error" }, - { - "inputs": [], - "name": "BadExtraData", - "type": "error" - }, { "inputs": [], "name": "BlockNumberMatches", diff --git a/packages/contracts-bedrock/snapshots/abi/SuperFaultDisputeGame.json b/packages/contracts-bedrock/snapshots/abi/SuperFaultDisputeGame.json index 6ea8b243ed648..b746003f132ef 100644 --- a/packages/contracts-bedrock/snapshots/abi/SuperFaultDisputeGame.json +++ b/packages/contracts-bedrock/snapshots/abi/SuperFaultDisputeGame.json @@ -924,11 +924,6 @@ "name": "AnchorRootNotFound", "type": "error" }, - { - "inputs": [], - "name": "BadExtraData", - "type": "error" - }, { "inputs": [], "name": "BondTransferFailed", diff --git a/packages/contracts-bedrock/snapshots/abi/SuperPermissionedDisputeGame.json b/packages/contracts-bedrock/snapshots/abi/SuperPermissionedDisputeGame.json index b9988791a0f77..17c01e9593fa6 100644 --- a/packages/contracts-bedrock/snapshots/abi/SuperPermissionedDisputeGame.json +++ b/packages/contracts-bedrock/snapshots/abi/SuperPermissionedDisputeGame.json @@ -965,11 +965,6 @@ "name": "BadAuth", "type": "error" }, - { - "inputs": [], - "name": "BadExtraData", - "type": "error" - }, { "inputs": [], "name": "BondTransferFailed", diff --git a/packages/contracts-bedrock/snapshots/semver-lock.json b/packages/contracts-bedrock/snapshots/semver-lock.json index 83294cb7a89c9..01f783e64d759 100644 --- a/packages/contracts-bedrock/snapshots/semver-lock.json +++ b/packages/contracts-bedrock/snapshots/semver-lock.json @@ -24,8 +24,8 @@ "sourceCodeHash": "0xb1264c7af50b6134c98cb82d1ffc7891adf97068fa7048ee70992fb94bc15bd1" }, "src/L1/OPContractsManagerStandardValidator.sol:OPContractsManagerStandardValidator": { - "initCodeHash": "0x4bf3bbdaf08989de57408b2ea88995e2f477b98add164dbf82e0dceb01417ef6", - "sourceCodeHash": "0x36861c793b247f4922ecd77b1b153a0f2a47a129117fbe59e7e1f6498ef46c42" + "initCodeHash": "0xde9192e313dca35250587bef0c0257322c7d0890f72ef864974910e616213b8f", + "sourceCodeHash": "0x1a2b30e391397cea5f3cb58e23bd5987b620609b40ad156b79d80bc8082e8515" }, "src/L1/OptimismPortal2.sol:OptimismPortal2": { "initCodeHash": "0x785b09610b2da65d248b49150fafc85b8369c921ddae95b0ea45608b1ce5cbc6", @@ -156,20 +156,20 @@ "sourceCodeHash": "0x1871aaeba0658f17270190cc95ffff172d92dca795d698401ec34a7462bf5242" }, "src/dispute/FaultDisputeGame.sol:FaultDisputeGame": { - "initCodeHash": "0xe7d3c982532946d196d7efadb9e2576c76b8f9e0d1f885ac36977d6f3fb72a65", - "sourceCodeHash": "0x63222e6926c8dd050d1adc0e65039c42382f269c3b0e113751d79e7a5167b7ac" + "initCodeHash": "0x9748700f873b6fe0599f9674a4c2dfbc9e35bbc918ebd2f7c54f709b1480df36", + "sourceCodeHash": "0xe6d4bdbfb05491164f203f1c5542a7ba961a20727a5b706b393f4f886ba5f901" }, "src/dispute/PermissionedDisputeGame.sol:PermissionedDisputeGame": { - "initCodeHash": "0xefa478f976e55eb53fcccf653b202bc2532781230f20013450ce0845b77d815c", - "sourceCodeHash": "0x335a503a4cc02dd30d88d163393680f3fd89168e0faa4fa4b0ae5da399656f91" + "initCodeHash": "0x1018dcbe7714a80a33dd8ad09bcc533dc6cbe1e97d2a17d3780887d406fc46a8", + "sourceCodeHash": "0x09455fe79619e63a08244647dca734fa58e96352fe21aeb289cc467437389125" }, "src/dispute/SuperFaultDisputeGame.sol:SuperFaultDisputeGame": { - "initCodeHash": "0xe7591ef9c806c236d78ed4b83e81701732e0fe2237d3d455d26f054aefcc54b6", - "sourceCodeHash": "0x089f457ecaa85379bcdb4b843a2b2db9616d87f957f7964de23f80e7655d3f53" + "initCodeHash": "0x687bde7b8632b47dc16530cc523946e4109e023f0d32c9bf0281b51f412f0f0d", + "sourceCodeHash": "0x7dd3852f6b744ddfb08699bf2d201eba92314ef70c9c62c06d84b0baac5f0299" }, "src/dispute/SuperPermissionedDisputeGame.sol:SuperPermissionedDisputeGame": { - "initCodeHash": "0x615baee73b605785025893fad655f8b7d8d546d77fbeca1f799000513ded3309", - "sourceCodeHash": "0x8fdd69d4bcd33a3d8b49a73ff5b6855f9ad5f7e2b7393e67cd755973b127b1e8" + "initCodeHash": "0x9c954076097eb80f70333a387f12ba190eb9374aebb923ce30ecfe1d17030cc0", + "sourceCodeHash": "0x9baa0f9e744cc0ecc61d0fade8bffc18321b228833ea0904dc645f3975be9ed1" }, "src/legacy/DeployerWhitelist.sol:DeployerWhitelist": { "initCodeHash": "0x53099379ed48b87f027d55712dbdd1da7d7099925426eb0531da9c0012e02c29", diff --git a/packages/contracts-bedrock/src/L1/OPContractsManagerStandardValidator.sol b/packages/contracts-bedrock/src/L1/OPContractsManagerStandardValidator.sol index 3d6debcc09ee4..053a3d0f8f87e 100644 --- a/packages/contracts-bedrock/src/L1/OPContractsManagerStandardValidator.sol +++ b/packages/contracts-bedrock/src/L1/OPContractsManagerStandardValidator.sol @@ -36,8 +36,8 @@ import { IProxyAdminOwnedBase } from "interfaces/L1/IProxyAdminOwnedBase.sol"; /// before and after an upgrade. contract OPContractsManagerStandardValidator is ISemver { /// @notice The semantic version of the OPContractsManagerStandardValidator contract. - /// @custom:semver 1.6.0 - string public constant version = "1.6.0"; + /// @custom:semver 1.6.0-patch.1 + string public constant version = "1.6.0-patch.1"; /// @notice The SuperchainConfig contract. ISuperchainConfig public superchainConfig; @@ -226,7 +226,7 @@ contract OPContractsManagerStandardValidator is ISemver { /// @notice Returns the expected PermissionedDisputeGame version. function permissionedDisputeGameVersion() public pure returns (string memory) { - return "1.8.0"; + return "1.7.0"; } /// @notice Returns the expected PreimageOracle version. diff --git a/packages/contracts-bedrock/src/dispute/FaultDisputeGame.sol b/packages/contracts-bedrock/src/dispute/FaultDisputeGame.sol index 8689221a03a8a..bedb826f97f37 100644 --- a/packages/contracts-bedrock/src/dispute/FaultDisputeGame.sol +++ b/packages/contracts-bedrock/src/dispute/FaultDisputeGame.sol @@ -57,8 +57,7 @@ import { InvalidBondDistributionMode, GameNotResolved, ReservedGameType, - GamePaused, - BadExtraData + GamePaused } from "src/dispute/lib/Errors.sol"; // Interfaces @@ -172,9 +171,9 @@ contract FaultDisputeGame is Clone, ISemver { uint256 internal constant HEADER_BLOCK_NUMBER_INDEX = 8; /// @notice Semantic version. - /// @custom:semver 1.8.0 + /// @custom:semver 1.7.0 function version() public pure virtual returns (string memory) { - return "1.8.0"; + return "1.7.0"; } /// @notice The starting timestamp of the game @@ -313,14 +312,20 @@ contract FaultDisputeGame is Clone, ISemver { // in the factory, but are not used by the game, which would allow for multiple dispute games for the same // output proposal to be created. // - // Expected length: 122 bytes - // - 4 bytes selector - // - 20 bytes creator address - // - 32 bytes root claim - // - 32 bytes l1 head - // - 32 bytes extraData - // - 2 bytes CWIA length - if (msg.data.length != 122) revert BadExtraData(); + // Expected length: 0x7A + // - 0x04 selector + // - 0x14 creator address + // - 0x20 root claim + // - 0x20 l1 head + // - 0x20 extraData + // - 0x02 CWIA bytes + assembly { + if iszero(eq(calldatasize(), 0x7A)) { + // Store the selector for `BadExtraData()` & revert + mstore(0x00, 0x9824bdab) + revert(0x1C, 0x04) + } + } // Do not allow the game to be initialized if the root claim corresponds to a block at or before the // configured starting block number. @@ -640,7 +645,7 @@ contract FaultDisputeGame is Clone, ISemver { /// @notice The l2BlockNumber of the disputed output root in the `L2OutputOracle`. function l2BlockNumber() public pure returns (uint256 l2BlockNumber_) { - l2BlockNumber_ = _getArgUint256(84); + l2BlockNumber_ = _getArgUint256(0x54); } /// @notice The l2SequenceNumber of the disputed output root in the `L2OutputOracle` (in this case - block number). @@ -855,21 +860,21 @@ contract FaultDisputeGame is Clone, ISemver { /// @dev `clones-with-immutable-args` argument #1 /// @return creator_ The creator of the dispute game. function gameCreator() public pure returns (address creator_) { - creator_ = _getArgAddress(0); + creator_ = _getArgAddress(0x00); } /// @notice Getter for the root claim. /// @dev `clones-with-immutable-args` argument #2 /// @return rootClaim_ The root claim of the DisputeGame. function rootClaim() public pure returns (Claim rootClaim_) { - rootClaim_ = Claim.wrap(_getArgBytes32(20)); + rootClaim_ = Claim.wrap(_getArgBytes32(0x14)); } /// @notice Getter for the parent hash of the L1 block when the dispute game was created. /// @dev `clones-with-immutable-args` argument #3 /// @return l1Head_ The parent hash of the L1 block when the dispute game was created. function l1Head() public pure returns (Hash l1Head_) { - l1Head_ = Hash.wrap(_getArgBytes32(52)); + l1Head_ = Hash.wrap(_getArgBytes32(0x34)); } /// @notice Getter for the extra data. @@ -878,7 +883,7 @@ contract FaultDisputeGame is Clone, ISemver { function extraData() public pure returns (bytes memory extraData_) { // The extra data starts at the second word within the cwia calldata and // is 32 bytes long. - extraData_ = _getArgBytes(84, 32); + extraData_ = _getArgBytes(0x54, 0x20); } /// @notice A compliant implementation of this interface should return the components of the diff --git a/packages/contracts-bedrock/src/dispute/PermissionedDisputeGame.sol b/packages/contracts-bedrock/src/dispute/PermissionedDisputeGame.sol index f356190ccdd7e..8e5574512dd11 100644 --- a/packages/contracts-bedrock/src/dispute/PermissionedDisputeGame.sol +++ b/packages/contracts-bedrock/src/dispute/PermissionedDisputeGame.sol @@ -32,9 +32,9 @@ contract PermissionedDisputeGame is FaultDisputeGame { } /// @notice Semantic version. - /// @custom:semver 1.8.0 + /// @custom:semver 1.7.0 function version() public pure override returns (string memory) { - return "1.8.0"; + return "1.7.0"; } /// @param _params Parameters for creating a new FaultDisputeGame. diff --git a/packages/contracts-bedrock/src/dispute/SuperFaultDisputeGame.sol b/packages/contracts-bedrock/src/dispute/SuperFaultDisputeGame.sol index ccb4e882395bd..17c8a5bbd7b97 100644 --- a/packages/contracts-bedrock/src/dispute/SuperFaultDisputeGame.sol +++ b/packages/contracts-bedrock/src/dispute/SuperFaultDisputeGame.sol @@ -50,8 +50,7 @@ import { InvalidBondDistributionMode, GameNotResolved, ReservedGameType, - GamePaused, - BadExtraData + GamePaused } from "src/dispute/lib/Errors.sol"; // Interfaces @@ -165,9 +164,9 @@ contract SuperFaultDisputeGame is Clone, ISemver { Position internal constant ROOT_POSITION = Position.wrap(1); /// @notice Semantic version. - /// @custom:semver 0.5.0 + /// @custom:semver 0.4.0 function version() public pure virtual returns (string memory) { - return "0.5.0"; + return "0.4.0"; } /// @notice The starting timestamp of the game @@ -303,14 +302,20 @@ contract SuperFaultDisputeGame is Clone, ISemver { // in the factory, but are not used by the game, which would allow for multiple dispute games for the same // output proposal to be created. // - // Expected length: 122 bytes - // - 4 bytes selector - // - 20 bytes creator address - // - 32 bytes root claim - // - 32 bytes l1 head - // - 32 bytes extraData - // - 2 bytes CWIA length - if (msg.data.length != 122) revert BadExtraData(); + // Expected length: 0x7A + // - 0x04 selector + // - 0x14 creator address + // - 0x20 root claim + // - 0x20 l1 head + // - 0x20 extraData + // - 0x02 CWIA bytes + assembly { + if iszero(eq(calldatasize(), 0x7A)) { + // Store the selector for `BadExtraData()` & revert + mstore(0x00, 0x9824bdab) + revert(0x1C, 0x04) + } + } // Do not allow the game to be initialized if the root claim corresponds to a l2 sequence number (timestamp) at // or before the configured starting sequence number. @@ -613,7 +618,7 @@ contract SuperFaultDisputeGame is Clone, ISemver { /// @notice The l2SequenceNumber (timestamp) of the disputed super root in game root claim. function l2SequenceNumber() public pure returns (uint256 l2SequenceNumber_) { - l2SequenceNumber_ = _getArgUint256(84); + l2SequenceNumber_ = _getArgUint256(0x54); } /// @notice Only the starting sequence number (timestamp) of the game. @@ -767,21 +772,21 @@ contract SuperFaultDisputeGame is Clone, ISemver { /// @dev `clones-with-immutable-args` argument #1 /// @return creator_ The creator of the dispute game. function gameCreator() public pure returns (address creator_) { - creator_ = _getArgAddress(0); + creator_ = _getArgAddress(0x00); } /// @notice Getter for the root claim. /// @dev `clones-with-immutable-args` argument #2 /// @return rootClaim_ The root claim of the DisputeGame. function rootClaim() public pure returns (Claim rootClaim_) { - rootClaim_ = Claim.wrap(_getArgBytes32(20)); + rootClaim_ = Claim.wrap(_getArgBytes32(0x14)); } /// @notice Getter for the parent hash of the L1 block when the dispute game was created. /// @dev `clones-with-immutable-args` argument #3 /// @return l1Head_ The parent hash of the L1 block when the dispute game was created. function l1Head() public pure returns (Hash l1Head_) { - l1Head_ = Hash.wrap(_getArgBytes32(52)); + l1Head_ = Hash.wrap(_getArgBytes32(0x34)); } /// @notice Getter for the extra data. @@ -790,7 +795,7 @@ contract SuperFaultDisputeGame is Clone, ISemver { function extraData() public pure returns (bytes memory extraData_) { // The extra data starts at the second word within the cwia calldata and // is 32 bytes long. - extraData_ = _getArgBytes(84, 32); + extraData_ = _getArgBytes(0x54, 0x20); } /// @notice A compliant implementation of this interface should return the components of the diff --git a/packages/contracts-bedrock/src/dispute/SuperPermissionedDisputeGame.sol b/packages/contracts-bedrock/src/dispute/SuperPermissionedDisputeGame.sol index 429bef26ce1ff..d41e3f0171e33 100644 --- a/packages/contracts-bedrock/src/dispute/SuperPermissionedDisputeGame.sol +++ b/packages/contracts-bedrock/src/dispute/SuperPermissionedDisputeGame.sol @@ -33,9 +33,9 @@ contract SuperPermissionedDisputeGame is SuperFaultDisputeGame { } /// @notice Semantic version. - /// @custom:semver 0.5.0 + /// @custom:semver 0.4.0 function version() public pure override returns (string memory) { - return "0.5.0"; + return "0.4.0"; } /// @param _params Parameters for creating a new FaultDisputeGame. diff --git a/packages/contracts-bedrock/test/L1/OPContractsManager.t.sol b/packages/contracts-bedrock/test/L1/OPContractsManager.t.sol index 92113e5d473f7..e98bb2b4e5697 100644 --- a/packages/contracts-bedrock/test/L1/OPContractsManager.t.sol +++ b/packages/contracts-bedrock/test/L1/OPContractsManager.t.sol @@ -462,13 +462,13 @@ contract OPContractsManager_Upgrade_Harness is CommonTest { // Check that the PermissionedDisputeGame is upgraded to the expected version, references // the correct anchor state and has the mipsImpl. Although Upgrade 15 doesn't actually // change any of this, we might as well check it again. - assertEq(ISemver(address(pdg)).version(), "1.8.0"); + assertEq(ISemver(address(pdg)).version(), "1.7.0"); assertEq(address(pdg.vm()), impls.mipsImpl); assertEq(pdg.l2ChainId(), oldPDG.l2ChainId()); // If the old FaultDisputeGame exists, we expect it to be upgraded. Check same as above. if (address(oldFDG) != address(0)) { - assertEq(ISemver(address(fdg)).version(), "1.8.0"); + assertEq(ISemver(address(fdg)).version(), "1.7.0"); assertEq(address(fdg.vm()), impls.mipsImpl); assertEq(fdg.l2ChainId(), oldFDG.l2ChainId()); }