Commit f73a0b9d authored by Maurelian's avatar Maurelian

feat(ctb): Remove Constants.INITIALIZER

parent e76272e3
......@@ -36,7 +36,7 @@ library ChainAssertions {
checkSystemConfig(prox, cfg);
checkL1CrossDomainMessenger(prox, vm);
checkL1StandardBridge(prox, vm);
checkL1StandardBridge(prox);
checkL2OutputOracle(prox, cfg, l2OutputOracleStartingTimestamp);
checkOptimismMintableERC20Factory(prox);
checkL1ERC721Bridge(prox);
......@@ -73,16 +73,12 @@ library ChainAssertions {
}
/// @notice Asserts that the L1StandardBridge is setup correctly
function checkL1StandardBridge(Types.ContractSet memory proxies, Vm vm) internal view {
function checkL1StandardBridge(Types.ContractSet memory proxies) internal view {
L1StandardBridge bridge = L1StandardBridge(payable(proxies.L1StandardBridge));
require(address(bridge.MESSENGER()) == proxies.L1CrossDomainMessenger);
require(address(bridge.messenger()) == proxies.L1CrossDomainMessenger);
require(address(bridge.OTHER_BRIDGE()) == Predeploys.L2_STANDARD_BRIDGE);
require(address(bridge.otherBridge()) == Predeploys.L2_STANDARD_BRIDGE);
// Ensures that the legacy slot is modified correctly. This will fail
// during predeployment simulation on OP Mainnet if there is a bug.
bytes32 slot0 = vm.load(address(bridge), bytes32(uint256(0)));
require(slot0 == bytes32(uint256(Constants.INITIALIZER)));
}
/// @notice Asserts that the L2OutputOracle is setup correctly
......
......@@ -678,7 +678,6 @@ contract Deploy is Deployer {
ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin"));
address l1StandardBridgeProxy = mustGetAddress("L1StandardBridgeProxy");
address l1StandardBridge = mustGetAddress("L1StandardBridge");
address l1CrossDomainMessengerProxy = mustGetAddress("L1CrossDomainMessengerProxy");
uint256 proxyType = uint256(proxyAdmin.proxyType(l1StandardBridgeProxy));
if (proxyType != uint256(ProxyAdmin.ProxyType.CHUGSPLASH)) {
......@@ -697,7 +696,7 @@ contract Deploy is Deployer {
string memory version = L1StandardBridge(payable(l1StandardBridgeProxy)).version();
console.log("L1StandardBridge version: %s", version);
ChainAssertions.checkL1StandardBridge(_proxies(), vm);
ChainAssertions.checkL1StandardBridge(_proxies());
}
/// @notice Initialize the L1ERC721Bridge
......@@ -705,7 +704,6 @@ contract Deploy is Deployer {
ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin"));
address l1ERC721BridgeProxy = mustGetAddress("L1ERC721BridgeProxy");
address l1ERC721Bridge = mustGetAddress("L1ERC721Bridge");
address l1CrossDomainMessengerProxy = mustGetAddress("L1CrossDomainMessengerProxy");
_callViaSafe({
_target: address(proxyAdmin),
......@@ -724,7 +722,6 @@ contract Deploy is Deployer {
address proxyAdmin = mustGetAddress("ProxyAdmin");
address optimismMintableERC20FactoryProxy = mustGetAddress("OptimismMintableERC20FactoryProxy");
address optimismMintableERC20Factory = mustGetAddress("OptimismMintableERC20Factory");
address l1StandardBridgeProxy = mustGetAddress("L1StandardBridgeProxy");
_callViaSafe({
_target: proxyAdmin,
......@@ -745,7 +742,6 @@ contract Deploy is Deployer {
ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin"));
address l1CrossDomainMessengerProxy = mustGetAddress("L1CrossDomainMessengerProxy");
address l1CrossDomainMessenger = mustGetAddress("L1CrossDomainMessenger");
address optimismPortalProxy = mustGetAddress("OptimismPortalProxy");
uint256 proxyType = uint256(proxyAdmin.proxyType(l1CrossDomainMessengerProxy));
if (proxyType != uint256(ProxyAdmin.ProxyType.RESOLVED)) {
......@@ -806,8 +802,6 @@ contract Deploy is Deployer {
function initializeOptimismPortal() public broadcast {
address optimismPortalProxy = mustGetAddress("OptimismPortalProxy");
address optimismPortal = mustGetAddress("OptimismPortal");
address l2OutputOracleProxy = mustGetAddress("L2OutputOracleProxy");
address systemConfigProxy = mustGetAddress("SystemConfigProxy");
_upgradeAndCallViaSafe({
_proxy: payable(optimismPortalProxy),
......
......@@ -55,14 +55,7 @@ contract ProtocolVersions is OwnableUpgradeable, ISemver {
/// @param _owner Initial owner of the contract.
/// @param _required Required protocol version to operate on this chain.
/// @param _recommended Recommended protocol version to operate on thi chain.
function initialize(
address _owner,
ProtocolVersion _required,
ProtocolVersion _recommended
)
public
reinitializer(Constants.INITIALIZER)
{
function initialize(address _owner, ProtocolVersion _required, ProtocolVersion _recommended) public initializer {
__Ownable_init();
transferOwnership(_owner);
_setRequired(_required);
......
......@@ -25,7 +25,7 @@ contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver {
}
/// @notice Initializer.
function initialize() public reinitializer(Constants.INITIALIZER) {
function initialize() public initializer {
__CrossDomainMessenger_init();
}
......
......@@ -43,8 +43,4 @@ library Constants {
});
return config;
}
/// @notice The `reinitailizer` input for upgradable contracts. This value must be updated
/// each time that the contracts are deployed.
uint8 internal constant INITIALIZER = 3;
}
......@@ -501,9 +501,9 @@ contract L2OutputOracleUpgradeable_Test is CommonTest {
NextImpl nextImpl = new NextImpl();
vm.startPrank(EIP1967Helper.getAdmin(address(proxy)));
proxy.upgradeToAndCall(
address(nextImpl), abi.encodeWithSelector(NextImpl.initialize.selector, Constants.INITIALIZER + 1)
);
// Reviewer note: the NextImpl() still uses reinitializer. If we want to remove that, we'll need to use a
// two step upgrade with the Storage lib.
proxy.upgradeToAndCall(address(nextImpl), abi.encodeWithSelector(NextImpl.initialize.selector, 2));
assertEq(proxy.implementation(), address(nextImpl));
// Verify that the NextImpl contract initialized its values according as expected
......
......@@ -11,7 +11,6 @@ import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
// Libraries
import { Types } from "src/libraries/Types.sol";
import { Hashing } from "src/libraries/Hashing.sol";
import { Constants } from "src/libraries/Constants.sol";
// Target contract dependencies
import { Proxy } from "src/universal/Proxy.sol";
......@@ -922,7 +921,7 @@ contract OptimismPortalUpgradeable_Test is CommonTest {
// The value passed to the initialize must be larger than the last value
// that initialize was called with.
Proxy(payable(address(optimismPortal))).upgradeToAndCall(
address(nextImpl), abi.encodeWithSelector(NextImpl.initialize.selector, Constants.INITIALIZER + 1)
address(nextImpl), abi.encodeWithSelector(NextImpl.initialize.selector, 2)
);
assertEq(Proxy(payable(address(optimismPortal))).implementation(), address(nextImpl));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment