Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ interface IOptimismPortal2 is IProxyAdminOwnedBase {
function respectedGameTypeUpdatedAt() external view returns (uint64);
function superRootsActive() external view returns (bool);
function systemConfig() external view returns (ISystemConfig);
function upgrade(IAnchorStateRegistry _anchorStateRegistry, IETHLockbox _ethLockbox, ISystemConfig _systemConfig) external;
function upgrade(IAnchorStateRegistry _anchorStateRegistry, IETHLockbox _ethLockbox) external;
function version() external pure returns (string memory);
function migrateLiquidity() external;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface ISuperchainConfig is IProxyAdminOwnedBase {

error SuperchainConfig_OnlyGuardian();
error SuperchainConfig_AlreadyPaused(address identifier);
error SuperchainConfig_NotAlreadyPaused(address identifier);
error ReinitializableBase_ZeroInitVersion();

function guardian() external view returns (address);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -789,11 +789,6 @@
"internalType": "contract IETHLockbox",
"name": "_ethLockbox",
"type": "address"
},
{
"internalType": "contract ISystemConfig",
"name": "_systemConfig",
"type": "address"
}
],
"name": "upgrade",
Expand Down
11 changes: 11 additions & 0 deletions packages/contracts-bedrock/snapshots/abi/SuperchainConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,17 @@
"name": "SuperchainConfig_AlreadyPaused",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "identifier",
"type": "address"
}
],
"name": "SuperchainConfig_NotAlreadyPaused",
"type": "error"
},
{
"inputs": [],
"name": "SuperchainConfig_OnlyGuardian",
Expand Down
48 changes: 24 additions & 24 deletions packages/contracts-bedrock/snapshots/semver-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,36 @@
"sourceCodeHash": "0x6c9d3e2dee44c234d59ab93b6564536dfd807f1c4a02a82d5393bc53cb15b8b7"
},
"src/L1/L1CrossDomainMessenger.sol:L1CrossDomainMessenger": {
"initCodeHash": "0x08cddeb55338b0783cd4dc75d7c62ff2fc02589c47bd5e4ed1de08cb58d4decf",
"sourceCodeHash": "0xd1bb05ad9cdee4d62c6ec7e70a4679d95278c308e73cb4954ccdfee304fa9449"
"initCodeHash": "0x117e4126f2accbcd0c4de00b8d19f522e76396dd39145b4c2e2b4f9dfa1b03ef",
"sourceCodeHash": "0x66b6e4d41c40efcc50b644d22d736408e28a73a6b55b18fcbb89a83bd3230d53"
},
"src/L1/L1ERC721Bridge.sol:L1ERC721Bridge": {
"initCodeHash": "0xf05ae41b99405e74ecb84ee39b74c5655eced21ab02af0b475615396060fc267",
"sourceCodeHash": "0xfcfc27b034cf2898d8795d60a410c66eba13ded52fc5f4ac71c2f9160903c36e"
"initCodeHash": "0xf1eaecec5e9c9c3d143bc9980d15e4671e97cb840f044bc2189a9d42ea7a1ef7",
"sourceCodeHash": "0x24e870fc3620d07ef9e336bd56e0df0604df69a2909c1aaf709f2c253ad16c78"
},
"src/L1/L1StandardBridge.sol:L1StandardBridge": {
"initCodeHash": "0x65c7197a676d93990f6c26d5e2cc5188bda9161633223c339588ee293b298157",
"sourceCodeHash": "0x86d7db4348cc8d0329da82ffef0d9cde1666e47d1443aca6154d6e03a64a0854"
"initCodeHash": "0x11e28569436e16691f03820e0fd5252492706f5855b350439f695c7e4cd331c3",
"sourceCodeHash": "0x11b35ee81f797b30ee834e2ffad52686d2100d7ee139db4299b7d854dba25550"
},
"src/L1/OPContractsManager.sol:OPContractsManager": {
"initCodeHash": "0xe3a452b02dfbd68c747788454e97244e52d46d1d1468dfa0590252824630ca58",
"sourceCodeHash": "0x8b806713bfd96b9a84b3b3738988fe47c187b0ebc69829d42f3d4394f15f64fb"
"initCodeHash": "0xab0bd49534411b7f57a20d897ea495dfea419421d4caec392371a4670bfa1ae3",
"sourceCodeHash": "0xafa3ebc3061831c4503664dff2e290934a2ba0ec7be354e1a11afcf9d130962e"
},
"src/L1/OptimismPortal2.sol:OptimismPortal2": {
"initCodeHash": "0x8bcea71af244b56d0615f0ff63ce381549575a605422c634a1afd5c6bcb442bb",
"sourceCodeHash": "0x0f1ae4b7a9ec316ab12aacce38933ce23775a59249f8b433f152d6df7184cb56"
"initCodeHash": "0x6f0c9089e4cbe2360473c95235115a4eb31462cd06799cd7ff288fc85efdbf91",
"sourceCodeHash": "0x2fa10a8e28dac549ec29270aa0f3ddd8963873762fd8dcd19a0fc8bc14e8d1fe"
},
"src/L1/ProtocolVersions.sol:ProtocolVersions": {
"initCodeHash": "0x5a76c8530cb24cf23d3baacc6eefaac226382af13f1e2a35535d2ec2b0573b29",
"sourceCodeHash": "0xb3e32b18c95d4940980333e1e99b4dcf42d8a8bfce78139db4dc3fb06e9349d0"
},
"src/L1/SuperchainConfig.sol:SuperchainConfig": {
"initCodeHash": "0x29db031af64093ea8439b7a3cdeb30ae209ff34e946e026f1c7c4a969a07d9a9",
"sourceCodeHash": "0xa53695ff8493be42eb4b7cfdc50ed165fef293075df3c38a29e0695095299c78"
"initCodeHash": "0x5c6d81d8c998a4fbe2b97737584197930a54c0bfc198ef62eae049b163e893aa",
"sourceCodeHash": "0x2a2b109a66b0025f118b64e2a81ad88fd097ce3cb2adc370b5bb3d6bd2029ddd"
},
"src/L1/SystemConfig.sol:SystemConfig": {
"initCodeHash": "0x8be717b2c665e36e0c619f072b9d3a80591d42d58f69815782d077a348a02f34",
"sourceCodeHash": "0x83add011a0950ab0b3aecb62b6b7a47bfaf3176a095f81491d1871b897023fc3"
"initCodeHash": "0x19e352bb99cab389e0eead6178746c49b14d061bea89c444f26e768f601bd6d8",
"sourceCodeHash": "0x5ab5f6a63e40b3c491167afa4a207daebc87286829e3cf07cc2a8ce04abe70e9"
},
"src/L2/BaseFeeVault.sol:BaseFeeVault": {
"initCodeHash": "0x9b664e3d84ad510091337b4aacaa494b142512e2f6f7fbcdb6210ed62ca9b885",
Expand Down Expand Up @@ -140,24 +140,24 @@
"sourceCodeHash": "0x03c160168986ffc8d26a90c37366e7ad6da03f49d83449e1f8b3de0f4b590f6f"
},
"src/dispute/AnchorStateRegistry.sol:AnchorStateRegistry": {
"initCodeHash": "0x963778e4ab7198b74d250ca3f08d928a614db7760372a9e889956ebfad520af2",
"sourceCodeHash": "0x944c0d0c611fcaeff3f93516a76d3380cc1d98c28f035e1eebfed22616b6c3e6"
"initCodeHash": "0x9bb9cd78ac1d15844fbff2e7c759f2c949f3aa1a8d950d54ddb4b1ed88863239",
"sourceCodeHash": "0xf2715ff5393244742428454e1661aae7a56433867ee7bc563f44ad572c492d82"
},
"src/dispute/DelayedWETH.sol:DelayedWETH": {
"initCodeHash": "0xa8f60e142108b33675a8f6b6979c73b96eea247884842d796f9f878904c0a906",
"sourceCodeHash": "0xdebf2ab3af4d5549c40e9dd9db6b2458af286f323b6891f3b0c4e89f3c8928db"
},
"src/dispute/DisputeGameFactory.sol:DisputeGameFactory": {
"initCodeHash": "0x7b7e20657b57920938f6bb97b2cb80c6e99a575394f0fb53818b5c162a8e97c9",
"sourceCodeHash": "0x4037e9b492045bd7c630aa20ae4687a32551965f96d579093670beece0ddce3b"
"initCodeHash": "0xa3e6a7466e16e6b7a8ce7a257ec543c1bf675e24f53565080d826404654b9262",
"sourceCodeHash": "0x1871aaeba0658f17270190cc95ffff172d92dca795d698401ec34a7462bf5242"
},
"src/dispute/FaultDisputeGame.sol:FaultDisputeGame": {
"initCodeHash": "0x143ba465e9d37cf169430322b1f8e4fc3520968a8696ceb20c864a259ce899b1",
"sourceCodeHash": "0x55179ce163dacd3470fee90b203dc552b3f1e394c70c6c3e9c072f7d8cb119e1"
"initCodeHash": "0x9748700f873b6fe0599f9674a4c2dfbc9e35bbc918ebd2f7c54f709b1480df36",
"sourceCodeHash": "0xe6d4bdbfb05491164f203f1c5542a7ba961a20727a5b706b393f4f886ba5f901"
},
"src/dispute/PermissionedDisputeGame.sol:PermissionedDisputeGame": {
"initCodeHash": "0x2a16858f30102c70a291edd92a27af30ff64b822254a1e83db3ec547ee7db3b5",
"sourceCodeHash": "0xa47741a34aaa6adec158032da19a98ca3dae696858ceede361c6dda9c6aa3f31"
"initCodeHash": "0x1018dcbe7714a80a33dd8ad09bcc533dc6cbe1e97d2a17d3780887d406fc46a8",
"sourceCodeHash": "0x09455fe79619e63a08244647dca734fa58e96352fe21aeb289cc467437389125"
},
"src/dispute/SuperFaultDisputeGame.sol:SuperFaultDisputeGame": {
"initCodeHash": "0x687bde7b8632b47dc16530cc523946e4109e023f0d32c9bf0281b51f412f0f0d",
Expand All @@ -180,8 +180,8 @@
"sourceCodeHash": "0x62c9a6182d82692fb9c173ddb0d7978bcff2d1d4dc8cd2f10625e1e65bda6888"
},
"src/safe/DeputyPauseModule.sol:DeputyPauseModule": {
"initCodeHash": "0xf5d06ae8d238d428216931738fd01cccb9933835347d174143f8bba069593b00",
"sourceCodeHash": "0x18a5c7268ce9f43e3a58681aec606c40ddfdc0d59a1668b93716517b0ce29361"
"initCodeHash": "0x4685af7d7c54b3bc5614afb735f34ae311d1d86d5112b9d28d931bc372b94ea8",
"sourceCodeHash": "0x2dc7c513be25e1350ae1caa71adad91a7cde91125540699ce83489dd772330ad"
},
"src/safe/LivenessGuard.sol:LivenessGuard": {
"initCodeHash": "0xc8e29e8b12f423c8cd229a38bc731240dd815d96f1b0ab96c71494dde63f6a81",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ProxyAdminOwnedBase, Re
address private spacer_253_0_20;

/// @notice Semantic version.
/// @custom:semver 2.8.0
string public constant version = "2.8.0";
/// @custom:semver 2.9.0
string public constant version = "2.9.0";

/// @notice Contract of the SystemConfig.
ISystemConfig public systemConfig;
Expand Down Expand Up @@ -68,7 +68,6 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ProxyAdminOwnedBase, Re

// Now perform upgrade logic.
systemConfig = _systemConfig;
spacer_251_0_20 = address(0);
}

/// @inheritdoc CrossDomainMessenger
Expand Down
5 changes: 2 additions & 3 deletions packages/contracts-bedrock/src/L1/L1ERC721Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ contract L1ERC721Bridge is ERC721Bridge, ProxyAdminOwnedBase, ReinitializableBas
address private spacer_50_0_20;

/// @notice Semantic version.
/// @custom:semver 2.6.0
string public constant version = "2.6.0";
/// @custom:semver 2.7.0
string public constant version = "2.7.0";

/// @notice Address of the SystemConfig contract.
ISystemConfig public systemConfig;
Expand Down Expand Up @@ -70,7 +70,6 @@ contract L1ERC721Bridge is ERC721Bridge, ProxyAdminOwnedBase, ReinitializableBas

// Now perform upgrade logic.
systemConfig = _systemConfig;
spacer_50_0_20 = address(0);
}

/// @inheritdoc ERC721Bridge
Expand Down
5 changes: 2 additions & 3 deletions packages/contracts-bedrock/src/L1/L1StandardBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ contract L1StandardBridge is StandardBridge, ProxyAdminOwnedBase, Reinitializabl
);

/// @notice Semantic version.
/// @custom:semver 2.5.0
string public constant version = "2.5.0";
/// @custom:semver 2.6.0
string public constant version = "2.6.0";

/// @custom:legacy
/// @custom:spacer superchainConfig
Expand Down Expand Up @@ -127,7 +127,6 @@ contract L1StandardBridge is StandardBridge, ProxyAdminOwnedBase, Reinitializabl

// Now perform upgrade logic.
systemConfig = _systemConfig;
spacer_50_0_20 = address(0);
}

/// @inheritdoc StandardBridge
Expand Down
13 changes: 7 additions & 6 deletions packages/contracts-bedrock/src/L1/OPContractsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ contract OPContractsManagerUpgrader is OPContractsManagerBase {
_l2ChainId: l2ChainId,
_proxyAdmin: _opChainConfigs[i].proxyAdmin,
_saltMixer: reusableSaltMixer(_opChainConfigs[i]),
_contractName: "AnchorStateRegistry-SOT"
_contractName: "AnchorStateRegistry-U16"
})
);

Expand Down Expand Up @@ -714,13 +714,13 @@ contract OPContractsManagerUpgrader is OPContractsManagerBase {
_l2ChainId: l2ChainId,
_proxyAdmin: _opChainConfigs[i].proxyAdmin,
_saltMixer: reusableSaltMixer(_opChainConfigs[i]),
_contractName: "ETHLockbox"
_contractName: "ETHLockbox-U16"
})
);

// Upgrade the OptimismPortal contract first so that the SystemConfig will have
// the SuperchainConfig reference required in the ETHLockbox.
optimismPortal.upgrade(newAnchorStateRegistryProxy, ethLockbox, _opChainConfigs[i].systemConfigProxy);
optimismPortal.upgrade(newAnchorStateRegistryProxy, ethLockbox);

// Initialize the ETHLockbox setting the OptimismPortal as an authorized portal.
IOptimismPortal[] memory portals = new IOptimismPortal[](1);
Expand Down Expand Up @@ -1754,9 +1754,9 @@ contract OPContractsManager is ISemver {

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

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

OPContractsManagerGameTypeAdder public immutable opcmGameTypeAdder;
Expand Down Expand Up @@ -1917,7 +1917,8 @@ contract OPContractsManager is ISemver {
_performDelegateCall(address(opcmGameTypeAdder), data);
}

/// @notice Migrates the Optimism contracts to the latest version. This is a stub for now.
/// @notice Migrates the Optimism contracts to the latest version.
/// @param _input Input parameters for the migration.
function migrate(OPContractsManagerInteropMigrator.MigrateInput calldata _input) external virtual {
if (address(this) == address(thisOPCM)) revert OnlyDelegatecall();

Expand Down
50 changes: 29 additions & 21 deletions packages/contracts-bedrock/src/L1/OptimismPortal2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,10 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ReinitializableBase
/// @notice Thrown when trying to migrate to the same AnchorStateRegistry.
error OptimismPortal_MigratingToSameRegistry();

/// @notice Reverts when paused.
modifier whenNotPaused() {
if (paused()) revert OptimismPortal_CallPaused();
_;
}

/// @notice Semantic version.
/// @custom:semver 4.4.0
/// @custom:semver 4.5.0
function version() public pure virtual returns (string memory) {
return "4.4.0";
return "4.5.0";
}

/// @param _proofMaturityDelaySeconds The proof maturity delay in seconds.
Expand Down Expand Up @@ -281,11 +275,9 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ReinitializableBase
/// @notice Upgrades the OptimismPortal contract to have a reference to the AnchorStateRegistry and SystemConfig
/// @param _anchorStateRegistry AnchorStateRegistry contract.
/// @param _ethLockbox ETHLockbox contract.
/// @param _systemConfig SystemConfig contract.
function upgrade(
IAnchorStateRegistry _anchorStateRegistry,
IETHLockbox _ethLockbox,
ISystemConfig _systemConfig
IETHLockbox _ethLockbox
)
external
reinitializer(initVersion())
Expand All @@ -296,8 +288,6 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ReinitializableBase
// Now perform upgrade logic.
anchorStateRegistry = _anchorStateRegistry;
ethLockbox = _ethLockbox;
systemConfig = _systemConfig;
spacer_53_1_20 = address(0);
}

/// @notice Getter for the current paused status.
Expand All @@ -317,13 +307,13 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ReinitializableBase

/// @notice Returns the SuperchainConfig contract.
/// @return ISuperchainConfig The SuperchainConfig contract.
function superchainConfig() public view returns (ISuperchainConfig) {
function superchainConfig() external view returns (ISuperchainConfig) {
return systemConfig.superchainConfig();
}

/// @custom:legacy
/// @notice Getter function for the address of the guardian.
function guardian() public view returns (address) {
function guardian() external view returns (address) {
return systemConfig.guardian();
}

Expand Down Expand Up @@ -403,6 +393,10 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ReinitializableBase
/// @param _newLockbox The address of the new ETHLockbox contract.
/// @param _newAnchorStateRegistry The address of the new AnchorStateRegistry contract.
function migrateToSuperRoots(IETHLockbox _newLockbox, IAnchorStateRegistry _newAnchorStateRegistry) external {
// Migration can only be triggered when the system is not paused because the migration can
// potentially unpause the system as a result of the modified ETHLockbox address.
_assertNotPaused();

// Migration can only be triggered by the ProxyAdmin owner.
_assertOnlyProxyAdminOwner();

Expand Down Expand Up @@ -450,8 +444,10 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ReinitializableBase
bytes[] calldata _withdrawalProof
)
external
whenNotPaused
{
// Cannot prove withdrawal transactions while the system is paused.
_assertNotPaused();

// Make sure that the OptimismPortal is using Super Roots.
if (!superRootsActive) {
revert OptimismPortal_WrongProofMethod();
Expand All @@ -476,8 +472,10 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ReinitializableBase
bytes[] calldata _withdrawalProof
)
external
whenNotPaused
{
// Cannot prove withdrawal transactions while the system is paused.
_assertNotPaused();

// Make sure that the OptimismPortal is using Output Roots.
if (superRootsActive) {
revert OptimismPortal_WrongProofMethod();
Expand Down Expand Up @@ -615,7 +613,7 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ReinitializableBase

/// @notice Finalizes a withdrawal transaction.
/// @param _tx Withdrawal transaction to finalize.
function finalizeWithdrawalTransaction(Types.WithdrawalTransaction memory _tx) external whenNotPaused {
function finalizeWithdrawalTransaction(Types.WithdrawalTransaction memory _tx) external {
finalizeWithdrawalTransactionExternalProof(_tx, msg.sender);
}

Expand All @@ -627,8 +625,10 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ReinitializableBase
address _proofSubmitter
)
public
whenNotPaused
{
// Cannot finalize withdrawal transactions while the system is paused.
_assertNotPaused();

// Make sure that the l2Sender has not yet been set. The l2Sender is set to a value other
// than the default value when a withdrawal transaction is being finalized. This check is
// a defacto reentrancy guard.
Expand Down Expand Up @@ -672,8 +672,9 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ReinitializableBase
// be achieved through contracts built on top of this contract
emit WithdrawalFinalized(withdrawalHash, success);

// Send ETH back to the Lockbox or it'll get stuck here.
if (!success) {
// Send ETH back to the Lockbox or it'll get stuck here and would need to be moved back via
// the migrateLiquidity function.
if (!success && _tx.value > 0) {
ethLockbox.lockETH{ value: _tx.value }();
}

Expand Down Expand Up @@ -792,6 +793,13 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ReinitializableBase
return proofSubmitters[_withdrawalHash].length;
}

/// @notice Asserts that the contract is not paused.
function _assertNotPaused() internal view {
if (paused()) {
revert OptimismPortal_CallPaused();
}
}

/// @notice Checks if a target address is unsafe.
function _isUnsafeTarget(address _target) internal view virtual returns (bool) {
// Prevent users from targeting an unsafe target address on a withdrawal transaction.
Expand Down
4 changes: 4 additions & 0 deletions packages/contracts-bedrock/src/L1/ProxyAdminOwnedBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import { IAddressManager } from "interfaces/legacy/IAddressManager.sol";
/// compatible Proxy contracts so that their ProxyAdmin and ProxyAdmin owner addresses can
/// be retrieved onchain. Existing Proxy contracts don't have these getters, so we need a
/// base contract instead.
/// @dev WARNING: This contract is ONLY designed to be used with either the Optimism Proxy
/// implementation or the Optimism ResolvedDelegateProxy implementation. It is not safe to use
/// this contract with any other proxy implementation.
/// WARNING: Multiple OP Stack chains may share the same ProxyAdmin owner address.
abstract contract ProxyAdminOwnedBase {
/// @notice Thrown when the ProxyAdmin owner of the current contract is not the same as the
/// ProxyAdmin owner of the other Proxy address provided.
Expand Down
Loading