Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maint: add remaining L1 contract interfaces #11848

Merged
merged 1 commit into from
Sep 11, 2024
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
16 changes: 8 additions & 8 deletions packages/contracts-bedrock/.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (
GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7597)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369242)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967382)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 564365)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4076580)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 467007)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3512689)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 72624)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 564356)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4076571)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 467019)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3512701)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 72618)
GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 92973)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 68320)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 68962)
GasBenchMark_OptimismPortal:test_proveWithdrawalTransaction_benchmark() (gas: 155618)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 68312)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 68943)
GasBenchMark_OptimismPortal:test_proveWithdrawalTransaction_benchmark() (gas: 155610)
34 changes: 21 additions & 13 deletions packages/contracts-bedrock/scripts/L2Genesis.s.sol
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

// Testing
import { Script } from "forge-std/Script.sol";
import { console2 as console } from "forge-std/console2.sol";
import { Deployer } from "scripts/deploy/Deployer.sol";
import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";

// Scripts
import { Deployer } from "scripts/deploy/Deployer.sol";
import { Config, OutputMode, OutputModeUtils, Fork, ForkUtils, LATEST_FORK } from "scripts/libraries/Config.sol";
import { Artifacts } from "scripts/Artifacts.s.sol";
import { DeployConfig } from "scripts/deploy/DeployConfig.s.sol";
import { Predeploys } from "src/libraries/Predeploys.sol";
import { Preinstalls } from "src/libraries/Preinstalls.sol";
import { Process } from "scripts/libraries/Process.sol";

// Contracts
import { L2CrossDomainMessenger } from "src/L2/L2CrossDomainMessenger.sol";
import { L1Block } from "src/L2/L1Block.sol";
import { GasPriceOracle } from "src/L2/GasPriceOracle.sol";
import { L2StandardBridge } from "src/L2/L2StandardBridge.sol";
import { L2ERC721Bridge } from "src/L2/L2ERC721Bridge.sol";
import { SequencerFeeVault } from "src/L2/SequencerFeeVault.sol";
import { OptimismMintableERC20Factory } from "src/universal/OptimismMintableERC20Factory.sol";
import { OptimismMintableERC721Factory } from "src/universal/OptimismMintableERC721Factory.sol";
import { BaseFeeVault } from "src/L2/BaseFeeVault.sol";
import { L1FeeVault } from "src/L2/L1FeeVault.sol";
import { GovernanceToken } from "src/governance/GovernanceToken.sol";
import { OptimismMintableERC721Factory } from "src/universal/OptimismMintableERC721Factory.sol";
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
import { L1StandardBridge } from "src/L1/L1StandardBridge.sol";
import { StandardBridge } from "src/universal/StandardBridge.sol";
import { FeeVault } from "src/universal/FeeVault.sol";
import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
import { Process } from "scripts/libraries/Process.sol";
import { GovernanceToken } from "src/governance/GovernanceToken.sol";

// Libraries
import { Predeploys } from "src/libraries/Predeploys.sol";
import { Preinstalls } from "src/libraries/Preinstalls.sol";

// Interfaces
import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol";

interface IInitializable {
function initialize(address _addr) external;
Expand Down Expand Up @@ -296,10 +304,10 @@ contract L2Genesis is Deployer {
impl = _setImplementationCode(Predeploys.L2_STANDARD_BRIDGE);
}

L2StandardBridge(payable(impl)).initialize({ _otherBridge: L1StandardBridge(payable(address(0))) });
L2StandardBridge(payable(impl)).initialize({ _otherBridge: StandardBridge(payable(address(0))) });

L2StandardBridge(payable(Predeploys.L2_STANDARD_BRIDGE)).initialize({
_otherBridge: L1StandardBridge(_l1StandardBridgeProxy)
_otherBridge: StandardBridge(_l1StandardBridgeProxy)
});
}

Expand Down Expand Up @@ -333,9 +341,9 @@ contract L2Genesis is Deployer {
function setOptimismMintableERC20Factory() public {
address impl = _setImplementationCode(Predeploys.OPTIMISM_MINTABLE_ERC20_FACTORY);

OptimismMintableERC20Factory(impl).initialize({ _bridge: address(0) });
IOptimismMintableERC20Factory(impl).initialize({ _bridge: address(0) });

OptimismMintableERC20Factory(Predeploys.OPTIMISM_MINTABLE_ERC20_FACTORY).initialize({
IOptimismMintableERC20Factory(Predeploys.OPTIMISM_MINTABLE_ERC20_FACTORY).initialize({
_bridge: Predeploys.L2_STANDARD_BRIDGE
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ EXCLUDE_CONTRACTS=(
"Vm"
"VmSafe"
"IMulticall3"
"IBeacon"
"IERC721TokenReceiver"
"IProxyCreationCallback"

Expand Down Expand Up @@ -68,6 +67,9 @@ EXCLUDE_CONTRACTS=(
"ISuperchainConfig"
"IOptimismPortal"
"IL1BlockIsthmus"

# Need to make complex tweaks to the check script for this one
"ISystemConfigInterop"
)

# Find all JSON files in the forge-artifacts folder
Expand Down
18 changes: 9 additions & 9 deletions packages/contracts-bedrock/scripts/deploy/ChainAssertions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ import { console2 as console } from "forge-std/console2.sol";
// Scripts
import { DeployConfig } from "scripts/deploy/DeployConfig.s.sol";
import { Deployer } from "scripts/deploy/Deployer.sol";
import { ISystemConfigV0 } from "scripts/interfaces/ISystemConfigV0.sol";

// Contracts
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol";
import { L1StandardBridge } from "src/L1/L1StandardBridge.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol";
import { ProtocolVersion, ProtocolVersions } from "src/L1/ProtocolVersions.sol";
import { OptimismMintableERC20Factory } from "src/universal/OptimismMintableERC20Factory.sol";
import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol";

// Libraries
import { Constants } from "src/libraries/Constants.sol";
Expand All @@ -31,7 +28,10 @@ import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { IL1CrossDomainMessenger } from "src/L1/interfaces/IL1CrossDomainMessenger.sol";
import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
import { IOptimismPortal2 } from "src/L1/interfaces/IOptimismPortal2.sol";
import { ISystemConfigV0 } from "scripts/interfaces/ISystemConfigV0.sol";
import { IL1ERC721Bridge } from "src/L1/interfaces/IL1ERC721Bridge.sol";
import { IL1StandardBridge } from "src/L1/interfaces/IL1StandardBridge.sol";
import { ProtocolVersion, IProtocolVersions } from "src/L1/interfaces/IProtocolVersions.sol";
import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol";

library ChainAssertions {
Vm internal constant vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
Expand Down Expand Up @@ -160,7 +160,7 @@ library ChainAssertions {
/// @notice Asserts that the L1StandardBridge is setup correctly
function checkL1StandardBridge(Types.ContractSet memory _contracts, bool _isProxy) internal view {
console.log("Running chain assertions on the L1StandardBridge");
L1StandardBridge bridge = L1StandardBridge(payable(_contracts.L1StandardBridge));
IL1StandardBridge bridge = IL1StandardBridge(payable(_contracts.L1StandardBridge));

// Check that the contract is initialized
assertSlotValueIsOne({ _contractAddress: address(bridge), _slot: 0, _offset: 0 });
Expand Down Expand Up @@ -291,7 +291,7 @@ library ChainAssertions {
/// @notice Asserts that the OptimismMintableERC20Factory is setup correctly
function checkOptimismMintableERC20Factory(Types.ContractSet memory _contracts, bool _isProxy) internal view {
console.log("Running chain assertions on the OptimismMintableERC20Factory");
OptimismMintableERC20Factory factory = OptimismMintableERC20Factory(_contracts.OptimismMintableERC20Factory);
IOptimismMintableERC20Factory factory = IOptimismMintableERC20Factory(_contracts.OptimismMintableERC20Factory);

// Check that the contract is initialized
assertSlotValueIsOne({ _contractAddress: address(factory), _slot: 0, _offset: 0 });
Expand All @@ -308,7 +308,7 @@ library ChainAssertions {
/// @notice Asserts that the L1ERC721Bridge is setup correctly
function checkL1ERC721Bridge(Types.ContractSet memory _contracts, bool _isProxy) internal view {
console.log("Running chain assertions on the L1ERC721Bridge");
L1ERC721Bridge bridge = L1ERC721Bridge(_contracts.L1ERC721Bridge);
IL1ERC721Bridge bridge = IL1ERC721Bridge(_contracts.L1ERC721Bridge);

// Check that the contract is initialized
assertSlotValueIsOne({ _contractAddress: address(bridge), _slot: 0, _offset: 0 });
Expand Down Expand Up @@ -405,7 +405,7 @@ library ChainAssertions {
view
{
console.log("Running chain assertions on the ProtocolVersions");
ProtocolVersions versions = ProtocolVersions(_contracts.ProtocolVersions);
IProtocolVersions versions = IProtocolVersions(_contracts.ProtocolVersions);

// Check that the contract is initialized
assertSlotValueIsOne({ _contractAddress: address(versions), _slot: 0, _offset: 0 });
Expand Down
50 changes: 17 additions & 33 deletions packages/contracts-bedrock/scripts/deploy/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,16 @@ import { ChainAssertions } from "scripts/deploy/ChainAssertions.sol";
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol";
import { AddressManager } from "src/legacy/AddressManager.sol";
import { Proxy } from "src/universal/Proxy.sol";
import { L1StandardBridge } from "src/L1/L1StandardBridge.sol";
import { StandardBridge } from "src/universal/StandardBridge.sol";
import { L1ChugSplashProxy } from "src/legacy/L1ChugSplashProxy.sol";
import { ResolvedDelegateProxy } from "src/legacy/ResolvedDelegateProxy.sol";
import { OptimismMintableERC20Factory } from "src/universal/OptimismMintableERC20Factory.sol";
import { SystemConfigInterop } from "src/L1/SystemConfigInterop.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol";
import { PermissionedDisputeGame } from "src/dispute/PermissionedDisputeGame.sol";
import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol";
import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol";
import { PreimageOracle } from "src/cannon/PreimageOracle.sol";
import { MIPS } from "src/cannon/MIPS.sol";
import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol";
import { ProtocolVersions, ProtocolVersion } from "src/L1/ProtocolVersions.sol";
import { StorageSetter } from "src/universal/StorageSetter.sol";

// Libraries
Expand All @@ -61,8 +56,12 @@ import { IL2OutputOracle } from "src/L1/interfaces/IL2OutputOracle.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { IDataAvailabilityChallenge } from "src/L1/interfaces/IDataAvailabilityChallenge.sol";
import { IL1ERC721Bridge } from "src/L1/interfaces/IL1ERC721Bridge.sol";
import { IL1StandardBridge } from "src/L1/interfaces/IL1StandardBridge.sol";
import { IProtocolVersions, ProtocolVersion } from "src/L1/interfaces/IProtocolVersions.sol";
import { IBigStepper } from "src/dispute/interfaces/IBigStepper.sol";
import { IPreimageOracle } from "src/cannon/interfaces/IPreimageOracle.sol";
import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol";

/// @title Deploy
/// @notice Script used to deploy a bedrock system. The entire system is deployed within the `run` function.
Expand Down Expand Up @@ -751,11 +750,8 @@ contract Deploy is Deployer {

/// @notice Deploy the OptimismMintableERC20Factory
function deployOptimismMintableERC20Factory() public broadcast returns (address addr_) {
console.log("Deploying OptimismMintableERC20Factory implementation");
OptimismMintableERC20Factory factory = new OptimismMintableERC20Factory{ salt: _implSalt() }();

save("OptimismMintableERC20Factory", address(factory));
console.log("OptimismMintableERC20Factory deployed at %s", address(factory));
IOptimismMintableERC20Factory factory =
IOptimismMintableERC20Factory(_deploy("OptimismMintableERC20Factory", hex""));

// Override the `OptimismMintableERC20Factory` contract to the deployed implementation. This is necessary
// to check the `OptimismMintableERC20Factory` implementation alongside dependent contracts, which
Expand Down Expand Up @@ -806,10 +802,7 @@ contract Deploy is Deployer {

/// @notice Deploy the ProtocolVersions
function deployProtocolVersions() public broadcast returns (address addr_) {
console.log("Deploying ProtocolVersions implementation");
ProtocolVersions versions = new ProtocolVersions{ salt: _implSalt() }();
save("ProtocolVersions", address(versions));
console.log("ProtocolVersions deployed at %s", address(versions));
IProtocolVersions versions = IProtocolVersions(_deploy("ProtocolVersions", hex""));

// Override the `ProtocolVersions` contract to the deployed implementation. This is necessary
// to check the `ProtocolVersions` implementation alongside dependent contracts, which
Expand Down Expand Up @@ -874,12 +867,7 @@ contract Deploy is Deployer {

/// @notice Deploy the L1StandardBridge
function deployL1StandardBridge() public broadcast returns (address addr_) {
console.log("Deploying L1StandardBridge implementation");

L1StandardBridge bridge = new L1StandardBridge{ salt: _implSalt() }();

save("L1StandardBridge", address(bridge));
console.log("L1StandardBridge deployed at %s", address(bridge));
IL1StandardBridge bridge = IL1StandardBridge(payable(_deploy("L1StandardBridge", hex"")));

// Override the `L1StandardBridge` contract to the deployed implementation. This is necessary
// to check the `L1StandardBridge` implementation alongside dependent contracts, which
Expand All @@ -893,11 +881,7 @@ contract Deploy is Deployer {

/// @notice Deploy the L1ERC721Bridge
function deployL1ERC721Bridge() public broadcast returns (address addr_) {
console.log("Deploying L1ERC721Bridge implementation");
L1ERC721Bridge bridge = new L1ERC721Bridge{ salt: _implSalt() }();

save("L1ERC721Bridge", address(bridge));
console.log("L1ERC721Bridge deployed at %s", address(bridge));
IL1ERC721Bridge bridge = IL1ERC721Bridge(_deploy("L1ERC721Bridge", hex""));

// Override the `L1ERC721Bridge` contract to the deployed implementation. This is necessary
// to check the `L1ERC721Bridge` implementation alongside dependent contracts, which
Expand Down Expand Up @@ -1137,7 +1121,7 @@ contract Deploy is Deployer {
_proxy: payable(l1StandardBridgeProxy),
_implementation: l1StandardBridge,
_innerCallData: abi.encodeCall(
L1StandardBridge.initialize,
IL1StandardBridge.initialize,
(
ICrossDomainMessenger(l1CrossDomainMessengerProxy),
ISuperchainConfig(superchainConfigProxy),
Expand All @@ -1146,7 +1130,7 @@ contract Deploy is Deployer {
)
});

string memory version = L1StandardBridge(payable(l1StandardBridgeProxy)).version();
string memory version = IL1StandardBridge(payable(l1StandardBridgeProxy)).version();
console.log("L1StandardBridge version: %s", version);

ChainAssertions.checkL1StandardBridge({ _contracts: _proxies(), _isProxy: true });
Expand All @@ -1164,12 +1148,12 @@ contract Deploy is Deployer {
_proxy: payable(l1ERC721BridgeProxy),
_implementation: l1ERC721Bridge,
_innerCallData: abi.encodeCall(
L1ERC721Bridge.initialize,
IL1ERC721Bridge.initialize,
(ICrossDomainMessenger(payable(l1CrossDomainMessengerProxy)), ISuperchainConfig(superchainConfigProxy))
)
});

L1ERC721Bridge bridge = L1ERC721Bridge(l1ERC721BridgeProxy);
IL1ERC721Bridge bridge = IL1ERC721Bridge(l1ERC721BridgeProxy);
string memory version = bridge.version();
console.log("L1ERC721Bridge version: %s", version);

Expand All @@ -1186,10 +1170,10 @@ contract Deploy is Deployer {
_upgradeAndCallViaSafe({
_proxy: payable(optimismMintableERC20FactoryProxy),
_implementation: optimismMintableERC20Factory,
_innerCallData: abi.encodeCall(OptimismMintableERC20Factory.initialize, (l1StandardBridgeProxy))
_innerCallData: abi.encodeCall(IOptimismMintableERC20Factory.initialize, (l1StandardBridgeProxy))
});

OptimismMintableERC20Factory factory = OptimismMintableERC20Factory(optimismMintableERC20FactoryProxy);
IOptimismMintableERC20Factory factory = IOptimismMintableERC20Factory(optimismMintableERC20FactoryProxy);
string memory version = factory.version();
console.log("OptimismMintableERC20Factory version: %s", version);

Expand Down Expand Up @@ -1358,7 +1342,7 @@ contract Deploy is Deployer {
_proxy: payable(protocolVersionsProxy),
_implementation: protocolVersions,
_innerCallData: abi.encodeCall(
ProtocolVersions.initialize,
IProtocolVersions.initialize,
(
finalSystemOwner,
ProtocolVersion.wrap(requiredProtocolVersion),
Expand All @@ -1367,7 +1351,7 @@ contract Deploy is Deployer {
)
});

ProtocolVersions versions = ProtocolVersions(protocolVersionsProxy);
IProtocolVersions versions = IProtocolVersions(protocolVersionsProxy);
string memory version = versions.version();
console.log("ProtocolVersions version: %s", version);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { PeripheryDeployConfig } from "scripts/periphery/deploy/PeripheryDeployC

import { ProxyAdmin } from "src/universal/ProxyAdmin.sol";
import { Proxy } from "src/universal/Proxy.sol";
import { L1StandardBridge } from "src/L1/L1StandardBridge.sol";
import { Faucet } from "src/periphery/faucet/Faucet.sol";
import { Drippie } from "src/periphery/drippie/Drippie.sol";
import { CheckGelatoLow } from "src/periphery/drippie/dripchecks/CheckGelatoLow.sol";
Expand Down
6 changes: 3 additions & 3 deletions packages/contracts-bedrock/semver-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@
},
"src/L2/L2ERC721Bridge.sol": {
"initCodeHash": "0x827077e1a0ce6c8f9ee1196c409ea77d831efd440992b3969b05259083cdf0bd",
"sourceCodeHash": "0xdc5e08a5a9ee8d61e843ac630126629ccfedb49a3b0dd167863dd48d75629a95"
"sourceCodeHash": "0x51a44e1fcef9483cc58ba0c9895cb3eec675785145428ece9aa7acd1a1a5b57c"
},
"src/L2/L2StandardBridge.sol": {
"initCodeHash": "0x01692b613e3d4e649d877a0fd8f0798a26401ba8ccc4cda0e61f1f9079729320",
"sourceCodeHash": "0x5c8e8ba3ecdae116f98caf67cca5fb3594bf7085e186f0a14bad1d6f143b6bc8"
"sourceCodeHash": "0xca7d45b137fb66a941cbfe97a914c8bda78462c86ddd90085b6e2275cfb6da92"
},
"src/L2/L2StandardBridgeInterop.sol": {
"initCodeHash": "0x5c9ef6b0817f715d1b8b097f3fc19e33bc54453426ca12bb48e4cea143076339",
"sourceCodeHash": "0x5a2d206477d6ba84e93bf0e1545a5cf2c93a6bb80529c07927f53915bde298bf"
"sourceCodeHash": "0x6c814f4536d9fb8f384ed2195957f868abd15252e36d6dd243f3d60349a61994"
},
"src/L2/L2ToL1MessagePasser.sol": {
"initCodeHash": "0x13fe3729beb9ed966c97bef09acb9fe5043fe651d453145073d05f2567fa988d",
Expand Down
Loading