Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
f73a0b9d
Unverified
Commit
f73a0b9d
authored
Nov 17, 2023
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ctb): Remove Constants.INITIALIZER
parent
e76272e3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
9 additions
and
31 deletions
+9
-31
ChainAssertions.sol
packages/contracts-bedrock/scripts/ChainAssertions.sol
+2
-6
Deploy.s.sol
packages/contracts-bedrock/scripts/Deploy.s.sol
+1
-7
ProtocolVersions.sol
packages/contracts-bedrock/src/L1/ProtocolVersions.sol
+1
-8
L2CrossDomainMessenger.sol
packages/contracts-bedrock/src/L2/L2CrossDomainMessenger.sol
+1
-1
Constants.sol
packages/contracts-bedrock/src/libraries/Constants.sol
+0
-4
L2OutputOracle.t.sol
packages/contracts-bedrock/test/L2OutputOracle.t.sol
+3
-3
OptimismPortal.t.sol
packages/contracts-bedrock/test/OptimismPortal.t.sol
+1
-2
No files found.
packages/contracts-bedrock/scripts/ChainAssertions.sol
View file @
f73a0b9d
...
@@ -36,7 +36,7 @@ library ChainAssertions {
...
@@ -36,7 +36,7 @@ library ChainAssertions {
checkSystemConfig(prox, cfg);
checkSystemConfig(prox, cfg);
checkL1CrossDomainMessenger(prox, vm);
checkL1CrossDomainMessenger(prox, vm);
checkL1StandardBridge(prox
, vm
);
checkL1StandardBridge(prox);
checkL2OutputOracle(prox, cfg, l2OutputOracleStartingTimestamp);
checkL2OutputOracle(prox, cfg, l2OutputOracleStartingTimestamp);
checkOptimismMintableERC20Factory(prox);
checkOptimismMintableERC20Factory(prox);
checkL1ERC721Bridge(prox);
checkL1ERC721Bridge(prox);
...
@@ -73,16 +73,12 @@ library ChainAssertions {
...
@@ -73,16 +73,12 @@ library ChainAssertions {
}
}
/// @notice Asserts that the L1StandardBridge is setup correctly
/// @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));
L1StandardBridge bridge = L1StandardBridge(payable(proxies.L1StandardBridge));
require(address(bridge.MESSENGER()) == proxies.L1CrossDomainMessenger);
require(address(bridge.MESSENGER()) == proxies.L1CrossDomainMessenger);
require(address(bridge.messenger()) == proxies.L1CrossDomainMessenger);
require(address(bridge.messenger()) == proxies.L1CrossDomainMessenger);
require(address(bridge.OTHER_BRIDGE()) == Predeploys.L2_STANDARD_BRIDGE);
require(address(bridge.OTHER_BRIDGE()) == Predeploys.L2_STANDARD_BRIDGE);
require(address(bridge.otherBridge()) == 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
/// @notice Asserts that the L2OutputOracle is setup correctly
...
...
packages/contracts-bedrock/scripts/Deploy.s.sol
View file @
f73a0b9d
...
@@ -678,7 +678,6 @@ contract Deploy is Deployer {
...
@@ -678,7 +678,6 @@ contract Deploy is Deployer {
ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin"));
ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin"));
address l1StandardBridgeProxy = mustGetAddress("L1StandardBridgeProxy");
address l1StandardBridgeProxy = mustGetAddress("L1StandardBridgeProxy");
address l1StandardBridge = mustGetAddress("L1StandardBridge");
address l1StandardBridge = mustGetAddress("L1StandardBridge");
address l1CrossDomainMessengerProxy = mustGetAddress("L1CrossDomainMessengerProxy");
uint256 proxyType = uint256(proxyAdmin.proxyType(l1StandardBridgeProxy));
uint256 proxyType = uint256(proxyAdmin.proxyType(l1StandardBridgeProxy));
if (proxyType != uint256(ProxyAdmin.ProxyType.CHUGSPLASH)) {
if (proxyType != uint256(ProxyAdmin.ProxyType.CHUGSPLASH)) {
...
@@ -697,7 +696,7 @@ contract Deploy is Deployer {
...
@@ -697,7 +696,7 @@ contract Deploy is Deployer {
string memory version = L1StandardBridge(payable(l1StandardBridgeProxy)).version();
string memory version = L1StandardBridge(payable(l1StandardBridgeProxy)).version();
console.log("L1StandardBridge version: %s", version);
console.log("L1StandardBridge version: %s", version);
ChainAssertions.checkL1StandardBridge(_proxies()
, vm
);
ChainAssertions.checkL1StandardBridge(_proxies());
}
}
/// @notice Initialize the L1ERC721Bridge
/// @notice Initialize the L1ERC721Bridge
...
@@ -705,7 +704,6 @@ contract Deploy is Deployer {
...
@@ -705,7 +704,6 @@ contract Deploy is Deployer {
ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin"));
ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin"));
address l1ERC721BridgeProxy = mustGetAddress("L1ERC721BridgeProxy");
address l1ERC721BridgeProxy = mustGetAddress("L1ERC721BridgeProxy");
address l1ERC721Bridge = mustGetAddress("L1ERC721Bridge");
address l1ERC721Bridge = mustGetAddress("L1ERC721Bridge");
address l1CrossDomainMessengerProxy = mustGetAddress("L1CrossDomainMessengerProxy");
_callViaSafe({
_callViaSafe({
_target: address(proxyAdmin),
_target: address(proxyAdmin),
...
@@ -724,7 +722,6 @@ contract Deploy is Deployer {
...
@@ -724,7 +722,6 @@ contract Deploy is Deployer {
address proxyAdmin = mustGetAddress("ProxyAdmin");
address proxyAdmin = mustGetAddress("ProxyAdmin");
address optimismMintableERC20FactoryProxy = mustGetAddress("OptimismMintableERC20FactoryProxy");
address optimismMintableERC20FactoryProxy = mustGetAddress("OptimismMintableERC20FactoryProxy");
address optimismMintableERC20Factory = mustGetAddress("OptimismMintableERC20Factory");
address optimismMintableERC20Factory = mustGetAddress("OptimismMintableERC20Factory");
address l1StandardBridgeProxy = mustGetAddress("L1StandardBridgeProxy");
_callViaSafe({
_callViaSafe({
_target: proxyAdmin,
_target: proxyAdmin,
...
@@ -745,7 +742,6 @@ contract Deploy is Deployer {
...
@@ -745,7 +742,6 @@ contract Deploy is Deployer {
ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin"));
ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin"));
address l1CrossDomainMessengerProxy = mustGetAddress("L1CrossDomainMessengerProxy");
address l1CrossDomainMessengerProxy = mustGetAddress("L1CrossDomainMessengerProxy");
address l1CrossDomainMessenger = mustGetAddress("L1CrossDomainMessenger");
address l1CrossDomainMessenger = mustGetAddress("L1CrossDomainMessenger");
address optimismPortalProxy = mustGetAddress("OptimismPortalProxy");
uint256 proxyType = uint256(proxyAdmin.proxyType(l1CrossDomainMessengerProxy));
uint256 proxyType = uint256(proxyAdmin.proxyType(l1CrossDomainMessengerProxy));
if (proxyType != uint256(ProxyAdmin.ProxyType.RESOLVED)) {
if (proxyType != uint256(ProxyAdmin.ProxyType.RESOLVED)) {
...
@@ -806,8 +802,6 @@ contract Deploy is Deployer {
...
@@ -806,8 +802,6 @@ contract Deploy is Deployer {
function initializeOptimismPortal() public broadcast {
function initializeOptimismPortal() public broadcast {
address optimismPortalProxy = mustGetAddress("OptimismPortalProxy");
address optimismPortalProxy = mustGetAddress("OptimismPortalProxy");
address optimismPortal = mustGetAddress("OptimismPortal");
address optimismPortal = mustGetAddress("OptimismPortal");
address l2OutputOracleProxy = mustGetAddress("L2OutputOracleProxy");
address systemConfigProxy = mustGetAddress("SystemConfigProxy");
_upgradeAndCallViaSafe({
_upgradeAndCallViaSafe({
_proxy: payable(optimismPortalProxy),
_proxy: payable(optimismPortalProxy),
...
...
packages/contracts-bedrock/src/L1/ProtocolVersions.sol
View file @
f73a0b9d
...
@@ -55,14 +55,7 @@ contract ProtocolVersions is OwnableUpgradeable, ISemver {
...
@@ -55,14 +55,7 @@ contract ProtocolVersions is OwnableUpgradeable, ISemver {
/// @param _owner Initial owner of the contract.
/// @param _owner Initial owner of the contract.
/// @param _required Required protocol version to operate on this chain.
/// @param _required Required protocol version to operate on this chain.
/// @param _recommended Recommended protocol version to operate on thi chain.
/// @param _recommended Recommended protocol version to operate on thi chain.
function initialize(
function initialize(address _owner, ProtocolVersion _required, ProtocolVersion _recommended) public initializer {
address _owner,
ProtocolVersion _required,
ProtocolVersion _recommended
)
public
reinitializer(Constants.INITIALIZER)
{
__Ownable_init();
__Ownable_init();
transferOwnership(_owner);
transferOwnership(_owner);
_setRequired(_required);
_setRequired(_required);
...
...
packages/contracts-bedrock/src/L2/L2CrossDomainMessenger.sol
View file @
f73a0b9d
...
@@ -25,7 +25,7 @@ contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver {
...
@@ -25,7 +25,7 @@ contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver {
}
}
/// @notice Initializer.
/// @notice Initializer.
function initialize() public
reinitializer(Constants.INITIALIZER)
{
function initialize() public
initializer
{
__CrossDomainMessenger_init();
__CrossDomainMessenger_init();
}
}
...
...
packages/contracts-bedrock/src/libraries/Constants.sol
View file @
f73a0b9d
...
@@ -43,8 +43,4 @@ library Constants {
...
@@ -43,8 +43,4 @@ library Constants {
});
});
return config;
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;
}
}
packages/contracts-bedrock/test/L2OutputOracle.t.sol
View file @
f73a0b9d
...
@@ -501,9 +501,9 @@ contract L2OutputOracleUpgradeable_Test is CommonTest {
...
@@ -501,9 +501,9 @@ contract L2OutputOracleUpgradeable_Test is CommonTest {
NextImpl nextImpl = new NextImpl();
NextImpl nextImpl = new NextImpl();
vm.startPrank(EIP1967Helper.getAdmin(address(proxy)));
vm.startPrank(EIP1967Helper.getAdmin(address(proxy)));
proxy.upgradeToAndCall(
// Reviewer note: the NextImpl() still uses reinitializer. If we want to remove that, we'll need to use a
address(nextImpl), abi.encodeWithSelector(NextImpl.initialize.selector, Constants.INITIALIZER + 1)
// two step upgrade with the Storage lib.
);
proxy.upgradeToAndCall(address(nextImpl), abi.encodeWithSelector(NextImpl.initialize.selector, 2)
);
assertEq(proxy.implementation(), address(nextImpl));
assertEq(proxy.implementation(), address(nextImpl));
// Verify that the NextImpl contract initialized its values according as expected
// Verify that the NextImpl contract initialized its values according as expected
...
...
packages/contracts-bedrock/test/OptimismPortal.t.sol
View file @
f73a0b9d
...
@@ -11,7 +11,6 @@ import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
...
@@ -11,7 +11,6 @@ import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
// Libraries
// Libraries
import { Types } from "src/libraries/Types.sol";
import { Types } from "src/libraries/Types.sol";
import { Hashing } from "src/libraries/Hashing.sol";
import { Hashing } from "src/libraries/Hashing.sol";
import { Constants } from "src/libraries/Constants.sol";
// Target contract dependencies
// Target contract dependencies
import { Proxy } from "src/universal/Proxy.sol";
import { Proxy } from "src/universal/Proxy.sol";
...
@@ -922,7 +921,7 @@ contract OptimismPortalUpgradeable_Test is CommonTest {
...
@@ -922,7 +921,7 @@ contract OptimismPortalUpgradeable_Test is CommonTest {
// The value passed to the initialize must be larger than the last value
// The value passed to the initialize must be larger than the last value
// that initialize was called with.
// that initialize was called with.
Proxy(payable(address(optimismPortal))).upgradeToAndCall(
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));
assertEq(Proxy(payable(address(optimismPortal))).implementation(), address(nextImpl));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment