Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,17 @@
"name": "IdentityPrecompileCallFailed",
"type": "error"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "devFeature",
"type": "bytes32"
}
],
"name": "InvalidDevFeatureAccess",
Comment thread
Inphi marked this conversation as resolved.
"type": "error"
},
{
"inputs": [],
"name": "NotABlueprint",
Expand Down
8 changes: 4 additions & 4 deletions packages/contracts-bedrock/snapshots/semver-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
"sourceCodeHash": "0xfca613b5d055ffc4c3cbccb0773ddb9030abedc1aa6508c9e2e7727cc0cd617b"
},
"src/L1/OPContractsManager.sol:OPContractsManager": {
"initCodeHash": "0x4025118658a1c56c4fc2d0166081e6d27da980318e749e7811c7178115e4413e",
"sourceCodeHash": "0xdb243ac7475b0214b8f662aa04f696d9ff213dade6b1bdade379e84df419b75a"
"initCodeHash": "0xc6a5146f158bc14297447cda1668f83e8dbfdd74f1b8bc2291d9626933bd23ad",
"sourceCodeHash": "0xcb40feb5d14737e625db5b2d5819a67d33b08561e6561ce3614b60cc2abfc628"
},
"src/L1/OPContractsManagerStandardValidator.sol:OPContractsManagerStandardValidator": {
"initCodeHash": "0x57d6a6729d887ead009d518e8f17fa0d26bfc97b8efe1494ab4ef8dbb000d109",
"sourceCodeHash": "0x1d58891954cf782d2fe4f112b0c7fd25be991c2b8873f10d8545c653b517cac9"
"initCodeHash": "0xd171ea5f458bf0bea6222299283b07c73f437e8b017913afe8587bbe220d8980",
"sourceCodeHash": "0x199e719889127fd743936ab78e5b9336ce17d2bd9cbcca013bfca7399e925dbe"
},
"src/L1/OptimismPortal2.sol:OptimismPortal2": {
"initCodeHash": "0x5bf576ea7f566e402a997204988471fc9b971410aa9dff8fe810b10baf6b7456",
Expand Down
142 changes: 118 additions & 24 deletions packages/contracts-bedrock/src/L1/OPContractsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { IAddressManager } from "interfaces/legacy/IAddressManager.sol";
import { IProxyAdmin } from "interfaces/universal/IProxyAdmin.sol";
import { IDisputeGameFactory } from "interfaces/dispute/IDisputeGameFactory.sol";
import { IFaultDisputeGame } from "interfaces/dispute/IFaultDisputeGame.sol";
import { IFaultDisputeGameV2 } from "interfaces/dispute/v2/IFaultDisputeGameV2.sol";
import { IPermissionedDisputeGame } from "interfaces/dispute/IPermissionedDisputeGame.sol";
import { ISuperFaultDisputeGame } from "interfaces/dispute/ISuperFaultDisputeGame.sol";
import { ISuperPermissionedDisputeGame } from "interfaces/dispute/ISuperPermissionedDisputeGame.sol";
Expand Down Expand Up @@ -869,32 +870,61 @@ contract OPContractsManagerUpgrader is OPContractsManagerBase {
IPermissionedDisputeGame permissionedDisputeGame =
IPermissionedDisputeGame(address(getGameImplementation(dgf, GameTypes.PERMISSIONED_CANNON)));

// Update the PermissionedDisputeGame.
// We're reusing the same DelayedWETH and ASR contracts.
deployAndSetNewGameImpl({
_l2ChainId: _l2ChainId,
_disputeGame: IDisputeGame(address(permissionedDisputeGame)),
_newDelayedWeth: permissionedDisputeGame.weth(),
_newAnchorStateRegistryProxy: permissionedDisputeGame.anchorStateRegistry(),
_gameType: GameTypes.PERMISSIONED_CANNON,
_opChainConfig: _opChainConfig
});

// Now retrieve the permissionless game.
IFaultDisputeGame permissionlessDisputeGame =
IFaultDisputeGame(address(getGameImplementation(dgf, GameTypes.CANNON)));

// If it exists, replace its implementation.
// We're reusing the same DelayedWETH and ASR contracts.
if (address(permissionlessDisputeGame) != address(0)) {
if (!isDevFeatureEnabled(DevFeatures.DEPLOY_V2_DISPUTE_GAMES)) {
// Update the PermissionedDisputeGame.
// We're reusing the same DelayedWETH and ASR contracts.
deployAndSetNewGameImpl({
_l2ChainId: _l2ChainId,
_disputeGame: IDisputeGame(address(permissionlessDisputeGame)),
_newDelayedWeth: permissionlessDisputeGame.weth(),
_newAnchorStateRegistryProxy: permissionlessDisputeGame.anchorStateRegistry(),
_gameType: GameTypes.CANNON,
_disputeGame: IDisputeGame(address(permissionedDisputeGame)),
_newDelayedWeth: permissionedDisputeGame.weth(),
_newAnchorStateRegistryProxy: permissionedDisputeGame.anchorStateRegistry(),
_gameType: GameTypes.PERMISSIONED_CANNON,
_opChainConfig: _opChainConfig
});

// Now retrieve the permissionless game.
IFaultDisputeGame permissionlessDisputeGame =
IFaultDisputeGame(address(getGameImplementation(dgf, GameTypes.CANNON)));

// If it exists, replace its implementation.
// We're reusing the same DelayedWETH and ASR contracts.
if (address(permissionlessDisputeGame) != address(0)) {
deployAndSetNewGameImpl({
_l2ChainId: _l2ChainId,
_disputeGame: IDisputeGame(address(permissionlessDisputeGame)),
_newDelayedWeth: permissionlessDisputeGame.weth(),
_newAnchorStateRegistryProxy: permissionlessDisputeGame.anchorStateRegistry(),
_gameType: GameTypes.CANNON,
_opChainConfig: _opChainConfig
});
}
} else {
setNewGameImplV2({
_impls: _impls,
_l2ChainId: _l2ChainId,
_disputeGame: IDisputeGame(address(permissionedDisputeGame)),
_newDelayedWeth: permissionedDisputeGame.weth(),
_newAnchorStateRegistryProxy: permissionedDisputeGame.anchorStateRegistry(),
Comment thread
Inphi marked this conversation as resolved.
Outdated
_gameType: GameTypes.PERMISSIONED_CANNON,
_opChainConfig: _opChainConfig
});

IFaultDisputeGame permissionlessDisputeGame =
IFaultDisputeGame(address(getGameImplementation(dgf, GameTypes.CANNON)));

// If it exists, replace its implementation.
// We're reusing the same DelayedWETH and ASR contracts.
if (address(permissionlessDisputeGame) != address(0)) {
setNewGameImplV2({
_impls: _impls,
_l2ChainId: _l2ChainId,
_disputeGame: IDisputeGame(address(permissionlessDisputeGame)),
_newDelayedWeth: permissionlessDisputeGame.weth(),
_newAnchorStateRegistryProxy: permissionlessDisputeGame.anchorStateRegistry(),
_gameType: GameTypes.CANNON,
_opChainConfig: _opChainConfig
});
}
}
}

Expand Down Expand Up @@ -1007,6 +1037,70 @@ contract OPContractsManagerUpgrader is OPContractsManagerBase {
// Set the new implementation.
setDGFImplementation(dgf, _gameType, IDisputeGame(newGame));
}

/// @notice Sets the latest dispute game v2 implementations
/// @param _impls The container for the new dispute game implementations.
/// @param _l2ChainId The L2 chain ID
/// @param _disputeGame The current dispute game implementation in the dispute game factory
/// @param _newDelayedWeth The new delayed WETH implementation
/// @param _newAnchorStateRegistryProxy The new anchor state registry proxy
/// @param _gameType The type of game to deploy
/// @param _opChainConfig The OP chain configuration
function setNewGameImplV2(
OPContractsManager.Implementations memory _impls,
uint256 _l2ChainId,
IDisputeGame _disputeGame,
IDelayedWETH _newDelayedWeth,
IAnchorStateRegistry _newAnchorStateRegistryProxy,
GameType _gameType,
OPContractsManager.OpChainConfig memory _opChainConfig
)
internal
{
// If the prestate is set in the config, use it. If not set, we'll try to use the prestate
// that already exists on the current dispute game.
Claim absolutePrestate;
if (Claim.unwrap(_opChainConfig.absolutePrestate) == bytes32(0)) {
// SAFETY: both V1 and V2 games support absolutePrestate()
absolutePrestate = IFaultDisputeGameV2(address(_disputeGame)).absolutePrestate();
Comment thread
Inphi marked this conversation as resolved.
Outdated
} else {
absolutePrestate = _opChainConfig.absolutePrestate;
}

// As a sanity check, if the prestate is zero here, revert.
if (absolutePrestate.raw() == bytes32(0)) {
revert OPContractsManager.PrestateNotSet();
}

IDisputeGame newGame;
bytes memory gameArgs;
if (GameType.unwrap(_gameType) == GameType.unwrap(GameTypes.PERMISSIONED_CANNON)) {
newGame = IDisputeGame(_impls.permissionedDisputeGameV2Impl);
address proposer = getProposer(IPermissionedDisputeGame(address(_disputeGame)));
address challenger = getChallenger(IPermissionedDisputeGame(address(_disputeGame)));
Comment thread
Inphi marked this conversation as resolved.
Outdated
gameArgs = abi.encodePacked(
absolutePrestate, // 32 bytes
_impls.mipsImpl, // 20 bytes
address(_newAnchorStateRegistryProxy), // 20 bytes
address(_newDelayedWeth), // 20 bytes
_l2ChainId, // 32 bytes
proposer, // 20 bytes
challenger // 20 bytes
);
} else {
newGame = IDisputeGame(_impls.faultDisputeGameV2Impl);
gameArgs = abi.encodePacked(
absolutePrestate, // 32 bytes
_impls.mipsImpl, // 20 bytes
address(_newAnchorStateRegistryProxy), // 20 bytes
address(_newDelayedWeth), // 20 bytes
_l2ChainId // 32 bytes
);
}

IDisputeGameFactory dgf = IDisputeGameFactory(_opChainConfig.systemConfigProxy.disputeGameFactory());
setDGFImplementation(dgf, _gameType, IDisputeGame(newGame), gameArgs);
}
}

contract OPContractsManagerDeployer is OPContractsManagerBase {
Expand Down Expand Up @@ -1898,9 +1992,9 @@ contract OPContractsManager is ISemver {

// -------- Constants and Variables --------

/// @custom:semver 4.2.0
/// @custom:semver 4.3.0
function version() public pure virtual returns (string memory) {
return "4.2.0";
return "4.3.0";
}

OPContractsManagerGameTypeAdder public immutable opcmGameTypeAdder;
Expand Down
Loading