Commit 6552854e authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

Merge pull request #8094 from ethereum-optimism/remove-mcp

Reset L1 contracts to pre-MCP
parents 8809a31f 7cf29750
......@@ -1542,11 +1542,6 @@ workflows:
- check-generated-mocks-op-service
- cannon-go-lint-and-test
- cannon-build-test-vectors
- check-values-match:
pattern_file1: "uint8 internal constant INITIALIZER ="
pattern_file2: "const InitializedValue ="
file1_path: "packages/contracts-bedrock/src/libraries/Constants.sol"
file2_path: "op-chain-ops/genesis/config.go"
release:
when:
not:
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -9,7 +9,7 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc"
)
const StandardBridgeStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"_initialized\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_uint8\"},{\"astId\":1001,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"_initializing\",\"offset\":1,\"slot\":\"0\",\"type\":\"t_bool\"},{\"astId\":1002,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"spacer_0_2_20\",\"offset\":2,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":1003,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"spacer_1_0_20\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_address\"},{\"astId\":1004,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"deposits\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_mapping(t_address,t_mapping(t_address,t_uint256))\"},{\"astId\":1005,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"messenger\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_contract(CrossDomainMessenger)1007\"},{\"astId\":1006,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"4\",\"type\":\"t_array(t_uint256)46_storage\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)46_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[46]\",\"numberOfBytes\":\"1472\",\"base\":\"t_uint256\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_contract(CrossDomainMessenger)1007\":{\"encoding\":\"inplace\",\"label\":\"contract CrossDomainMessenger\",\"numberOfBytes\":\"20\"},\"t_mapping(t_address,t_mapping(t_address,t_uint256))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(address =\u003e uint256))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_address,t_uint256)\"},\"t_mapping(t_address,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_uint256\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_uint8\":{\"encoding\":\"inplace\",\"label\":\"uint8\",\"numberOfBytes\":\"1\"}}}"
const StandardBridgeStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"spacer_0_0_20\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_address\"},{\"astId\":1001,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"spacer_1_0_20\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_address\"},{\"astId\":1002,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"deposits\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_mapping(t_address,t_mapping(t_address,t_uint256))\"},{\"astId\":1003,\"contract\":\"src/universal/StandardBridge.sol:StandardBridge\",\"label\":\"__gap\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_array(t_uint256)47_storage\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_uint256)47_storage\":{\"encoding\":\"inplace\",\"label\":\"uint256[47]\",\"numberOfBytes\":\"1504\",\"base\":\"t_uint256\"},\"t_mapping(t_address,t_mapping(t_address,t_uint256))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(address =\u003e uint256))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_address,t_uint256)\"},\"t_mapping(t_address,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_uint256\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"}}}"
var StandardBridgeStorageLayout = new(solc.StorageLayout)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -131,6 +131,7 @@ func BuildOptimism(immutable ImmutableConfig) (DeploymentResults, error) {
{
Name: "L2ERC721Bridge",
Args: []interface{}{
immutable["L2ERC721Bridge"]["messenger"],
immutable["L2ERC721Bridge"]["otherBridge"],
},
},
......@@ -216,7 +217,7 @@ func l2Deployer(backend *backends.SimulatedBackend, opts *bind.TransactOpts, dep
}
_, tx, _, err = bindings.DeployL1FeeVault(opts, backend, recipient, minimumWithdrawalAmount, withdrawalNetwork)
case "OptimismMintableERC20Factory":
_, tx, _, err = bindings.DeployOptimismMintableERC20Factory(opts, backend)
_, tx, _, err = bindings.DeployOptimismMintableERC20Factory(opts, backend, predeploys.L2StandardBridgeAddr)
case "DeployerWhitelist":
_, tx, _, err = bindings.DeployDeployerWhitelist(opts, backend)
case "LegacyMessagePasser":
......@@ -224,11 +225,15 @@ func l2Deployer(backend *backends.SimulatedBackend, opts *bind.TransactOpts, dep
case "L1BlockNumber":
_, tx, _, err = bindings.DeployL1BlockNumber(opts, backend)
case "L2ERC721Bridge":
otherBridge, ok := deployment.Args[0].(common.Address)
messenger, ok := deployment.Args[0].(common.Address)
if !ok {
return nil, fmt.Errorf("invalid type for messenger")
}
otherBridge, ok := deployment.Args[1].(common.Address)
if !ok {
return nil, fmt.Errorf("invalid type for otherBridge")
}
_, tx, _, err = bindings.DeployL2ERC721Bridge(opts, backend, otherBridge)
_, tx, _, err = bindings.DeployL2ERC721Bridge(opts, backend, messenger, otherBridge)
case "OptimismMintableERC721Factory":
bridge, ok := deployment.Args[0].(common.Address)
if !ok {
......
This diff is collapsed.
......@@ -33,8 +33,11 @@ func setupL2OutputOracle() (common.Address, *bind.TransactOpts, *backends.Simula
backend,
big.NewInt(10),
big.NewInt(2),
big.NewInt(100),
)
big.NewInt(0),
big.NewInt(0),
from,
common.Address{0xdd},
big.NewInt(100))
if err != nil {
return common.Address{}, nil, nil, nil, err
}
......
......@@ -49,6 +49,10 @@ describe('helpers', () => {
const L2OutputOracleImplementation = await Factory__L2OutputOracle.deploy(
deployConfig.l2OutputOracleSubmissionInterval,
deployConfig.l2BlockTime,
deployConfig.l2OutputOracleStartingBlockNumber,
deployConfig.l2OutputOracleStartingTimestamp,
deployConfig.l2OutputOracleProposer,
deployConfig.l2OutputOracleChallenger,
deployConfig.finalizationPeriodSeconds
)
......@@ -57,8 +61,6 @@ describe('helpers', () => {
L2OutputOracleImplementation.interface.encodeFunctionData('initialize', [
deployConfig.l2OutputOracleStartingBlockNumber,
deployConfig.l2OutputOracleStartingTimestamp,
deployConfig.l2OutputOracleProposer,
deployConfig.l2OutputOracleChallenger,
])
)
......
This diff is collapsed.
This diff is collapsed.
# `SystemConfig` Invariants
## The gas limit of the `SystemConfig` contract can never be lower than the hard-coded lower bound.
**Test:** [`SystemConfig.t.sol#L70`](../test/invariants/SystemConfig.t.sol#L70)
**Test:** [`SystemConfig.t.sol#L68`](../test/invariants/SystemConfig.t.sol#L68)
This diff is collapsed.
......@@ -13,25 +13,24 @@ import { Constants } from "src/libraries/Constants.sol";
/// for sending and receiving data on the L1 side. Users are encouraged to use this
/// interface instead of interacting with lower-level contracts directly.
contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver {
/// @notice Address of the OptimismPortal. The public getter for this
/// is legacy and will be removed in the future. Use `portal()` instead.
/// @custom:network-specific
/// @notice Address of the OptimismPortal. This will be removed in the
/// future, use `portal` instead.
/// @custom:legacy
OptimismPortal public PORTAL;
OptimismPortal public immutable PORTAL;
/// @notice Semantic version.
/// @custom:semver 1.7.1
string public constant version = "1.7.1";
/// @custom:semver 1.8.0
string public constant version = "1.8.0";
/// @notice Constructs the L1CrossDomainMessenger contract.
constructor() CrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER) {
initialize({ _portal: OptimismPortal(payable(0)) });
/// @param _portal Address of the OptimismPortal contract on this network.
constructor(OptimismPortal _portal) CrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER) {
PORTAL = _portal;
initialize();
}
/// @notice Initializes the contract.
/// @param _portal Address of the OptimismPortal contract on this network.
function initialize(OptimismPortal _portal) public reinitializer(Constants.INITIALIZER) {
PORTAL = _portal;
function initialize() public initializer {
__CrossDomainMessenger_init();
}
......
......@@ -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();
}
......
......@@ -20,19 +20,13 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
/// wait for the one-week challenge period to elapse before their Optimism-native NFT
/// can be refunded on L2.
contract L2ERC721Bridge is ERC721Bridge, ISemver {
/// @custom:semver 1.4.0
string public constant version = "1.4.0";
/// @custom:semver 1.5.0
string public constant version = "1.5.0";
/// @notice Constructs the L2ERC721Bridge contract.
/// @param _messenger Address of the CrossDomainMessenger on this network.
/// @param _otherBridge Address of the ERC721 bridge on the other network.
constructor(address _otherBridge) ERC721Bridge(_otherBridge) {
initialize();
}
/// @notice Initializes the contract.
function initialize() public reinitializer(Constants.INITIALIZER) {
__ERC721Bridge_init({ _messenger: CrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER) });
}
constructor(address _messenger, address _otherBridge) ERC721Bridge(_messenger, _otherBridge) { }
/// @notice Completes an ERC721 bridge from the other domain and sends the ERC721 token to the
/// recipient on this domain.
......@@ -114,7 +108,7 @@ contract L2ERC721Bridge is ERC721Bridge, ISemver {
// Send message to L1 bridge
// slither-disable-next-line reentrancy-events
messenger.sendMessage(OTHER_BRIDGE, message, _minGasLimit);
MESSENGER.sendMessage(OTHER_BRIDGE, message, _minGasLimit);
// slither-disable-next-line reentrancy-events
emit ERC721BridgeInitiated(_localToken, remoteToken, _from, _to, _tokenId, _extraData);
......
......@@ -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;
}
......@@ -139,7 +139,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
/// For now, it is critical that the first proposed output root of an OP stack
/// chain is done so by an honest party.
function test_initialize_firstOutput_reverts() public {
uint256 submissionInterval = l2OutputOracle.submissionInterval();
uint256 submissionInterval = l2OutputOracle.SUBMISSION_INTERVAL();
vm.expectRevert(abi.encodeWithSignature("Panic(uint256)", 0x11));
factory.create(GAME_TYPE, ROOT_CLAIM, abi.encode(submissionInterval, block.number - 1));
}
......
......@@ -35,8 +35,6 @@ contract L1StandardBridge_Initialize_Test is Bridge_Initializer {
assertEq(address(l1StandardBridge.messenger()), address(l1CrossDomainMessenger));
assertEq(address(l1StandardBridge.OTHER_BRIDGE()), Predeploys.L2_STANDARD_BRIDGE);
assertEq(address(l2StandardBridge), Predeploys.L2_STANDARD_BRIDGE);
bytes32 slot0 = vm.load(address(l1StandardBridge), bytes32(uint256(0)));
assertEq(slot0, bytes32(uint256(Constants.INITIALIZER)));
}
}
......
......@@ -10,12 +10,7 @@ import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
/// @notice Simple wrapper around the StandardBridge contract that exposes
/// internal functions so they can be more easily tested directly.
contract StandardBridgeTester is StandardBridge {
constructor(
address payable _messenger,
address payable _otherBridge
)
StandardBridge(StandardBridge(_otherBridge))
{ }
constructor(address payable _messenger, address payable _otherBridge) StandardBridge(_messenger, _otherBridge) { }
function isOptimismMintableERC20(address _token) external view returns (bool) {
return _isOptimismMintableERC20(_token);
......
......@@ -116,18 +116,19 @@ contract Setup is Deploy {
vm.etch(address(l2ToL1MessagePasser), address(new L2ToL1MessagePasser()).code);
vm.etch(address(l2StandardBridge), address(new L2StandardBridge(payable(l1StandardBridge))).code);
vm.etch(
address(l2StandardBridge), address(new L2StandardBridge(StandardBridge(payable(l1StandardBridge)))).code
address(l2OptimismMintableERC20Factory),
address(new OptimismMintableERC20Factory(address(l2StandardBridge))).code
);
l2StandardBridge.initialize();
vm.etch(address(l2OptimismMintableERC20Factory), address(new OptimismMintableERC20Factory()).code);
l2OptimismMintableERC20Factory.initialize(address(l2StandardBridge));
vm.etch(address(legacyERC20ETH), address(new LegacyERC20ETH()).code);
vm.etch(address(l2ERC721Bridge), address(new L2ERC721Bridge(address(l1ERC721Bridge))).code);
l2ERC721Bridge.initialize();
vm.etch(
address(l2ERC721Bridge),
address(new L2ERC721Bridge(address(l2CrossDomainMessenger), address(l1ERC721Bridge))).code
);
vm.etch(
address(sequencerFeeVault),
......
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