Commit de869226 authored by smartcontracts's avatar smartcontracts Committed by GitHub

maint: add more L1 interfaces (#11822)

Another PR adding contract interfaces. L1 contract interfaces are
way more involved than everything else so we're required to start
replacing the contracts with interfaces all over the place.
parent 9a222407
...@@ -4,14 +4,14 @@ GasBenchMark_L1BlockIsthmus_SetValuesIsthmus:test_setL1BlockValuesIsthmus_benchm ...@@ -4,14 +4,14 @@ GasBenchMark_L1BlockIsthmus_SetValuesIsthmus:test_setL1BlockValuesIsthmus_benchm
GasBenchMark_L1BlockIsthmus_SetValuesIsthmus_Warm:test_setL1BlockValuesIsthmus_benchmark() (gas: 5121) GasBenchMark_L1BlockIsthmus_SetValuesIsthmus_Warm:test_setL1BlockValuesIsthmus_benchmark() (gas: 5121)
GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (gas: 158531) GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (gas: 158531)
GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7597) GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7597)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369356) GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369242)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967496) GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967382)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 564483) GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 564365)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4076526) GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4076580)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 466947) GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 467007)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3512629) GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3512689)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 72624) GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 72624)
GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 92973) GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 92973)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 68433) GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 68320)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 68903) GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 68962)
GasBenchMark_OptimismPortal:test_proveWithdrawalTransaction_benchmark() (gas: 155618) GasBenchMark_OptimismPortal:test_proveWithdrawalTransaction_benchmark() (gas: 155618)
\ No newline at end of file
# `OptimismPortal` Invariants # `OptimismPortal` Invariants
## Deposits of any value should always succeed unless `_to` = `address(0)` or `_isCreation` = `true`. ## Deposits of any value should always succeed unless `_to` = `address(0)` or `_isCreation` = `true`.
**Test:** [`OptimismPortal.t.sol#L148`](../test/invariants/OptimismPortal.t.sol#L148) **Test:** [`OptimismPortal.t.sol#L151`](../test/invariants/OptimismPortal.t.sol#L151)
All deposits, barring creation transactions and transactions sent to `address(0)`, should always succeed. All deposits, barring creation transactions and transactions sent to `address(0)`, should always succeed.
## `finalizeWithdrawalTransaction` should revert if the finalization period has not elapsed. ## `finalizeWithdrawalTransaction` should revert if the finalization period has not elapsed.
**Test:** [`OptimismPortal.t.sol#L171`](../test/invariants/OptimismPortal.t.sol#L171) **Test:** [`OptimismPortal.t.sol#L174`](../test/invariants/OptimismPortal.t.sol#L174)
A withdrawal that has been proven should not be able to be finalized until after the finalization period has elapsed. A withdrawal that has been proven should not be able to be finalized until after the finalization period has elapsed.
## `finalizeWithdrawalTransaction` should revert if the withdrawal has already been finalized. ## `finalizeWithdrawalTransaction` should revert if the withdrawal has already been finalized.
**Test:** [`OptimismPortal.t.sol#L201`](../test/invariants/OptimismPortal.t.sol#L201) **Test:** [`OptimismPortal.t.sol#L204`](../test/invariants/OptimismPortal.t.sol#L204)
Ensures that there is no chain of calls that can be made that allows a withdrawal to be finalized twice. Ensures that there is no chain of calls that can be made that allows a withdrawal to be finalized twice.
## A withdrawal should **always** be able to be finalized `FINALIZATION_PERIOD_SECONDS` after it was successfully proven. ## A withdrawal should **always** be able to be finalized `FINALIZATION_PERIOD_SECONDS` after it was successfully proven.
**Test:** [`OptimismPortal.t.sol#L230`](../test/invariants/OptimismPortal.t.sol#L230) **Test:** [`OptimismPortal.t.sol#L233`](../test/invariants/OptimismPortal.t.sol#L233)
This invariant asserts that there is no chain of calls that can be made that will prevent a withdrawal from being finalized exactly `FINALIZATION_PERIOD_SECONDS` after it was successfully proven. This invariant asserts that there is no chain of calls that can be made that will prevent a withdrawal from being finalized exactly `FINALIZATION_PERIOD_SECONDS` after it was successfully proven.
\ No newline at end of file
# `OptimismPortal2` Invariants # `OptimismPortal2` Invariants
## Deposits of any value should always succeed unless `_to` = `address(0)` or `_isCreation` = `true`. ## Deposits of any value should always succeed unless `_to` = `address(0)` or `_isCreation` = `true`.
**Test:** [`OptimismPortal2.t.sol#L161`](../test/invariants/OptimismPortal2.t.sol#L161) **Test:** [`OptimismPortal2.t.sol#L163`](../test/invariants/OptimismPortal2.t.sol#L163)
All deposits, barring creation transactions and transactions sent to `address(0)`, should always succeed. All deposits, barring creation transactions and transactions sent to `address(0)`, should always succeed.
## `finalizeWithdrawalTransaction` should revert if the proof maturity period has not elapsed. ## `finalizeWithdrawalTransaction` should revert if the proof maturity period has not elapsed.
**Test:** [`OptimismPortal2.t.sol#L183`](../test/invariants/OptimismPortal2.t.sol#L183) **Test:** [`OptimismPortal2.t.sol#L185`](../test/invariants/OptimismPortal2.t.sol#L185)
A withdrawal that has been proven should not be able to be finalized until after the proof maturity period has elapsed. A withdrawal that has been proven should not be able to be finalized until after the proof maturity period has elapsed.
## `finalizeWithdrawalTransaction` should revert if the withdrawal has already been finalized. ## `finalizeWithdrawalTransaction` should revert if the withdrawal has already been finalized.
**Test:** [`OptimismPortal2.t.sol#L212`](../test/invariants/OptimismPortal2.t.sol#L212) **Test:** [`OptimismPortal2.t.sol#L214`](../test/invariants/OptimismPortal2.t.sol#L214)
Ensures that there is no chain of calls that can be made that allows a withdrawal to be finalized twice. Ensures that there is no chain of calls that can be made that allows a withdrawal to be finalized twice.
## A withdrawal should **always** be able to be finalized `PROOF_MATURITY_DELAY_SECONDS` after it was successfully proven, if the game has resolved and passed the air-gap. ## A withdrawal should **always** be able to be finalized `PROOF_MATURITY_DELAY_SECONDS` after it was successfully proven, if the game has resolved and passed the air-gap.
**Test:** [`OptimismPortal2.t.sol#L240`](../test/invariants/OptimismPortal2.t.sol#L240) **Test:** [`OptimismPortal2.t.sol#L242`](../test/invariants/OptimismPortal2.t.sol#L242)
This invariant asserts that there is no chain of calls that can be made that will prevent a withdrawal from being finalized exactly `PROOF_MATURITY_DELAY_SECONDS` after it was successfully proven and the game has resolved and passed the air-gap. This invariant asserts that there is no chain of calls that can be made that will prevent a withdrawal from being finalized exactly `PROOF_MATURITY_DELAY_SECONDS` after it was successfully proven and the game has resolved and passed the air-gap.
\ No newline at end of file
# `ResourceMetering` Invariants # `ResourceMetering` Invariants
## The base fee should increase if the last block used more than the target amount of gas. ## The base fee should increase if the last block used more than the target amount of gas.
**Test:** [`ResourceMetering.t.sol#L163`](../test/invariants/ResourceMetering.t.sol#L163) **Test:** [`ResourceMetering.t.sol#L166`](../test/invariants/ResourceMetering.t.sol#L166)
If the last block used more than the target amount of gas (and there were no empty blocks in between), ensure this block's baseFee increased, but not by more than the max amount per block. If the last block used more than the target amount of gas (and there were no empty blocks in between), ensure this block's baseFee increased, but not by more than the max amount per block.
## The base fee should decrease if the last block used less than the target amount of gas. ## The base fee should decrease if the last block used less than the target amount of gas.
**Test:** [`ResourceMetering.t.sol#L172`](../test/invariants/ResourceMetering.t.sol#L172) **Test:** [`ResourceMetering.t.sol#L175`](../test/invariants/ResourceMetering.t.sol#L175)
If the previous block used less than the target amount of gas, the base fee should decrease, but not more than the max amount. If the previous block used less than the target amount of gas, the base fee should decrease, but not more than the max amount.
## A block's base fee should never be below `MINIMUM_BASE_FEE`. ## A block's base fee should never be below `MINIMUM_BASE_FEE`.
**Test:** [`ResourceMetering.t.sol#L180`](../test/invariants/ResourceMetering.t.sol#L180) **Test:** [`ResourceMetering.t.sol#L183`](../test/invariants/ResourceMetering.t.sol#L183)
This test asserts that a block's base fee can never drop below the `MINIMUM_BASE_FEE` threshold. This test asserts that a block's base fee can never drop below the `MINIMUM_BASE_FEE` threshold.
## A block can never consume more than `MAX_RESOURCE_LIMIT` gas. ## A block can never consume more than `MAX_RESOURCE_LIMIT` gas.
**Test:** [`ResourceMetering.t.sol#L188`](../test/invariants/ResourceMetering.t.sol#L188) **Test:** [`ResourceMetering.t.sol#L191`](../test/invariants/ResourceMetering.t.sol#L191)
This test asserts that a block can never consume more than the `MAX_RESOURCE_LIMIT` gas threshold. This test asserts that a block can never consume more than the `MAX_RESOURCE_LIMIT` gas threshold.
## The base fee can never be raised more than the max base fee change. ## The base fee can never be raised more than the max base fee change.
**Test:** [`ResourceMetering.t.sol#L198`](../test/invariants/ResourceMetering.t.sol#L198) **Test:** [`ResourceMetering.t.sol#L201`](../test/invariants/ResourceMetering.t.sol#L201)
After a block consumes more gas than the target gas, the base fee cannot be raised more than the maximum amount allowed. The max base fee change (per-block) is derived as follows: `prevBaseFee / BASE_FEE_MAX_CHANGE_DENOMINATOR` After a block consumes more gas than the target gas, the base fee cannot be raised more than the maximum amount allowed. The max base fee change (per-block) is derived as follows: `prevBaseFee / BASE_FEE_MAX_CHANGE_DENOMINATOR`
## The base fee can never be lowered more than the max base fee change. ## The base fee can never be lowered more than the max base fee change.
**Test:** [`ResourceMetering.t.sol#L208`](../test/invariants/ResourceMetering.t.sol#L208) **Test:** [`ResourceMetering.t.sol#L211`](../test/invariants/ResourceMetering.t.sol#L211)
After a block consumes less than the target gas, the base fee cannot be lowered more than the maximum amount allowed. The max base fee change (per-block) is derived as follows: `prevBaseFee / BASE_FEE_MAX_CHANGE_DENOMINATOR` After a block consumes less than the target gas, the base fee cannot be lowered more than the maximum amount allowed. The max base fee change (per-block) is derived as follows: `prevBaseFee / BASE_FEE_MAX_CHANGE_DENOMINATOR`
## The `maxBaseFeeChange` calculation over multiple blocks can never underflow. ## The `maxBaseFeeChange` calculation over multiple blocks can never underflow.
**Test:** [`ResourceMetering.t.sol#L217`](../test/invariants/ResourceMetering.t.sol#L217) **Test:** [`ResourceMetering.t.sol#L220`](../test/invariants/ResourceMetering.t.sol#L220)
When calculating the `maxBaseFeeChange` after multiple empty blocks, the calculation should never be allowed to underflow. When calculating the `maxBaseFeeChange` after multiple empty blocks, the calculation should never be allowed to underflow.
\ No newline at end of file
# `SystemConfig` Invariants # `SystemConfig` Invariants
## Gas limit boundaries ## Gas limit boundaries
**Test:** [`SystemConfig.t.sol#L70`](../test/invariants/SystemConfig.t.sol#L70) **Test:** [`SystemConfig.t.sol#L71`](../test/invariants/SystemConfig.t.sol#L71)
The gas limit of the `SystemConfig` contract can never be lower than the hard-coded lower bound or higher than the hard-coded upper bound. The lower bound must never be higher than the upper bound. The gas limit of the `SystemConfig` contract can never be lower than the hard-coded lower bound or higher than the hard-coded upper bound. The lower bound must never be higher than the upper bound.
\ No newline at end of file
...@@ -21,7 +21,7 @@ import { OptimismMintableERC721Factory } from "src/universal/OptimismMintableERC ...@@ -21,7 +21,7 @@ import { OptimismMintableERC721Factory } from "src/universal/OptimismMintableERC
import { BaseFeeVault } from "src/L2/BaseFeeVault.sol"; import { BaseFeeVault } from "src/L2/BaseFeeVault.sol";
import { L1FeeVault } from "src/L2/L1FeeVault.sol"; import { L1FeeVault } from "src/L2/L1FeeVault.sol";
import { GovernanceToken } from "src/governance/GovernanceToken.sol"; import { GovernanceToken } from "src/governance/GovernanceToken.sol";
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol"; import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
import { L1StandardBridge } from "src/L1/L1StandardBridge.sol"; import { L1StandardBridge } from "src/L1/L1StandardBridge.sol";
import { FeeVault } from "src/universal/FeeVault.sol"; import { FeeVault } from "src/universal/FeeVault.sol";
import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol"; import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
...@@ -277,10 +277,10 @@ contract L2Genesis is Deployer { ...@@ -277,10 +277,10 @@ contract L2Genesis is Deployer {
function setL2CrossDomainMessenger(address payable _l1CrossDomainMessengerProxy) public { function setL2CrossDomainMessenger(address payable _l1CrossDomainMessengerProxy) public {
address impl = _setImplementationCode(Predeploys.L2_CROSS_DOMAIN_MESSENGER); address impl = _setImplementationCode(Predeploys.L2_CROSS_DOMAIN_MESSENGER);
L2CrossDomainMessenger(impl).initialize({ _l1CrossDomainMessenger: L1CrossDomainMessenger(address(0)) }); L2CrossDomainMessenger(impl).initialize({ _l1CrossDomainMessenger: CrossDomainMessenger(address(0)) });
L2CrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER).initialize({ L2CrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER).initialize({
_l1CrossDomainMessenger: L1CrossDomainMessenger(_l1CrossDomainMessengerProxy) _l1CrossDomainMessenger: CrossDomainMessenger(_l1CrossDomainMessengerProxy)
}); });
} }
......
...@@ -180,8 +180,24 @@ for interface_file in $JSON_FILES; do ...@@ -180,8 +180,24 @@ for interface_file in $JSON_FILES; do
interface_abi=$(jq '[.abi[] | select(.type != "constructor")]' < "$interface_file") interface_abi=$(jq '[.abi[] | select(.type != "constructor")]' < "$interface_file")
contract_abi=$(jq '[.abi[] | select(.type != "constructor")]' < "$corresponding_contract_file") contract_abi=$(jq '[.abi[] | select(.type != "constructor")]' < "$corresponding_contract_file")
# Function to normalize ABI by replacing interface name with contract name.
# Base contracts aren't allowed to inherit from their interfaces in order
# to guarantee a 1:1 match between interfaces and contracts. This means
# that the interface will redefine types in the base contract. We normalize
# the ABI as if the interface and contract are the same name
normalize_abi() {
local abi="$1"
local interface_name="$2"
local contract_name="$3"
echo "${abi//$interface_name/$contract_name}"
}
# Normalize the ABIs
normalized_interface_abi=$(normalize_abi "$interface_abi" "$contract_name" "$contract_basename")
normalized_contract_abi="$contract_abi"
# Use jq to compare the ABIs # Use jq to compare the ABIs
if ! diff_result=$(diff -u <(echo "$interface_abi" | jq -S .) <(echo "$contract_abi" | jq -S .)); then if ! diff_result=$(diff -u <(echo "$normalized_interface_abi" | jq -S .) <(echo "$normalized_contract_abi" | jq -S .)); then
if ! grep -q "^$contract_name$" "$REPORTED_INTERFACES_FILE"; then if ! grep -q "^$contract_name$" "$REPORTED_INTERFACES_FILE"; then
echo "$contract_name" >> "$REPORTED_INTERFACES_FILE" echo "$contract_name" >> "$REPORTED_INTERFACES_FILE"
if ! is_excluded "$contract_name"; then if ! is_excluded "$contract_name"; then
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol"; // Testing
import { ResourceMetering } from "src/L1/ResourceMetering.sol"; import { Vm } from "forge-std/Vm.sol";
import { console2 as console } from "forge-std/console2.sol";
// Scripts
import { DeployConfig } from "scripts/deploy/DeployConfig.s.sol"; import { DeployConfig } from "scripts/deploy/DeployConfig.s.sol";
import { Deployer } from "scripts/deploy/Deployer.sol"; import { Deployer } from "scripts/deploy/Deployer.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { Constants } from "src/libraries/Constants.sol"; // Contracts
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol";
import { L1StandardBridge } from "src/L1/L1StandardBridge.sol"; import { L1StandardBridge } from "src/L1/L1StandardBridge.sol";
import { IL2OutputOracle } from "src/L1/interfaces/IL2OutputOracle.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol"; import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol"; import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol";
import { ProtocolVersion, ProtocolVersions } from "src/L1/ProtocolVersions.sol"; import { ProtocolVersion, ProtocolVersions } from "src/L1/ProtocolVersions.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol";
import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol";
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol";
import { OptimismMintableERC20Factory } from "src/universal/OptimismMintableERC20Factory.sol"; import { OptimismMintableERC20Factory } from "src/universal/OptimismMintableERC20Factory.sol";
import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol"; import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol";
// Libraries
import { Constants } from "src/libraries/Constants.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { Types } from "scripts/libraries/Types.sol"; import { Types } from "scripts/libraries/Types.sol";
import { Vm } from "forge-std/Vm.sol";
// Interfaces
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { IL2OutputOracle } from "src/L1/interfaces/IL2OutputOracle.sol";
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 { ISystemConfigV0 } from "scripts/interfaces/ISystemConfigV0.sol";
import { console2 as console } from "forge-std/console2.sol";
library ChainAssertions { library ChainAssertions {
Vm internal constant vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D); Vm internal constant vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
...@@ -39,8 +48,8 @@ library ChainAssertions { ...@@ -39,8 +48,8 @@ library ChainAssertions {
view view
{ {
console.log("Running post-deploy assertions"); console.log("Running post-deploy assertions");
ResourceMetering.ResourceConfig memory rcfg = SystemConfig(_prox.SystemConfig).resourceConfig(); IResourceMetering.ResourceConfig memory rcfg = ISystemConfig(_prox.SystemConfig).resourceConfig();
ResourceMetering.ResourceConfig memory dflt = Constants.DEFAULT_RESOURCE_CONFIG(); IResourceMetering.ResourceConfig memory dflt = Constants.DEFAULT_RESOURCE_CONFIG();
require(keccak256(abi.encode(rcfg)) == keccak256(abi.encode(dflt))); require(keccak256(abi.encode(rcfg)) == keccak256(abi.encode(dflt)));
checkSystemConfig({ _contracts: _prox, _cfg: _cfg, _isProxy: true }); checkSystemConfig({ _contracts: _prox, _cfg: _cfg, _isProxy: true });
...@@ -62,12 +71,12 @@ library ChainAssertions { ...@@ -62,12 +71,12 @@ library ChainAssertions {
/// @notice Asserts that the SystemConfig is setup correctly /// @notice Asserts that the SystemConfig is setup correctly
function checkSystemConfig(Types.ContractSet memory _contracts, DeployConfig _cfg, bool _isProxy) internal view { function checkSystemConfig(Types.ContractSet memory _contracts, DeployConfig _cfg, bool _isProxy) internal view {
console.log("Running chain assertions on the SystemConfig"); console.log("Running chain assertions on the SystemConfig");
SystemConfig config = SystemConfig(_contracts.SystemConfig); ISystemConfig config = ISystemConfig(_contracts.SystemConfig);
// Check that the contract is initialized // Check that the contract is initialized
assertSlotValueIsOne({ _contractAddress: address(config), _slot: 0, _offset: 0 }); assertSlotValueIsOne({ _contractAddress: address(config), _slot: 0, _offset: 0 });
ResourceMetering.ResourceConfig memory resourceConfig = config.resourceConfig(); IResourceMetering.ResourceConfig memory resourceConfig = config.resourceConfig();
if (_isProxy) { if (_isProxy) {
require(config.owner() == _cfg.finalSystemOwner()); require(config.owner() == _cfg.finalSystemOwner());
...@@ -78,7 +87,7 @@ library ChainAssertions { ...@@ -78,7 +87,7 @@ library ChainAssertions {
require(config.unsafeBlockSigner() == _cfg.p2pSequencerAddress()); require(config.unsafeBlockSigner() == _cfg.p2pSequencerAddress());
require(config.scalar() >> 248 == 1); require(config.scalar() >> 248 == 1);
// Check _config // Check _config
ResourceMetering.ResourceConfig memory rconfig = Constants.DEFAULT_RESOURCE_CONFIG(); IResourceMetering.ResourceConfig memory rconfig = Constants.DEFAULT_RESOURCE_CONFIG();
require(resourceConfig.maxResourceLimit == rconfig.maxResourceLimit); require(resourceConfig.maxResourceLimit == rconfig.maxResourceLimit);
require(resourceConfig.elasticityMultiplier == rconfig.elasticityMultiplier); require(resourceConfig.elasticityMultiplier == rconfig.elasticityMultiplier);
require(resourceConfig.baseFeeMaxChangeDenominator == rconfig.baseFeeMaxChangeDenominator); require(resourceConfig.baseFeeMaxChangeDenominator == rconfig.baseFeeMaxChangeDenominator);
...@@ -127,7 +136,7 @@ library ChainAssertions { ...@@ -127,7 +136,7 @@ library ChainAssertions {
/// @notice Asserts that the L1CrossDomainMessenger is setup correctly /// @notice Asserts that the L1CrossDomainMessenger is setup correctly
function checkL1CrossDomainMessenger(Types.ContractSet memory _contracts, Vm _vm, bool _isProxy) internal view { function checkL1CrossDomainMessenger(Types.ContractSet memory _contracts, Vm _vm, bool _isProxy) internal view {
console.log("Running chain assertions on the L1CrossDomainMessenger"); console.log("Running chain assertions on the L1CrossDomainMessenger");
L1CrossDomainMessenger messenger = L1CrossDomainMessenger(_contracts.L1CrossDomainMessenger); IL1CrossDomainMessenger messenger = IL1CrossDomainMessenger(_contracts.L1CrossDomainMessenger);
// Check that the contract is initialized // Check that the contract is initialized
assertSlotValueIsOne({ _contractAddress: address(messenger), _slot: 0, _offset: 20 }); assertSlotValueIsOne({ _contractAddress: address(messenger), _slot: 0, _offset: 20 });
...@@ -201,7 +210,7 @@ library ChainAssertions { ...@@ -201,7 +210,7 @@ library ChainAssertions {
if (_isProxy) { if (_isProxy) {
require(weth.owner() == _expectedOwner); require(weth.owner() == _expectedOwner);
require(weth.delay() == _cfg.faultGameWithdrawalDelay()); require(weth.delay() == _cfg.faultGameWithdrawalDelay());
require(weth.config() == SuperchainConfig(_contracts.SuperchainConfig)); require(weth.config() == ISuperchainConfig(_contracts.SuperchainConfig));
} else { } else {
require(weth.owner() == _expectedOwner); require(weth.owner() == _expectedOwner);
require(weth.delay() == _cfg.faultGameWithdrawalDelay()); require(weth.delay() == _cfg.faultGameWithdrawalDelay());
...@@ -227,7 +236,7 @@ library ChainAssertions { ...@@ -227,7 +236,7 @@ library ChainAssertions {
if (_isProxy) { if (_isProxy) {
require(weth.owner() == _expectedOwner); require(weth.owner() == _expectedOwner);
require(weth.delay() == _cfg.faultGameWithdrawalDelay()); require(weth.delay() == _cfg.faultGameWithdrawalDelay());
require(weth.config() == SuperchainConfig(_contracts.SuperchainConfig)); require(weth.config() == ISuperchainConfig(_contracts.SuperchainConfig));
} else { } else {
require(weth.owner() == _expectedOwner); require(weth.owner() == _expectedOwner);
require(weth.delay() == _cfg.faultGameWithdrawalDelay()); require(weth.delay() == _cfg.faultGameWithdrawalDelay());
...@@ -322,7 +331,7 @@ library ChainAssertions { ...@@ -322,7 +331,7 @@ library ChainAssertions {
function checkOptimismPortal(Types.ContractSet memory _contracts, DeployConfig _cfg, bool _isProxy) internal view { function checkOptimismPortal(Types.ContractSet memory _contracts, DeployConfig _cfg, bool _isProxy) internal view {
console.log("Running chain assertions on the OptimismPortal"); console.log("Running chain assertions on the OptimismPortal");
OptimismPortal portal = OptimismPortal(payable(_contracts.OptimismPortal)); IOptimismPortal portal = IOptimismPortal(payable(_contracts.OptimismPortal));
// Check that the contract is initialized // Check that the contract is initialized
assertSlotValueIsOne({ _contractAddress: address(portal), _slot: 0, _offset: 0 }); assertSlotValueIsOne({ _contractAddress: address(portal), _slot: 0, _offset: 0 });
...@@ -337,7 +346,7 @@ library ChainAssertions { ...@@ -337,7 +346,7 @@ library ChainAssertions {
require(address(portal.systemConfig()) == _contracts.SystemConfig); require(address(portal.systemConfig()) == _contracts.SystemConfig);
require(portal.guardian() == guardian); require(portal.guardian() == guardian);
require(address(portal.superchainConfig()) == address(_contracts.SuperchainConfig)); require(address(portal.superchainConfig()) == address(_contracts.SuperchainConfig));
require(portal.paused() == SuperchainConfig(_contracts.SuperchainConfig).paused()); require(portal.paused() == ISuperchainConfig(_contracts.SuperchainConfig).paused());
require(portal.l2Sender() == Constants.DEFAULT_L2_SENDER); require(portal.l2Sender() == Constants.DEFAULT_L2_SENDER);
} else { } else {
require(address(portal.l2Oracle()) == address(0)); require(address(portal.l2Oracle()) == address(0));
...@@ -358,7 +367,7 @@ library ChainAssertions { ...@@ -358,7 +367,7 @@ library ChainAssertions {
{ {
console.log("Running chain assertions on the OptimismPortal2"); console.log("Running chain assertions on the OptimismPortal2");
OptimismPortal2 portal = OptimismPortal2(payable(_contracts.OptimismPortal2)); IOptimismPortal2 portal = IOptimismPortal2(payable(_contracts.OptimismPortal2));
// Check that the contract is initialized // Check that the contract is initialized
assertSlotValueIsOne({ _contractAddress: address(portal), _slot: 0, _offset: 0 }); assertSlotValueIsOne({ _contractAddress: address(portal), _slot: 0, _offset: 0 });
...@@ -373,7 +382,7 @@ library ChainAssertions { ...@@ -373,7 +382,7 @@ library ChainAssertions {
require(address(portal.systemConfig()) == _contracts.SystemConfig); require(address(portal.systemConfig()) == _contracts.SystemConfig);
require(portal.guardian() == guardian); require(portal.guardian() == guardian);
require(address(portal.superchainConfig()) == address(_contracts.SuperchainConfig)); require(address(portal.superchainConfig()) == address(_contracts.SuperchainConfig));
require(portal.paused() == SuperchainConfig(_contracts.SuperchainConfig).paused()); require(portal.paused() == ISuperchainConfig(_contracts.SuperchainConfig).paused());
require(portal.l2Sender() == Constants.DEFAULT_L2_SENDER); require(portal.l2Sender() == Constants.DEFAULT_L2_SENDER);
} else { } else {
require(address(portal.disputeGameFactory()) == address(0)); require(address(portal.disputeGameFactory()) == address(0));
...@@ -422,7 +431,7 @@ library ChainAssertions { ...@@ -422,7 +431,7 @@ library ChainAssertions {
view view
{ {
console.log("Running chain assertions on the SuperchainConfig"); console.log("Running chain assertions on the SuperchainConfig");
SuperchainConfig superchainConfig = SuperchainConfig(_contracts.SuperchainConfig); ISuperchainConfig superchainConfig = ISuperchainConfig(_contracts.SuperchainConfig);
// Check that the contract is initialized // Check that the contract is initialized
assertSlotValueIsOne({ _contractAddress: address(superchainConfig), _slot: 0, _offset: 0 }); assertSlotValueIsOne({ _contractAddress: address(superchainConfig), _slot: 0, _offset: 0 });
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
// Testing
import { VmSafe } from "forge-std/Vm.sol"; import { VmSafe } from "forge-std/Vm.sol";
import { Script } from "forge-std/Script.sol"; import { Script } from "forge-std/Script.sol";
import { console2 as console } from "forge-std/console2.sol"; import { console2 as console } from "forge-std/console2.sol";
import { stdJson } from "forge-std/StdJson.sol"; import { stdJson } from "forge-std/StdJson.sol";
import { AlphabetVM } from "test/mocks/AlphabetVM.sol";
import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
// Safe
import { GnosisSafe as Safe } from "safe-contracts/GnosisSafe.sol"; import { GnosisSafe as Safe } from "safe-contracts/GnosisSafe.sol";
import { OwnerManager } from "safe-contracts/base/OwnerManager.sol"; import { OwnerManager } from "safe-contracts/base/OwnerManager.sol";
import { GnosisSafeProxyFactory as SafeProxyFactory } from "safe-contracts/proxies/GnosisSafeProxyFactory.sol"; import { GnosisSafeProxyFactory as SafeProxyFactory } from "safe-contracts/proxies/GnosisSafeProxyFactory.sol";
import { Enum as SafeOps } from "safe-contracts/common/Enum.sol"; import { Enum as SafeOps } from "safe-contracts/common/Enum.sol";
// Scripts
import { Deployer } from "scripts/deploy/Deployer.sol"; import { Deployer } from "scripts/deploy/Deployer.sol";
import { Chains } from "scripts/libraries/Chains.sol";
import { Config } from "scripts/libraries/Config.sol";
import { LibStateDiff } from "scripts/libraries/LibStateDiff.sol";
import { Process } from "scripts/libraries/Process.sol";
import { ForgeArtifacts } from "scripts/libraries/ForgeArtifacts.sol";
import { ChainAssertions } from "scripts/deploy/ChainAssertions.sol";
// Contracts
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol"; import { ProxyAdmin } from "src/universal/ProxyAdmin.sol";
import { AddressManager } from "src/legacy/AddressManager.sol"; import { AddressManager } from "src/legacy/AddressManager.sol";
import { Proxy } from "src/universal/Proxy.sol"; import { Proxy } from "src/universal/Proxy.sol";
import { L1StandardBridge } from "src/L1/L1StandardBridge.sol"; import { L1StandardBridge } from "src/L1/L1StandardBridge.sol";
import { StandardBridge } from "src/universal/StandardBridge.sol"; import { StandardBridge } from "src/universal/StandardBridge.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol";
import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol";
import { OptimismPortalInterop } from "src/L1/OptimismPortalInterop.sol";
import { L1ChugSplashProxy } from "src/legacy/L1ChugSplashProxy.sol"; import { L1ChugSplashProxy } from "src/legacy/L1ChugSplashProxy.sol";
import { ResolvedDelegateProxy } from "src/legacy/ResolvedDelegateProxy.sol"; import { ResolvedDelegateProxy } from "src/legacy/ResolvedDelegateProxy.sol";
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol";
import { IL2OutputOracle } from "src/L1/interfaces/IL2OutputOracle.sol";
import { OptimismMintableERC20Factory } from "src/universal/OptimismMintableERC20Factory.sol"; import { OptimismMintableERC20Factory } from "src/universal/OptimismMintableERC20Factory.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { SystemConfigInterop } from "src/L1/SystemConfigInterop.sol"; import { SystemConfigInterop } from "src/L1/SystemConfigInterop.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { DataAvailabilityChallenge } from "src/L1/DataAvailabilityChallenge.sol";
import { Constants } from "src/libraries/Constants.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol"; import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol"; import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol";
import { PermissionedDisputeGame } from "src/dispute/PermissionedDisputeGame.sol"; import { PermissionedDisputeGame } from "src/dispute/PermissionedDisputeGame.sol";
...@@ -43,20 +44,25 @@ import { MIPS } from "src/cannon/MIPS.sol"; ...@@ -43,20 +44,25 @@ import { MIPS } from "src/cannon/MIPS.sol";
import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol"; import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol";
import { ProtocolVersions, ProtocolVersion } from "src/L1/ProtocolVersions.sol"; import { ProtocolVersions, ProtocolVersion } from "src/L1/ProtocolVersions.sol";
import { StorageSetter } from "src/universal/StorageSetter.sol"; import { StorageSetter } from "src/universal/StorageSetter.sol";
// Libraries
import { Constants } from "src/libraries/Constants.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { Chains } from "scripts/libraries/Chains.sol"; import { Types } from "scripts/libraries/Types.sol";
import { Config } from "scripts/libraries/Config.sol"; import "src/dispute/lib/Types.sol";
// Interfaces
import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
import { IOptimismPortal2 } from "src/L1/interfaces/IOptimismPortal2.sol";
import { IOptimismPortalInterop } from "src/L1/interfaces/IOptimismPortalInterop.sol";
import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
import { IL1CrossDomainMessenger } from "src/L1/interfaces/IL1CrossDomainMessenger.sol";
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 { IBigStepper } from "src/dispute/interfaces/IBigStepper.sol"; import { IBigStepper } from "src/dispute/interfaces/IBigStepper.sol";
import { IPreimageOracle } from "src/cannon/interfaces/IPreimageOracle.sol"; import { IPreimageOracle } from "src/cannon/interfaces/IPreimageOracle.sol";
import { AlphabetVM } from "test/mocks/AlphabetVM.sol";
import "src/dispute/lib/Types.sol";
import { ChainAssertions } from "scripts/deploy/ChainAssertions.sol";
import { Types } from "scripts/libraries/Types.sol";
import { LibStateDiff } from "scripts/libraries/LibStateDiff.sol";
import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
import { ForgeArtifacts } from "scripts/libraries/ForgeArtifacts.sol";
import { Process } from "scripts/libraries/Process.sol";
/// @title Deploy /// @title Deploy
/// @notice Script used to deploy a bedrock system. The entire system is deployed within the `run` function. /// @notice Script used to deploy a bedrock system. The entire system is deployed within the `run` function.
...@@ -613,23 +619,16 @@ contract Deploy is Deployer { ...@@ -613,23 +619,16 @@ contract Deploy is Deployer {
/// @notice Deploy the SuperchainConfig contract /// @notice Deploy the SuperchainConfig contract
function deploySuperchainConfig() public broadcast { function deploySuperchainConfig() public broadcast {
SuperchainConfig superchainConfig = new SuperchainConfig{ salt: _implSalt() }(); ISuperchainConfig superchainConfig = ISuperchainConfig(_deploy("SuperchainConfig", hex""));
require(superchainConfig.guardian() == address(0)); require(superchainConfig.guardian() == address(0));
bytes32 initialized = vm.load(address(superchainConfig), bytes32(0)); bytes32 initialized = vm.load(address(superchainConfig), bytes32(0));
require(initialized != 0); require(initialized != 0);
save("SuperchainConfig", address(superchainConfig));
console.log("SuperchainConfig deployed at %s", address(superchainConfig));
} }
/// @notice Deploy the L1CrossDomainMessenger /// @notice Deploy the L1CrossDomainMessenger
function deployL1CrossDomainMessenger() public broadcast returns (address addr_) { function deployL1CrossDomainMessenger() public broadcast returns (address addr_) {
console.log("Deploying L1CrossDomainMessenger implementation"); IL1CrossDomainMessenger messenger = IL1CrossDomainMessenger(_deploy("L1CrossDomainMessenger", hex""));
L1CrossDomainMessenger messenger = new L1CrossDomainMessenger{ salt: _implSalt() }();
save("L1CrossDomainMessenger", address(messenger));
console.log("L1CrossDomainMessenger deployed at %s", address(messenger));
// Override the `L1CrossDomainMessenger` contract to the deployed implementation. This is necessary // Override the `L1CrossDomainMessenger` contract to the deployed implementation. This is necessary
// to check the `L1CrossDomainMessenger` implementation alongside dependent contracts, which // to check the `L1CrossDomainMessenger` implementation alongside dependent contracts, which
...@@ -643,13 +642,11 @@ contract Deploy is Deployer { ...@@ -643,13 +642,11 @@ contract Deploy is Deployer {
/// @notice Deploy the OptimismPortal /// @notice Deploy the OptimismPortal
function deployOptimismPortal() public broadcast returns (address addr_) { function deployOptimismPortal() public broadcast returns (address addr_) {
console.log("Deploying OptimismPortal implementation");
if (cfg.useInterop()) { if (cfg.useInterop()) {
console.log("Attempting to deploy OptimismPortal with interop, this config is a noop"); console.log("Attempting to deploy OptimismPortal with interop, this config is a noop");
} }
addr_ = address(new OptimismPortal{ salt: _implSalt() }());
save("OptimismPortal", addr_); addr_ = _deploy("OptimismPortal", hex"");
console.log("OptimismPortal deployed at %s", addr_);
// Override the `OptimismPortal` contract to the deployed implementation. This is necessary // Override the `OptimismPortal` contract to the deployed implementation. This is necessary
// to check the `OptimismPortal` implementation alongside dependent contracts, which // to check the `OptimismPortal` implementation alongside dependent contracts, which
...@@ -661,32 +658,23 @@ contract Deploy is Deployer { ...@@ -661,32 +658,23 @@ contract Deploy is Deployer {
/// @notice Deploy the OptimismPortal2 /// @notice Deploy the OptimismPortal2
function deployOptimismPortal2() public broadcast returns (address addr_) { function deployOptimismPortal2() public broadcast returns (address addr_) {
console.log("Deploying OptimismPortal2 implementation");
// Could also verify this inside DeployConfig but doing it here is a bit more reliable. // Could also verify this inside DeployConfig but doing it here is a bit more reliable.
require( require(
uint32(cfg.respectedGameType()) == cfg.respectedGameType(), "Deploy: respectedGameType must fit into uint32" uint32(cfg.respectedGameType()) == cfg.respectedGameType(), "Deploy: respectedGameType must fit into uint32"
); );
if (cfg.useInterop()) { if (cfg.useInterop()) {
addr_ = address( addr_ = _deploy(
new OptimismPortalInterop{ salt: _implSalt() }({ "OptimismPortalInterop",
_proofMaturityDelaySeconds: cfg.proofMaturityDelaySeconds(), abi.encode(cfg.proofMaturityDelaySeconds(), cfg.disputeGameFinalityDelaySeconds())
_disputeGameFinalityDelaySeconds: cfg.disputeGameFinalityDelaySeconds()
})
); );
save("OptimismPortal2", addr_);
} else { } else {
addr_ = address( addr_ = _deploy(
new OptimismPortal2{ salt: _implSalt() }({ "OptimismPortal2", abi.encode(cfg.proofMaturityDelaySeconds(), cfg.disputeGameFinalityDelaySeconds())
_proofMaturityDelaySeconds: cfg.proofMaturityDelaySeconds(),
_disputeGameFinalityDelaySeconds: cfg.disputeGameFinalityDelaySeconds()
})
); );
} }
save("OptimismPortal2", addr_);
console.log("OptimismPortal2 deployed at %s", addr_);
// Override the `OptimismPortal2` contract to the deployed implementation. This is necessary // Override the `OptimismPortal2` contract to the deployed implementation. This is necessary
// to check the `OptimismPortal2` implementation alongside dependent contracts, which // to check the `OptimismPortal2` implementation alongside dependent contracts, which
// are always proxies. // are always proxies.
...@@ -822,14 +810,12 @@ contract Deploy is Deployer { ...@@ -822,14 +810,12 @@ contract Deploy is Deployer {
/// @notice Deploy the SystemConfig /// @notice Deploy the SystemConfig
function deploySystemConfig() public broadcast returns (address addr_) { function deploySystemConfig() public broadcast returns (address addr_) {
console.log("Deploying SystemConfig implementation");
if (cfg.useInterop()) { if (cfg.useInterop()) {
addr_ = address(new SystemConfigInterop{ salt: _implSalt() }()); addr_ = _deploy("SystemConfigInterop", hex"");
save("SystemConfig", addr_);
} else { } else {
addr_ = address(new SystemConfig{ salt: _implSalt() }()); addr_ = _deploy("SystemConfig", hex"");
} }
save("SystemConfig", addr_);
console.log("SystemConfig deployed at %s", addr_);
// Override the `SystemConfig` contract to the deployed implementation. This is necessary // Override the `SystemConfig` contract to the deployed implementation. This is necessary
// to check the `SystemConfig` implementation alongside dependent contracts, which // to check the `SystemConfig` implementation alongside dependent contracts, which
...@@ -893,11 +879,8 @@ contract Deploy is Deployer { ...@@ -893,11 +879,8 @@ contract Deploy is Deployer {
/// @notice Deploy the DataAvailabilityChallenge /// @notice Deploy the DataAvailabilityChallenge
function deployDataAvailabilityChallenge() public broadcast returns (address addr_) { function deployDataAvailabilityChallenge() public broadcast returns (address addr_) {
console.log("Deploying DataAvailabilityChallenge implementation"); IDataAvailabilityChallenge dac =
DataAvailabilityChallenge dac = new DataAvailabilityChallenge(); IDataAvailabilityChallenge(payable(_deploy("DataAvailabilityChallenge", hex"")));
save("DataAvailabilityChallenge", address(dac));
console.log("DataAvailabilityChallenge deployed at %s", address(dac));
addr_ = address(dac); addr_ = address(dac);
} }
...@@ -912,7 +895,7 @@ contract Deploy is Deployer { ...@@ -912,7 +895,7 @@ contract Deploy is Deployer {
_upgradeAndCallViaSafe({ _upgradeAndCallViaSafe({
_proxy: superchainConfigProxy, _proxy: superchainConfigProxy,
_implementation: superchainConfig, _implementation: superchainConfig,
_innerCallData: abi.encodeCall(SuperchainConfig.initialize, (cfg.superchainConfigGuardian(), false)) _innerCallData: abi.encodeCall(ISuperchainConfig.initialize, (cfg.superchainConfigGuardian(), false))
}); });
ChainAssertions.checkSuperchainConfig({ _contracts: _proxiesUnstrict(), _cfg: cfg, _isPaused: false }); ChainAssertions.checkSuperchainConfig({ _contracts: _proxiesUnstrict(), _cfg: cfg, _isPaused: false });
...@@ -945,7 +928,7 @@ contract Deploy is Deployer { ...@@ -945,7 +928,7 @@ contract Deploy is Deployer {
_upgradeAndCallViaSafe({ _upgradeAndCallViaSafe({
_proxy: payable(delayedWETHProxy), _proxy: payable(delayedWETHProxy),
_implementation: delayedWETH, _implementation: delayedWETH,
_innerCallData: abi.encodeCall(DelayedWETH.initialize, (msg.sender, SuperchainConfig(superchainConfigProxy))) _innerCallData: abi.encodeCall(DelayedWETH.initialize, (msg.sender, ISuperchainConfig(superchainConfigProxy)))
}); });
string memory version = DelayedWETH(payable(delayedWETHProxy)).version(); string memory version = DelayedWETH(payable(delayedWETHProxy)).version();
...@@ -968,7 +951,7 @@ contract Deploy is Deployer { ...@@ -968,7 +951,7 @@ contract Deploy is Deployer {
_upgradeAndCallViaSafe({ _upgradeAndCallViaSafe({
_proxy: payable(delayedWETHProxy), _proxy: payable(delayedWETHProxy),
_implementation: delayedWETH, _implementation: delayedWETH,
_innerCallData: abi.encodeCall(DelayedWETH.initialize, (msg.sender, SuperchainConfig(superchainConfigProxy))) _innerCallData: abi.encodeCall(DelayedWETH.initialize, (msg.sender, ISuperchainConfig(superchainConfigProxy)))
}); });
string memory version = DelayedWETH(payable(delayedWETHProxy)).version(); string memory version = DelayedWETH(payable(delayedWETHProxy)).version();
...@@ -986,7 +969,7 @@ contract Deploy is Deployer { ...@@ -986,7 +969,7 @@ contract Deploy is Deployer {
console.log("Upgrading and initializing AnchorStateRegistry proxy"); console.log("Upgrading and initializing AnchorStateRegistry proxy");
address anchorStateRegistryProxy = mustGetAddress("AnchorStateRegistryProxy"); address anchorStateRegistryProxy = mustGetAddress("AnchorStateRegistryProxy");
address anchorStateRegistry = mustGetAddress("AnchorStateRegistry"); address anchorStateRegistry = mustGetAddress("AnchorStateRegistry");
SuperchainConfig superchainConfig = SuperchainConfig(mustGetAddress("SuperchainConfigProxy")); ISuperchainConfig superchainConfig = ISuperchainConfig(mustGetAddress("SuperchainConfigProxy"));
AnchorStateRegistry.StartingAnchorRoot[] memory roots = new AnchorStateRegistry.StartingAnchorRoot[](5); AnchorStateRegistry.StartingAnchorRoot[] memory roots = new AnchorStateRegistry.StartingAnchorRoot[](5);
roots[0] = AnchorStateRegistry.StartingAnchorRoot({ roots[0] = AnchorStateRegistry.StartingAnchorRoot({
...@@ -1052,7 +1035,7 @@ contract Deploy is Deployer { ...@@ -1052,7 +1035,7 @@ contract Deploy is Deployer {
_proxy: payable(systemConfigProxy), _proxy: payable(systemConfigProxy),
_implementation: systemConfig, _implementation: systemConfig,
_innerCallData: abi.encodeCall( _innerCallData: abi.encodeCall(
SystemConfig.initialize, ISystemConfig.initialize,
( (
cfg.finalSystemOwner(), cfg.finalSystemOwner(),
cfg.basefeeScalar(), cfg.basefeeScalar(),
...@@ -1062,7 +1045,7 @@ contract Deploy is Deployer { ...@@ -1062,7 +1045,7 @@ contract Deploy is Deployer {
cfg.p2pSequencerAddress(), cfg.p2pSequencerAddress(),
Constants.DEFAULT_RESOURCE_CONFIG(), Constants.DEFAULT_RESOURCE_CONFIG(),
cfg.batchInboxAddress(), cfg.batchInboxAddress(),
SystemConfig.Addresses({ ISystemConfig.Addresses({
l1CrossDomainMessenger: mustGetAddress("L1CrossDomainMessengerProxy"), l1CrossDomainMessenger: mustGetAddress("L1CrossDomainMessengerProxy"),
l1ERC721Bridge: mustGetAddress("L1ERC721BridgeProxy"), l1ERC721Bridge: mustGetAddress("L1ERC721BridgeProxy"),
l1StandardBridge: mustGetAddress("L1StandardBridgeProxy"), l1StandardBridge: mustGetAddress("L1StandardBridgeProxy"),
...@@ -1075,7 +1058,7 @@ contract Deploy is Deployer { ...@@ -1075,7 +1058,7 @@ contract Deploy is Deployer {
) )
}); });
SystemConfig config = SystemConfig(systemConfigProxy); ISystemConfig config = ISystemConfig(systemConfigProxy);
string memory version = config.version(); string memory version = config.version();
console.log("SystemConfig version: %s", version); console.log("SystemConfig version: %s", version);
...@@ -1109,9 +1092,9 @@ contract Deploy is Deployer { ...@@ -1109,9 +1092,9 @@ contract Deploy is Deployer {
_innerCallData: abi.encodeCall( _innerCallData: abi.encodeCall(
L1StandardBridge.initialize, L1StandardBridge.initialize,
( (
L1CrossDomainMessenger(l1CrossDomainMessengerProxy), ICrossDomainMessenger(l1CrossDomainMessengerProxy),
SuperchainConfig(superchainConfigProxy), ISuperchainConfig(superchainConfigProxy),
SystemConfig(systemConfigProxy) ISystemConfig(systemConfigProxy)
) )
) )
}); });
...@@ -1135,7 +1118,7 @@ contract Deploy is Deployer { ...@@ -1135,7 +1118,7 @@ contract Deploy is Deployer {
_implementation: l1ERC721Bridge, _implementation: l1ERC721Bridge,
_innerCallData: abi.encodeCall( _innerCallData: abi.encodeCall(
L1ERC721Bridge.initialize, L1ERC721Bridge.initialize,
(L1CrossDomainMessenger(payable(l1CrossDomainMessengerProxy)), SuperchainConfig(superchainConfigProxy)) (ICrossDomainMessenger(payable(l1CrossDomainMessengerProxy)), ISuperchainConfig(superchainConfigProxy))
) )
}); });
...@@ -1205,16 +1188,16 @@ contract Deploy is Deployer { ...@@ -1205,16 +1188,16 @@ contract Deploy is Deployer {
_proxy: payable(l1CrossDomainMessengerProxy), _proxy: payable(l1CrossDomainMessengerProxy),
_implementation: l1CrossDomainMessenger, _implementation: l1CrossDomainMessenger,
_innerCallData: abi.encodeCall( _innerCallData: abi.encodeCall(
L1CrossDomainMessenger.initialize, IL1CrossDomainMessenger.initialize,
( (
SuperchainConfig(superchainConfigProxy), ISuperchainConfig(superchainConfigProxy),
OptimismPortal(payable(optimismPortalProxy)), IOptimismPortal(payable(optimismPortalProxy)),
SystemConfig(systemConfigProxy) ISystemConfig(systemConfigProxy)
) )
) )
}); });
L1CrossDomainMessenger messenger = L1CrossDomainMessenger(l1CrossDomainMessengerProxy); IL1CrossDomainMessenger messenger = IL1CrossDomainMessenger(l1CrossDomainMessengerProxy);
string memory version = messenger.version(); string memory version = messenger.version();
console.log("L1CrossDomainMessenger version: %s", version); console.log("L1CrossDomainMessenger version: %s", version);
...@@ -1269,16 +1252,16 @@ contract Deploy is Deployer { ...@@ -1269,16 +1252,16 @@ contract Deploy is Deployer {
_proxy: payable(optimismPortalProxy), _proxy: payable(optimismPortalProxy),
_implementation: optimismPortal, _implementation: optimismPortal,
_innerCallData: abi.encodeCall( _innerCallData: abi.encodeCall(
OptimismPortal.initialize, IOptimismPortal.initialize,
( (
IL2OutputOracle(l2OutputOracleProxy), IL2OutputOracle(l2OutputOracleProxy),
SystemConfig(systemConfigProxy), ISystemConfig(systemConfigProxy),
SuperchainConfig(superchainConfigProxy) ISuperchainConfig(superchainConfigProxy)
) )
) )
}); });
OptimismPortal portal = OptimismPortal(payable(optimismPortalProxy)); IOptimismPortal portal = IOptimismPortal(payable(optimismPortalProxy));
string memory version = portal.version(); string memory version = portal.version();
console.log("OptimismPortal version: %s", version); console.log("OptimismPortal version: %s", version);
...@@ -1298,17 +1281,17 @@ contract Deploy is Deployer { ...@@ -1298,17 +1281,17 @@ contract Deploy is Deployer {
_proxy: payable(optimismPortalProxy), _proxy: payable(optimismPortalProxy),
_implementation: optimismPortal2, _implementation: optimismPortal2,
_innerCallData: abi.encodeCall( _innerCallData: abi.encodeCall(
OptimismPortal2.initialize, IOptimismPortal2.initialize,
( (
DisputeGameFactory(disputeGameFactoryProxy), DisputeGameFactory(disputeGameFactoryProxy),
SystemConfig(systemConfigProxy), ISystemConfig(systemConfigProxy),
SuperchainConfig(superchainConfigProxy), ISuperchainConfig(superchainConfigProxy),
GameType.wrap(uint32(cfg.respectedGameType())) GameType.wrap(uint32(cfg.respectedGameType()))
) )
) )
}); });
OptimismPortal2 portal = OptimismPortal2(payable(optimismPortalProxy)); IOptimismPortal2 portal = IOptimismPortal2(payable(optimismPortalProxy));
string memory version = portal.version(); string memory version = portal.version();
console.log("OptimismPortal2 version: %s", version); console.log("OptimismPortal2 version: %s", version);
...@@ -1596,12 +1579,12 @@ contract Deploy is Deployer { ...@@ -1596,12 +1579,12 @@ contract Deploy is Deployer {
_proxy: payable(dataAvailabilityChallengeProxy), _proxy: payable(dataAvailabilityChallengeProxy),
_implementation: dataAvailabilityChallenge, _implementation: dataAvailabilityChallenge,
_innerCallData: abi.encodeCall( _innerCallData: abi.encodeCall(
DataAvailabilityChallenge.initialize, IDataAvailabilityChallenge.initialize,
(finalSystemOwner, daChallengeWindow, daResolveWindow, daBondSize, daResolverRefundPercentage) (finalSystemOwner, daChallengeWindow, daResolveWindow, daBondSize, daResolverRefundPercentage)
) )
}); });
DataAvailabilityChallenge dac = DataAvailabilityChallenge(payable(dataAvailabilityChallengeProxy)); IDataAvailabilityChallenge dac = IDataAvailabilityChallenge(payable(dataAvailabilityChallengeProxy));
string memory version = dac.version(); string memory version = dac.version();
console.log("DataAvailabilityChallenge version: %s", version); console.log("DataAvailabilityChallenge version: %s", version);
......
...@@ -14,7 +14,7 @@ import { Deployer } from "scripts/deploy/Deployer.sol"; ...@@ -14,7 +14,7 @@ import { Deployer } from "scripts/deploy/Deployer.sol";
import { LivenessGuard } from "src/Safe/LivenessGuard.sol"; import { LivenessGuard } from "src/Safe/LivenessGuard.sol";
import { LivenessModule } from "src/Safe/LivenessModule.sol"; import { LivenessModule } from "src/Safe/LivenessModule.sol";
import { DeputyGuardianModule } from "src/Safe/DeputyGuardianModule.sol"; import { DeputyGuardianModule } from "src/Safe/DeputyGuardianModule.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol"; import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { Deploy } from "./Deploy.s.sol"; import { Deploy } from "./Deploy.s.sol";
...@@ -41,7 +41,7 @@ struct SecurityCouncilConfig { ...@@ -41,7 +41,7 @@ struct SecurityCouncilConfig {
/// @notice Configuration for the Deputy Guardian Module /// @notice Configuration for the Deputy Guardian Module
struct DeputyGuardianModuleConfig { struct DeputyGuardianModuleConfig {
address deputyGuardian; address deputyGuardian;
SuperchainConfig superchainConfig; ISuperchainConfig superchainConfig;
} }
/// @notice Configuration for the Guardian Safe. /// @notice Configuration for the Guardian Safe.
...@@ -89,7 +89,7 @@ contract DeployOwnership is Deploy { ...@@ -89,7 +89,7 @@ contract DeployOwnership is Deploy {
safeConfig: SafeConfig({ threshold: 1, owners: exampleGuardianOwners }), safeConfig: SafeConfig({ threshold: 1, owners: exampleGuardianOwners }),
deputyGuardianModuleConfig: DeputyGuardianModuleConfig({ deputyGuardianModuleConfig: DeputyGuardianModuleConfig({
deputyGuardian: mustGetAddress("FoundationOperationsSafe"), deputyGuardian: mustGetAddress("FoundationOperationsSafe"),
superchainConfig: SuperchainConfig(mustGetAddress("SuperchainConfig")) superchainConfig: ISuperchainConfig(mustGetAddress("SuperchainConfig"))
}) })
}); });
} }
......
...@@ -86,14 +86,14 @@ contract FPACOPS is Deploy, StdAssertions { ...@@ -86,14 +86,14 @@ contract FPACOPS is Deploy, StdAssertions {
address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy"); address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy");
Proxy(payable(wethProxy)).upgradeToAndCall( Proxy(payable(wethProxy)).upgradeToAndCall(
mustGetAddress("DelayedWETH"), mustGetAddress("DelayedWETH"),
abi.encodeCall(DelayedWETH.initialize, (msg.sender, SuperchainConfig(superchainConfigProxy))) abi.encodeCall(DelayedWETH.initialize, (msg.sender, ISuperchainConfig(superchainConfigProxy)))
); );
} }
function initializeAnchorStateRegistryProxy() internal broadcast { function initializeAnchorStateRegistryProxy() internal broadcast {
console.log("Initializing AnchorStateRegistryProxy with AnchorStateRegistry."); console.log("Initializing AnchorStateRegistryProxy with AnchorStateRegistry.");
address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy"); address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy");
SuperchainConfig superchainConfig = SuperchainConfig(superchainConfigProxy); ISuperchainConfig superchainConfig = ISuperchainConfig(superchainConfigProxy);
AnchorStateRegistry.StartingAnchorRoot[] memory roots = new AnchorStateRegistry.StartingAnchorRoot[](2); AnchorStateRegistry.StartingAnchorRoot[] memory roots = new AnchorStateRegistry.StartingAnchorRoot[](2);
roots[0] = AnchorStateRegistry.StartingAnchorRoot({ roots[0] = AnchorStateRegistry.StartingAnchorRoot({
......
...@@ -134,7 +134,7 @@ contract FPACOPS2 is Deploy, StdAssertions { ...@@ -134,7 +134,7 @@ contract FPACOPS2 is Deploy, StdAssertions {
address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy"); address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy");
Proxy(payable(wethProxy)).upgradeToAndCall( Proxy(payable(wethProxy)).upgradeToAndCall(
mustGetAddress("DelayedWETH"), mustGetAddress("DelayedWETH"),
abi.encodeCall(DelayedWETH.initialize, (msg.sender, SuperchainConfig(superchainConfigProxy))) abi.encodeCall(DelayedWETH.initialize, (msg.sender, ISuperchainConfig(superchainConfigProxy)))
); );
} }
...@@ -146,7 +146,7 @@ contract FPACOPS2 is Deploy, StdAssertions { ...@@ -146,7 +146,7 @@ contract FPACOPS2 is Deploy, StdAssertions {
address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy"); address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy");
Proxy(payable(wethProxy)).upgradeToAndCall( Proxy(payable(wethProxy)).upgradeToAndCall(
mustGetAddress("DelayedWETH"), mustGetAddress("DelayedWETH"),
abi.encodeCall(DelayedWETH.initialize, (msg.sender, SuperchainConfig(superchainConfigProxy))) abi.encodeCall(DelayedWETH.initialize, (msg.sender, ISuperchainConfig(superchainConfigProxy)))
); );
} }
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
import { ResourceMetering } from "src/L1/ResourceMetering.sol"; import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
/// @title ISystemConfigV0 /// @title ISystemConfigV0
/// @notice Minimal interface of the Legacy SystemConfig containing only getters. /// @notice Minimal interface of the Legacy SystemConfig containing only getters.
...@@ -14,6 +14,6 @@ interface ISystemConfigV0 { ...@@ -14,6 +14,6 @@ interface ISystemConfigV0 {
function scalar() external view returns (uint256); function scalar() external view returns (uint256);
function batcherHash() external view returns (bytes32); function batcherHash() external view returns (bytes32);
function gasLimit() external view returns (uint64); function gasLimit() external view returns (uint64);
function resourceConfig() external view returns (ResourceMetering.ResourceConfig memory); function resourceConfig() external view returns (IResourceMetering.ResourceConfig memory);
function unsafeBlockSigner() external view returns (address); function unsafeBlockSigner() external view returns (address);
} }
...@@ -9,23 +9,23 @@ ...@@ -9,23 +9,23 @@
}, },
"src/L1/DataAvailabilityChallenge.sol": { "src/L1/DataAvailabilityChallenge.sol": {
"initCodeHash": "0xcc96cf2e4d841adb7ecb9dd84abeb0893dd62d913c0d47ab5b66a893c6e47e88", "initCodeHash": "0xcc96cf2e4d841adb7ecb9dd84abeb0893dd62d913c0d47ab5b66a893c6e47e88",
"sourceCodeHash": "0x3260f2721af58ab77d4eae50365f3afe021a03b6383139e69779ac40f511b792" "sourceCodeHash": "0xce01773740f4d50ac77f868343d654f6ca24f85d2770eb7e4043e98f609b1c15"
}, },
"src/L1/DelayedVetoable.sol": { "src/L1/DelayedVetoable.sol": {
"initCodeHash": "0xd504ab0568719a0fb960ebe73d0437645f5c4bd8f6619219858209ef002516dd", "initCodeHash": "0xd504ab0568719a0fb960ebe73d0437645f5c4bd8f6619219858209ef002516dd",
"sourceCodeHash": "0x1806db090be1a0bd8cba1b0b44a4f1c28a3cfc58a174a025fc292163bfff8cee" "sourceCodeHash": "0x60af558156543d639a0a92e983ad0f045aac1f9ac4c3adaa1d4d97b37175e03a"
}, },
"src/L1/L1CrossDomainMessenger.sol": { "src/L1/L1CrossDomainMessenger.sol": {
"initCodeHash": "0x48db42620b9f16e0dec2355f4076314f82fd0f60ef04c10cdbc266eac9472515", "initCodeHash": "0x48db42620b9f16e0dec2355f4076314f82fd0f60ef04c10cdbc266eac9472515",
"sourceCodeHash": "0xca37e50dd6c1aa86bbc5f9ec640410bf234cd911158ba91af984fd2ed94c19c5" "sourceCodeHash": "0xb77342e6b55b835e9597f7a1c4a2d52ddd56f5cfb7cd38da0bcc488c79a9011e"
}, },
"src/L1/L1ERC721Bridge.sol": { "src/L1/L1ERC721Bridge.sol": {
"initCodeHash": "0xda80d225e332f9ab38d5f3ae655df3eea1dd56dbb523036a25c78859d2931ada", "initCodeHash": "0xda80d225e332f9ab38d5f3ae655df3eea1dd56dbb523036a25c78859d2931ada",
"sourceCodeHash": "0xcef23f69992fa6cb5ad051858dbec924a06fa3b7b44f03caa2415804d6ce7bd0" "sourceCodeHash": "0x0454bb88f7b52c362309935fa21ecc8be7bd6f0d888270b8a00677c60c1014cb"
}, },
"src/L1/L1StandardBridge.sol": { "src/L1/L1StandardBridge.sol": {
"initCodeHash": "0x2868b09ecbe9f2bbc885605c2886b4c79f1c8e4171626c63776603b1b84698a8", "initCodeHash": "0x2868b09ecbe9f2bbc885605c2886b4c79f1c8e4171626c63776603b1b84698a8",
"sourceCodeHash": "0x35f27059e5a7421ddf6394f9739a8c9f434de17e1736644695791c19b8240e74" "sourceCodeHash": "0xc03da137b3ea72e0109fb284229283b21a0303104afbe37d2fe86ad806392a7f"
}, },
"src/L1/L2OutputOracle.sol": { "src/L1/L2OutputOracle.sol": {
"initCodeHash": "0x433fac9de52d8ce8fc3471b78ef6cc9cff1019f480c9ad91b6e09ab8738a8edb", "initCodeHash": "0x433fac9de52d8ce8fc3471b78ef6cc9cff1019f480c9ad91b6e09ab8738a8edb",
...@@ -36,16 +36,16 @@ ...@@ -36,16 +36,16 @@
"sourceCodeHash": "0x5182a2678dadb200dd255ecdfa395e5f7b1e1e27288e78ddf8802ab51ed2dd81" "sourceCodeHash": "0x5182a2678dadb200dd255ecdfa395e5f7b1e1e27288e78ddf8802ab51ed2dd81"
}, },
"src/L1/OptimismPortal.sol": { "src/L1/OptimismPortal.sol": {
"initCodeHash": "0x6bf59539298b20221de6c51db21016be8d3278bdbe0be1cdd49638dc828e003e", "initCodeHash": "0xb7a7a28d5b3b88334e7cb4bc1c5fbbf9f691d934e907a2fed6a30e461eb1c0f6",
"sourceCodeHash": "0x07f6f4c0cc14be4aeb9a29ec4a238ea3748d5cb6b244e0054845a18308c16ab5" "sourceCodeHash": "0x17404b6cc3f62f66786c314e2abdf021a19c00845e2cbb2ec7796f2fa469991c"
}, },
"src/L1/OptimismPortal2.sol": { "src/L1/OptimismPortal2.sol": {
"initCodeHash": "0x414ad1fdb6296ac32fc67ce01288b6e67bedd2ed239d7eb8ed40c7f55f9021f2", "initCodeHash": "0x6c1168834a0d2a23d9bfb995dd458ef5c2fd059c874d453988ef648de8300730",
"sourceCodeHash": "0xa70bdc0bb666baa731ab32c79a7b8b15cee23bd46ddfec5f259eaf19b5653fe1" "sourceCodeHash": "0xa8053edf2ddd421615c7570e5dbb435980b88e0f08e3189e2fc69b7a476e80a2"
}, },
"src/L1/OptimismPortalInterop.sol": { "src/L1/OptimismPortalInterop.sol": {
"initCodeHash": "0x9222fba222d1ab66898eef09ecea3ea757e64c8ae98def4da7808cd7cc8f39a8", "initCodeHash": "0xc95dd89962e301ce1fe773337463ea6e3b32b362971e5ad4f69e0881af7f4b7d",
"sourceCodeHash": "0x57353b84bbcb05634f135ad8090d96f07467dd3dbf159650714449d0667efc62" "sourceCodeHash": "0xe6a7794799915f408cb57c73af266670de8a3f02408d3dbc2c97db25d3e42635"
}, },
"src/L1/ProtocolVersions.sol": { "src/L1/ProtocolVersions.sol": {
"initCodeHash": "0x8f033874dd8b36615b2209d553660dcff1ff91ca2bad3ca1de7b441dbfba4842", "initCodeHash": "0x8f033874dd8b36615b2209d553660dcff1ff91ca2bad3ca1de7b441dbfba4842",
...@@ -57,11 +57,11 @@ ...@@ -57,11 +57,11 @@
}, },
"src/L1/SystemConfig.sol": { "src/L1/SystemConfig.sol": {
"initCodeHash": "0x2fc36af5b3c493a423a19e0b597f6ff230b756b861b68099f3192d69b6088dc0", "initCodeHash": "0x2fc36af5b3c493a423a19e0b597f6ff230b756b861b68099f3192d69b6088dc0",
"sourceCodeHash": "0xacffbb4e73d39a642adc24baaa50c92604f4c0b04ff31287e24a46bda5277033" "sourceCodeHash": "0x06a50ac992175fdb434b13e8461893e83862c23ce399e697e6e8109728ad1a3d"
}, },
"src/L1/SystemConfigInterop.sol": { "src/L1/SystemConfigInterop.sol": {
"initCodeHash": "0xc5a3ffc59dd7bf1ef238087414cfa04b37f0d83fc9a4f5e6d62a1059a23359f3", "initCodeHash": "0xc5a3ffc59dd7bf1ef238087414cfa04b37f0d83fc9a4f5e6d62a1059a23359f3",
"sourceCodeHash": "0x272bcfafab62516609250c85cd73815bf0a243fdb9d34fc603f71e801299b57c" "sourceCodeHash": "0xd7b6ebf03ead541917b1bdfcf1293ca3c8a8e3865b8a8548bee69956a4ce71cc"
}, },
"src/L2/BaseFeeVault.sol": { "src/L2/BaseFeeVault.sol": {
"initCodeHash": "0x3bfcd57e25ad54b66c374f63e24e33a6cf107044aa8f5f69ef21202c380b5c5b", "initCodeHash": "0x3bfcd57e25ad54b66c374f63e24e33a6cf107044aa8f5f69ef21202c380b5c5b",
...@@ -97,11 +97,11 @@ ...@@ -97,11 +97,11 @@
}, },
"src/L2/L2ERC721Bridge.sol": { "src/L2/L2ERC721Bridge.sol": {
"initCodeHash": "0x827077e1a0ce6c8f9ee1196c409ea77d831efd440992b3969b05259083cdf0bd", "initCodeHash": "0x827077e1a0ce6c8f9ee1196c409ea77d831efd440992b3969b05259083cdf0bd",
"sourceCodeHash": "0xaef911601556f93deac78cb3329fdcc1507ea248c3986548e76997938c43391b" "sourceCodeHash": "0xdc5e08a5a9ee8d61e843ac630126629ccfedb49a3b0dd167863dd48d75629a95"
}, },
"src/L2/L2StandardBridge.sol": { "src/L2/L2StandardBridge.sol": {
"initCodeHash": "0x01692b613e3d4e649d877a0fd8f0798a26401ba8ccc4cda0e61f1f9079729320", "initCodeHash": "0x01692b613e3d4e649d877a0fd8f0798a26401ba8ccc4cda0e61f1f9079729320",
"sourceCodeHash": "0x3efb2dabff452f5d2584839d1460183cb8aecd5456fbfa3a72d80de40df783b7" "sourceCodeHash": "0x5c8e8ba3ecdae116f98caf67cca5fb3594bf7085e186f0a14bad1d6f143b6bc8"
}, },
"src/L2/L2StandardBridgeInterop.sol": { "src/L2/L2StandardBridgeInterop.sol": {
"initCodeHash": "0x5c9ef6b0817f715d1b8b097f3fc19e33bc54453426ca12bb48e4cea143076339", "initCodeHash": "0x5c9ef6b0817f715d1b8b097f3fc19e33bc54453426ca12bb48e4cea143076339",
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
}, },
"src/Safe/DeputyGuardianModule.sol": { "src/Safe/DeputyGuardianModule.sol": {
"initCodeHash": "0xce6cd0e4f21693a32e7a8ef463b8233b0dde83bdb426f5adc3eef822d4de7bec", "initCodeHash": "0xce6cd0e4f21693a32e7a8ef463b8233b0dde83bdb426f5adc3eef822d4de7bec",
"sourceCodeHash": "0x45fdf6b414a6eae662392051a5e0acc5b95f23ca33f739ddfb35ae2e7ce81728" "sourceCodeHash": "0x7b0f24df9af4cf5a52e23b98898b884d8175ad89cc24046d6463c3e9b3599d4d"
}, },
"src/Safe/LivenessGuard.sol": { "src/Safe/LivenessGuard.sol": {
"initCodeHash": "0xfd74ff89e7b689b38ab97515d64429ffaf6c0cd1ea6488c6a4743a0665419c85", "initCodeHash": "0xfd74ff89e7b689b38ab97515d64429ffaf6c0cd1ea6488c6a4743a0665419c85",
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
}, },
"src/dispute/AnchorStateRegistry.sol": { "src/dispute/AnchorStateRegistry.sol": {
"initCodeHash": "0x6198f305686e6fdfd94db7aeb840a12e263036dcdc234550db49d3f0b87039a8", "initCodeHash": "0x6198f305686e6fdfd94db7aeb840a12e263036dcdc234550db49d3f0b87039a8",
"sourceCodeHash": "0x384d4e7067d423dc32b8588341b61a504a28505aa5ed7dd76f115991be072ee0" "sourceCodeHash": "0x8450bdccf5039bad48284c73c9cfa657cbcc0a435965d9e13ac88f388c591779"
}, },
"src/dispute/DisputeGameFactory.sol": { "src/dispute/DisputeGameFactory.sol": {
"initCodeHash": "0xc1a10f65287c414076b68a7de6c238b91bc6252213187bdef35657d0f00f9382", "initCodeHash": "0xc1a10f65287c414076b68a7de6c238b91bc6252213187bdef35657d0f00f9382",
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
}, },
"src/dispute/weth/DelayedWETH.sol": { "src/dispute/weth/DelayedWETH.sol": {
"initCodeHash": "0x3e687c928b6c890b91c82584ccb1fec47b025b8e58cd9cbfa65229b38b304bae", "initCodeHash": "0x3e687c928b6c890b91c82584ccb1fec47b025b8e58cd9cbfa65229b38b304bae",
"sourceCodeHash": "0x7ebe0d9771fc8adfd97386972a571eb1753065a202d4711c0b9587d99f3bd261" "sourceCodeHash": "0x9d6667536161b3fa655dfb3e9a01db070cd0e84d800e34947b10b3b2168a3d56"
}, },
"src/legacy/DeployerWhitelist.sol": { "src/legacy/DeployerWhitelist.sol": {
"initCodeHash": "0x0b8177ed75b69eddbb9ce6537683f69a9935efed86a1d6faa8feaafbd151c1bd", "initCodeHash": "0x0b8177ed75b69eddbb9ce6537683f69a9935efed86a1d6faa8feaafbd151c1bd",
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
"type": "tuple[]" "type": "tuple[]"
}, },
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "_superchainConfig", "name": "_superchainConfig",
"type": "address" "type": "address"
} }
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
"name": "superchainConfig", "name": "superchainConfig",
"outputs": [ "outputs": [
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "", "name": "",
"type": "address" "type": "address"
} }
......
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
"name": "config", "name": "config",
"outputs": [ "outputs": [
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
"type": "address" "type": "address"
}, },
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "_config", "name": "_config",
"type": "address" "type": "address"
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"type": "address" "type": "address"
}, },
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "_superchainConfig", "name": "_superchainConfig",
"type": "address" "type": "address"
}, },
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
{ {
"inputs": [ "inputs": [
{ {
"internalType": "contract OptimismPortal2", "internalType": "contract IOptimismPortal2",
"name": "_portal", "name": "_portal",
"type": "address" "type": "address"
}, },
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
{ {
"inputs": [ "inputs": [
{ {
"internalType": "contract OptimismPortal2", "internalType": "contract IOptimismPortal2",
"name": "_portal", "name": "_portal",
"type": "address" "type": "address"
}, },
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
"name": "superchainConfig", "name": "superchainConfig",
"outputs": [ "outputs": [
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "superchainConfig_", "name": "superchainConfig_",
"type": "address" "type": "address"
} }
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
"name": "PORTAL", "name": "PORTAL",
"outputs": [ "outputs": [
{ {
"internalType": "contract OptimismPortal", "internalType": "contract IOptimismPortal",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -180,17 +180,17 @@ ...@@ -180,17 +180,17 @@
{ {
"inputs": [ "inputs": [
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "_superchainConfig", "name": "_superchainConfig",
"type": "address" "type": "address"
}, },
{ {
"internalType": "contract OptimismPortal", "internalType": "contract IOptimismPortal",
"name": "_portal", "name": "_portal",
"type": "address" "type": "address"
}, },
{ {
"internalType": "contract SystemConfig", "internalType": "contract ISystemConfig",
"name": "_systemConfig", "name": "_systemConfig",
"type": "address" "type": "address"
} }
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
"name": "portal", "name": "portal",
"outputs": [ "outputs": [
{ {
"internalType": "contract OptimismPortal", "internalType": "contract IOptimismPortal",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -337,7 +337,7 @@ ...@@ -337,7 +337,7 @@
"name": "superchainConfig", "name": "superchainConfig",
"outputs": [ "outputs": [
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -350,7 +350,7 @@ ...@@ -350,7 +350,7 @@
"name": "systemConfig", "name": "systemConfig",
"outputs": [ "outputs": [
{ {
"internalType": "contract SystemConfig", "internalType": "contract ISystemConfig",
"name": "", "name": "",
"type": "address" "type": "address"
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"name": "MESSENGER", "name": "MESSENGER",
"outputs": [ "outputs": [
{ {
"internalType": "contract CrossDomainMessenger", "internalType": "contract ICrossDomainMessenger",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -171,12 +171,12 @@ ...@@ -171,12 +171,12 @@
{ {
"inputs": [ "inputs": [
{ {
"internalType": "contract CrossDomainMessenger", "internalType": "contract ICrossDomainMessenger",
"name": "_messenger", "name": "_messenger",
"type": "address" "type": "address"
}, },
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "_superchainConfig", "name": "_superchainConfig",
"type": "address" "type": "address"
} }
...@@ -191,7 +191,7 @@ ...@@ -191,7 +191,7 @@
"name": "messenger", "name": "messenger",
"outputs": [ "outputs": [
{ {
"internalType": "contract CrossDomainMessenger", "internalType": "contract ICrossDomainMessenger",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
"name": "superchainConfig", "name": "superchainConfig",
"outputs": [ "outputs": [
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "", "name": "",
"type": "address" "type": "address"
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
"name": "MESSENGER", "name": "MESSENGER",
"outputs": [ "outputs": [
{ {
"internalType": "contract CrossDomainMessenger", "internalType": "contract ICrossDomainMessenger",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -417,17 +417,17 @@ ...@@ -417,17 +417,17 @@
{ {
"inputs": [ "inputs": [
{ {
"internalType": "contract CrossDomainMessenger", "internalType": "contract ICrossDomainMessenger",
"name": "_messenger", "name": "_messenger",
"type": "address" "type": "address"
}, },
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "_superchainConfig", "name": "_superchainConfig",
"type": "address" "type": "address"
}, },
{ {
"internalType": "contract SystemConfig", "internalType": "contract ISystemConfig",
"name": "_systemConfig", "name": "_systemConfig",
"type": "address" "type": "address"
} }
...@@ -455,7 +455,7 @@ ...@@ -455,7 +455,7 @@
"name": "messenger", "name": "messenger",
"outputs": [ "outputs": [
{ {
"internalType": "contract CrossDomainMessenger", "internalType": "contract ICrossDomainMessenger",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -494,7 +494,7 @@ ...@@ -494,7 +494,7 @@
"name": "superchainConfig", "name": "superchainConfig",
"outputs": [ "outputs": [
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -507,7 +507,7 @@ ...@@ -507,7 +507,7 @@
"name": "systemConfig", "name": "systemConfig",
"outputs": [ "outputs": [
{ {
"internalType": "contract SystemConfig", "internalType": "contract ISystemConfig",
"name": "", "name": "",
"type": "address" "type": "address"
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"name": "MESSENGER", "name": "MESSENGER",
"outputs": [ "outputs": [
{ {
"internalType": "contract CrossDomainMessenger", "internalType": "contract ICrossDomainMessenger",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
"name": "messenger", "name": "messenger",
"outputs": [ "outputs": [
{ {
"internalType": "contract CrossDomainMessenger", "internalType": "contract ICrossDomainMessenger",
"name": "", "name": "",
"type": "address" "type": "address"
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
"name": "MESSENGER", "name": "MESSENGER",
"outputs": [ "outputs": [
{ {
"internalType": "contract CrossDomainMessenger", "internalType": "contract ICrossDomainMessenger",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -267,7 +267,7 @@ ...@@ -267,7 +267,7 @@
"name": "messenger", "name": "messenger",
"outputs": [ "outputs": [
{ {
"internalType": "contract CrossDomainMessenger", "internalType": "contract ICrossDomainMessenger",
"name": "", "name": "",
"type": "address" "type": "address"
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"name": "MESSENGER", "name": "MESSENGER",
"outputs": [ "outputs": [
{ {
"internalType": "contract CrossDomainMessenger", "internalType": "contract ICrossDomainMessenger",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -285,7 +285,7 @@ ...@@ -285,7 +285,7 @@
"name": "messenger", "name": "messenger",
"outputs": [ "outputs": [
{ {
"internalType": "contract CrossDomainMessenger", "internalType": "contract ICrossDomainMessenger",
"name": "", "name": "",
"type": "address" "type": "address"
} }
......
...@@ -184,12 +184,12 @@ ...@@ -184,12 +184,12 @@
"type": "address" "type": "address"
}, },
{ {
"internalType": "contract SystemConfig", "internalType": "contract ISystemConfig",
"name": "_systemConfig", "name": "_systemConfig",
"type": "address" "type": "address"
}, },
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "_superchainConfig", "name": "_superchainConfig",
"type": "address" "type": "address"
} }
...@@ -443,7 +443,7 @@ ...@@ -443,7 +443,7 @@
"name": "superchainConfig", "name": "superchainConfig",
"outputs": [ "outputs": [
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -456,7 +456,7 @@ ...@@ -456,7 +456,7 @@
"name": "systemConfig", "name": "systemConfig",
"outputs": [ "outputs": [
{ {
"internalType": "contract SystemConfig", "internalType": "contract ISystemConfig",
"name": "", "name": "",
"type": "address" "type": "address"
} }
......
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
"name": "disputeGameFactory", "name": "disputeGameFactory",
"outputs": [ "outputs": [
{ {
"internalType": "contract DisputeGameFactory", "internalType": "contract IDisputeGameFactory",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -316,17 +316,17 @@ ...@@ -316,17 +316,17 @@
{ {
"inputs": [ "inputs": [
{ {
"internalType": "contract DisputeGameFactory", "internalType": "contract IDisputeGameFactory",
"name": "_disputeGameFactory", "name": "_disputeGameFactory",
"type": "address" "type": "address"
}, },
{ {
"internalType": "contract SystemConfig", "internalType": "contract ISystemConfig",
"name": "_systemConfig", "name": "_systemConfig",
"type": "address" "type": "address"
}, },
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "_superchainConfig", "name": "_superchainConfig",
"type": "address" "type": "address"
}, },
...@@ -648,7 +648,7 @@ ...@@ -648,7 +648,7 @@
"name": "superchainConfig", "name": "superchainConfig",
"outputs": [ "outputs": [
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -661,7 +661,7 @@ ...@@ -661,7 +661,7 @@
"name": "systemConfig", "name": "systemConfig",
"outputs": [ "outputs": [
{ {
"internalType": "contract SystemConfig", "internalType": "contract ISystemConfig",
"name": "", "name": "",
"type": "address" "type": "address"
} }
......
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
"name": "disputeGameFactory", "name": "disputeGameFactory",
"outputs": [ "outputs": [
{ {
"internalType": "contract DisputeGameFactory", "internalType": "contract IDisputeGameFactory",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -316,17 +316,17 @@ ...@@ -316,17 +316,17 @@
{ {
"inputs": [ "inputs": [
{ {
"internalType": "contract DisputeGameFactory", "internalType": "contract IDisputeGameFactory",
"name": "_disputeGameFactory", "name": "_disputeGameFactory",
"type": "address" "type": "address"
}, },
{ {
"internalType": "contract SystemConfig", "internalType": "contract ISystemConfig",
"name": "_systemConfig", "name": "_systemConfig",
"type": "address" "type": "address"
}, },
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "_superchainConfig", "name": "_superchainConfig",
"type": "address" "type": "address"
}, },
...@@ -666,7 +666,7 @@ ...@@ -666,7 +666,7 @@
"name": "superchainConfig", "name": "superchainConfig",
"outputs": [ "outputs": [
{ {
"internalType": "contract SuperchainConfig", "internalType": "contract ISuperchainConfig",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -679,7 +679,7 @@ ...@@ -679,7 +679,7 @@
"name": "systemConfig", "name": "systemConfig",
"outputs": [ "outputs": [
{ {
"internalType": "contract SystemConfig", "internalType": "contract ISystemConfig",
"name": "", "name": "",
"type": "address" "type": "address"
} }
...@@ -949,11 +949,6 @@ ...@@ -949,11 +949,6 @@
"name": "Unauthorized", "name": "Unauthorized",
"type": "error" "type": "error"
}, },
{
"inputs": [],
"name": "Unauthorized",
"type": "error"
},
{ {
"inputs": [], "inputs": [],
"name": "UnexpectedList", "name": "UnexpectedList",
......
...@@ -321,7 +321,7 @@ ...@@ -321,7 +321,7 @@
"type": "uint128" "type": "uint128"
} }
], ],
"internalType": "struct ResourceMetering.ResourceConfig", "internalType": "struct IResourceMetering.ResourceConfig",
"name": "_config", "name": "_config",
"type": "tuple" "type": "tuple"
}, },
...@@ -552,7 +552,7 @@ ...@@ -552,7 +552,7 @@
"type": "uint128" "type": "uint128"
} }
], ],
"internalType": "struct ResourceMetering.ResourceConfig", "internalType": "struct IResourceMetering.ResourceConfig",
"name": "", "name": "",
"type": "tuple" "type": "tuple"
} }
......
...@@ -342,7 +342,7 @@ ...@@ -342,7 +342,7 @@
"type": "uint128" "type": "uint128"
} }
], ],
"internalType": "struct ResourceMetering.ResourceConfig", "internalType": "struct IResourceMetering.ResourceConfig",
"name": "_config", "name": "_config",
"type": "tuple" "type": "tuple"
}, },
...@@ -469,7 +469,7 @@ ...@@ -469,7 +469,7 @@
"type": "uint128" "type": "uint128"
} }
], ],
"internalType": "struct ResourceMetering.ResourceConfig", "internalType": "struct IResourceMetering.ResourceConfig",
"name": "_config", "name": "_config",
"type": "tuple" "type": "tuple"
}, },
...@@ -713,7 +713,7 @@ ...@@ -713,7 +713,7 @@
"type": "uint128" "type": "uint128"
} }
], ],
"internalType": "struct ResourceMetering.ResourceConfig", "internalType": "struct IResourceMetering.ResourceConfig",
"name": "", "name": "",
"type": "tuple" "type": "tuple"
} }
......
...@@ -25,6 +25,6 @@ ...@@ -25,6 +25,6 @@
"label": "superchainConfig", "label": "superchainConfig",
"offset": 0, "offset": 0,
"slot": "2", "slot": "2",
"type": "contract SuperchainConfig" "type": "contract ISuperchainConfig"
} }
] ]
\ No newline at end of file
...@@ -60,6 +60,6 @@ ...@@ -60,6 +60,6 @@
"label": "config", "label": "config",
"offset": 0, "offset": 0,
"slot": "104", "slot": "104",
"type": "contract SuperchainConfig" "type": "contract ISuperchainConfig"
} }
] ]
\ No newline at end of file
...@@ -130,20 +130,20 @@ ...@@ -130,20 +130,20 @@
"label": "superchainConfig", "label": "superchainConfig",
"offset": 0, "offset": 0,
"slot": "251", "slot": "251",
"type": "contract SuperchainConfig" "type": "contract ISuperchainConfig"
}, },
{ {
"bytes": "20", "bytes": "20",
"label": "portal", "label": "portal",
"offset": 0, "offset": 0,
"slot": "252", "slot": "252",
"type": "contract OptimismPortal" "type": "contract IOptimismPortal"
}, },
{ {
"bytes": "20", "bytes": "20",
"label": "systemConfig", "label": "systemConfig",
"offset": 0, "offset": 0,
"slot": "253", "slot": "253",
"type": "contract SystemConfig" "type": "contract ISystemConfig"
} }
] ]
\ No newline at end of file
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
"label": "messenger", "label": "messenger",
"offset": 0, "offset": 0,
"slot": "1", "slot": "1",
"type": "contract CrossDomainMessenger" "type": "contract ICrossDomainMessenger"
}, },
{ {
"bytes": "20", "bytes": "20",
...@@ -53,6 +53,6 @@ ...@@ -53,6 +53,6 @@
"label": "superchainConfig", "label": "superchainConfig",
"offset": 0, "offset": 0,
"slot": "50", "slot": "50",
"type": "contract SuperchainConfig" "type": "contract ISuperchainConfig"
} }
] ]
\ No newline at end of file
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
"label": "messenger", "label": "messenger",
"offset": 0, "offset": 0,
"slot": "3", "slot": "3",
"type": "contract CrossDomainMessenger" "type": "contract ICrossDomainMessenger"
}, },
{ {
"bytes": "20", "bytes": "20",
...@@ -60,13 +60,13 @@ ...@@ -60,13 +60,13 @@
"label": "superchainConfig", "label": "superchainConfig",
"offset": 0, "offset": 0,
"slot": "50", "slot": "50",
"type": "contract SuperchainConfig" "type": "contract ISuperchainConfig"
}, },
{ {
"bytes": "20", "bytes": "20",
"label": "systemConfig", "label": "systemConfig",
"offset": 0, "offset": 0,
"slot": "51", "slot": "51",
"type": "contract SystemConfig" "type": "contract ISystemConfig"
} }
] ]
\ No newline at end of file
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
"label": "messenger", "label": "messenger",
"offset": 0, "offset": 0,
"slot": "1", "slot": "1",
"type": "contract CrossDomainMessenger" "type": "contract ICrossDomainMessenger"
}, },
{ {
"bytes": "20", "bytes": "20",
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
"label": "messenger", "label": "messenger",
"offset": 0, "offset": 0,
"slot": "3", "slot": "3",
"type": "contract CrossDomainMessenger" "type": "contract ICrossDomainMessenger"
}, },
{ {
"bytes": "20", "bytes": "20",
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
"label": "messenger", "label": "messenger",
"offset": 0, "offset": 0,
"slot": "3", "slot": "3",
"type": "contract CrossDomainMessenger" "type": "contract ICrossDomainMessenger"
}, },
{ {
"bytes": "20", "bytes": "20",
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
"label": "superchainConfig", "label": "superchainConfig",
"offset": 1, "offset": 1,
"slot": "53", "slot": "53",
"type": "contract SuperchainConfig" "type": "contract ISuperchainConfig"
}, },
{ {
"bytes": "20", "bytes": "20",
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
"label": "systemConfig", "label": "systemConfig",
"offset": 0, "offset": 0,
"slot": "55", "slot": "55",
"type": "contract SystemConfig" "type": "contract ISystemConfig"
}, },
{ {
"bytes": "20", "bytes": "20",
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
"label": "superchainConfig", "label": "superchainConfig",
"offset": 1, "offset": 1,
"slot": "53", "slot": "53",
"type": "contract SuperchainConfig" "type": "contract ISuperchainConfig"
}, },
{ {
"bytes": "20", "bytes": "20",
...@@ -74,14 +74,14 @@ ...@@ -74,14 +74,14 @@
"label": "systemConfig", "label": "systemConfig",
"offset": 0, "offset": 0,
"slot": "55", "slot": "55",
"type": "contract SystemConfig" "type": "contract ISystemConfig"
}, },
{ {
"bytes": "20", "bytes": "20",
"label": "disputeGameFactory", "label": "disputeGameFactory",
"offset": 0, "offset": 0,
"slot": "56", "slot": "56",
"type": "contract DisputeGameFactory" "type": "contract IDisputeGameFactory"
}, },
{ {
"bytes": "32", "bytes": "32",
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
"label": "superchainConfig", "label": "superchainConfig",
"offset": 1, "offset": 1,
"slot": "53", "slot": "53",
"type": "contract SuperchainConfig" "type": "contract ISuperchainConfig"
}, },
{ {
"bytes": "20", "bytes": "20",
...@@ -74,14 +74,14 @@ ...@@ -74,14 +74,14 @@
"label": "systemConfig", "label": "systemConfig",
"offset": 0, "offset": 0,
"slot": "55", "slot": "55",
"type": "contract SystemConfig" "type": "contract ISystemConfig"
}, },
{ {
"bytes": "20", "bytes": "20",
"label": "disputeGameFactory", "label": "disputeGameFactory",
"offset": 0, "offset": 0,
"slot": "56", "slot": "56",
"type": "contract DisputeGameFactory" "type": "contract IDisputeGameFactory"
}, },
{ {
"bytes": "32", "bytes": "32",
......
...@@ -81,6 +81,6 @@ ...@@ -81,6 +81,6 @@
"label": "_resourceConfig", "label": "_resourceConfig",
"offset": 0, "offset": 0,
"slot": "105", "slot": "105",
"type": "struct ResourceMetering.ResourceConfig" "type": "struct IResourceMetering.ResourceConfig"
} }
] ]
\ No newline at end of file
...@@ -81,6 +81,6 @@ ...@@ -81,6 +81,6 @@
"label": "_resourceConfig", "label": "_resourceConfig",
"offset": 0, "offset": 0,
"slot": "105", "slot": "105",
"type": "struct ResourceMetering.ResourceConfig" "type": "struct IResourceMetering.ResourceConfig"
} }
] ]
\ No newline at end of file
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Contracts
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";
// Libraries
import { SafeCall } from "src/libraries/SafeCall.sol"; import { SafeCall } from "src/libraries/SafeCall.sol";
// Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol";
/// @dev An enum representing the status of a DA challenge. /// @dev An enum representing the status of a DA challenge.
enum ChallengeStatus { enum ChallengeStatus {
Uninitialized, Uninitialized,
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol"; import { ISemver } from "src/universal/interfaces/ISemver.sol";
/// @title DelayedVetoable /// @title DelayedVetoable
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
import { Predeploys } from "src/libraries/Predeploys.sol"; // Contracts
import { OptimismPortal } from "src/L1/OptimismPortal.sol";
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol"; import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
// Libraries
import { Predeploys } from "src/libraries/Predeploys.sol";
// Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol"; import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol"; import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol"; import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
/// @custom:proxied true /// @custom:proxied true
/// @title L1CrossDomainMessenger /// @title L1CrossDomainMessenger
...@@ -15,14 +20,14 @@ import { SystemConfig } from "src/L1/SystemConfig.sol"; ...@@ -15,14 +20,14 @@ import { SystemConfig } from "src/L1/SystemConfig.sol";
/// interface instead of interacting with lower-level contracts directly. /// interface instead of interacting with lower-level contracts directly.
contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver { contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver {
/// @notice Contract of the SuperchainConfig. /// @notice Contract of the SuperchainConfig.
SuperchainConfig public superchainConfig; ISuperchainConfig public superchainConfig;
/// @notice Contract of the OptimismPortal. /// @notice Contract of the OptimismPortal.
/// @custom:network-specific /// @custom:network-specific
OptimismPortal public portal; IOptimismPortal public portal;
/// @notice Address of the SystemConfig contract. /// @notice Address of the SystemConfig contract.
SystemConfig public systemConfig; ISystemConfig public systemConfig;
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 2.4.1-beta.1 /// @custom:semver 2.4.1-beta.1
...@@ -31,9 +36,9 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver { ...@@ -31,9 +36,9 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver {
/// @notice Constructs the L1CrossDomainMessenger contract. /// @notice Constructs the L1CrossDomainMessenger contract.
constructor() CrossDomainMessenger() { constructor() CrossDomainMessenger() {
initialize({ initialize({
_superchainConfig: SuperchainConfig(address(0)), _superchainConfig: ISuperchainConfig(address(0)),
_portal: OptimismPortal(payable(address(0))), _portal: IOptimismPortal(payable(address(0))),
_systemConfig: SystemConfig(address(0)) _systemConfig: ISystemConfig(address(0))
}); });
} }
...@@ -42,9 +47,9 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver { ...@@ -42,9 +47,9 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver {
/// @param _portal Contract of the OptimismPortal contract on this network. /// @param _portal Contract of the OptimismPortal contract on this network.
/// @param _systemConfig Contract of the SystemConfig contract on this network. /// @param _systemConfig Contract of the SystemConfig contract on this network.
function initialize( function initialize(
SuperchainConfig _superchainConfig, ISuperchainConfig _superchainConfig,
OptimismPortal _portal, IOptimismPortal _portal,
SystemConfig _systemConfig ISystemConfig _systemConfig
) )
public public
initializer initializer
...@@ -64,7 +69,7 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver { ...@@ -64,7 +69,7 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver {
/// Public getter is legacy and will be removed in the future. Use `portal()` instead. /// Public getter is legacy and will be removed in the future. Use `portal()` instead.
/// @return Contract of the OptimismPortal on this chain. /// @return Contract of the OptimismPortal on this chain.
/// @custom:legacy /// @custom:legacy
function PORTAL() external view returns (OptimismPortal) { function PORTAL() external view returns (IOptimismPortal) {
return portal; return portal;
} }
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Contracts
import { ERC721Bridge } from "src/universal/ERC721Bridge.sol"; import { ERC721Bridge } from "src/universal/ERC721Bridge.sol";
import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import { L2ERC721Bridge } from "src/L2/L2ERC721Bridge.sol"; import { L2ERC721Bridge } from "src/L2/L2ERC721Bridge.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";
// Libraries
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
import { StandardBridge } from "src/universal/StandardBridge.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
// Interfaces
import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
/// @custom:proxied true /// @custom:proxied true
/// @title L1ERC721Bridge /// @title L1ERC721Bridge
...@@ -22,7 +26,7 @@ contract L1ERC721Bridge is ERC721Bridge, ISemver { ...@@ -22,7 +26,7 @@ contract L1ERC721Bridge is ERC721Bridge, ISemver {
mapping(address => mapping(address => mapping(uint256 => bool))) public deposits; mapping(address => mapping(address => mapping(uint256 => bool))) public deposits;
/// @notice Address of the SuperchainConfig contract. /// @notice Address of the SuperchainConfig contract.
SuperchainConfig public superchainConfig; ISuperchainConfig public superchainConfig;
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 2.1.1-beta.2 /// @custom:semver 2.1.1-beta.2
...@@ -30,13 +34,13 @@ contract L1ERC721Bridge is ERC721Bridge, ISemver { ...@@ -30,13 +34,13 @@ contract L1ERC721Bridge is ERC721Bridge, ISemver {
/// @notice Constructs the L1ERC721Bridge contract. /// @notice Constructs the L1ERC721Bridge contract.
constructor() ERC721Bridge() { constructor() ERC721Bridge() {
initialize({ _messenger: CrossDomainMessenger(address(0)), _superchainConfig: SuperchainConfig(address(0)) }); initialize({ _messenger: ICrossDomainMessenger(address(0)), _superchainConfig: ISuperchainConfig(address(0)) });
} }
/// @notice Initializes the contract. /// @notice Initializes the contract.
/// @param _messenger Contract of the CrossDomainMessenger on this network. /// @param _messenger Contract of the CrossDomainMessenger on this network.
/// @param _superchainConfig Contract of the SuperchainConfig contract on this network. /// @param _superchainConfig Contract of the SuperchainConfig contract on this network.
function initialize(CrossDomainMessenger _messenger, SuperchainConfig _superchainConfig) public initializer { function initialize(ICrossDomainMessenger _messenger, ISuperchainConfig _superchainConfig) public initializer {
superchainConfig = _superchainConfig; superchainConfig = _superchainConfig;
__ERC721Bridge_init({ _messenger: _messenger, _otherBridge: ERC721Bridge(payable(Predeploys.L2_ERC721_BRIDGE)) }); __ERC721Bridge_init({ _messenger: _messenger, _otherBridge: ERC721Bridge(payable(Predeploys.L2_ERC721_BRIDGE)) });
} }
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
import { Predeploys } from "src/libraries/Predeploys.sol"; // Contracts
import { StandardBridge } from "src/universal/StandardBridge.sol"; import { StandardBridge } from "src/universal/StandardBridge.sol";
// Libraries
import { Predeploys } from "src/libraries/Predeploys.sol";
// Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol"; import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol"; import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol"; import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol"; import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
/// @custom:proxied true /// @custom:proxied true
/// @title L1StandardBridge /// @title L1StandardBridge
...@@ -75,17 +79,17 @@ contract L1StandardBridge is StandardBridge, ISemver { ...@@ -75,17 +79,17 @@ contract L1StandardBridge is StandardBridge, ISemver {
string public constant version = "2.2.1-beta.1"; string public constant version = "2.2.1-beta.1";
/// @notice Address of the SuperchainConfig contract. /// @notice Address of the SuperchainConfig contract.
SuperchainConfig public superchainConfig; ISuperchainConfig public superchainConfig;
/// @notice Address of the SystemConfig contract. /// @notice Address of the SystemConfig contract.
SystemConfig public systemConfig; ISystemConfig public systemConfig;
/// @notice Constructs the L1StandardBridge contract. /// @notice Constructs the L1StandardBridge contract.
constructor() StandardBridge() { constructor() StandardBridge() {
initialize({ initialize({
_messenger: CrossDomainMessenger(address(0)), _messenger: ICrossDomainMessenger(address(0)),
_superchainConfig: SuperchainConfig(address(0)), _superchainConfig: ISuperchainConfig(address(0)),
_systemConfig: SystemConfig(address(0)) _systemConfig: ISystemConfig(address(0))
}); });
} }
...@@ -93,9 +97,9 @@ contract L1StandardBridge is StandardBridge, ISemver { ...@@ -93,9 +97,9 @@ contract L1StandardBridge is StandardBridge, ISemver {
/// @param _messenger Contract for the CrossDomainMessenger on this network. /// @param _messenger Contract for the CrossDomainMessenger on this network.
/// @param _superchainConfig Contract for the SuperchainConfig on this network. /// @param _superchainConfig Contract for the SuperchainConfig on this network.
function initialize( function initialize(
CrossDomainMessenger _messenger, ICrossDomainMessenger _messenger,
SuperchainConfig _superchainConfig, ISuperchainConfig _superchainConfig,
SystemConfig _systemConfig ISystemConfig _systemConfig
) )
public public
initializer initializer
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Contracts
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { L1Block } from "src/L2/L1Block.sol";
// Libraries
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { SafeCall } from "src/libraries/SafeCall.sol"; import { SafeCall } from "src/libraries/SafeCall.sol";
import { IL2OutputOracle } from "src/L1/interfaces/IL2OutputOracle.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
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 { SecureMerkleTrie } from "src/libraries/trie/SecureMerkleTrie.sol"; import { SecureMerkleTrie } from "src/libraries/trie/SecureMerkleTrie.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { L1Block } from "src/L2/L1Block.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import "src/libraries/PortalErrors.sol"; import "src/libraries/PortalErrors.sol";
// Interfaces
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IL2OutputOracle } from "src/L1/interfaces/IL2OutputOracle.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";
/// @custom:proxied true /// @custom:proxied true
/// @title OptimismPortal /// @title OptimismPortal
/// @notice The OptimismPortal is a low-level contract responsible for passing messages between L1 /// @notice The OptimismPortal is a low-level contract responsible for passing messages between L1
...@@ -64,7 +70,7 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver { ...@@ -64,7 +70,7 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
bool private spacer_53_0_1; bool private spacer_53_0_1;
/// @notice Contract of the Superchain Config. /// @notice Contract of the Superchain Config.
SuperchainConfig public superchainConfig; ISuperchainConfig public superchainConfig;
/// @notice Contract of the L2OutputOracle. /// @notice Contract of the L2OutputOracle.
/// @custom:network-specific /// @custom:network-specific
...@@ -72,7 +78,7 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver { ...@@ -72,7 +78,7 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
/// @notice Contract of the SystemConfig. /// @notice Contract of the SystemConfig.
/// @custom:network-specific /// @custom:network-specific
SystemConfig public systemConfig; ISystemConfig public systemConfig;
/// @custom:spacer disputeGameFactory /// @custom:spacer disputeGameFactory
/// @notice Spacer for backwards compatibility. /// @notice Spacer for backwards compatibility.
...@@ -137,8 +143,8 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver { ...@@ -137,8 +143,8 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
constructor() { constructor() {
initialize({ initialize({
_l2Oracle: IL2OutputOracle(address(0)), _l2Oracle: IL2OutputOracle(address(0)),
_systemConfig: SystemConfig(address(0)), _systemConfig: ISystemConfig(address(0)),
_superchainConfig: SuperchainConfig(address(0)) _superchainConfig: ISuperchainConfig(address(0))
}); });
} }
...@@ -148,8 +154,8 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver { ...@@ -148,8 +154,8 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
/// @param _superchainConfig Contract of the SuperchainConfig. /// @param _superchainConfig Contract of the SuperchainConfig.
function initialize( function initialize(
IL2OutputOracle _l2Oracle, IL2OutputOracle _l2Oracle,
SystemConfig _systemConfig, ISystemConfig _systemConfig,
SuperchainConfig _superchainConfig ISuperchainConfig _superchainConfig
) )
public public
initializer initializer
...@@ -222,8 +228,16 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver { ...@@ -222,8 +228,16 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
/// Used internally by the ResourceMetering contract. /// Used internally by the ResourceMetering contract.
/// The SystemConfig is the source of truth for the resource config. /// The SystemConfig is the source of truth for the resource config.
/// @return ResourceMetering ResourceConfig /// @return ResourceMetering ResourceConfig
function _resourceConfig() internal view override returns (ResourceMetering.ResourceConfig memory) { function _resourceConfig() internal view override returns (ResourceConfig memory) {
return systemConfig.resourceConfig(); IResourceMetering.ResourceConfig memory config = systemConfig.resourceConfig();
return ResourceConfig({
maxResourceLimit: config.maxResourceLimit,
elasticityMultiplier: config.elasticityMultiplier,
baseFeeMaxChangeDenominator: config.baseFeeMaxChangeDenominator,
minimumBaseFee: config.minimumBaseFee,
systemTxMaxGas: config.systemTxMaxGas,
maximumBaseFee: config.maximumBaseFee
});
} }
/// @notice Proves a withdrawal transaction. /// @notice Proves a withdrawal transaction.
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Contracts
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { L1Block } from "src/L2/L1Block.sol";
// Libraries
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { SafeCall } from "src/libraries/SafeCall.sol"; import { SafeCall } from "src/libraries/SafeCall.sol";
import { DisputeGameFactory, IDisputeGame } from "src/dispute/DisputeGameFactory.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
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 { SecureMerkleTrie } from "src/libraries/trie/SecureMerkleTrie.sol"; import { SecureMerkleTrie } from "src/libraries/trie/SecureMerkleTrie.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { Constants } from "src/libraries/Constants.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { L1Block } from "src/L2/L1Block.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import "src/libraries/PortalErrors.sol"; import "src/libraries/PortalErrors.sol";
import "src/dispute/lib/Types.sol"; import "src/dispute/lib/Types.sol";
// Interfaces
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol";
import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";
/// @custom:proxied true /// @custom:proxied true
/// @title OptimismPortal2 /// @title OptimismPortal2
/// @notice The OptimismPortal is a low-level contract responsible for passing messages between L1 /// @notice The OptimismPortal is a low-level contract responsible for passing messages between L1
...@@ -74,7 +79,7 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver { ...@@ -74,7 +79,7 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
bool private spacer_53_0_1; bool private spacer_53_0_1;
/// @notice Contract of the Superchain Config. /// @notice Contract of the Superchain Config.
SuperchainConfig public superchainConfig; ISuperchainConfig public superchainConfig;
/// @custom:legacy /// @custom:legacy
/// @custom:spacer l2Oracle /// @custom:spacer l2Oracle
...@@ -83,11 +88,11 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver { ...@@ -83,11 +88,11 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
/// @notice Contract of the SystemConfig. /// @notice Contract of the SystemConfig.
/// @custom:network-specific /// @custom:network-specific
SystemConfig public systemConfig; ISystemConfig public systemConfig;
/// @notice Address of the DisputeGameFactory. /// @notice Address of the DisputeGameFactory.
/// @custom:network-specific /// @custom:network-specific
DisputeGameFactory public disputeGameFactory; IDisputeGameFactory public disputeGameFactory;
/// @notice A mapping of withdrawal hashes to proof submitters to `ProvenWithdrawal` data. /// @notice A mapping of withdrawal hashes to proof submitters to `ProvenWithdrawal` data.
mapping(bytes32 => mapping(address => ProvenWithdrawal)) public provenWithdrawals; mapping(bytes32 => mapping(address => ProvenWithdrawal)) public provenWithdrawals;
...@@ -164,9 +169,9 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver { ...@@ -164,9 +169,9 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
DISPUTE_GAME_FINALITY_DELAY_SECONDS = _disputeGameFinalityDelaySeconds; DISPUTE_GAME_FINALITY_DELAY_SECONDS = _disputeGameFinalityDelaySeconds;
initialize({ initialize({
_disputeGameFactory: DisputeGameFactory(address(0)), _disputeGameFactory: IDisputeGameFactory(address(0)),
_systemConfig: SystemConfig(address(0)), _systemConfig: ISystemConfig(address(0)),
_superchainConfig: SuperchainConfig(address(0)), _superchainConfig: ISuperchainConfig(address(0)),
_initialRespectedGameType: GameType.wrap(0) _initialRespectedGameType: GameType.wrap(0)
}); });
} }
...@@ -176,9 +181,9 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver { ...@@ -176,9 +181,9 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
/// @param _systemConfig Contract of the SystemConfig. /// @param _systemConfig Contract of the SystemConfig.
/// @param _superchainConfig Contract of the SuperchainConfig. /// @param _superchainConfig Contract of the SuperchainConfig.
function initialize( function initialize(
DisputeGameFactory _disputeGameFactory, IDisputeGameFactory _disputeGameFactory,
SystemConfig _systemConfig, ISystemConfig _systemConfig,
SuperchainConfig _superchainConfig, ISuperchainConfig _superchainConfig,
GameType _initialRespectedGameType GameType _initialRespectedGameType
) )
public public
...@@ -271,9 +276,12 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver { ...@@ -271,9 +276,12 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
/// @notice Getter for the resource config. /// @notice Getter for the resource config.
/// Used internally by the ResourceMetering contract. /// Used internally by the ResourceMetering contract.
/// The SystemConfig is the source of truth for the resource config. /// The SystemConfig is the source of truth for the resource config.
/// @return ResourceMetering ResourceConfig /// @return config_ ResourceMetering ResourceConfig
function _resourceConfig() internal view override returns (ResourceMetering.ResourceConfig memory) { function _resourceConfig() internal view override returns (ResourceMetering.ResourceConfig memory config_) {
return systemConfig.resourceConfig(); IResourceMetering.ResourceConfig memory config = systemConfig.resourceConfig();
assembly ("memory-safe") {
config_ := config
}
} }
/// @notice Proves a withdrawal transaction. /// @notice Proves a withdrawal transaction.
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Contracts
import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol"; import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol";
import { L1BlockIsthmus, ConfigType } from "src/L2/L1BlockIsthmus.sol"; import { L1BlockIsthmus, ConfigType } from "src/L2/L1BlockIsthmus.sol";
// Libraries
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import "src/libraries/PortalErrors.sol";
/// @custom:proxied true /// @custom:proxied true
/// @title OptimismPortalInterop /// @title OptimismPortalInterop
...@@ -12,9 +16,6 @@ import { Constants } from "src/libraries/Constants.sol"; ...@@ -12,9 +16,6 @@ import { Constants } from "src/libraries/Constants.sol";
/// and L2. Messages sent directly to the OptimismPortal have no form of replayability. /// and L2. Messages sent directly to the OptimismPortal have no form of replayability.
/// Users are encouraged to use the L1CrossDomainMessenger for a higher-level interface. /// Users are encouraged to use the L1CrossDomainMessenger for a higher-level interface.
contract OptimismPortalInterop is OptimismPortal2 { contract OptimismPortalInterop is OptimismPortal2 {
/// @notice Thrown when a non-depositor account attempts update static configuration.
error Unauthorized();
constructor( constructor(
uint256 _proofMaturityDelaySeconds, uint256 _proofMaturityDelaySeconds,
uint256 _disputeGameFinalityDelaySeconds uint256 _disputeGameFinalityDelaySeconds
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Contracts
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
// Libraries
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol"; import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { Burn } from "src/libraries/Burn.sol"; import { Burn } from "src/libraries/Burn.sol";
import { Arithmetic } from "src/libraries/Arithmetic.sol"; import { Arithmetic } from "src/libraries/Arithmetic.sol";
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Contracts
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol"; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
// Libraries
import { Storage } from "src/libraries/Storage.sol"; import { Storage } from "src/libraries/Storage.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol";
import { GasPayingToken, IGasToken } from "src/libraries/GasPayingToken.sol"; import { GasPayingToken, IGasToken } from "src/libraries/GasPayingToken.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
// Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
/// @custom:proxied true /// @custom:proxied true
/// @title SystemConfig /// @title SystemConfig
...@@ -116,7 +121,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken { ...@@ -116,7 +121,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken {
/// @notice The configuration for the deposit fee market. /// @notice The configuration for the deposit fee market.
/// Used by the OptimismPortal to meter the cost of buying L2 gas on L1. /// Used by the OptimismPortal to meter the cost of buying L2 gas on L1.
/// Set as internal with a getter so that the struct is returned instead of a tuple. /// Set as internal with a getter so that the struct is returned instead of a tuple.
ResourceMetering.ResourceConfig internal _resourceConfig; IResourceMetering.ResourceConfig internal _resourceConfig;
/// @notice Emitted when configuration is updated. /// @notice Emitted when configuration is updated.
/// @param version SystemConfig version. /// @param version SystemConfig version.
...@@ -144,7 +149,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken { ...@@ -144,7 +149,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken {
_batcherHash: bytes32(0), _batcherHash: bytes32(0),
_gasLimit: 1, _gasLimit: 1,
_unsafeBlockSigner: address(0), _unsafeBlockSigner: address(0),
_config: ResourceMetering.ResourceConfig({ _config: IResourceMetering.ResourceConfig({
maxResourceLimit: 1, maxResourceLimit: 1,
elasticityMultiplier: 1, elasticityMultiplier: 1,
baseFeeMaxChangeDenominator: 2, baseFeeMaxChangeDenominator: 2,
...@@ -184,7 +189,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken { ...@@ -184,7 +189,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken {
bytes32 _batcherHash, bytes32 _batcherHash,
uint64 _gasLimit, uint64 _gasLimit,
address _unsafeBlockSigner, address _unsafeBlockSigner,
ResourceMetering.ResourceConfig memory _config, IResourceMetering.ResourceConfig memory _config,
address _batchInbox, address _batchInbox,
SystemConfig.Addresses memory _addresses SystemConfig.Addresses memory _addresses
) )
...@@ -318,7 +323,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken { ...@@ -318,7 +323,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken {
// Set the gas paying token in storage and in the OptimismPortal. // Set the gas paying token in storage and in the OptimismPortal.
GasPayingToken.set({ _token: _token, _decimals: GAS_PAYING_TOKEN_DECIMALS, _name: name, _symbol: symbol }); GasPayingToken.set({ _token: _token, _decimals: GAS_PAYING_TOKEN_DECIMALS, _name: name, _symbol: symbol });
OptimismPortal(payable(optimismPortal())).setGasPayingToken({ IOptimismPortal(payable(optimismPortal())).setGasPayingToken({
_token: _token, _token: _token,
_decimals: GAS_PAYING_TOKEN_DECIMALS, _decimals: GAS_PAYING_TOKEN_DECIMALS,
_name: name, _name: name,
...@@ -433,7 +438,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken { ...@@ -433,7 +438,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken {
/// @notice A getter for the resource config. /// @notice A getter for the resource config.
/// Ensures that the struct is returned instead of a tuple. /// Ensures that the struct is returned instead of a tuple.
/// @return ResourceConfig /// @return ResourceConfig
function resourceConfig() external view returns (ResourceMetering.ResourceConfig memory) { function resourceConfig() external view returns (IResourceMetering.ResourceConfig memory) {
return _resourceConfig; return _resourceConfig;
} }
...@@ -442,7 +447,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken { ...@@ -442,7 +447,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken {
/// In the future, this method may emit an event that the `op-node` picks up /// In the future, this method may emit an event that the `op-node` picks up
/// for when the resource config is changed. /// for when the resource config is changed.
/// @param _config The new resource config. /// @param _config The new resource config.
function _setResourceConfig(ResourceMetering.ResourceConfig memory _config) internal { function _setResourceConfig(IResourceMetering.ResourceConfig memory _config) internal {
// Min base fee must be less than or equal to max base fee. // Min base fee must be less than or equal to max base fee.
require( require(
_config.minimumBaseFee <= _config.maximumBaseFee, "SystemConfig: min base fee must be less than max base" _config.minimumBaseFee <= _config.maximumBaseFee, "SystemConfig: min base fee must be less than max base"
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
import { Constants } from "src/libraries/Constants.sol"; // Contracts
import { OptimismPortalInterop as OptimismPortal } from "src/L1/OptimismPortalInterop.sol";
import { GasPayingToken } from "src/libraries/GasPayingToken.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { IOptimismPortalInterop as IOptimismPortal } from "src/L1/interfaces/IOptimismPortalInterop.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol"; import { SystemConfig } from "src/L1/SystemConfig.sol";
import { ConfigType } from "src/L2/L1BlockIsthmus.sol"; import { ConfigType } from "src/L2/L1BlockIsthmus.sol";
// Libraries
import { Constants } from "src/libraries/Constants.sol";
import { GasPayingToken } from "src/libraries/GasPayingToken.sol";
import { StaticConfig } from "src/libraries/StaticConfig.sol"; import { StaticConfig } from "src/libraries/StaticConfig.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { Storage } from "src/libraries/Storage.sol"; import { Storage } from "src/libraries/Storage.sol";
// Interfaces
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
/// @custom:proxied true /// @custom:proxied true
/// @title SystemConfigInterop /// @title SystemConfigInterop
/// @notice The SystemConfig contract is used to manage configuration of an Optimism network. /// @notice The SystemConfig contract is used to manage configuration of an Optimism network.
...@@ -41,7 +46,7 @@ contract SystemConfigInterop is SystemConfig { ...@@ -41,7 +46,7 @@ contract SystemConfigInterop is SystemConfig {
bytes32 _batcherHash, bytes32 _batcherHash,
uint64 _gasLimit, uint64 _gasLimit,
address _unsafeBlockSigner, address _unsafeBlockSigner,
ResourceMetering.ResourceConfig memory _config, IResourceMetering.ResourceConfig memory _config,
address _batchInbox, address _batchInbox,
SystemConfig.Addresses memory _addresses, SystemConfig.Addresses memory _addresses,
address _dependencyManager address _dependencyManager
...@@ -85,7 +90,7 @@ contract SystemConfigInterop is SystemConfig { ...@@ -85,7 +90,7 @@ contract SystemConfigInterop is SystemConfig {
// Set the gas paying token in storage and in the OptimismPortal. // Set the gas paying token in storage and in the OptimismPortal.
GasPayingToken.set({ _token: _token, _decimals: GAS_PAYING_TOKEN_DECIMALS, _name: name, _symbol: symbol }); GasPayingToken.set({ _token: _token, _decimals: GAS_PAYING_TOKEN_DECIMALS, _name: name, _symbol: symbol });
OptimismPortal(payable(optimismPortal())).setConfig( IOptimismPortal(payable(optimismPortal())).setConfig(
ConfigType.SET_GAS_PAYING_TOKEN, ConfigType.SET_GAS_PAYING_TOKEN,
StaticConfig.encodeSetGasPayingToken({ StaticConfig.encodeSetGasPayingToken({
_token: _token, _token: _token,
...@@ -101,7 +106,7 @@ contract SystemConfigInterop is SystemConfig { ...@@ -101,7 +106,7 @@ contract SystemConfigInterop is SystemConfig {
/// @param _chainId Chain ID of chain to add. /// @param _chainId Chain ID of chain to add.
function addDependency(uint256 _chainId) external { function addDependency(uint256 _chainId) external {
require(msg.sender == dependencyManager(), "SystemConfig: caller is not the dependency manager"); require(msg.sender == dependencyManager(), "SystemConfig: caller is not the dependency manager");
OptimismPortal(payable(optimismPortal())).setConfig( IOptimismPortal(payable(optimismPortal())).setConfig(
ConfigType.ADD_DEPENDENCY, StaticConfig.encodeAddDependency(_chainId) ConfigType.ADD_DEPENDENCY, StaticConfig.encodeAddDependency(_chainId)
); );
} }
...@@ -110,7 +115,7 @@ contract SystemConfigInterop is SystemConfig { ...@@ -110,7 +115,7 @@ contract SystemConfigInterop is SystemConfig {
/// @param _chainId Chain ID of the chain to remove. /// @param _chainId Chain ID of the chain to remove.
function removeDependency(uint256 _chainId) external { function removeDependency(uint256 _chainId) external {
require(msg.sender == dependencyManager(), "SystemConfig: caller is not the dependency manager"); require(msg.sender == dependencyManager(), "SystemConfig: caller is not the dependency manager");
OptimismPortal(payable(optimismPortal())).setConfig( IOptimismPortal(payable(optimismPortal())).setConfig(
ConfigType.REMOVE_DEPENDENCY, StaticConfig.encodeRemoveDependency(_chainId) ConfigType.REMOVE_DEPENDENCY, StaticConfig.encodeRemoveDependency(_chainId)
); );
} }
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
enum ChallengeStatus {
Uninitialized,
Active,
Resolved,
Expired
}
enum CommitmentType {
Keccak256
}
struct Challenge {
address challenger;
uint256 lockedBond;
uint256 startBlock;
uint256 resolvedBlock;
}
interface IDataAvailabilityChallenge {
error BondTooLow(uint256 balance, uint256 required);
error ChallengeExists();
error ChallengeNotActive();
error ChallengeNotExpired();
error ChallengeWindowNotOpen();
error InvalidCommitmentLength(uint8 commitmentType, uint256 expectedLength, uint256 actualLength);
error InvalidInputData(bytes providedDataCommitment, bytes expectedCommitment);
error InvalidResolverRefundPercentage(uint256 invalidResolverRefundPercentage);
error UnknownCommitmentType(uint8 commitmentType);
error WithdrawalFailed();
event BalanceChanged(address account, uint256 balance);
event ChallengeStatusChanged(
uint256 indexed challengedBlockNumber, bytes challengedCommitment, ChallengeStatus status
);
event Initialized(uint8 version);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event RequiredBondSizeChanged(uint256 challengeWindow);
event ResolverRefundPercentageChanged(uint256 resolverRefundPercentage);
receive() external payable;
function balances(address) external view returns (uint256);
function bondSize() external view returns (uint256);
function challenge(uint256 challengedBlockNumber, bytes memory challengedCommitment) external payable;
function challengeWindow() external view returns (uint256);
function deposit() external payable;
function fixedResolutionCost() external view returns (uint256);
function getChallenge(
uint256 challengedBlockNumber,
bytes memory challengedCommitment
)
external
view
returns (Challenge memory);
function getChallengeStatus(
uint256 challengedBlockNumber,
bytes memory challengedCommitment
)
external
view
returns (ChallengeStatus);
function initialize(
address _owner,
uint256 _challengeWindow,
uint256 _resolveWindow,
uint256 _bondSize,
uint256 _resolverRefundPercentage
)
external;
function owner() external view returns (address);
function renounceOwnership() external;
function resolve(
uint256 challengedBlockNumber,
bytes memory challengedCommitment,
bytes memory resolveData
)
external;
function resolveWindow() external view returns (uint256);
function resolverRefundPercentage() external view returns (uint256);
function setBondSize(uint256 _bondSize) external;
function setResolverRefundPercentage(uint256 _resolverRefundPercentage) external;
function transferOwnership(address newOwner) external;
function unlockBond(uint256 challengedBlockNumber, bytes memory challengedCommitment) external;
function validateCommitment(bytes memory commitment) external pure;
function variableResolutionCost() external view returns (uint256);
function variableResolutionCostPrecision() external view returns (uint256);
function version() external view returns (string memory);
function withdraw() external;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IDelayedVetoable {
error ForwardingEarly();
error Unauthorized(address expected, address actual);
event DelayActivated(uint256 delay);
event Forwarded(bytes32 indexed callHash, bytes data);
event Initiated(bytes32 indexed callHash, bytes data);
event Vetoed(bytes32 indexed callHash, bytes data);
fallback() external;
function delay() external returns (uint256 delay_);
function initiator() external returns (address initiator_);
function queuedAt(bytes32 callHash) external returns (uint256 queuedAt_);
function target() external returns (address target_);
function version() external view returns (string memory);
function vetoer() external returns (address vetoer_);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
interface IL1CrossDomainMessenger {
event FailedRelayedMessage(bytes32 indexed msgHash);
event Initialized(uint8 version);
event RelayedMessage(bytes32 indexed msgHash);
event SentMessage(address indexed target, address sender, bytes message, uint256 messageNonce, uint256 gasLimit);
event SentMessageExtension1(address indexed sender, uint256 value);
function MESSAGE_VERSION() external view returns (uint16);
function MIN_GAS_CALLDATA_OVERHEAD() external view returns (uint64);
function MIN_GAS_DYNAMIC_OVERHEAD_DENOMINATOR() external view returns (uint64);
function MIN_GAS_DYNAMIC_OVERHEAD_NUMERATOR() external view returns (uint64);
function OTHER_MESSENGER() external view returns (address);
function PORTAL() external view returns (address);
function RELAY_CALL_OVERHEAD() external view returns (uint64);
function RELAY_CONSTANT_OVERHEAD() external view returns (uint64);
function RELAY_GAS_CHECK_BUFFER() external view returns (uint64);
function RELAY_RESERVED_GAS() external view returns (uint64);
function baseGas(bytes memory _message, uint32 _minGasLimit) external pure returns (uint64);
function failedMessages(bytes32) external view returns (bool);
function initialize(
ISuperchainConfig _superchainConfig,
IOptimismPortal _portal,
ISystemConfig _systemConfig
)
external;
function messageNonce() external view returns (uint256);
function otherMessenger() external view returns (address);
function paused() external view returns (bool);
function portal() external view returns (address);
function relayMessage(
uint256 _nonce,
address _sender,
address _target,
uint256 _value,
uint256 _minGasLimit,
bytes memory _message
)
external
payable;
function sendMessage(address _target, bytes memory _message, uint32 _minGasLimit) external payable;
function successfulMessages(bytes32) external view returns (bool);
function superchainConfig() external view returns (address);
function systemConfig() external view returns (address);
function version() external view returns (string memory);
function xDomainMessageSender() external view returns (address);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { Types } from "src/libraries/Types.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { IL2OutputOracle } from "src/L1/interfaces/IL2OutputOracle.sol";
interface IOptimismPortal {
error BadTarget();
error CallPaused();
error ContentLengthMismatch();
error EmptyItem();
error GasEstimation();
error InvalidDataRemainder();
error InvalidHeader();
error LargeCalldata();
error NoValue();
error NonReentrant();
error OnlyCustomGasToken();
error OutOfGas();
error SmallGasLimit();
error TransferFailed();
error Unauthorized();
error UnexpectedList();
error UnexpectedString();
event Initialized(uint8 version);
event TransactionDeposited(address indexed from, address indexed to, uint256 indexed version, bytes opaqueData);
event WithdrawalFinalized(bytes32 indexed withdrawalHash, bool success);
event WithdrawalProven(bytes32 indexed withdrawalHash, address indexed from, address indexed to);
receive() external payable;
function balance() external view returns (uint256);
function depositERC20Transaction(
address _to,
uint256 _mint,
uint256 _value,
uint64 _gasLimit,
bool _isCreation,
bytes memory _data
)
external;
function depositTransaction(
address _to,
uint256 _value,
uint64 _gasLimit,
bool _isCreation,
bytes memory _data
)
external
payable;
function donateETH() external payable;
function finalizeWithdrawalTransaction(Types.WithdrawalTransaction memory _tx) external;
function finalizedWithdrawals(bytes32) external view returns (bool);
function guardian() external view returns (address);
function initialize(
IL2OutputOracle _l2Oracle,
ISystemConfig _systemConfig,
ISuperchainConfig _superchainConfig
)
external;
function isOutputFinalized(uint256 _l2OutputIndex) external view returns (bool);
function l2Oracle() external view returns (IL2OutputOracle);
function l2Sender() external view returns (address);
function minimumGasLimit(uint64 _byteCount) external pure returns (uint64);
function params() external view returns (uint128 prevBaseFee, uint64 prevBoughtGas, uint64 prevBlockNum);
function paused() external view returns (bool paused_);
function proveWithdrawalTransaction(
Types.WithdrawalTransaction memory _tx,
uint256 _l2OutputIndex,
Types.OutputRootProof memory _outputRootProof,
bytes[] memory _withdrawalProof
)
external;
function provenWithdrawals(bytes32)
external
view
returns (bytes32 outputRoot, uint128 timestamp, uint128 l2OutputIndex);
function setGasPayingToken(address _token, uint8 _decimals, bytes32 _name, bytes32 _symbol) external;
function superchainConfig() external view returns (ISuperchainConfig);
function systemConfig() external view returns (ISystemConfig);
function version() external pure returns (string memory);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { Types } from "src/libraries/Types.sol";
import { GameType, Timestamp } from "src/dispute/lib/LibUDT.sol";
import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
interface IOptimismPortal2 {
error AlreadyFinalized();
error BadTarget();
error Blacklisted();
error CallPaused();
error ContentLengthMismatch();
error EmptyItem();
error GasEstimation();
error InvalidDataRemainder();
error InvalidDisputeGame();
error InvalidGameType();
error InvalidHeader();
error InvalidMerkleProof();
error InvalidProof();
error LargeCalldata();
error NoValue();
error NonReentrant();
error OnlyCustomGasToken();
error OutOfGas();
error ProposalNotValidated();
error SmallGasLimit();
error TransferFailed();
error Unauthorized();
error UnexpectedList();
error UnexpectedString();
error Unproven();
event DisputeGameBlacklisted(IDisputeGame indexed disputeGame);
event Initialized(uint8 version);
event RespectedGameTypeSet(GameType indexed newGameType, Timestamp indexed updatedAt);
event TransactionDeposited(address indexed from, address indexed to, uint256 indexed version, bytes opaqueData);
event WithdrawalFinalized(bytes32 indexed withdrawalHash, bool success);
event WithdrawalProven(bytes32 indexed withdrawalHash, address indexed from, address indexed to);
event WithdrawalProvenExtension1(bytes32 indexed withdrawalHash, address indexed proofSubmitter);
receive() external payable;
function balance() external view returns (uint256);
function blacklistDisputeGame(IDisputeGame _disputeGame) external;
function checkWithdrawal(bytes32 _withdrawalHash, address _proofSubmitter) external view;
function depositERC20Transaction(
address _to,
uint256 _mint,
uint256 _value,
uint64 _gasLimit,
bool _isCreation,
bytes memory _data
)
external;
function depositTransaction(
address _to,
uint256 _value,
uint64 _gasLimit,
bool _isCreation,
bytes memory _data
)
external
payable;
function disputeGameBlacklist(IDisputeGame) external view returns (bool);
function disputeGameFactory() external view returns (IDisputeGameFactory);
function disputeGameFinalityDelaySeconds() external view returns (uint256);
function donateETH() external payable;
function finalizeWithdrawalTransaction(Types.WithdrawalTransaction memory _tx) external;
function finalizeWithdrawalTransactionExternalProof(
Types.WithdrawalTransaction memory _tx,
address _proofSubmitter
)
external;
function finalizedWithdrawals(bytes32) external view returns (bool);
function guardian() external view returns (address);
function initialize(
IDisputeGameFactory _disputeGameFactory,
ISystemConfig _systemConfig,
ISuperchainConfig _superchainConfig,
GameType _initialRespectedGameType
)
external;
function l2Sender() external view returns (address);
function minimumGasLimit(uint64 _byteCount) external pure returns (uint64);
function numProofSubmitters(bytes32 _withdrawalHash) external view returns (uint256);
function params() external view returns (uint128 prevBaseFee, uint64 prevBoughtGas, uint64 prevBlockNum);
function paused() external view returns (bool);
function proofMaturityDelaySeconds() external view returns (uint256);
function proofSubmitters(bytes32, uint256) external view returns (address);
function proveWithdrawalTransaction(
Types.WithdrawalTransaction memory _tx,
uint256 _disputeGameIndex,
Types.OutputRootProof memory _outputRootProof,
bytes[] memory _withdrawalProof
)
external;
function provenWithdrawals(
bytes32,
address
)
external
view
returns (IDisputeGame disputeGameProxy, uint64 timestamp);
function respectedGameType() external view returns (GameType);
function respectedGameTypeUpdatedAt() external view returns (uint64);
function setGasPayingToken(address _token, uint8 _decimals, bytes32 _name, bytes32 _symbol) external;
function setRespectedGameType(GameType _gameType) external;
function superchainConfig() external view returns (ISuperchainConfig);
function systemConfig() external view returns (ISystemConfig);
function version() external pure returns (string memory);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { Types } from "src/libraries/Types.sol";
import { GameType, Timestamp } from "src/dispute/lib/LibUDT.sol";
import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { ConfigType } from "src/L2/L1BlockIsthmus.sol";
interface IOptimismPortalInterop {
error AlreadyFinalized();
error BadTarget();
error Blacklisted();
error CallPaused();
error ContentLengthMismatch();
error EmptyItem();
error GasEstimation();
error InvalidDataRemainder();
error InvalidDisputeGame();
error InvalidGameType();
error InvalidHeader();
error InvalidMerkleProof();
error InvalidProof();
error LargeCalldata();
error NoValue();
error NonReentrant();
error OnlyCustomGasToken();
error OutOfGas();
error ProposalNotValidated();
error SmallGasLimit();
error TransferFailed();
error Unauthorized();
error UnexpectedList();
error UnexpectedString();
error Unproven();
event DisputeGameBlacklisted(IDisputeGame indexed disputeGame);
event Initialized(uint8 version);
event RespectedGameTypeSet(GameType indexed newGameType, Timestamp indexed updatedAt);
event TransactionDeposited(address indexed from, address indexed to, uint256 indexed version, bytes opaqueData);
event WithdrawalFinalized(bytes32 indexed withdrawalHash, bool success);
event WithdrawalProven(bytes32 indexed withdrawalHash, address indexed from, address indexed to);
event WithdrawalProvenExtension1(bytes32 indexed withdrawalHash, address indexed proofSubmitter);
receive() external payable;
function balance() external view returns (uint256);
function blacklistDisputeGame(IDisputeGame _disputeGame) external;
function checkWithdrawal(bytes32 _withdrawalHash, address _proofSubmitter) external view;
function depositERC20Transaction(
address _to,
uint256 _mint,
uint256 _value,
uint64 _gasLimit,
bool _isCreation,
bytes memory _data
)
external;
function depositTransaction(
address _to,
uint256 _value,
uint64 _gasLimit,
bool _isCreation,
bytes memory _data
)
external
payable;
function disputeGameBlacklist(IDisputeGame) external view returns (bool);
function disputeGameFactory() external view returns (IDisputeGameFactory);
function disputeGameFinalityDelaySeconds() external view returns (uint256);
function donateETH() external payable;
function finalizeWithdrawalTransaction(Types.WithdrawalTransaction memory _tx) external;
function finalizeWithdrawalTransactionExternalProof(
Types.WithdrawalTransaction memory _tx,
address _proofSubmitter
)
external;
function finalizedWithdrawals(bytes32) external view returns (bool);
function guardian() external view returns (address);
function initialize(
IDisputeGameFactory _disputeGameFactory,
ISystemConfig _systemConfig,
ISuperchainConfig _superchainConfig,
GameType _initialRespectedGameType
)
external;
function l2Sender() external view returns (address);
function minimumGasLimit(uint64 _byteCount) external pure returns (uint64);
function numProofSubmitters(bytes32 _withdrawalHash) external view returns (uint256);
function params() external view returns (uint128 prevBaseFee, uint64 prevBoughtGas, uint64 prevBlockNum);
function paused() external view returns (bool);
function proofMaturityDelaySeconds() external view returns (uint256);
function proofSubmitters(bytes32, uint256) external view returns (address);
function proveWithdrawalTransaction(
Types.WithdrawalTransaction memory _tx,
uint256 _disputeGameIndex,
Types.OutputRootProof memory _outputRootProof,
bytes[] memory _withdrawalProof
)
external;
function provenWithdrawals(
bytes32,
address
)
external
view
returns (IDisputeGame disputeGameProxy, uint64 timestamp);
function respectedGameType() external view returns (GameType);
function respectedGameTypeUpdatedAt() external view returns (uint64);
function setConfig(ConfigType _type, bytes memory _value) external;
function setGasPayingToken(address _token, uint8 _decimals, bytes32 _name, bytes32 _symbol) external;
function setRespectedGameType(GameType _gameType) external;
function superchainConfig() external view returns (ISuperchainConfig);
function systemConfig() external view returns (ISystemConfig);
function version() external pure returns (string memory);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IResourceMetering {
struct ResourceParams {
uint128 prevBaseFee;
uint64 prevBoughtGas;
uint64 prevBlockNum;
}
struct ResourceConfig {
uint32 maxResourceLimit;
uint8 elasticityMultiplier;
uint8 baseFeeMaxChangeDenominator;
uint32 minimumBaseFee;
uint32 systemTxMaxGas;
uint128 maximumBaseFee;
}
error OutOfGas();
event Initialized(uint8 version);
function params() external view returns (uint128 prevBaseFee, uint64 prevBoughtGas, uint64 prevBlockNum);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ISuperchainConfig {
enum UpdateType {
GUARDIAN
}
event ConfigUpdate(UpdateType indexed updateType, bytes data);
event Initialized(uint8 version);
event Paused(string identifier);
event Unpaused();
function GUARDIAN_SLOT() external view returns (bytes32);
function PAUSED_SLOT() external view returns (bytes32);
function guardian() external view returns (address guardian_);
function initialize(address _guardian, bool _paused) external;
function pause(string memory _identifier) external;
function paused() external view returns (bool paused_);
function unpause() external;
function version() external view returns (string memory);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
interface ISystemConfig {
enum UpdateType {
BATCHER,
GAS_CONFIG,
GAS_LIMIT,
UNSAFE_BLOCK_SIGNER
}
struct Addresses {
address l1CrossDomainMessenger;
address l1ERC721Bridge;
address l1StandardBridge;
address disputeGameFactory;
address optimismPortal;
address optimismMintableERC20Factory;
address gasPayingToken;
}
event ConfigUpdate(uint256 indexed version, UpdateType indexed updateType, bytes data);
event Initialized(uint8 version);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function BATCH_INBOX_SLOT() external view returns (bytes32);
function DISPUTE_GAME_FACTORY_SLOT() external view returns (bytes32);
function L1_CROSS_DOMAIN_MESSENGER_SLOT() external view returns (bytes32);
function L1_ERC_721_BRIDGE_SLOT() external view returns (bytes32);
function L1_STANDARD_BRIDGE_SLOT() external view returns (bytes32);
function OPTIMISM_MINTABLE_ERC20_FACTORY_SLOT() external view returns (bytes32);
function OPTIMISM_PORTAL_SLOT() external view returns (bytes32);
function START_BLOCK_SLOT() external view returns (bytes32);
function UNSAFE_BLOCK_SIGNER_SLOT() external view returns (bytes32);
function VERSION() external view returns (uint256);
function basefeeScalar() external view returns (uint32);
function batchInbox() external view returns (address addr_);
function batcherHash() external view returns (bytes32);
function blobbasefeeScalar() external view returns (uint32);
function disputeGameFactory() external view returns (address addr_);
function gasLimit() external view returns (uint64);
function gasPayingToken() external view returns (address addr_, uint8 decimals_);
function gasPayingTokenName() external view returns (string memory name_);
function gasPayingTokenSymbol() external view returns (string memory symbol_);
function initialize(
address _owner,
uint32 _basefeeScalar,
uint32 _blobbasefeeScalar,
bytes32 _batcherHash,
uint64 _gasLimit,
address _unsafeBlockSigner,
IResourceMetering.ResourceConfig memory _config,
address _batchInbox,
Addresses memory _addresses
)
external;
function isCustomGasToken() external view returns (bool);
function l1CrossDomainMessenger() external view returns (address addr_);
function l1ERC721Bridge() external view returns (address addr_);
function l1StandardBridge() external view returns (address addr_);
function maximumGasLimit() external pure returns (uint64);
function minimumGasLimit() external view returns (uint64);
function optimismMintableERC20Factory() external view returns (address addr_);
function optimismPortal() external view returns (address addr_);
function overhead() external view returns (uint256);
function owner() external view returns (address);
function renounceOwnership() external;
function resourceConfig() external view returns (IResourceMetering.ResourceConfig memory);
function scalar() external view returns (uint256);
function setBatcherHash(bytes32 _batcherHash) external;
function setGasConfig(uint256 _overhead, uint256 _scalar) external;
function setGasConfigEcotone(uint32 _basefeeScalar, uint32 _blobbasefeeScalar) external;
function setGasLimit(uint64 _gasLimit) external;
function setUnsafeBlockSigner(address _unsafeBlockSigner) external;
function startBlock() external view returns (uint256 startBlock_);
function transferOwnership(address newOwner) external;
function unsafeBlockSigner() external view returns (address addr_);
function version() external pure returns (string memory);
}
...@@ -5,7 +5,7 @@ import { ERC721Bridge } from "src/universal/ERC721Bridge.sol"; ...@@ -5,7 +5,7 @@ import { ERC721Bridge } from "src/universal/ERC721Bridge.sol";
import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol"; import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol";
import { IOptimismMintableERC721 } from "src/universal/interfaces/IOptimismMintableERC721.sol"; import { IOptimismMintableERC721 } from "src/universal/interfaces/IOptimismMintableERC721.sol";
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol"; import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol"; import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
...@@ -34,7 +34,7 @@ contract L2ERC721Bridge is ERC721Bridge, ISemver { ...@@ -34,7 +34,7 @@ contract L2ERC721Bridge is ERC721Bridge, ISemver {
/// @param _l1ERC721Bridge Address of the ERC721 bridge contract on the other network. /// @param _l1ERC721Bridge Address of the ERC721 bridge contract on the other network.
function initialize(address payable _l1ERC721Bridge) public initializer { function initialize(address payable _l1ERC721Bridge) public initializer {
__ERC721Bridge_init({ __ERC721Bridge_init({
_messenger: CrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER), _messenger: ICrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER),
_otherBridge: ERC721Bridge(_l1ERC721Bridge) _otherBridge: ERC721Bridge(_l1ERC721Bridge)
}); });
} }
......
...@@ -5,7 +5,7 @@ import { Predeploys } from "src/libraries/Predeploys.sol"; ...@@ -5,7 +5,7 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
import { StandardBridge } from "src/universal/StandardBridge.sol"; import { StandardBridge } from "src/universal/StandardBridge.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol"; import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol"; import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol";
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol"; import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
import { L1Block } from "src/L2/L1Block.sol"; import { L1Block } from "src/L2/L1Block.sol";
/// @custom:proxied true /// @custom:proxied true
...@@ -67,7 +67,7 @@ contract L2StandardBridge is StandardBridge, ISemver { ...@@ -67,7 +67,7 @@ contract L2StandardBridge is StandardBridge, ISemver {
/// @param _otherBridge Contract for the corresponding bridge on the other chain. /// @param _otherBridge Contract for the corresponding bridge on the other chain.
function initialize(StandardBridge _otherBridge) public initializer { function initialize(StandardBridge _otherBridge) public initializer {
__StandardBridge_init({ __StandardBridge_init({
_messenger: CrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER), _messenger: ICrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER),
_otherBridge: _otherBridge _otherBridge: _otherBridge
}); });
} }
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Safe
import { GnosisSafe as Safe } from "safe-contracts/GnosisSafe.sol"; import { GnosisSafe as Safe } from "safe-contracts/GnosisSafe.sol";
import { Enum } from "safe-contracts/common/Enum.sol"; import { Enum } from "safe-contracts/common/Enum.sol";
import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol"; // Contracts
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol";
import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { Unauthorized } from "src/libraries/PortalErrors.sol";
import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol"; import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol";
// Libraries
import { Unauthorized } from "src/libraries/PortalErrors.sol";
import "src/dispute/lib/Types.sol"; import "src/dispute/lib/Types.sol";
// Interfaces
import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { IOptimismPortal2 } from "src/L1/interfaces/IOptimismPortal2.sol";
import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";
/// @title DeputyGuardianModule /// @title DeputyGuardianModule
/// @notice This module is intended to be enabled on the Security Council Safe, which will own the Guardian role in the /// @notice This module is intended to be enabled on the Security Council Safe, which will own the Guardian role in the
/// SuperchainConfig contract. The DeputyGuardianModule should allow a Deputy Guardian to administer any of the /// SuperchainConfig contract. The DeputyGuardianModule should allow a Deputy Guardian to administer any of the
...@@ -39,7 +44,7 @@ contract DeputyGuardianModule is ISemver { ...@@ -39,7 +44,7 @@ contract DeputyGuardianModule is ISemver {
Safe internal immutable SAFE; Safe internal immutable SAFE;
/// @notice The SuperchainConfig's address /// @notice The SuperchainConfig's address
SuperchainConfig internal immutable SUPERCHAIN_CONFIG; ISuperchainConfig internal immutable SUPERCHAIN_CONFIG;
/// @notice The deputy guardian's address /// @notice The deputy guardian's address
address internal immutable DEPUTY_GUARDIAN; address internal immutable DEPUTY_GUARDIAN;
...@@ -49,7 +54,7 @@ contract DeputyGuardianModule is ISemver { ...@@ -49,7 +54,7 @@ contract DeputyGuardianModule is ISemver {
string public constant version = "2.0.1-beta.1"; string public constant version = "2.0.1-beta.1";
// Constructor to initialize the Safe and baseModule instances // Constructor to initialize the Safe and baseModule instances
constructor(Safe _safe, SuperchainConfig _superchainConfig, address _deputyGuardian) { constructor(Safe _safe, ISuperchainConfig _superchainConfig, address _deputyGuardian) {
SAFE = _safe; SAFE = _safe;
SUPERCHAIN_CONFIG = _superchainConfig; SUPERCHAIN_CONFIG = _superchainConfig;
DEPUTY_GUARDIAN = _deputyGuardian; DEPUTY_GUARDIAN = _deputyGuardian;
...@@ -63,7 +68,7 @@ contract DeputyGuardianModule is ISemver { ...@@ -63,7 +68,7 @@ contract DeputyGuardianModule is ISemver {
/// @notice Getter function for the SuperchainConfig's address /// @notice Getter function for the SuperchainConfig's address
/// @return superchainConfig_ The SuperchainConfig's address /// @return superchainConfig_ The SuperchainConfig's address
function superchainConfig() public view returns (SuperchainConfig superchainConfig_) { function superchainConfig() public view returns (ISuperchainConfig superchainConfig_) {
superchainConfig_ = SUPERCHAIN_CONFIG; superchainConfig_ = SUPERCHAIN_CONFIG;
} }
...@@ -131,10 +136,10 @@ contract DeputyGuardianModule is ISemver { ...@@ -131,10 +136,10 @@ contract DeputyGuardianModule is ISemver {
/// Only the deputy guardian can call this function. /// Only the deputy guardian can call this function.
/// @param _portal The `OptimismPortal2` contract instance. /// @param _portal The `OptimismPortal2` contract instance.
/// @param _game The `IDisputeGame` contract instance. /// @param _game The `IDisputeGame` contract instance.
function blacklistDisputeGame(OptimismPortal2 _portal, IDisputeGame _game) external { function blacklistDisputeGame(IOptimismPortal2 _portal, IDisputeGame _game) external {
_onlyDeputyGuardian(); _onlyDeputyGuardian();
bytes memory data = abi.encodeCall(OptimismPortal2.blacklistDisputeGame, (_game)); bytes memory data = abi.encodeCall(IOptimismPortal2.blacklistDisputeGame, (_game));
(bool success, bytes memory returnData) = (bool success, bytes memory returnData) =
SAFE.execTransactionFromModuleReturnData(address(_portal), 0, data, Enum.Operation.Call); SAFE.execTransactionFromModuleReturnData(address(_portal), 0, data, Enum.Operation.Call);
if (!success) { if (!success) {
...@@ -148,10 +153,10 @@ contract DeputyGuardianModule is ISemver { ...@@ -148,10 +153,10 @@ contract DeputyGuardianModule is ISemver {
/// Only the deputy guardian can call this function. /// Only the deputy guardian can call this function.
/// @param _portal The `OptimismPortal2` contract instance. /// @param _portal The `OptimismPortal2` contract instance.
/// @param _gameType The `GameType` to set as the respected game type. /// @param _gameType The `GameType` to set as the respected game type.
function setRespectedGameType(OptimismPortal2 _portal, GameType _gameType) external { function setRespectedGameType(IOptimismPortal2 _portal, GameType _gameType) external {
_onlyDeputyGuardian(); _onlyDeputyGuardian();
bytes memory data = abi.encodeCall(OptimismPortal2.setRespectedGameType, (_gameType)); bytes memory data = abi.encodeCall(IOptimismPortal2.setRespectedGameType, (_gameType));
(bool success, bytes memory returnData) = (bool success, bytes memory returnData) =
SAFE.execTransactionFromModuleReturnData(address(_portal), 0, data, Enum.Operation.Call); SAFE.execTransactionFromModuleReturnData(address(_portal), 0, data, Enum.Operation.Call);
if (!success) { if (!success) {
......
...@@ -8,7 +8,7 @@ import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistr ...@@ -8,7 +8,7 @@ import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistr
import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol"; import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol";
import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol"; import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol"; import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol"; import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import "src/dispute/lib/Types.sol"; import "src/dispute/lib/Types.sol";
import { Unauthorized } from "src/libraries/errors/CommonErrors.sol"; import { Unauthorized } from "src/libraries/errors/CommonErrors.sol";
...@@ -38,7 +38,7 @@ contract AnchorStateRegistry is Initializable, IAnchorStateRegistry, ISemver { ...@@ -38,7 +38,7 @@ contract AnchorStateRegistry is Initializable, IAnchorStateRegistry, ISemver {
mapping(GameType => OutputRoot) public anchors; mapping(GameType => OutputRoot) public anchors;
/// @notice Address of the SuperchainConfig contract. /// @notice Address of the SuperchainConfig contract.
SuperchainConfig public superchainConfig; ISuperchainConfig public superchainConfig;
/// @param _disputeGameFactory DisputeGameFactory address. /// @param _disputeGameFactory DisputeGameFactory address.
constructor(IDisputeGameFactory _disputeGameFactory) { constructor(IDisputeGameFactory _disputeGameFactory) {
...@@ -51,7 +51,7 @@ contract AnchorStateRegistry is Initializable, IAnchorStateRegistry, ISemver { ...@@ -51,7 +51,7 @@ contract AnchorStateRegistry is Initializable, IAnchorStateRegistry, ISemver {
/// @param _superchainConfig The address of the SuperchainConfig contract. /// @param _superchainConfig The address of the SuperchainConfig contract.
function initialize( function initialize(
StartingAnchorRoot[] memory _startingAnchorRoots, StartingAnchorRoot[] memory _startingAnchorRoots,
SuperchainConfig _superchainConfig ISuperchainConfig _superchainConfig
) )
public public
initializer initializer
......
...@@ -8,7 +8,7 @@ import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol"; ...@@ -8,7 +8,7 @@ import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol";
import { IWETH } from "src/dispute/interfaces/IWETH.sol"; import { IWETH } from "src/dispute/interfaces/IWETH.sol";
import { WETH98 } from "src/dispute/weth/WETH98.sol"; import { WETH98 } from "src/dispute/weth/WETH98.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol"; import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
/// @custom:proxied true /// @custom:proxied true
/// @title DelayedWETH /// @title DelayedWETH
...@@ -32,18 +32,18 @@ contract DelayedWETH is OwnableUpgradeable, WETH98, IDelayedWETH, ISemver { ...@@ -32,18 +32,18 @@ contract DelayedWETH is OwnableUpgradeable, WETH98, IDelayedWETH, ISemver {
uint256 internal immutable DELAY_SECONDS; uint256 internal immutable DELAY_SECONDS;
/// @notice Address of the SuperchainConfig contract. /// @notice Address of the SuperchainConfig contract.
SuperchainConfig public config; ISuperchainConfig public config;
/// @param _delay The delay for withdrawals in seconds. /// @param _delay The delay for withdrawals in seconds.
constructor(uint256 _delay) { constructor(uint256 _delay) {
DELAY_SECONDS = _delay; DELAY_SECONDS = _delay;
initialize({ _owner: address(0), _config: SuperchainConfig(address(0)) }); initialize({ _owner: address(0), _config: ISuperchainConfig(address(0)) });
} }
/// @notice Initializes the contract. /// @notice Initializes the contract.
/// @param _owner The address of the owner. /// @param _owner The address of the owner.
/// @param _config Address of the SuperchainConfig contract. /// @param _config Address of the SuperchainConfig contract.
function initialize(address _owner, SuperchainConfig _config) public initializer { function initialize(address _owner, ISuperchainConfig _config) public initializer {
__Ownable_init(); __Ownable_init();
_transferOwnership(_owner); _transferOwnership(_owner);
config = _config; config = _config;
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
import { ResourceMetering } from "src/L1/ResourceMetering.sol"; import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
/// @title Constants /// @title Constants
/// @notice Constants is a library for storing constants. Simple! Don't put everything in here, just /// @notice Constants is a library for storing constants. Simple! Don't put everything in here, just
...@@ -39,8 +39,8 @@ library Constants { ...@@ -39,8 +39,8 @@ library Constants {
/// @notice Returns the default values for the ResourceConfig. These are the recommended values /// @notice Returns the default values for the ResourceConfig. These are the recommended values
/// for a production network. /// for a production network.
function DEFAULT_RESOURCE_CONFIG() internal pure returns (ResourceMetering.ResourceConfig memory) { function DEFAULT_RESOURCE_CONFIG() internal pure returns (IResourceMetering.ResourceConfig memory) {
ResourceMetering.ResourceConfig memory config = ResourceMetering.ResourceConfig({ IResourceMetering.ResourceConfig memory config = IResourceMetering.ResourceConfig({
maxResourceLimit: 20_000_000, maxResourceLimit: 20_000_000,
elasticityMultiplier: 10, elasticityMultiplier: 10,
baseFeeMaxChangeDenominator: 8, baseFeeMaxChangeDenominator: 8,
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol"; import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol"; import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
...@@ -15,7 +14,7 @@ abstract contract ERC721Bridge is Initializable { ...@@ -15,7 +14,7 @@ abstract contract ERC721Bridge is Initializable {
/// @notice Messenger contract on this domain. /// @notice Messenger contract on this domain.
/// @custom:network-specific /// @custom:network-specific
CrossDomainMessenger public messenger; ICrossDomainMessenger public messenger;
/// @notice Contract of the bridge on the other network. /// @notice Contract of the bridge on the other network.
/// @custom:network-specific /// @custom:network-specific
...@@ -69,7 +68,7 @@ abstract contract ERC721Bridge is Initializable { ...@@ -69,7 +68,7 @@ abstract contract ERC721Bridge is Initializable {
/// @param _messenger Contract of the CrossDomainMessenger on this network. /// @param _messenger Contract of the CrossDomainMessenger on this network.
/// @param _otherBridge Contract of the ERC721 bridge on the other network. /// @param _otherBridge Contract of the ERC721 bridge on the other network.
function __ERC721Bridge_init( function __ERC721Bridge_init(
CrossDomainMessenger _messenger, ICrossDomainMessenger _messenger,
ERC721Bridge _otherBridge ERC721Bridge _otherBridge
) )
internal internal
...@@ -83,7 +82,7 @@ abstract contract ERC721Bridge is Initializable { ...@@ -83,7 +82,7 @@ abstract contract ERC721Bridge is Initializable {
/// Public getter is legacy and will be removed in the future. Use `messenger` instead. /// Public getter is legacy and will be removed in the future. Use `messenger` instead.
/// @return Messenger contract on this domain. /// @return Messenger contract on this domain.
/// @custom:legacy /// @custom:legacy
function MESSENGER() external view returns (CrossDomainMessenger) { function MESSENGER() external view returns (ICrossDomainMessenger) {
return messenger; return messenger;
} }
......
...@@ -7,7 +7,7 @@ import { Address } from "@openzeppelin/contracts/utils/Address.sol"; ...@@ -7,7 +7,7 @@ import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { SafeCall } from "src/libraries/SafeCall.sol"; import { SafeCall } from "src/libraries/SafeCall.sol";
import { IOptimismMintableERC20, ILegacyMintableERC20 } from "src/universal/interfaces/IOptimismMintableERC20.sol"; import { IOptimismMintableERC20, ILegacyMintableERC20 } from "src/universal/interfaces/IOptimismMintableERC20.sol";
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol"; import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol"; import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol";
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
...@@ -38,7 +38,7 @@ abstract contract StandardBridge is Initializable { ...@@ -38,7 +38,7 @@ abstract contract StandardBridge is Initializable {
/// @notice Messenger contract on this domain. /// @notice Messenger contract on this domain.
/// @custom:network-specific /// @custom:network-specific
CrossDomainMessenger public messenger; ICrossDomainMessenger public messenger;
/// @notice Corresponding bridge on the other domain. /// @notice Corresponding bridge on the other domain.
/// @custom:network-specific /// @custom:network-specific
...@@ -116,7 +116,7 @@ abstract contract StandardBridge is Initializable { ...@@ -116,7 +116,7 @@ abstract contract StandardBridge is Initializable {
/// @param _messenger Contract for CrossDomainMessenger on this network. /// @param _messenger Contract for CrossDomainMessenger on this network.
/// @param _otherBridge Contract for the other StandardBridge contract. /// @param _otherBridge Contract for the other StandardBridge contract.
function __StandardBridge_init( function __StandardBridge_init(
CrossDomainMessenger _messenger, ICrossDomainMessenger _messenger,
StandardBridge _otherBridge StandardBridge _otherBridge
) )
internal internal
...@@ -143,7 +143,7 @@ abstract contract StandardBridge is Initializable { ...@@ -143,7 +143,7 @@ abstract contract StandardBridge is Initializable {
/// Public getter is legacy and will be removed in the future. Use `messenger` instead. /// Public getter is legacy and will be removed in the future. Use `messenger` instead.
/// @return Contract of the messenger on this domain. /// @return Contract of the messenger on this domain.
/// @custom:legacy /// @custom:legacy
function MESSENGER() external view returns (CrossDomainMessenger) { function MESSENGER() external view returns (ICrossDomainMessenger) {
return messenger; return messenger;
} }
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ICrossDomainMessenger {
event FailedRelayedMessage(bytes32 indexed msgHash);
event Initialized(uint8 version);
event RelayedMessage(bytes32 indexed msgHash);
event SentMessage(address indexed target, address sender, bytes message, uint256 messageNonce, uint256 gasLimit);
event SentMessageExtension1(address indexed sender, uint256 value);
function MESSAGE_VERSION() external view returns (uint16);
function MIN_GAS_CALLDATA_OVERHEAD() external view returns (uint64);
function MIN_GAS_DYNAMIC_OVERHEAD_DENOMINATOR() external view returns (uint64);
function MIN_GAS_DYNAMIC_OVERHEAD_NUMERATOR() external view returns (uint64);
function OTHER_MESSENGER() external view returns (ICrossDomainMessenger);
function RELAY_CALL_OVERHEAD() external view returns (uint64);
function RELAY_CONSTANT_OVERHEAD() external view returns (uint64);
function RELAY_GAS_CHECK_BUFFER() external view returns (uint64);
function RELAY_RESERVED_GAS() external view returns (uint64);
function baseGas(bytes memory _message, uint32 _minGasLimit) external pure returns (uint64);
function failedMessages(bytes32) external view returns (bool);
function messageNonce() external view returns (uint256);
function otherMessenger() external view returns (ICrossDomainMessenger);
function paused() external view returns (bool);
function relayMessage(
uint256 _nonce,
address _sender,
address _target,
uint256 _value,
uint256 _minGasLimit,
bytes memory _message
)
external
payable;
function sendMessage(address _target, bytes memory _message, uint32 _minGasLimit) external payable;
function successfulMessages(bytes32) external view returns (bool);
function xDomainMessageSender() external view returns (address);
}
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Testing utilities // Testing
import { Test } from "forge-std/Test.sol"; import { Test } from "forge-std/Test.sol";
import { Vm } from "forge-std/Vm.sol"; import { Vm } from "forge-std/Vm.sol";
import { CommonTest } from "test/setup/CommonTest.sol"; import { CommonTest } from "test/setup/CommonTest.sol";
import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol"; import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol";
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol"; // Libraries
import { Types } from "src/libraries/Types.sol"; import { Types } from "src/libraries/Types.sol";
import { SafeCall } from "src/libraries/SafeCall.sol"; import { SafeCall } from "src/libraries/SafeCall.sol";
import { L1BlockIsthmus } from "src/L2/L1BlockIsthmus.sol"; import { L1BlockIsthmus } from "src/L2/L1BlockIsthmus.sol";
import { Encoding } from "src/libraries/Encoding.sol"; import { Encoding } from "src/libraries/Encoding.sol";
// Interfaces
import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
// Free function for setting the prevBaseFee param in the OptimismPortal. // Free function for setting the prevBaseFee param in the OptimismPortal.
function setPrevBaseFee(Vm _vm, address _op, uint128 _prevBaseFee) { function setPrevBaseFee(Vm _vm, address _op, uint128 _prevBaseFee) {
_vm.store(address(_op), bytes32(uint256(1)), bytes32((block.number << 192) | _prevBaseFee)); _vm.store(address(_op), bytes32(uint256(1)), bytes32((block.number << 192) | _prevBaseFee));
...@@ -182,7 +185,7 @@ contract GasBenchMark_L1StandardBridge_Finalize is Bridge_Initializer { ...@@ -182,7 +185,7 @@ contract GasBenchMark_L1StandardBridge_Finalize is Bridge_Initializer {
deal(address(L1Token), address(l1StandardBridge), 100, true); deal(address(L1Token), address(l1StandardBridge), 100, true);
vm.mockCall( vm.mockCall(
address(l1StandardBridge.messenger()), address(l1StandardBridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l1StandardBridge.OTHER_BRIDGE())) abi.encode(address(l1StandardBridge.OTHER_BRIDGE()))
); );
vm.startPrank(address(l1StandardBridge.messenger())); vm.startPrank(address(l1StandardBridge.messenger()));
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
pragma solidity 0.8.15; pragma solidity 0.8.15;
import { CommonTest } from "test/setup/CommonTest.sol"; import { CommonTest } from "test/setup/CommonTest.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
/// @dev These tests are somewhat redundant with tests in the SuperchainConfig and other pausable contracts, however /// @dev These tests are somewhat redundant with tests in the SuperchainConfig and other pausable contracts, however
/// it is worthwhile to pull them into one location to ensure that the behavior is consistent. /// it is worthwhile to pull them into one location to ensure that the behavior is consistent.
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
pragma solidity 0.8.15; pragma solidity 0.8.15;
import { import {
DataAvailabilityChallenge, IDataAvailabilityChallenge,
ChallengeStatus, ChallengeStatus,
Challenge, Challenge,
CommitmentType, CommitmentType
computeCommitmentKeccak256 } from "src/L1/interfaces/IDataAvailabilityChallenge.sol";
} from "src/L1/DataAvailabilityChallenge.sol"; import { computeCommitmentKeccak256 } from "src/L1/DataAvailabilityChallenge.sol";
import { Proxy } from "src/universal/Proxy.sol"; import { Proxy } from "src/universal/Proxy.sol";
import { CommonTest } from "test/setup/CommonTest.sol"; import { CommonTest } from "test/setup/CommonTest.sol";
...@@ -145,7 +145,9 @@ contract DataAvailabilityChallengeTest is CommonTest { ...@@ -145,7 +145,9 @@ contract DataAvailabilityChallengeTest is CommonTest {
uint256 actualBond = requiredBond - 1; uint256 actualBond = requiredBond - 1;
dataAvailabilityChallenge.deposit{ value: actualBond }(); dataAvailabilityChallenge.deposit{ value: actualBond }();
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.BondTooLow.selector, actualBond, requiredBond)); vm.expectRevert(
abi.encodeWithSelector(IDataAvailabilityChallenge.BondTooLow.selector, actualBond, requiredBond)
);
dataAvailabilityChallenge.challenge(0, computeCommitmentKeccak256("some hash")); dataAvailabilityChallenge.challenge(0, computeCommitmentKeccak256("some hash"));
} }
...@@ -160,7 +162,7 @@ contract DataAvailabilityChallengeTest is CommonTest { ...@@ -160,7 +162,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
// Second challenge of the same hash/blockNumber fails // Second challenge of the same hash/blockNumber fails
dataAvailabilityChallenge.deposit{ value: dataAvailabilityChallenge.bondSize() }(); dataAvailabilityChallenge.deposit{ value: dataAvailabilityChallenge.bondSize() }();
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.ChallengeExists.selector)); vm.expectRevert(abi.encodeWithSelector(IDataAvailabilityChallenge.ChallengeExists.selector));
dataAvailabilityChallenge.challenge(0, challengedCommitment); dataAvailabilityChallenge.challenge(0, challengedCommitment);
// Challenge succeed if the challenged block number is different // Challenge succeed if the challenged block number is different
...@@ -181,7 +183,7 @@ contract DataAvailabilityChallengeTest is CommonTest { ...@@ -181,7 +183,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
// Challenge fails because the current block number must be after the challenged block // Challenge fails because the current block number must be after the challenged block
dataAvailabilityChallenge.deposit{ value: dataAvailabilityChallenge.bondSize() }(); dataAvailabilityChallenge.deposit{ value: dataAvailabilityChallenge.bondSize() }();
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.ChallengeWindowNotOpen.selector)); vm.expectRevert(abi.encodeWithSelector(IDataAvailabilityChallenge.ChallengeWindowNotOpen.selector));
dataAvailabilityChallenge.challenge(challengedBlockNumber, challengedCommitment); dataAvailabilityChallenge.challenge(challengedBlockNumber, challengedCommitment);
} }
...@@ -194,7 +196,7 @@ contract DataAvailabilityChallengeTest is CommonTest { ...@@ -194,7 +196,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
// Challenge fails because the block number is after the challenge window // Challenge fails because the block number is after the challenge window
dataAvailabilityChallenge.deposit{ value: dataAvailabilityChallenge.bondSize() }(); dataAvailabilityChallenge.deposit{ value: dataAvailabilityChallenge.bondSize() }();
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.ChallengeWindowNotOpen.selector)); vm.expectRevert(abi.encodeWithSelector(IDataAvailabilityChallenge.ChallengeWindowNotOpen.selector));
dataAvailabilityChallenge.challenge(challengedBlockNumber, challengedCommitment); dataAvailabilityChallenge.challenge(challengedBlockNumber, challengedCommitment);
} }
...@@ -287,7 +289,7 @@ contract DataAvailabilityChallengeTest is CommonTest { ...@@ -287,7 +289,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
vm.roll(challengedBlockNumber + 1); vm.roll(challengedBlockNumber + 1);
// Resolving a non-existent challenge fails // Resolving a non-existent challenge fails
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.ChallengeNotActive.selector)); vm.expectRevert(abi.encodeWithSelector(IDataAvailabilityChallenge.ChallengeNotActive.selector));
dataAvailabilityChallenge.resolve(challengedBlockNumber, computeCommitmentKeccak256(preImage), preImage); dataAvailabilityChallenge.resolve(challengedBlockNumber, computeCommitmentKeccak256(preImage), preImage);
} }
...@@ -307,7 +309,7 @@ contract DataAvailabilityChallengeTest is CommonTest { ...@@ -307,7 +309,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
dataAvailabilityChallenge.resolve(challengedBlockNumber, challengedCommitment, preImage); dataAvailabilityChallenge.resolve(challengedBlockNumber, challengedCommitment, preImage);
// Resolving an already resolved challenge fails // Resolving an already resolved challenge fails
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.ChallengeNotActive.selector)); vm.expectRevert(abi.encodeWithSelector(IDataAvailabilityChallenge.ChallengeNotActive.selector));
dataAvailabilityChallenge.resolve(challengedBlockNumber, challengedCommitment, preImage); dataAvailabilityChallenge.resolve(challengedBlockNumber, challengedCommitment, preImage);
} }
...@@ -327,7 +329,7 @@ contract DataAvailabilityChallengeTest is CommonTest { ...@@ -327,7 +329,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
vm.roll(block.number + dataAvailabilityChallenge.resolveWindow() + 1); vm.roll(block.number + dataAvailabilityChallenge.resolveWindow() + 1);
// Resolving an expired challenge fails // Resolving an expired challenge fails
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.ChallengeNotActive.selector)); vm.expectRevert(abi.encodeWithSelector(IDataAvailabilityChallenge.ChallengeNotActive.selector));
dataAvailabilityChallenge.resolve(challengedBlockNumber, challengedCommitment, preImage); dataAvailabilityChallenge.resolve(challengedBlockNumber, challengedCommitment, preImage);
} }
...@@ -347,7 +349,7 @@ contract DataAvailabilityChallengeTest is CommonTest { ...@@ -347,7 +349,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
vm.roll(block.number + dataAvailabilityChallenge.resolveWindow() + 1); vm.roll(block.number + dataAvailabilityChallenge.resolveWindow() + 1);
// Resolve the challenge // Resolve the challenge
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.ChallengeNotActive.selector)); vm.expectRevert(abi.encodeWithSelector(IDataAvailabilityChallenge.ChallengeNotActive.selector));
dataAvailabilityChallenge.resolve(challengedBlockNumber, challengedCommitment, preImage); dataAvailabilityChallenge.resolve(challengedBlockNumber, challengedCommitment, preImage);
} }
...@@ -405,7 +407,7 @@ contract DataAvailabilityChallengeTest is CommonTest { ...@@ -405,7 +407,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
vm.roll(challengedBlockNumber + 1); vm.roll(challengedBlockNumber + 1);
// Unlock a bond of a non-existent challenge fails // Unlock a bond of a non-existent challenge fails
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.ChallengeNotExpired.selector)); vm.expectRevert(abi.encodeWithSelector(IDataAvailabilityChallenge.ChallengeNotExpired.selector));
dataAvailabilityChallenge.unlockBond(challengedBlockNumber, challengedCommitment); dataAvailabilityChallenge.unlockBond(challengedBlockNumber, challengedCommitment);
} }
...@@ -425,7 +427,7 @@ contract DataAvailabilityChallengeTest is CommonTest { ...@@ -425,7 +427,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
dataAvailabilityChallenge.resolve(challengedBlockNumber, challengedCommitment, preImage); dataAvailabilityChallenge.resolve(challengedBlockNumber, challengedCommitment, preImage);
// Attempting to unlock a bond of a resolved challenge fails // Attempting to unlock a bond of a resolved challenge fails
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.ChallengeNotExpired.selector)); vm.expectRevert(abi.encodeWithSelector(IDataAvailabilityChallenge.ChallengeNotExpired.selector));
dataAvailabilityChallenge.unlockBond(challengedBlockNumber, challengedCommitment); dataAvailabilityChallenge.unlockBond(challengedBlockNumber, challengedCommitment);
} }
...@@ -469,7 +471,7 @@ contract DataAvailabilityChallengeTest is CommonTest { ...@@ -469,7 +471,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
vm.roll(block.number + dataAvailabilityChallenge.resolveWindow() - 1); vm.roll(block.number + dataAvailabilityChallenge.resolveWindow() - 1);
// Expiring the challenge before the resolve window closes fails // Expiring the challenge before the resolve window closes fails
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.ChallengeNotExpired.selector)); vm.expectRevert(abi.encodeWithSelector(IDataAvailabilityChallenge.ChallengeNotExpired.selector));
dataAvailabilityChallenge.unlockBond(challengedBlockNumber, challengedCommitment); dataAvailabilityChallenge.unlockBond(challengedBlockNumber, challengedCommitment);
} }
...@@ -480,7 +482,9 @@ contract DataAvailabilityChallengeTest is CommonTest { ...@@ -480,7 +482,9 @@ contract DataAvailabilityChallengeTest is CommonTest {
// Expect the challenge to fail because the bond is too low // Expect the challenge to fail because the bond is too low
bytes memory challengedCommitment = computeCommitmentKeccak256("some hash"); bytes memory challengedCommitment = computeCommitmentKeccak256("some hash");
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.BondTooLow.selector, actualBond, requiredBond)); vm.expectRevert(
abi.encodeWithSelector(IDataAvailabilityChallenge.BondTooLow.selector, actualBond, requiredBond)
);
dataAvailabilityChallenge.challenge(0, challengedCommitment); dataAvailabilityChallenge.challenge(0, challengedCommitment);
// Reduce the required bond // Reduce the required bond
...@@ -500,7 +504,9 @@ contract DataAvailabilityChallengeTest is CommonTest { ...@@ -500,7 +504,9 @@ contract DataAvailabilityChallengeTest is CommonTest {
function testSetResolverRefundPercentageFail() public { function testSetResolverRefundPercentageFail() public {
address owner = dataAvailabilityChallenge.owner(); address owner = dataAvailabilityChallenge.owner();
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.InvalidResolverRefundPercentage.selector, 101)); vm.expectRevert(
abi.encodeWithSelector(IDataAvailabilityChallenge.InvalidResolverRefundPercentage.selector, 101)
);
vm.prank(owner); vm.prank(owner);
dataAvailabilityChallenge.setResolverRefundPercentage(101); dataAvailabilityChallenge.setResolverRefundPercentage(101);
} }
...@@ -520,13 +526,13 @@ contract DataAvailabilityChallengeTest is CommonTest { ...@@ -520,13 +526,13 @@ contract DataAvailabilityChallengeTest is CommonTest {
dataAvailabilityChallenge.validateCommitment(validCommitment); dataAvailabilityChallenge.validateCommitment(validCommitment);
// Should revert if the commitment type is unknown // Should revert if the commitment type is unknown
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.UnknownCommitmentType.selector, uint8(1))); vm.expectRevert(abi.encodeWithSelector(IDataAvailabilityChallenge.UnknownCommitmentType.selector, uint8(1)));
bytes memory unknownType = abi.encodePacked(uint8(1), keccak256("test")); bytes memory unknownType = abi.encodePacked(uint8(1), keccak256("test"));
dataAvailabilityChallenge.validateCommitment(unknownType); dataAvailabilityChallenge.validateCommitment(unknownType);
// Should revert if the commitment length does not match // Should revert if the commitment length does not match
vm.expectRevert( vm.expectRevert(
abi.encodeWithSelector(DataAvailabilityChallenge.InvalidCommitmentLength.selector, uint8(0), 33, 34) abi.encodeWithSelector(IDataAvailabilityChallenge.InvalidCommitmentLength.selector, uint8(0), 33, 34)
); );
bytes memory invalidLength = abi.encodePacked(CommitmentType.Keccak256, keccak256("test"), "x"); bytes memory invalidLength = abi.encodePacked(CommitmentType.Keccak256, keccak256("test"), "x");
dataAvailabilityChallenge.validateCommitment(invalidLength); dataAvailabilityChallenge.validateCommitment(invalidLength);
......
...@@ -3,6 +3,7 @@ pragma solidity 0.8.15; ...@@ -3,6 +3,7 @@ pragma solidity 0.8.15;
import { Test } from "forge-std/Test.sol"; import { Test } from "forge-std/Test.sol";
import { DelayedVetoable } from "src/L1/DelayedVetoable.sol"; import { DelayedVetoable } from "src/L1/DelayedVetoable.sol";
import { IDelayedVetoable } from "src/L1/interfaces/IDelayedVetoable.sol";
contract DelayedVetoable_Init is Test { contract DelayedVetoable_Init is Test {
error Unauthorized(address expected, address actual); error Unauthorized(address expected, address actual);
...@@ -16,7 +17,7 @@ contract DelayedVetoable_Init is Test { ...@@ -16,7 +17,7 @@ contract DelayedVetoable_Init is Test {
address initiator; address initiator;
address vetoer; address vetoer;
uint256 operatingDelay = 14 days; uint256 operatingDelay = 14 days;
DelayedVetoable delayedVetoable; IDelayedVetoable delayedVetoable;
function setUp() public { function setUp() public {
initiator = makeAddr("initiator"); initiator = makeAddr("initiator");
...@@ -25,12 +26,16 @@ contract DelayedVetoable_Init is Test { ...@@ -25,12 +26,16 @@ contract DelayedVetoable_Init is Test {
vm.deal(initiator, 10000 ether); vm.deal(initiator, 10000 ether);
vm.deal(vetoer, 10000 ether); vm.deal(vetoer, 10000 ether);
delayedVetoable = new DelayedVetoable({ delayedVetoable = IDelayedVetoable(
initiator_: initiator, address(
vetoer_: vetoer, new DelayedVetoable({
target_: address(target), initiator_: initiator,
operatingDelay_: operatingDelay vetoer_: vetoer,
}); target_: address(target),
operatingDelay_: operatingDelay
})
)
);
// Most tests will use the operating delay, so we call as the initiator with null data // Most tests will use the operating delay, so we call as the initiator with null data
// to set the delay. For tests that need to use the initial zero delay, we'll modify the // to set the delay. For tests that need to use the initial zero delay, we'll modify the
......
...@@ -13,10 +13,10 @@ import { Encoding } from "src/libraries/Encoding.sol"; ...@@ -13,10 +13,10 @@ import { Encoding } from "src/libraries/Encoding.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
// Target contract dependencies // Target contract dependencies
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol"; import { IL1CrossDomainMessenger } from "src/L1/interfaces/IL1CrossDomainMessenger.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol"; import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol"; import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol"; import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
contract L1CrossDomainMessenger_Test is Bridge_Initializer { contract L1CrossDomainMessenger_Test is Bridge_Initializer {
/// @dev The receiver address /// @dev The receiver address
...@@ -29,7 +29,7 @@ contract L1CrossDomainMessenger_Test is Bridge_Initializer { ...@@ -29,7 +29,7 @@ contract L1CrossDomainMessenger_Test is Bridge_Initializer {
/// @notice Marked virtual to be overridden in /// @notice Marked virtual to be overridden in
/// test/kontrol/deployment/DeploymentSummary.t.sol /// test/kontrol/deployment/DeploymentSummary.t.sol
function test_constructor_succeeds() external virtual { function test_constructor_succeeds() external virtual {
L1CrossDomainMessenger impl = L1CrossDomainMessenger(deploy.mustGetAddress("L1CrossDomainMessenger")); IL1CrossDomainMessenger impl = IL1CrossDomainMessenger(deploy.mustGetAddress("L1CrossDomainMessenger"));
assertEq(address(impl.superchainConfig()), address(0)); assertEq(address(impl.superchainConfig()), address(0));
assertEq(address(impl.PORTAL()), address(0)); assertEq(address(impl.PORTAL()), address(0));
assertEq(address(impl.portal()), address(0)); assertEq(address(impl.portal()), address(0));
...@@ -60,7 +60,7 @@ contract L1CrossDomainMessenger_Test is Bridge_Initializer { ...@@ -60,7 +60,7 @@ contract L1CrossDomainMessenger_Test is Bridge_Initializer {
vm.expectCall( vm.expectCall(
address(optimismPortal), address(optimismPortal),
abi.encodeWithSelector( abi.encodeWithSelector(
OptimismPortal.depositTransaction.selector, IOptimismPortal.depositTransaction.selector,
Predeploys.L2_CROSS_DOMAIN_MESSENGER, Predeploys.L2_CROSS_DOMAIN_MESSENGER,
0, 0,
l1CrossDomainMessenger.baseGas(hex"ff", 100), l1CrossDomainMessenger.baseGas(hex"ff", 100),
...@@ -605,7 +605,7 @@ contract L1CrossDomainMessenger_Test is Bridge_Initializer { ...@@ -605,7 +605,7 @@ contract L1CrossDomainMessenger_Test is Bridge_Initializer {
/// @dev Tests that the superchain config is called by the messengers paused function /// @dev Tests that the superchain config is called by the messengers paused function
function test_pause_callsSuperchainConfig_succeeds() external { function test_pause_callsSuperchainConfig_succeeds() external {
vm.expectCall(address(superchainConfig), abi.encodeWithSelector(SuperchainConfig.paused.selector)); vm.expectCall(address(superchainConfig), abi.encodeWithSelector(ISuperchainConfig.paused.selector));
l1CrossDomainMessenger.paused(); l1CrossDomainMessenger.paused();
} }
...@@ -632,7 +632,7 @@ contract L1CrossDomainMessenger_Test is Bridge_Initializer { ...@@ -632,7 +632,7 @@ contract L1CrossDomainMessenger_Test is Bridge_Initializer {
vm.expectCall( vm.expectCall(
address(optimismPortal), address(optimismPortal),
abi.encodeWithSelector( abi.encodeWithSelector(
OptimismPortal.depositTransaction.selector, IOptimismPortal.depositTransaction.selector,
Predeploys.L2_CROSS_DOMAIN_MESSENGER, Predeploys.L2_CROSS_DOMAIN_MESSENGER,
0, 0,
l1CrossDomainMessenger.baseGas(hex"ff", 100), l1CrossDomainMessenger.baseGas(hex"ff", 100),
...@@ -770,7 +770,7 @@ contract L1CrossDomainMessenger_ReinitReentryTest is Bridge_Initializer { ...@@ -770,7 +770,7 @@ contract L1CrossDomainMessenger_ReinitReentryTest is Bridge_Initializer {
// call the initializer function // call the initializer function
l1CrossDomainMessenger.initialize( l1CrossDomainMessenger.initialize(
SuperchainConfig(superchainConfig), OptimismPortal(optimismPortal), SystemConfig(systemConfig) ISuperchainConfig(superchainConfig), IOptimismPortal(optimismPortal), ISystemConfig(systemConfig)
); );
// attempt to re-replay the withdrawal // attempt to re-replay the withdrawal
......
...@@ -8,8 +8,8 @@ import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; ...@@ -8,8 +8,8 @@ import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
// Target contract dependencies // Target contract dependencies
import { L2ERC721Bridge } from "src/L2/L2ERC721Bridge.sol"; import { L2ERC721Bridge } from "src/L2/L2ERC721Bridge.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol"; import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol"; import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
// Target contract // Target contract
import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol"; import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol";
...@@ -323,7 +323,7 @@ contract L1ERC721Bridge_Pause_Test is Bridge_Initializer { ...@@ -323,7 +323,7 @@ contract L1ERC721Bridge_Pause_Test is Bridge_Initializer {
/// @dev Ensures that the `paused` function of the bridge contract actually calls the `paused` function of the /// @dev Ensures that the `paused` function of the bridge contract actually calls the `paused` function of the
/// `superchainConfig`. /// `superchainConfig`.
function test_pause_callsSuperchainConfig_succeeds() external { function test_pause_callsSuperchainConfig_succeeds() external {
vm.expectCall(address(superchainConfig), abi.encodeWithSelector(SuperchainConfig.paused.selector)); vm.expectCall(address(superchainConfig), abi.encodeWithSelector(ISuperchainConfig.paused.selector));
l1ERC721Bridge.paused(); l1ERC721Bridge.paused();
} }
...@@ -352,7 +352,7 @@ contract L1ERC721Bridge_Pause_TestFail is Bridge_Initializer { ...@@ -352,7 +352,7 @@ contract L1ERC721Bridge_Pause_TestFail is Bridge_Initializer {
vm.mockCall( vm.mockCall(
address(l1ERC721Bridge.messenger()), address(l1ERC721Bridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l1ERC721Bridge.otherBridge())) abi.encode(address(l1ERC721Bridge.otherBridge()))
); );
} }
......
...@@ -14,20 +14,20 @@ import { Constants } from "src/libraries/Constants.sol"; ...@@ -14,20 +14,20 @@ import { Constants } from "src/libraries/Constants.sol";
import { StandardBridge } from "src/universal/StandardBridge.sol"; import { StandardBridge } from "src/universal/StandardBridge.sol";
import { L1StandardBridge } from "src/L1/L1StandardBridge.sol"; import { L1StandardBridge } from "src/L1/L1StandardBridge.sol";
import { L2StandardBridge } from "src/L2/L2StandardBridge.sol"; import { L2StandardBridge } from "src/L2/L2StandardBridge.sol";
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol"; import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol"; import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol"; import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
// Target contract // Target contract
import { OptimismPortal } from "src/L1/OptimismPortal.sol"; import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
contract L1StandardBridge_Getter_Test is Bridge_Initializer { contract L1StandardBridge_Getter_Test is Bridge_Initializer {
/// @dev Test that the accessors return the correct initialized values. /// @dev Test that the accessors return the correct initialized values.
function test_getters_succeeds() external view { function test_getters_succeeds() external view {
assert(l1StandardBridge.l2TokenBridge() == address(l2StandardBridge)); assert(l1StandardBridge.l2TokenBridge() == address(l2StandardBridge));
assert(l1StandardBridge.OTHER_BRIDGE() == l2StandardBridge); assert(l1StandardBridge.OTHER_BRIDGE() == l2StandardBridge);
assert(l1StandardBridge.messenger() == l1CrossDomainMessenger); assert(address(l1StandardBridge.messenger()) == address(l1CrossDomainMessenger));
assert(l1StandardBridge.MESSENGER() == l1CrossDomainMessenger); assert(address(l1StandardBridge.MESSENGER()) == address(l1CrossDomainMessenger));
assert(l1StandardBridge.superchainConfig() == superchainConfig); assert(l1StandardBridge.superchainConfig() == superchainConfig);
assert(l1StandardBridge.systemConfig() == systemConfig); assert(l1StandardBridge.systemConfig() == systemConfig);
} }
...@@ -70,7 +70,7 @@ contract L1StandardBridge_Pause_Test is Bridge_Initializer { ...@@ -70,7 +70,7 @@ contract L1StandardBridge_Pause_Test is Bridge_Initializer {
/// @dev Ensures that the `paused` function of the bridge contract actually calls the `paused` function of the /// @dev Ensures that the `paused` function of the bridge contract actually calls the `paused` function of the
/// `superchainConfig`. /// `superchainConfig`.
function test_pause_callsSuperchainConfig_succeeds() external { function test_pause_callsSuperchainConfig_succeeds() external {
vm.expectCall(address(superchainConfig), abi.encodeWithSelector(SuperchainConfig.paused.selector)); vm.expectCall(address(superchainConfig), abi.encodeWithSelector(ISuperchainConfig.paused.selector));
l1StandardBridge.paused(); l1StandardBridge.paused();
} }
...@@ -101,7 +101,7 @@ contract L1StandardBridge_Pause_TestFail is Bridge_Initializer { ...@@ -101,7 +101,7 @@ contract L1StandardBridge_Pause_TestFail is Bridge_Initializer {
vm.mockCall( vm.mockCall(
address(l1StandardBridge.messenger()), address(l1StandardBridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l1StandardBridge.otherBridge())) abi.encode(address(l1StandardBridge.otherBridge()))
); );
} }
...@@ -176,7 +176,7 @@ contract L1StandardBridge_Receive_Test is Bridge_Initializer { ...@@ -176,7 +176,7 @@ contract L1StandardBridge_Receive_Test is Bridge_Initializer {
vm.expectCall( vm.expectCall(
address(l1CrossDomainMessenger), address(l1CrossDomainMessenger),
abi.encodeWithSelector( abi.encodeWithSelector(
CrossDomainMessenger.sendMessage.selector, ICrossDomainMessenger.sendMessage.selector,
address(l2StandardBridge), address(l2StandardBridge),
abi.encodeWithSelector(StandardBridge.finalizeBridgeETH.selector, alice, alice, 100, hex""), abi.encodeWithSelector(StandardBridge.finalizeBridgeETH.selector, alice, alice, 100, hex""),
200_000 200_000
...@@ -235,11 +235,13 @@ contract PreBridgeETH is Bridge_Initializer { ...@@ -235,11 +235,13 @@ contract PreBridgeETH is Bridge_Initializer {
vm.expectCall( vm.expectCall(
address(l1CrossDomainMessenger), address(l1CrossDomainMessenger),
value, value,
abi.encodeWithSelector(CrossDomainMessenger.sendMessage.selector, address(l2StandardBridge), message, 50000) abi.encodeWithSelector(
ICrossDomainMessenger.sendMessage.selector, address(l2StandardBridge), message, 50000
)
); );
bytes memory innerMessage = abi.encodeWithSelector( bytes memory innerMessage = abi.encodeWithSelector(
CrossDomainMessenger.relayMessage.selector, ICrossDomainMessenger.relayMessage.selector,
nonce, nonce,
address(l1StandardBridge), address(l1StandardBridge),
address(l2StandardBridge), address(l2StandardBridge),
...@@ -253,7 +255,7 @@ contract PreBridgeETH is Bridge_Initializer { ...@@ -253,7 +255,7 @@ contract PreBridgeETH is Bridge_Initializer {
address(optimismPortal), address(optimismPortal),
value, value,
abi.encodeWithSelector( abi.encodeWithSelector(
OptimismPortal.depositTransaction.selector, IOptimismPortal.depositTransaction.selector,
address(l2CrossDomainMessenger), address(l2CrossDomainMessenger),
value, value,
baseGas, baseGas,
...@@ -375,11 +377,13 @@ contract PreBridgeETHTo is Bridge_Initializer { ...@@ -375,11 +377,13 @@ contract PreBridgeETHTo is Bridge_Initializer {
// L1CrossDomainMessenger.sendMessage // L1CrossDomainMessenger.sendMessage
vm.expectCall( vm.expectCall(
address(l1CrossDomainMessenger), address(l1CrossDomainMessenger),
abi.encodeWithSelector(CrossDomainMessenger.sendMessage.selector, address(l2StandardBridge), message, 60000) abi.encodeWithSelector(
ICrossDomainMessenger.sendMessage.selector, address(l2StandardBridge), message, 60000
)
); );
bytes memory innerMessage = abi.encodeWithSelector( bytes memory innerMessage = abi.encodeWithSelector(
CrossDomainMessenger.relayMessage.selector, ICrossDomainMessenger.relayMessage.selector,
nonce, nonce,
address(l1StandardBridge), address(l1StandardBridge),
address(l2StandardBridge), address(l2StandardBridge),
...@@ -392,7 +396,7 @@ contract PreBridgeETHTo is Bridge_Initializer { ...@@ -392,7 +396,7 @@ contract PreBridgeETHTo is Bridge_Initializer {
vm.expectCall( vm.expectCall(
address(optimismPortal), address(optimismPortal),
abi.encodeWithSelector( abi.encodeWithSelector(
OptimismPortal.depositTransaction.selector, IOptimismPortal.depositTransaction.selector,
address(l2CrossDomainMessenger), address(l2CrossDomainMessenger),
value, value,
baseGas, baseGas,
...@@ -527,11 +531,13 @@ contract L1StandardBridge_DepositERC20_Test is Bridge_Initializer { ...@@ -527,11 +531,13 @@ contract L1StandardBridge_DepositERC20_Test is Bridge_Initializer {
// the L1 bridge should call L1CrossDomainMessenger.sendMessage // the L1 bridge should call L1CrossDomainMessenger.sendMessage
vm.expectCall( vm.expectCall(
address(l1CrossDomainMessenger), address(l1CrossDomainMessenger),
abi.encodeWithSelector(CrossDomainMessenger.sendMessage.selector, address(l2StandardBridge), message, 10000) abi.encodeWithSelector(
ICrossDomainMessenger.sendMessage.selector, address(l2StandardBridge), message, 10000
)
); );
bytes memory innerMessage = abi.encodeWithSelector( bytes memory innerMessage = abi.encodeWithSelector(
CrossDomainMessenger.relayMessage.selector, ICrossDomainMessenger.relayMessage.selector,
nonce, nonce,
address(l1StandardBridge), address(l1StandardBridge),
address(l2StandardBridge), address(l2StandardBridge),
...@@ -544,7 +550,7 @@ contract L1StandardBridge_DepositERC20_Test is Bridge_Initializer { ...@@ -544,7 +550,7 @@ contract L1StandardBridge_DepositERC20_Test is Bridge_Initializer {
vm.expectCall( vm.expectCall(
address(optimismPortal), address(optimismPortal),
abi.encodeWithSelector( abi.encodeWithSelector(
OptimismPortal.depositTransaction.selector, IOptimismPortal.depositTransaction.selector,
address(l2CrossDomainMessenger), address(l2CrossDomainMessenger),
0, 0,
baseGas, baseGas,
...@@ -610,7 +616,7 @@ contract L1StandardBridge_DepositERC20To_Test is Bridge_Initializer { ...@@ -610,7 +616,7 @@ contract L1StandardBridge_DepositERC20To_Test is Bridge_Initializer {
); );
bytes memory innerMessage = abi.encodeWithSelector( bytes memory innerMessage = abi.encodeWithSelector(
CrossDomainMessenger.relayMessage.selector, ICrossDomainMessenger.relayMessage.selector,
nonce, nonce,
address(l1StandardBridge), address(l1StandardBridge),
address(l2StandardBridge), address(l2StandardBridge),
...@@ -649,13 +655,15 @@ contract L1StandardBridge_DepositERC20To_Test is Bridge_Initializer { ...@@ -649,13 +655,15 @@ contract L1StandardBridge_DepositERC20To_Test is Bridge_Initializer {
// the L1 bridge should call L1CrossDomainMessenger.sendMessage // the L1 bridge should call L1CrossDomainMessenger.sendMessage
vm.expectCall( vm.expectCall(
address(l1CrossDomainMessenger), address(l1CrossDomainMessenger),
abi.encodeWithSelector(CrossDomainMessenger.sendMessage.selector, address(l2StandardBridge), message, 10000) abi.encodeWithSelector(
ICrossDomainMessenger.sendMessage.selector, address(l2StandardBridge), message, 10000
)
); );
// The L1 XDM should call OptimismPortal.depositTransaction // The L1 XDM should call OptimismPortal.depositTransaction
vm.expectCall( vm.expectCall(
address(optimismPortal), address(optimismPortal),
abi.encodeWithSelector( abi.encodeWithSelector(
OptimismPortal.depositTransaction.selector, IOptimismPortal.depositTransaction.selector,
address(l2CrossDomainMessenger), address(l2CrossDomainMessenger),
0, 0,
baseGas, baseGas,
...@@ -694,7 +702,7 @@ contract L1StandardBridge_FinalizeETHWithdrawal_Test is Bridge_Initializer { ...@@ -694,7 +702,7 @@ contract L1StandardBridge_FinalizeETHWithdrawal_Test is Bridge_Initializer {
vm.mockCall( vm.mockCall(
address(l1StandardBridge.messenger()), address(l1StandardBridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l1StandardBridge.OTHER_BRIDGE())) abi.encode(address(l1StandardBridge.OTHER_BRIDGE()))
); );
// ensure that the messenger has ETH to call with // ensure that the messenger has ETH to call with
...@@ -720,7 +728,7 @@ contract L1StandardBridge_FinalizeETHWithdrawal_TestFail is Bridge_Initializer { ...@@ -720,7 +728,7 @@ contract L1StandardBridge_FinalizeETHWithdrawal_TestFail is Bridge_Initializer {
); );
vm.mockCall( vm.mockCall(
address(l1StandardBridge.messenger()), address(l1StandardBridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l1StandardBridge.OTHER_BRIDGE())) abi.encode(address(l1StandardBridge.OTHER_BRIDGE()))
); );
vm.deal(address(l1StandardBridge.messenger()), _value); vm.deal(address(l1StandardBridge.messenger()), _value);
...@@ -759,7 +767,7 @@ contract L1StandardBridge_FinalizeERC20Withdrawal_Test is Bridge_Initializer { ...@@ -759,7 +767,7 @@ contract L1StandardBridge_FinalizeERC20Withdrawal_Test is Bridge_Initializer {
vm.mockCall( vm.mockCall(
address(l1StandardBridge.messenger()), address(l1StandardBridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l1StandardBridge.OTHER_BRIDGE())) abi.encode(address(l1StandardBridge.OTHER_BRIDGE()))
); );
vm.prank(address(l1StandardBridge.messenger())); vm.prank(address(l1StandardBridge.messenger()));
...@@ -775,7 +783,7 @@ contract L1StandardBridge_FinalizeERC20Withdrawal_TestFail is Bridge_Initializer ...@@ -775,7 +783,7 @@ contract L1StandardBridge_FinalizeERC20Withdrawal_TestFail is Bridge_Initializer
function test_finalizeERC20Withdrawal_notMessenger_reverts() external { function test_finalizeERC20Withdrawal_notMessenger_reverts() external {
vm.mockCall( vm.mockCall(
address(l1StandardBridge.messenger()), address(l1StandardBridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l1StandardBridge.OTHER_BRIDGE())) abi.encode(address(l1StandardBridge.OTHER_BRIDGE()))
); );
vm.prank(address(28)); vm.prank(address(28));
...@@ -787,7 +795,7 @@ contract L1StandardBridge_FinalizeERC20Withdrawal_TestFail is Bridge_Initializer ...@@ -787,7 +795,7 @@ contract L1StandardBridge_FinalizeERC20Withdrawal_TestFail is Bridge_Initializer
function test_finalizeERC20Withdrawal_notOtherBridge_reverts() external { function test_finalizeERC20Withdrawal_notOtherBridge_reverts() external {
vm.mockCall( vm.mockCall(
address(l1StandardBridge.messenger()), address(l1StandardBridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(address(0))) abi.encode(address(address(0)))
); );
vm.prank(address(l1StandardBridge.messenger())); vm.prank(address(l1StandardBridge.messenger()));
...@@ -802,7 +810,7 @@ contract L1StandardBridge_FinalizeBridgeETH_Test is Bridge_Initializer { ...@@ -802,7 +810,7 @@ contract L1StandardBridge_FinalizeBridgeETH_Test is Bridge_Initializer {
address messenger = address(l1StandardBridge.messenger()); address messenger = address(l1StandardBridge.messenger());
vm.mockCall( vm.mockCall(
messenger, messenger,
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l1StandardBridge.OTHER_BRIDGE())) abi.encode(address(l1StandardBridge.OTHER_BRIDGE()))
); );
vm.deal(messenger, 100); vm.deal(messenger, 100);
...@@ -820,7 +828,7 @@ contract L1StandardBridge_FinalizeBridgeETH_TestFail is Bridge_Initializer { ...@@ -820,7 +828,7 @@ contract L1StandardBridge_FinalizeBridgeETH_TestFail is Bridge_Initializer {
function testFuzz_finalizeBridgeETH_customGasToken_reverts(uint256 _value, bytes calldata _extraData) external { function testFuzz_finalizeBridgeETH_customGasToken_reverts(uint256 _value, bytes calldata _extraData) external {
vm.mockCall( vm.mockCall(
address(l1StandardBridge.messenger()), address(l1StandardBridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l1StandardBridge.OTHER_BRIDGE())) abi.encode(address(l1StandardBridge.OTHER_BRIDGE()))
); );
vm.deal(address(l1CrossDomainMessenger), _value); vm.deal(address(l1CrossDomainMessenger), _value);
...@@ -838,7 +846,7 @@ contract L1StandardBridge_FinalizeBridgeETH_TestFail is Bridge_Initializer { ...@@ -838,7 +846,7 @@ contract L1StandardBridge_FinalizeBridgeETH_TestFail is Bridge_Initializer {
address messenger = address(l1StandardBridge.messenger()); address messenger = address(l1StandardBridge.messenger());
vm.mockCall( vm.mockCall(
messenger, messenger,
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l1StandardBridge.OTHER_BRIDGE())) abi.encode(address(l1StandardBridge.OTHER_BRIDGE()))
); );
vm.deal(messenger, 100); vm.deal(messenger, 100);
...@@ -852,7 +860,7 @@ contract L1StandardBridge_FinalizeBridgeETH_TestFail is Bridge_Initializer { ...@@ -852,7 +860,7 @@ contract L1StandardBridge_FinalizeBridgeETH_TestFail is Bridge_Initializer {
address messenger = address(l1StandardBridge.messenger()); address messenger = address(l1StandardBridge.messenger());
vm.mockCall( vm.mockCall(
messenger, messenger,
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l1StandardBridge.OTHER_BRIDGE())) abi.encode(address(l1StandardBridge.OTHER_BRIDGE()))
); );
vm.deal(messenger, 100); vm.deal(messenger, 100);
...@@ -866,7 +874,7 @@ contract L1StandardBridge_FinalizeBridgeETH_TestFail is Bridge_Initializer { ...@@ -866,7 +874,7 @@ contract L1StandardBridge_FinalizeBridgeETH_TestFail is Bridge_Initializer {
address messenger = address(l1StandardBridge.messenger()); address messenger = address(l1StandardBridge.messenger());
vm.mockCall( vm.mockCall(
messenger, messenger,
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l1StandardBridge.OTHER_BRIDGE())) abi.encode(address(l1StandardBridge.OTHER_BRIDGE()))
); );
vm.deal(messenger, 100); vm.deal(messenger, 100);
......
...@@ -16,14 +16,13 @@ import { Constants } from "src/libraries/Constants.sol"; ...@@ -16,14 +16,13 @@ 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";
import { ResourceMetering } from "src/L1/ResourceMetering.sol"; import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol"; import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import { IL2OutputOracle } from "src/L1/interfaces/IL2OutputOracle.sol"; import { IL2OutputOracle } from "src/L1/interfaces/IL2OutputOracle.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol"; import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { L1Block } from "src/L2/L1Block.sol"; import { L1Block } from "src/L2/L1Block.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol"; import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
import { GasPayingToken } from "src/libraries/GasPayingToken.sol"; import { GasPayingToken } from "src/libraries/GasPayingToken.sol";
import { MockERC20 } from "solmate/test/utils/mocks/MockERC20.sol"; import { MockERC20 } from "solmate/test/utils/mocks/MockERC20.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol"; import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
...@@ -43,7 +42,7 @@ contract OptimismPortal_Test is CommonTest { ...@@ -43,7 +42,7 @@ contract OptimismPortal_Test is CommonTest {
/// @notice Marked virtual to be overridden in /// @notice Marked virtual to be overridden in
/// test/kontrol/deployment/DeploymentSummary.t.sol /// test/kontrol/deployment/DeploymentSummary.t.sol
function test_constructor_succeeds() external virtual { function test_constructor_succeeds() external virtual {
OptimismPortal opImpl = OptimismPortal(payable(deploy.mustGetAddress("OptimismPortal"))); IOptimismPortal opImpl = IOptimismPortal(payable(deploy.mustGetAddress("OptimismPortal")));
assertEq(address(opImpl.l2Oracle()), address(0)); assertEq(address(opImpl.l2Oracle()), address(0));
assertEq(address(opImpl.systemConfig()), address(0)); assertEq(address(opImpl.systemConfig()), address(0));
assertEq(address(opImpl.superchainConfig()), address(0)); assertEq(address(opImpl.superchainConfig()), address(0));
...@@ -170,7 +169,7 @@ contract OptimismPortal_Test is CommonTest { ...@@ -170,7 +169,7 @@ contract OptimismPortal_Test is CommonTest {
_to = address(0); _to = address(0);
} }
vm.assume(_data.length <= 120_000); vm.assume(_data.length <= 120_000);
ResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig(); IResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig();
_gasLimit = _gasLimit =
uint64(bound(_gasLimit, optimismPortal.minimumGasLimit(uint64(_data.length)), rcfg.maxResourceLimit)); uint64(bound(_gasLimit, optimismPortal.minimumGasLimit(uint64(_data.length)), rcfg.maxResourceLimit));
...@@ -1156,7 +1155,7 @@ contract OptimismPortalUpgradeable_Test is CommonTest { ...@@ -1156,7 +1155,7 @@ contract OptimismPortalUpgradeable_Test is CommonTest {
/// @dev Tests that the proxy is initialized correctly. /// @dev Tests that the proxy is initialized correctly.
function test_params_initValuesOnProxy_succeeds() external view { function test_params_initValuesOnProxy_succeeds() external view {
(uint128 prevBaseFee, uint64 prevBoughtGas, uint64 prevBlockNum) = optimismPortal.params(); (uint128 prevBaseFee, uint64 prevBoughtGas, uint64 prevBlockNum) = optimismPortal.params();
ResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig(); IResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig();
assertEq(prevBaseFee, rcfg.minimumBaseFee); assertEq(prevBaseFee, rcfg.minimumBaseFee);
assertEq(prevBoughtGas, 0); assertEq(prevBoughtGas, 0);
...@@ -1240,7 +1239,7 @@ contract OptimismPortalResourceFuzz_Test is CommonTest { ...@@ -1240,7 +1239,7 @@ contract OptimismPortalResourceFuzz_Test is CommonTest {
vm.roll(uint256(keccak256(abi.encode(_blockDiff))) % uint256(type(uint16).max) + uint256(_blockDiff)); vm.roll(uint256(keccak256(abi.encode(_blockDiff))) % uint256(type(uint16).max) + uint256(_blockDiff));
// Create a resource config to mock the call to the system config with // Create a resource config to mock the call to the system config with
ResourceMetering.ResourceConfig memory rcfg = ResourceMetering.ResourceConfig({ IResourceMetering.ResourceConfig memory rcfg = IResourceMetering.ResourceConfig({
maxResourceLimit: _maxResourceLimit, maxResourceLimit: _maxResourceLimit,
elasticityMultiplier: _elasticityMultiplier, elasticityMultiplier: _elasticityMultiplier,
baseFeeMaxChangeDenominator: _baseFeeMaxChangeDenominator, baseFeeMaxChangeDenominator: _baseFeeMaxChangeDenominator,
...@@ -1299,7 +1298,7 @@ contract OptimismPortalWithMockERC20_Test is OptimismPortal_FinalizeWithdrawal_T ...@@ -1299,7 +1298,7 @@ contract OptimismPortalWithMockERC20_Test is OptimismPortal_FinalizeWithdrawal_T
_to = address(0); _to = address(0);
} }
vm.assume(_data.length <= 120_000); vm.assume(_data.length <= 120_000);
ResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig(); IResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig();
_gasLimit = _gasLimit =
uint64(bound(_gasLimit, optimismPortal.minimumGasLimit(uint64(_data.length)), rcfg.maxResourceLimit)); uint64(bound(_gasLimit, optimismPortal.minimumGasLimit(uint64(_data.length)), rcfg.maxResourceLimit));
...@@ -1514,7 +1513,7 @@ contract OptimismPortalWithMockERC20_Test is OptimismPortal_FinalizeWithdrawal_T ...@@ -1514,7 +1513,7 @@ contract OptimismPortalWithMockERC20_Test is OptimismPortal_FinalizeWithdrawal_T
_to = address(0); _to = address(0);
} }
vm.assume(_data.length <= 120_000); vm.assume(_data.length <= 120_000);
ResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig(); IResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig();
_gasLimit = _gasLimit =
uint64(bound(_gasLimit, optimismPortal.minimumGasLimit(uint64(_data.length)), rcfg.maxResourceLimit)); uint64(bound(_gasLimit, optimismPortal.minimumGasLimit(uint64(_data.length)), rcfg.maxResourceLimit));
......
...@@ -17,12 +17,11 @@ import { Predeploys } from "src/libraries/Predeploys.sol"; ...@@ -17,12 +17,11 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
// Target contract dependencies // Target contract dependencies
import { Proxy } from "src/universal/Proxy.sol"; import { Proxy } from "src/universal/Proxy.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol"; import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol"; import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { L1Block } from "src/L2/L1Block.sol"; import { L1Block } from "src/L2/L1Block.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol"; import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol"; import { IOptimismPortal2 } from "src/L1/interfaces/IOptimismPortal2.sol";
import { GasPayingToken } from "src/libraries/GasPayingToken.sol"; import { GasPayingToken } from "src/libraries/GasPayingToken.sol";
import { MockERC20 } from "solmate/test/utils/mocks/MockERC20.sol"; import { MockERC20 } from "solmate/test/utils/mocks/MockERC20.sol";
...@@ -50,7 +49,7 @@ contract OptimismPortal2_Test is CommonTest { ...@@ -50,7 +49,7 @@ contract OptimismPortal2_Test is CommonTest {
/// @notice Marked virtual to be overridden in /// @notice Marked virtual to be overridden in
/// test/kontrol/deployment/DeploymentSummary.t.sol /// test/kontrol/deployment/DeploymentSummary.t.sol
function test_constructor_succeeds() external virtual { function test_constructor_succeeds() external virtual {
OptimismPortal2 opImpl = OptimismPortal2(payable(deploy.mustGetAddress("OptimismPortal2"))); IOptimismPortal2 opImpl = IOptimismPortal2(payable(deploy.mustGetAddress("OptimismPortal2")));
assertEq(address(opImpl.disputeGameFactory()), address(0)); assertEq(address(opImpl.disputeGameFactory()), address(0));
assertEq(address(opImpl.systemConfig()), address(0)); assertEq(address(opImpl.systemConfig()), address(0));
assertEq(address(opImpl.superchainConfig()), address(0)); assertEq(address(opImpl.superchainConfig()), address(0));
...@@ -1404,7 +1403,7 @@ contract OptimismPortal2_Upgradeable_Test is CommonTest { ...@@ -1404,7 +1403,7 @@ contract OptimismPortal2_Upgradeable_Test is CommonTest {
/// @dev Tests that the proxy is initialized correctly. /// @dev Tests that the proxy is initialized correctly.
function test_params_initValuesOnProxy_succeeds() external view { function test_params_initValuesOnProxy_succeeds() external view {
(uint128 prevBaseFee, uint64 prevBoughtGas, uint64 prevBlockNum) = optimismPortal2.params(); (uint128 prevBaseFee, uint64 prevBoughtGas, uint64 prevBlockNum) = optimismPortal2.params();
ResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig(); IResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig();
assertEq(prevBaseFee, rcfg.minimumBaseFee); assertEq(prevBaseFee, rcfg.minimumBaseFee);
assertEq(prevBoughtGas, 0); assertEq(prevBoughtGas, 0);
...@@ -1494,7 +1493,7 @@ contract OptimismPortal2_ResourceFuzz_Test is CommonTest { ...@@ -1494,7 +1493,7 @@ contract OptimismPortal2_ResourceFuzz_Test is CommonTest {
vm.roll(uint256(keccak256(abi.encode(_blockDiff))) % uint256(type(uint16).max) + uint256(_blockDiff)); vm.roll(uint256(keccak256(abi.encode(_blockDiff))) % uint256(type(uint16).max) + uint256(_blockDiff));
// Create a resource config to mock the call to the system config with // Create a resource config to mock the call to the system config with
ResourceMetering.ResourceConfig memory rcfg = ResourceMetering.ResourceConfig({ IResourceMetering.ResourceConfig memory rcfg = IResourceMetering.ResourceConfig({
maxResourceLimit: _maxResourceLimit, maxResourceLimit: _maxResourceLimit,
elasticityMultiplier: _elasticityMultiplier, elasticityMultiplier: _elasticityMultiplier,
baseFeeMaxChangeDenominator: _baseFeeMaxChangeDenominator, baseFeeMaxChangeDenominator: _baseFeeMaxChangeDenominator,
...@@ -1553,7 +1552,7 @@ contract OptimismPortal2WithMockERC20_Test is OptimismPortal2_FinalizeWithdrawal ...@@ -1553,7 +1552,7 @@ contract OptimismPortal2WithMockERC20_Test is OptimismPortal2_FinalizeWithdrawal
_to = address(0); _to = address(0);
} }
vm.assume(_data.length <= 120_000); vm.assume(_data.length <= 120_000);
ResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig(); IResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig();
_gasLimit = _gasLimit =
uint64(bound(_gasLimit, optimismPortal2.minimumGasLimit(uint64(_data.length)), rcfg.maxResourceLimit)); uint64(bound(_gasLimit, optimismPortal2.minimumGasLimit(uint64(_data.length)), rcfg.maxResourceLimit));
...@@ -1777,7 +1776,7 @@ contract OptimismPortal2WithMockERC20_Test is OptimismPortal2_FinalizeWithdrawal ...@@ -1777,7 +1776,7 @@ contract OptimismPortal2WithMockERC20_Test is OptimismPortal2_FinalizeWithdrawal
_to = address(0); _to = address(0);
} }
vm.assume(_data.length <= 120_000); vm.assume(_data.length <= 120_000);
ResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig(); IResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig();
_gasLimit = _gasLimit =
uint64(bound(_gasLimit, optimismPortal2.minimumGasLimit(uint64(_data.length)), rcfg.maxResourceLimit)); uint64(bound(_gasLimit, optimismPortal2.minimumGasLimit(uint64(_data.length)), rcfg.maxResourceLimit));
......
...@@ -7,12 +7,16 @@ import { CommonTest } from "test/setup/CommonTest.sol"; ...@@ -7,12 +7,16 @@ import { CommonTest } from "test/setup/CommonTest.sol";
// Libraries // Libraries
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import "src/libraries/PortalErrors.sol";
// Target contract dependencies // Target contract dependencies
import "src/libraries/PortalErrors.sol"; import "src/libraries/PortalErrors.sol";
import { OptimismPortalInterop } from "src/L1/OptimismPortalInterop.sol"; import { OptimismPortalInterop } from "src/L1/OptimismPortalInterop.sol";
import { L1BlockIsthmus, ConfigType } from "src/L2/L1BlockIsthmus.sol"; import { L1BlockIsthmus, ConfigType } from "src/L2/L1BlockIsthmus.sol";
// Interfaces
import { IOptimismPortalInterop } from "src/L1/interfaces/IOptimismPortalInterop.sol";
contract OptimismPortalInterop_Test is CommonTest { contract OptimismPortalInterop_Test is CommonTest {
/// @notice Marked virtual to be overridden in /// @notice Marked virtual to be overridden in
/// test/kontrol/deployment/DeploymentSummary.t.sol /// test/kontrol/deployment/DeploymentSummary.t.sol
...@@ -91,7 +95,7 @@ contract OptimismPortalInterop_Test is CommonTest { ...@@ -91,7 +95,7 @@ contract OptimismPortalInterop_Test is CommonTest {
} }
/// @dev Returns the OptimismPortalInterop instance. /// @dev Returns the OptimismPortalInterop instance.
function _optimismPortalInterop() internal view returns (OptimismPortalInterop) { function _optimismPortalInterop() internal view returns (IOptimismPortalInterop) {
return OptimismPortalInterop(payable(address(optimismPortal))); return IOptimismPortalInterop(payable(address(optimismPortal)));
} }
} }
...@@ -12,13 +12,22 @@ import { Proxy } from "src/universal/Proxy.sol"; ...@@ -12,13 +12,22 @@ import { Proxy } from "src/universal/Proxy.sol";
// Target contract // Target contract
import { ResourceMetering } from "src/L1/ResourceMetering.sol"; import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
contract MeterUser is ResourceMetering { contract MeterUser is ResourceMetering {
ResourceMetering.ResourceConfig public innerConfig; ResourceMetering.ResourceConfig public innerConfig;
constructor() { constructor() {
initialize(); initialize();
innerConfig = Constants.DEFAULT_RESOURCE_CONFIG(); IResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG();
innerConfig = ResourceMetering.ResourceConfig({
maxResourceLimit: rcfg.maxResourceLimit,
elasticityMultiplier: rcfg.elasticityMultiplier,
baseFeeMaxChangeDenominator: rcfg.baseFeeMaxChangeDenominator,
minimumBaseFee: rcfg.minimumBaseFee,
systemTxMaxGas: rcfg.systemTxMaxGas,
maximumBaseFee: rcfg.maximumBaseFee
});
} }
function initialize() public initializer { function initialize() public initializer {
...@@ -231,7 +240,15 @@ contract CustomMeterUser is ResourceMetering { ...@@ -231,7 +240,15 @@ contract CustomMeterUser is ResourceMetering {
} }
function _resourceConfig() internal pure override returns (ResourceMetering.ResourceConfig memory) { function _resourceConfig() internal pure override returns (ResourceMetering.ResourceConfig memory) {
return Constants.DEFAULT_RESOURCE_CONFIG(); IResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG();
return ResourceMetering.ResourceConfig({
maxResourceLimit: rcfg.maxResourceLimit,
elasticityMultiplier: rcfg.elasticityMultiplier,
baseFeeMaxChangeDenominator: rcfg.baseFeeMaxChangeDenominator,
minimumBaseFee: rcfg.minimumBaseFee,
systemTxMaxGas: rcfg.systemTxMaxGas,
maximumBaseFee: rcfg.maximumBaseFee
});
} }
function use(uint64 _amount) public returns (uint256) { function use(uint64 _amount) public returns (uint256) {
......
...@@ -12,6 +12,7 @@ import { Proxy } from "src/universal/Proxy.sol"; ...@@ -12,6 +12,7 @@ import { Proxy } from "src/universal/Proxy.sol";
// Target contract // Target contract
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol"; import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
contract SuperchainConfig_Init_Test is CommonTest { contract SuperchainConfig_Init_Test is CommonTest {
/// @dev Tests that initialization sets the correct values. These are defined in CommonTest.sol. /// @dev Tests that initialization sets the correct values. These are defined in CommonTest.sol.
...@@ -23,16 +24,16 @@ contract SuperchainConfig_Init_Test is CommonTest { ...@@ -23,16 +24,16 @@ contract SuperchainConfig_Init_Test is CommonTest {
/// @dev Tests that it can be intialized as paused. /// @dev Tests that it can be intialized as paused.
function test_initialize_paused_succeeds() external { function test_initialize_paused_succeeds() external {
Proxy newProxy = new Proxy(alice); Proxy newProxy = new Proxy(alice);
SuperchainConfig newImpl = new SuperchainConfig(); ISuperchainConfig newImpl = ISuperchainConfig(address(new SuperchainConfig()));
vm.startPrank(alice); vm.startPrank(alice);
newProxy.upgradeToAndCall( newProxy.upgradeToAndCall(
address(newImpl), address(newImpl),
abi.encodeWithSelector(SuperchainConfig.initialize.selector, deploy.cfg().superchainConfigGuardian(), true) abi.encodeWithSelector(ISuperchainConfig.initialize.selector, deploy.cfg().superchainConfigGuardian(), true)
); );
assertTrue(SuperchainConfig(address(newProxy)).paused()); assertTrue(ISuperchainConfig(address(newProxy)).paused());
assertEq(SuperchainConfig(address(newProxy)).guardian(), deploy.cfg().superchainConfigGuardian()); assertEq(ISuperchainConfig(address(newProxy)).guardian(), deploy.cfg().superchainConfigGuardian());
} }
} }
......
...@@ -11,16 +11,16 @@ import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol"; ...@@ -11,16 +11,16 @@ import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
// Target contract dependencies // Target contract dependencies
import { ResourceMetering } from "src/L1/ResourceMetering.sol"; import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { Proxy } from "src/universal/Proxy.sol"; import { Proxy } from "src/universal/Proxy.sol";
import { L1Block } from "src/L2/L1Block.sol"; import { L1Block } from "src/L2/L1Block.sol";
import { GasPayingToken } from "src/libraries/GasPayingToken.sol"; import { GasPayingToken } from "src/libraries/GasPayingToken.sol";
// Target contract // Target contract
import { SystemConfig } from "src/L1/SystemConfig.sol"; import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
contract SystemConfig_Init is CommonTest { contract SystemConfig_Init is CommonTest {
event ConfigUpdate(uint256 indexed version, SystemConfig.UpdateType indexed updateType, bytes data); event ConfigUpdate(uint256 indexed version, ISystemConfig.UpdateType indexed updateType, bytes data);
} }
contract SystemConfig_Initialize_Test is SystemConfig_Init { contract SystemConfig_Initialize_Test is SystemConfig_Init {
...@@ -49,7 +49,7 @@ contract SystemConfig_Initialize_Test is SystemConfig_Init { ...@@ -49,7 +49,7 @@ contract SystemConfig_Initialize_Test is SystemConfig_Init {
/// @dev Tests that constructor sets the correct values. /// @dev Tests that constructor sets the correct values.
function test_constructor_succeeds() external view { function test_constructor_succeeds() external view {
SystemConfig impl = SystemConfig(systemConfigImpl); ISystemConfig impl = ISystemConfig(systemConfigImpl);
assertEq(impl.owner(), address(0xdEaD)); assertEq(impl.owner(), address(0xdEaD));
assertEq(impl.overhead(), 0); assertEq(impl.overhead(), 0);
assertEq(impl.scalar(), uint256(0x01) << 248); assertEq(impl.scalar(), uint256(0x01) << 248);
...@@ -58,7 +58,7 @@ contract SystemConfig_Initialize_Test is SystemConfig_Init { ...@@ -58,7 +58,7 @@ contract SystemConfig_Initialize_Test is SystemConfig_Init {
assertEq(impl.unsafeBlockSigner(), address(0)); assertEq(impl.unsafeBlockSigner(), address(0));
assertEq(impl.basefeeScalar(), 0); assertEq(impl.basefeeScalar(), 0);
assertEq(impl.blobbasefeeScalar(), 0); assertEq(impl.blobbasefeeScalar(), 0);
ResourceMetering.ResourceConfig memory actual = impl.resourceConfig(); IResourceMetering.ResourceConfig memory actual = impl.resourceConfig();
assertEq(actual.maxResourceLimit, 1); assertEq(actual.maxResourceLimit, 1);
assertEq(actual.elasticityMultiplier, 1); assertEq(actual.elasticityMultiplier, 1);
assertEq(actual.baseFeeMaxChangeDenominator, 2); assertEq(actual.baseFeeMaxChangeDenominator, 2);
...@@ -91,8 +91,8 @@ contract SystemConfig_Initialize_Test is SystemConfig_Init { ...@@ -91,8 +91,8 @@ contract SystemConfig_Initialize_Test is SystemConfig_Init {
assertEq(systemConfig.basefeeScalar(), basefeeScalar); assertEq(systemConfig.basefeeScalar(), basefeeScalar);
assertEq(systemConfig.blobbasefeeScalar(), blobbasefeeScalar); assertEq(systemConfig.blobbasefeeScalar(), blobbasefeeScalar);
// Depends on `initialize` being called with defaults // Depends on `initialize` being called with defaults
ResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG(); IResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG();
ResourceMetering.ResourceConfig memory actual = systemConfig.resourceConfig(); IResourceMetering.ResourceConfig memory actual = systemConfig.resourceConfig();
assertEq(actual.maxResourceLimit, rcfg.maxResourceLimit); assertEq(actual.maxResourceLimit, rcfg.maxResourceLimit);
assertEq(actual.elasticityMultiplier, rcfg.elasticityMultiplier); assertEq(actual.elasticityMultiplier, rcfg.elasticityMultiplier);
assertEq(actual.baseFeeMaxChangeDenominator, rcfg.baseFeeMaxChangeDenominator); assertEq(actual.baseFeeMaxChangeDenominator, rcfg.baseFeeMaxChangeDenominator);
...@@ -138,7 +138,7 @@ contract SystemConfig_Initialize_TestFail is SystemConfig_Initialize_Test { ...@@ -138,7 +138,7 @@ contract SystemConfig_Initialize_TestFail is SystemConfig_Initialize_Test {
_unsafeBlockSigner: address(1), _unsafeBlockSigner: address(1),
_config: Constants.DEFAULT_RESOURCE_CONFIG(), _config: Constants.DEFAULT_RESOURCE_CONFIG(),
_batchInbox: address(0), _batchInbox: address(0),
_addresses: SystemConfig.Addresses({ _addresses: ISystemConfig.Addresses({
l1CrossDomainMessenger: address(0), l1CrossDomainMessenger: address(0),
l1ERC721Bridge: address(0), l1ERC721Bridge: address(0),
l1StandardBridge: address(0), l1StandardBridge: address(0),
...@@ -168,7 +168,7 @@ contract SystemConfig_Initialize_TestFail is SystemConfig_Initialize_Test { ...@@ -168,7 +168,7 @@ contract SystemConfig_Initialize_TestFail is SystemConfig_Initialize_Test {
_unsafeBlockSigner: address(1), _unsafeBlockSigner: address(1),
_config: Constants.DEFAULT_RESOURCE_CONFIG(), _config: Constants.DEFAULT_RESOURCE_CONFIG(),
_batchInbox: address(0), _batchInbox: address(0),
_addresses: SystemConfig.Addresses({ _addresses: ISystemConfig.Addresses({
l1CrossDomainMessenger: address(0), l1CrossDomainMessenger: address(0),
l1ERC721Bridge: address(0), l1ERC721Bridge: address(0),
l1StandardBridge: address(0), l1StandardBridge: address(0),
...@@ -199,7 +199,7 @@ contract SystemConfig_Initialize_TestFail is SystemConfig_Initialize_Test { ...@@ -199,7 +199,7 @@ contract SystemConfig_Initialize_TestFail is SystemConfig_Initialize_Test {
_unsafeBlockSigner: address(1), _unsafeBlockSigner: address(1),
_config: Constants.DEFAULT_RESOURCE_CONFIG(), _config: Constants.DEFAULT_RESOURCE_CONFIG(),
_batchInbox: address(0), _batchInbox: address(0),
_addresses: SystemConfig.Addresses({ _addresses: ISystemConfig.Addresses({
l1CrossDomainMessenger: address(0), l1CrossDomainMessenger: address(0),
l1ERC721Bridge: address(0), l1ERC721Bridge: address(0),
l1StandardBridge: address(0), l1StandardBridge: address(0),
...@@ -217,7 +217,7 @@ contract SystemConfig_Init_ResourceConfig is SystemConfig_Init { ...@@ -217,7 +217,7 @@ contract SystemConfig_Init_ResourceConfig is SystemConfig_Init {
/// @dev Tests that `setResourceConfig` reverts if the min base fee /// @dev Tests that `setResourceConfig` reverts if the min base fee
/// is greater than the maximum allowed base fee. /// is greater than the maximum allowed base fee.
function test_setResourceConfig_badMinMax_reverts() external { function test_setResourceConfig_badMinMax_reverts() external {
ResourceMetering.ResourceConfig memory config = ResourceMetering.ResourceConfig({ IResourceMetering.ResourceConfig memory config = IResourceMetering.ResourceConfig({
maxResourceLimit: 20_000_000, maxResourceLimit: 20_000_000,
elasticityMultiplier: 10, elasticityMultiplier: 10,
baseFeeMaxChangeDenominator: 8, baseFeeMaxChangeDenominator: 8,
...@@ -231,7 +231,7 @@ contract SystemConfig_Init_ResourceConfig is SystemConfig_Init { ...@@ -231,7 +231,7 @@ contract SystemConfig_Init_ResourceConfig is SystemConfig_Init {
/// @dev Tests that `setResourceConfig` reverts if the baseFeeMaxChangeDenominator /// @dev Tests that `setResourceConfig` reverts if the baseFeeMaxChangeDenominator
/// is zero. /// is zero.
function test_setResourceConfig_zeroDenominator_reverts() external { function test_setResourceConfig_zeroDenominator_reverts() external {
ResourceMetering.ResourceConfig memory config = ResourceMetering.ResourceConfig({ IResourceMetering.ResourceConfig memory config = IResourceMetering.ResourceConfig({
maxResourceLimit: 20_000_000, maxResourceLimit: 20_000_000,
elasticityMultiplier: 10, elasticityMultiplier: 10,
baseFeeMaxChangeDenominator: 0, baseFeeMaxChangeDenominator: 0,
...@@ -246,7 +246,7 @@ contract SystemConfig_Init_ResourceConfig is SystemConfig_Init { ...@@ -246,7 +246,7 @@ contract SystemConfig_Init_ResourceConfig is SystemConfig_Init {
function test_setResourceConfig_lowGasLimit_reverts() external { function test_setResourceConfig_lowGasLimit_reverts() external {
uint64 gasLimit = systemConfig.gasLimit(); uint64 gasLimit = systemConfig.gasLimit();
ResourceMetering.ResourceConfig memory config = ResourceMetering.ResourceConfig({ IResourceMetering.ResourceConfig memory config = IResourceMetering.ResourceConfig({
maxResourceLimit: uint32(gasLimit), maxResourceLimit: uint32(gasLimit),
elasticityMultiplier: 10, elasticityMultiplier: 10,
baseFeeMaxChangeDenominator: 8, baseFeeMaxChangeDenominator: 8,
...@@ -260,7 +260,7 @@ contract SystemConfig_Init_ResourceConfig is SystemConfig_Init { ...@@ -260,7 +260,7 @@ contract SystemConfig_Init_ResourceConfig is SystemConfig_Init {
/// @dev Tests that `setResourceConfig` reverts if the elasticity multiplier /// @dev Tests that `setResourceConfig` reverts if the elasticity multiplier
/// and max resource limit are configured such that there is a loss of precision. /// and max resource limit are configured such that there is a loss of precision.
function test_setResourceConfig_badPrecision_reverts() external { function test_setResourceConfig_badPrecision_reverts() external {
ResourceMetering.ResourceConfig memory config = ResourceMetering.ResourceConfig({ IResourceMetering.ResourceConfig memory config = IResourceMetering.ResourceConfig({
maxResourceLimit: 20_000_000, maxResourceLimit: 20_000_000,
elasticityMultiplier: 11, elasticityMultiplier: 11,
baseFeeMaxChangeDenominator: 8, baseFeeMaxChangeDenominator: 8,
...@@ -274,7 +274,7 @@ contract SystemConfig_Init_ResourceConfig is SystemConfig_Init { ...@@ -274,7 +274,7 @@ contract SystemConfig_Init_ResourceConfig is SystemConfig_Init {
/// @dev Helper to initialize the system config with a resource config and default values, and expect a revert /// @dev Helper to initialize the system config with a resource config and default values, and expect a revert
/// with the given message. /// with the given message.
function _initializeWithResourceConfig( function _initializeWithResourceConfig(
ResourceMetering.ResourceConfig memory config, IResourceMetering.ResourceConfig memory config,
string memory revertMessage string memory revertMessage
) )
internal internal
...@@ -294,7 +294,7 @@ contract SystemConfig_Init_ResourceConfig is SystemConfig_Init { ...@@ -294,7 +294,7 @@ contract SystemConfig_Init_ResourceConfig is SystemConfig_Init {
_unsafeBlockSigner: address(0), _unsafeBlockSigner: address(0),
_config: config, _config: config,
_batchInbox: address(0), _batchInbox: address(0),
_addresses: SystemConfig.Addresses({ _addresses: ISystemConfig.Addresses({
l1CrossDomainMessenger: address(0), l1CrossDomainMessenger: address(0),
l1ERC721Bridge: address(0), l1ERC721Bridge: address(0),
l1StandardBridge: address(0), l1StandardBridge: address(0),
...@@ -332,7 +332,7 @@ contract SystemConfig_Init_CustomGasToken is SystemConfig_Init { ...@@ -332,7 +332,7 @@ contract SystemConfig_Init_CustomGasToken is SystemConfig_Init {
_unsafeBlockSigner: address(1), _unsafeBlockSigner: address(1),
_config: Constants.DEFAULT_RESOURCE_CONFIG(), _config: Constants.DEFAULT_RESOURCE_CONFIG(),
_batchInbox: address(0), _batchInbox: address(0),
_addresses: SystemConfig.Addresses({ _addresses: ISystemConfig.Addresses({
l1CrossDomainMessenger: address(0), l1CrossDomainMessenger: address(0),
l1ERC721Bridge: address(0), l1ERC721Bridge: address(0),
disputeGameFactory: address(0), disputeGameFactory: address(0),
...@@ -533,7 +533,7 @@ contract SystemConfig_Setters_Test is SystemConfig_Init { ...@@ -533,7 +533,7 @@ contract SystemConfig_Setters_Test is SystemConfig_Init {
/// @dev Tests that `setBatcherHash` updates the batcher hash successfully. /// @dev Tests that `setBatcherHash` updates the batcher hash successfully.
function testFuzz_setBatcherHash_succeeds(bytes32 newBatcherHash) external { function testFuzz_setBatcherHash_succeeds(bytes32 newBatcherHash) external {
vm.expectEmit(address(systemConfig)); vm.expectEmit(address(systemConfig));
emit ConfigUpdate(0, SystemConfig.UpdateType.BATCHER, abi.encode(newBatcherHash)); emit ConfigUpdate(0, ISystemConfig.UpdateType.BATCHER, abi.encode(newBatcherHash));
vm.prank(systemConfig.owner()); vm.prank(systemConfig.owner());
systemConfig.setBatcherHash(newBatcherHash); systemConfig.setBatcherHash(newBatcherHash);
...@@ -545,7 +545,7 @@ contract SystemConfig_Setters_Test is SystemConfig_Init { ...@@ -545,7 +545,7 @@ contract SystemConfig_Setters_Test is SystemConfig_Init {
// always zero out most significant byte // always zero out most significant byte
newScalar = (newScalar << 16) >> 16; newScalar = (newScalar << 16) >> 16;
vm.expectEmit(address(systemConfig)); vm.expectEmit(address(systemConfig));
emit ConfigUpdate(0, SystemConfig.UpdateType.GAS_CONFIG, abi.encode(newOverhead, newScalar)); emit ConfigUpdate(0, ISystemConfig.UpdateType.GAS_CONFIG, abi.encode(newOverhead, newScalar));
vm.prank(systemConfig.owner()); vm.prank(systemConfig.owner());
systemConfig.setGasConfig(newOverhead, newScalar); systemConfig.setGasConfig(newOverhead, newScalar);
...@@ -558,7 +558,7 @@ contract SystemConfig_Setters_Test is SystemConfig_Init { ...@@ -558,7 +558,7 @@ contract SystemConfig_Setters_Test is SystemConfig_Init {
ffi.encodeScalarEcotone({ _basefeeScalar: _basefeeScalar, _blobbasefeeScalar: _blobbasefeeScalar }); ffi.encodeScalarEcotone({ _basefeeScalar: _basefeeScalar, _blobbasefeeScalar: _blobbasefeeScalar });
vm.expectEmit(address(systemConfig)); vm.expectEmit(address(systemConfig));
emit ConfigUpdate(0, SystemConfig.UpdateType.GAS_CONFIG, abi.encode(systemConfig.overhead(), encoded)); emit ConfigUpdate(0, ISystemConfig.UpdateType.GAS_CONFIG, abi.encode(systemConfig.overhead(), encoded));
vm.prank(systemConfig.owner()); vm.prank(systemConfig.owner());
systemConfig.setGasConfigEcotone({ _basefeeScalar: _basefeeScalar, _blobbasefeeScalar: _blobbasefeeScalar }); systemConfig.setGasConfigEcotone({ _basefeeScalar: _basefeeScalar, _blobbasefeeScalar: _blobbasefeeScalar });
...@@ -578,7 +578,7 @@ contract SystemConfig_Setters_Test is SystemConfig_Init { ...@@ -578,7 +578,7 @@ contract SystemConfig_Setters_Test is SystemConfig_Init {
newGasLimit = uint64(bound(uint256(newGasLimit), uint256(minimumGasLimit), uint256(maximumGasLimit))); newGasLimit = uint64(bound(uint256(newGasLimit), uint256(minimumGasLimit), uint256(maximumGasLimit)));
vm.expectEmit(address(systemConfig)); vm.expectEmit(address(systemConfig));
emit ConfigUpdate(0, SystemConfig.UpdateType.GAS_LIMIT, abi.encode(newGasLimit)); emit ConfigUpdate(0, ISystemConfig.UpdateType.GAS_LIMIT, abi.encode(newGasLimit));
vm.prank(systemConfig.owner()); vm.prank(systemConfig.owner());
systemConfig.setGasLimit(newGasLimit); systemConfig.setGasLimit(newGasLimit);
...@@ -588,7 +588,7 @@ contract SystemConfig_Setters_Test is SystemConfig_Init { ...@@ -588,7 +588,7 @@ contract SystemConfig_Setters_Test is SystemConfig_Init {
/// @dev Tests that `setUnsafeBlockSigner` updates the block signer successfully. /// @dev Tests that `setUnsafeBlockSigner` updates the block signer successfully.
function testFuzz_setUnsafeBlockSigner_succeeds(address newUnsafeSigner) external { function testFuzz_setUnsafeBlockSigner_succeeds(address newUnsafeSigner) external {
vm.expectEmit(address(systemConfig)); vm.expectEmit(address(systemConfig));
emit ConfigUpdate(0, SystemConfig.UpdateType.UNSAFE_BLOCK_SIGNER, abi.encode(newUnsafeSigner)); emit ConfigUpdate(0, ISystemConfig.UpdateType.UNSAFE_BLOCK_SIGNER, abi.encode(newUnsafeSigner));
vm.prank(systemConfig.owner()); vm.prank(systemConfig.owner());
systemConfig.setUnsafeBlockSigner(newUnsafeSigner); systemConfig.setUnsafeBlockSigner(newUnsafeSigner);
......
...@@ -10,9 +10,9 @@ import { StaticConfig } from "src/libraries/StaticConfig.sol"; ...@@ -10,9 +10,9 @@ import { StaticConfig } from "src/libraries/StaticConfig.sol";
import { GasPayingToken } from "src/libraries/GasPayingToken.sol"; import { GasPayingToken } from "src/libraries/GasPayingToken.sol";
// Target contract dependencies // Target contract dependencies
import { SystemConfig } from "src/L1/SystemConfig.sol"; import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { SystemConfigInterop } from "src/L1/SystemConfigInterop.sol"; import { SystemConfigInterop } from "src/L1/SystemConfigInterop.sol";
import { OptimismPortalInterop } from "src/L1/OptimismPortalInterop.sol"; import { IOptimismPortalInterop } from "src/L1/interfaces/IOptimismPortalInterop.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { ConfigType } from "src/L2/L1BlockIsthmus.sol"; import { ConfigType } from "src/L2/L1BlockIsthmus.sol";
...@@ -46,7 +46,7 @@ contract SystemConfigInterop_Test is CommonTest { ...@@ -46,7 +46,7 @@ contract SystemConfigInterop_Test is CommonTest {
vm.expectCall( vm.expectCall(
address(optimismPortal), address(optimismPortal),
abi.encodeCall( abi.encodeCall(
OptimismPortalInterop.setConfig, IOptimismPortalInterop.setConfig,
( (
ConfigType.SET_GAS_PAYING_TOKEN, ConfigType.SET_GAS_PAYING_TOKEN,
StaticConfig.encodeSetGasPayingToken({ StaticConfig.encodeSetGasPayingToken({
...@@ -67,7 +67,8 @@ contract SystemConfigInterop_Test is CommonTest { ...@@ -67,7 +67,8 @@ contract SystemConfigInterop_Test is CommonTest {
vm.expectCall( vm.expectCall(
address(optimismPortal), address(optimismPortal),
abi.encodeCall( abi.encodeCall(
OptimismPortalInterop.setConfig, (ConfigType.ADD_DEPENDENCY, StaticConfig.encodeAddDependency(_chainId)) IOptimismPortalInterop.setConfig,
(ConfigType.ADD_DEPENDENCY, StaticConfig.encodeAddDependency(_chainId))
) )
); );
...@@ -86,7 +87,7 @@ contract SystemConfigInterop_Test is CommonTest { ...@@ -86,7 +87,7 @@ contract SystemConfigInterop_Test is CommonTest {
vm.expectCall( vm.expectCall(
address(optimismPortal), address(optimismPortal),
abi.encodeCall( abi.encodeCall(
OptimismPortalInterop.setConfig, IOptimismPortalInterop.setConfig,
(ConfigType.REMOVE_DEPENDENCY, StaticConfig.encodeRemoveDependency(_chainId)) (ConfigType.REMOVE_DEPENDENCY, StaticConfig.encodeRemoveDependency(_chainId))
) )
); );
...@@ -118,7 +119,7 @@ contract SystemConfigInterop_Test is CommonTest { ...@@ -118,7 +119,7 @@ contract SystemConfigInterop_Test is CommonTest {
_unsafeBlockSigner: address(1), _unsafeBlockSigner: address(1),
_config: Constants.DEFAULT_RESOURCE_CONFIG(), _config: Constants.DEFAULT_RESOURCE_CONFIG(),
_batchInbox: address(0), _batchInbox: address(0),
_addresses: SystemConfig.Addresses({ _addresses: ISystemConfig.Addresses({
l1CrossDomainMessenger: address(0), l1CrossDomainMessenger: address(0),
l1ERC721Bridge: address(0), l1ERC721Bridge: address(0),
disputeGameFactory: address(0), disputeGameFactory: address(0),
......
...@@ -16,7 +16,6 @@ import { Constants } from "src/libraries/Constants.sol"; ...@@ -16,7 +16,6 @@ import { Constants } from "src/libraries/Constants.sol";
import { L2CrossDomainMessenger } from "src/L2/L2CrossDomainMessenger.sol"; import { L2CrossDomainMessenger } from "src/L2/L2CrossDomainMessenger.sol";
import { L2ToL1MessagePasser } from "src/L2/L2ToL1MessagePasser.sol"; import { L2ToL1MessagePasser } from "src/L2/L2ToL1MessagePasser.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol"; import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol";
contract L2CrossDomainMessenger_Test is Bridge_Initializer { contract L2CrossDomainMessenger_Test is Bridge_Initializer {
/// @dev Receiver address for testing /// @dev Receiver address for testing
......
...@@ -7,7 +7,7 @@ import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol"; ...@@ -7,7 +7,7 @@ import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
// Target contract is imported by the `Bridge_Initializer` // Target contract is imported by the `Bridge_Initializer`
import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol"; import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol";
import { stdStorage, StdStorage } from "forge-std/Test.sol"; import { stdStorage, StdStorage } from "forge-std/Test.sol";
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol"; import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
import { L2ToL1MessagePasser } from "src/L2/L2ToL1MessagePasser.sol"; import { L2ToL1MessagePasser } from "src/L2/L2ToL1MessagePasser.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
...@@ -60,7 +60,7 @@ contract L2StandardBridge_Test is Bridge_Initializer { ...@@ -60,7 +60,7 @@ contract L2StandardBridge_Test is Bridge_Initializer {
abi.encodeWithSelector(StandardBridge.finalizeBridgeETH.selector, alice, alice, 100, hex""); abi.encodeWithSelector(StandardBridge.finalizeBridgeETH.selector, alice, alice, 100, hex"");
uint64 baseGas = l2CrossDomainMessenger.baseGas(message, 200_000); uint64 baseGas = l2CrossDomainMessenger.baseGas(message, 200_000);
bytes memory withdrawalData = abi.encodeWithSelector( bytes memory withdrawalData = abi.encodeWithSelector(
CrossDomainMessenger.relayMessage.selector, ICrossDomainMessenger.relayMessage.selector,
nonce, nonce,
address(l2StandardBridge), address(l2StandardBridge),
address(l1StandardBridge), address(l1StandardBridge),
...@@ -108,7 +108,7 @@ contract L2StandardBridge_Test is Bridge_Initializer { ...@@ -108,7 +108,7 @@ contract L2StandardBridge_Test is Bridge_Initializer {
vm.expectCall( vm.expectCall(
address(l2CrossDomainMessenger), address(l2CrossDomainMessenger),
abi.encodeWithSelector( abi.encodeWithSelector(
CrossDomainMessenger.sendMessage.selector, ICrossDomainMessenger.sendMessage.selector,
address(l1StandardBridge), address(l1StandardBridge),
message, message,
200_000 // StandardBridge's RECEIVE_DEFAULT_GAS_LIMIT 200_000 // StandardBridge's RECEIVE_DEFAULT_GAS_LIMIT
...@@ -282,7 +282,7 @@ contract PreBridgeERC20 is Bridge_Initializer { ...@@ -282,7 +282,7 @@ contract PreBridgeERC20 is Bridge_Initializer {
); );
uint64 baseGas = l2CrossDomainMessenger.baseGas(message, 1000); uint64 baseGas = l2CrossDomainMessenger.baseGas(message, 1000);
bytes memory withdrawalData = abi.encodeWithSelector( bytes memory withdrawalData = abi.encodeWithSelector(
CrossDomainMessenger.relayMessage.selector, ICrossDomainMessenger.relayMessage.selector,
nonce, nonce,
address(l2StandardBridge), address(l2StandardBridge),
address(l1StandardBridge), address(l1StandardBridge),
...@@ -317,7 +317,7 @@ contract PreBridgeERC20 is Bridge_Initializer { ...@@ -317,7 +317,7 @@ contract PreBridgeERC20 is Bridge_Initializer {
vm.expectCall( vm.expectCall(
address(l2CrossDomainMessenger), address(l2CrossDomainMessenger),
abi.encodeWithSelector(CrossDomainMessenger.sendMessage.selector, address(l1StandardBridge), message, 1000) abi.encodeWithSelector(ICrossDomainMessenger.sendMessage.selector, address(l1StandardBridge), message, 1000)
); );
vm.expectCall( vm.expectCall(
...@@ -420,7 +420,7 @@ contract PreBridgeERC20To is Bridge_Initializer { ...@@ -420,7 +420,7 @@ contract PreBridgeERC20To is Bridge_Initializer {
); );
uint64 baseGas = l2CrossDomainMessenger.baseGas(message, 1000); uint64 baseGas = l2CrossDomainMessenger.baseGas(message, 1000);
bytes memory withdrawalData = abi.encodeWithSelector( bytes memory withdrawalData = abi.encodeWithSelector(
CrossDomainMessenger.relayMessage.selector, ICrossDomainMessenger.relayMessage.selector,
nonce, nonce,
address(l2StandardBridge), address(l2StandardBridge),
address(l1StandardBridge), address(l1StandardBridge),
...@@ -480,7 +480,7 @@ contract PreBridgeERC20To is Bridge_Initializer { ...@@ -480,7 +480,7 @@ contract PreBridgeERC20To is Bridge_Initializer {
vm.expectCall( vm.expectCall(
address(l2CrossDomainMessenger), address(l2CrossDomainMessenger),
abi.encodeWithSelector(CrossDomainMessenger.sendMessage.selector, address(l1StandardBridge), message, 1000) abi.encodeWithSelector(ICrossDomainMessenger.sendMessage.selector, address(l1StandardBridge), message, 1000)
); );
vm.expectCall( vm.expectCall(
...@@ -524,7 +524,7 @@ contract L2StandardBridge_Bridge_Test is Bridge_Initializer { ...@@ -524,7 +524,7 @@ contract L2StandardBridge_Bridge_Test is Bridge_Initializer {
function test_finalizeBridgeETH_sendToSelf_reverts() external { function test_finalizeBridgeETH_sendToSelf_reverts() external {
vm.mockCall( vm.mockCall(
address(l2StandardBridge.messenger()), address(l2StandardBridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l2StandardBridge.OTHER_BRIDGE())) abi.encode(address(l2StandardBridge.OTHER_BRIDGE()))
); );
vm.deal(address(l2CrossDomainMessenger), 100); vm.deal(address(l2CrossDomainMessenger), 100);
...@@ -537,7 +537,7 @@ contract L2StandardBridge_Bridge_Test is Bridge_Initializer { ...@@ -537,7 +537,7 @@ contract L2StandardBridge_Bridge_Test is Bridge_Initializer {
function test_finalizeBridgeETH_sendToMessenger_reverts() external { function test_finalizeBridgeETH_sendToMessenger_reverts() external {
vm.mockCall( vm.mockCall(
address(l2StandardBridge.messenger()), address(l2StandardBridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l2StandardBridge.OTHER_BRIDGE())) abi.encode(address(l2StandardBridge.OTHER_BRIDGE()))
); );
vm.deal(address(l2CrossDomainMessenger), 100); vm.deal(address(l2CrossDomainMessenger), 100);
...@@ -563,7 +563,7 @@ contract L2StandardBridge_Bridge_Test is Bridge_Initializer { ...@@ -563,7 +563,7 @@ contract L2StandardBridge_Bridge_Test is Bridge_Initializer {
address(l2CrossDomainMessenger), address(l2CrossDomainMessenger),
_value, _value,
abi.encodeWithSelector( abi.encodeWithSelector(
CrossDomainMessenger.sendMessage.selector, address(l1StandardBridge), message, _minGasLimit ICrossDomainMessenger.sendMessage.selector, address(l1StandardBridge), message, _minGasLimit
) )
); );
...@@ -611,7 +611,7 @@ contract L2StandardBridge_Bridge_Test is Bridge_Initializer { ...@@ -611,7 +611,7 @@ contract L2StandardBridge_Bridge_Test is Bridge_Initializer {
vm.expectCall( vm.expectCall(
address(l2CrossDomainMessenger), address(l2CrossDomainMessenger),
abi.encodeWithSelector( abi.encodeWithSelector(
CrossDomainMessenger.sendMessage.selector, address(l1StandardBridge), message, _minGasLimit ICrossDomainMessenger.sendMessage.selector, address(l1StandardBridge), message, _minGasLimit
) )
); );
...@@ -654,7 +654,7 @@ contract L2StandardBridge_FinalizeBridgeETH_Test is Bridge_Initializer { ...@@ -654,7 +654,7 @@ contract L2StandardBridge_FinalizeBridgeETH_Test is Bridge_Initializer {
address messenger = address(l2StandardBridge.messenger()); address messenger = address(l2StandardBridge.messenger());
vm.mockCall( vm.mockCall(
messenger, messenger,
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l2StandardBridge.OTHER_BRIDGE())) abi.encode(address(l2StandardBridge.OTHER_BRIDGE()))
); );
vm.deal(messenger, 100); vm.deal(messenger, 100);
...@@ -674,7 +674,7 @@ contract L2StandardBridge_FinalizeBridgeETH_Test is Bridge_Initializer { ...@@ -674,7 +674,7 @@ contract L2StandardBridge_FinalizeBridgeETH_Test is Bridge_Initializer {
address messenger = address(l2StandardBridge.messenger()); address messenger = address(l2StandardBridge.messenger());
vm.mockCall( vm.mockCall(
messenger, messenger,
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l2StandardBridge.OTHER_BRIDGE())) abi.encode(address(l2StandardBridge.OTHER_BRIDGE()))
); );
vm.deal(address(l2CrossDomainMessenger), 1); vm.deal(address(l2CrossDomainMessenger), 1);
......
...@@ -18,7 +18,6 @@ import { GuardManager } from "safe-contracts/base/GuardManager.sol"; ...@@ -18,7 +18,6 @@ import { GuardManager } from "safe-contracts/base/GuardManager.sol";
import { LivenessGuard } from "src/Safe/LivenessGuard.sol"; import { LivenessGuard } from "src/Safe/LivenessGuard.sol";
import { LivenessModule } from "src/Safe/LivenessModule.sol"; import { LivenessModule } from "src/Safe/LivenessModule.sol";
import { DeputyGuardianModule } from "src/Safe/DeputyGuardianModule.sol"; import { DeputyGuardianModule } from "src/Safe/DeputyGuardianModule.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
contract DeployOwnershipTest is Test, DeployOwnership { contract DeployOwnershipTest is Test, DeployOwnership {
address internal constant SENTINEL_MODULES = address(0x1); address internal constant SENTINEL_MODULES = address(0x1);
......
...@@ -278,10 +278,12 @@ contract DeputyGuardianModule_NoPortalCollisions_Test is DeputyGuardianModule_Te ...@@ -278,10 +278,12 @@ contract DeputyGuardianModule_NoPortalCollisions_Test is DeputyGuardianModule_Te
/// @dev tests that no function selectors in the L1 contracts collide with the OptimismPortal2 functions called by /// @dev tests that no function selectors in the L1 contracts collide with the OptimismPortal2 functions called by
/// the DeputyGuardianModule. /// the DeputyGuardianModule.
function test_noPortalCollisions_succeeds() external { function test_noPortalCollisions_succeeds() external {
string[] memory excludes = new string[](3); string[] memory excludes = new string[](5);
excludes[0] = "src/L1/OptimismPortal2.sol"; excludes[0] = "src/dispute/lib/*";
excludes[1] = "src/dispute/lib/*"; excludes[1] = "src/L1/OptimismPortal2.sol";
excludes[2] = "src/L1/OptimismPortalInterop.sol"; excludes[2] = "src/L1/OptimismPortalInterop.sol";
excludes[3] = "src/L1/interfaces/IOptimismPortal2.sol";
excludes[4] = "src/L1/interfaces/IOptimismPortalInterop.sol";
Abi[] memory abis = ForgeArtifacts.getContractFunctionAbis("src/{L1,dispute,universal}", excludes); Abi[] memory abis = ForgeArtifacts.getContractFunctionAbis("src/{L1,dispute,universal}", excludes);
for (uint256 i; i < abis.length; i++) { for (uint256 i; i < abis.length; i++) {
for (uint256 j; j < abis[i].entries.length; j++) { for (uint256 j; j < abis[i].entries.length; j++) {
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity ^0.8.15; pragma solidity ^0.8.15;
// Testing
import { CommonTest } from "test/setup/CommonTest.sol"; import { CommonTest } from "test/setup/CommonTest.sol";
import { console2 as console } from "forge-std/console2.sol"; import { console2 as console } from "forge-std/console2.sol";
// Scripts
import { Executables } from "scripts/libraries/Executables.sol";
import { ForgeArtifacts, Abi, AbiEntry } from "scripts/libraries/ForgeArtifacts.sol";
// Contracts
import { ProtocolVersions } from "src/L1/ProtocolVersions.sol"; import { ProtocolVersions } from "src/L1/ProtocolVersions.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol";
import { OptimismPortalInterop } from "src/L1/OptimismPortalInterop.sol";
import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { DataAvailabilityChallenge } from "src/L1/DataAvailabilityChallenge.sol";
import { OPStackManager } from "src/L1/OPStackManager.sol"; import { OPStackManager } from "src/L1/OPStackManager.sol";
import { ForgeArtifacts, Abi, AbiEntry } from "scripts/libraries/ForgeArtifacts.sol";
// Interfaces
import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
import { IOptimismPortal2 } from "src/L1/interfaces/IOptimismPortal2.sol";
import { IOptimismPortalInterop } from "src/L1/interfaces/IOptimismPortalInterop.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { IDataAvailabilityChallenge } from "src/L1/interfaces/IDataAvailabilityChallenge.sol";
/// @title Specification_Test /// @title Specification_Test
/// @dev Specifies common security properties of entrypoints to L1 contracts, including authorization and /// @dev Specifies common security properties of entrypoints to L1 contracts, including authorization and
...@@ -79,25 +87,25 @@ contract Specification_Test is CommonTest { ...@@ -79,25 +87,25 @@ contract Specification_Test is CommonTest {
_addSpec({ _name: "DataAvailabilityChallenge", _sel: _getSel("resolveWindow()") }); _addSpec({ _name: "DataAvailabilityChallenge", _sel: _getSel("resolveWindow()") });
_addSpec({ _name: "DataAvailabilityChallenge", _sel: _getSel("resolverRefundPercentage()") }); _addSpec({ _name: "DataAvailabilityChallenge", _sel: _getSel("resolverRefundPercentage()") });
_addSpec({ _name: "DataAvailabilityChallenge", _sel: _getSel("balances(address)") }); _addSpec({ _name: "DataAvailabilityChallenge", _sel: _getSel("balances(address)") });
_addSpec({ _name: "DataAvailabilityChallenge", _sel: DataAvailabilityChallenge.initialize.selector }); _addSpec({ _name: "DataAvailabilityChallenge", _sel: IDataAvailabilityChallenge.initialize.selector });
_addSpec({ _addSpec({
_name: "DataAvailabilityChallenge", _name: "DataAvailabilityChallenge",
_sel: DataAvailabilityChallenge.setBondSize.selector, _sel: IDataAvailabilityChallenge.setBondSize.selector,
_auth: Role.DATAAVAILABILITYCHALLENGEOWNER _auth: Role.DATAAVAILABILITYCHALLENGEOWNER
}); });
_addSpec({ _addSpec({
_name: "DataAvailabilityChallenge", _name: "DataAvailabilityChallenge",
_sel: DataAvailabilityChallenge.setResolverRefundPercentage.selector, _sel: IDataAvailabilityChallenge.setResolverRefundPercentage.selector,
_auth: Role.DATAAVAILABILITYCHALLENGEOWNER _auth: Role.DATAAVAILABILITYCHALLENGEOWNER
}); });
_addSpec({ _name: "DataAvailabilityChallenge", _sel: DataAvailabilityChallenge.deposit.selector }); _addSpec({ _name: "DataAvailabilityChallenge", _sel: IDataAvailabilityChallenge.deposit.selector });
_addSpec({ _name: "DataAvailabilityChallenge", _sel: DataAvailabilityChallenge.withdraw.selector }); _addSpec({ _name: "DataAvailabilityChallenge", _sel: IDataAvailabilityChallenge.withdraw.selector });
_addSpec({ _name: "DataAvailabilityChallenge", _sel: DataAvailabilityChallenge.getChallenge.selector }); _addSpec({ _name: "DataAvailabilityChallenge", _sel: IDataAvailabilityChallenge.getChallenge.selector });
_addSpec({ _name: "DataAvailabilityChallenge", _sel: DataAvailabilityChallenge.getChallengeStatus.selector }); _addSpec({ _name: "DataAvailabilityChallenge", _sel: IDataAvailabilityChallenge.getChallengeStatus.selector });
_addSpec({ _name: "DataAvailabilityChallenge", _sel: DataAvailabilityChallenge.validateCommitment.selector }); _addSpec({ _name: "DataAvailabilityChallenge", _sel: IDataAvailabilityChallenge.validateCommitment.selector });
_addSpec({ _name: "DataAvailabilityChallenge", _sel: DataAvailabilityChallenge.challenge.selector }); _addSpec({ _name: "DataAvailabilityChallenge", _sel: IDataAvailabilityChallenge.challenge.selector });
_addSpec({ _name: "DataAvailabilityChallenge", _sel: DataAvailabilityChallenge.resolve.selector }); _addSpec({ _name: "DataAvailabilityChallenge", _sel: IDataAvailabilityChallenge.resolve.selector });
_addSpec({ _name: "DataAvailabilityChallenge", _sel: DataAvailabilityChallenge.unlockBond.selector }); _addSpec({ _name: "DataAvailabilityChallenge", _sel: IDataAvailabilityChallenge.unlockBond.selector });
// DelayedVetoable // DelayedVetoable
_addSpec({ _name: "DelayedVetoable", _sel: _getSel("delay()") }); _addSpec({ _name: "DelayedVetoable", _sel: _getSel("delay()") });
...@@ -247,7 +255,7 @@ contract Specification_Test is CommonTest { ...@@ -247,7 +255,7 @@ contract Specification_Test is CommonTest {
_addSpec({ _name: "OptimismPortal", _sel: _getSel("donateETH()") }); _addSpec({ _name: "OptimismPortal", _sel: _getSel("donateETH()") });
_addSpec({ _addSpec({
_name: "OptimismPortal", _name: "OptimismPortal",
_sel: OptimismPortal.finalizeWithdrawalTransaction.selector, _sel: IOptimismPortal.finalizeWithdrawalTransaction.selector,
_pausable: true _pausable: true
}); });
_addSpec({ _name: "OptimismPortal", _sel: _getSel("finalizedWithdrawals(bytes32)") }); _addSpec({ _name: "OptimismPortal", _sel: _getSel("finalizedWithdrawals(bytes32)") });
...@@ -259,7 +267,7 @@ contract Specification_Test is CommonTest { ...@@ -259,7 +267,7 @@ contract Specification_Test is CommonTest {
_addSpec({ _name: "OptimismPortal", _sel: _getSel("minimumGasLimit(uint64)") }); _addSpec({ _name: "OptimismPortal", _sel: _getSel("minimumGasLimit(uint64)") });
_addSpec({ _name: "OptimismPortal", _sel: _getSel("params()") }); _addSpec({ _name: "OptimismPortal", _sel: _getSel("params()") });
_addSpec({ _name: "OptimismPortal", _sel: _getSel("paused()") }); _addSpec({ _name: "OptimismPortal", _sel: _getSel("paused()") });
_addSpec({ _name: "OptimismPortal", _sel: OptimismPortal.proveWithdrawalTransaction.selector, _pausable: true }); _addSpec({ _name: "OptimismPortal", _sel: IOptimismPortal.proveWithdrawalTransaction.selector, _pausable: true });
_addSpec({ _name: "OptimismPortal", _sel: _getSel("provenWithdrawals(bytes32)") }); _addSpec({ _name: "OptimismPortal", _sel: _getSel("provenWithdrawals(bytes32)") });
_addSpec({ _name: "OptimismPortal", _sel: _getSel("superchainConfig()") }); _addSpec({ _name: "OptimismPortal", _sel: _getSel("superchainConfig()") });
_addSpec({ _name: "OptimismPortal", _sel: _getSel("systemConfig()") }); _addSpec({ _name: "OptimismPortal", _sel: _getSel("systemConfig()") });
...@@ -279,12 +287,12 @@ contract Specification_Test is CommonTest { ...@@ -279,12 +287,12 @@ contract Specification_Test is CommonTest {
_addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("donateETH()") }); _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("donateETH()") });
_addSpec({ _addSpec({
_name: "OptimismPortalInterop", _name: "OptimismPortalInterop",
_sel: OptimismPortal2.finalizeWithdrawalTransaction.selector, _sel: IOptimismPortal2.finalizeWithdrawalTransaction.selector,
_pausable: true _pausable: true
}); });
_addSpec({ _addSpec({
_name: "OptimismPortalInterop", _name: "OptimismPortalInterop",
_sel: OptimismPortal2.finalizeWithdrawalTransactionExternalProof.selector, _sel: IOptimismPortal2.finalizeWithdrawalTransactionExternalProof.selector,
_pausable: true _pausable: true
}); });
_addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("finalizedWithdrawals(bytes32)") }); _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("finalizedWithdrawals(bytes32)") });
...@@ -296,7 +304,7 @@ contract Specification_Test is CommonTest { ...@@ -296,7 +304,7 @@ contract Specification_Test is CommonTest {
_addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("paused()") }); _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("paused()") });
_addSpec({ _addSpec({
_name: "OptimismPortalInterop", _name: "OptimismPortalInterop",
_sel: OptimismPortal2.proveWithdrawalTransaction.selector, _sel: IOptimismPortal2.proveWithdrawalTransaction.selector,
_pausable: true _pausable: true
}); });
_addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("provenWithdrawals(bytes32,address)") }); _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("provenWithdrawals(bytes32,address)") });
...@@ -331,7 +339,7 @@ contract Specification_Test is CommonTest { ...@@ -331,7 +339,7 @@ contract Specification_Test is CommonTest {
_addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("setGasPayingToken(address,uint8,bytes32,bytes32)") }); _addSpec({ _name: "OptimismPortalInterop", _sel: _getSel("setGasPayingToken(address,uint8,bytes32,bytes32)") });
_addSpec({ _addSpec({
_name: "OptimismPortalInterop", _name: "OptimismPortalInterop",
_sel: OptimismPortalInterop.setConfig.selector, _sel: IOptimismPortalInterop.setConfig.selector,
_auth: Role.SYSTEMCONFIGOWNER _auth: Role.SYSTEMCONFIGOWNER
}); });
...@@ -340,12 +348,12 @@ contract Specification_Test is CommonTest { ...@@ -340,12 +348,12 @@ contract Specification_Test is CommonTest {
_addSpec({ _name: "OptimismPortal2", _sel: _getSel("donateETH()") }); _addSpec({ _name: "OptimismPortal2", _sel: _getSel("donateETH()") });
_addSpec({ _addSpec({
_name: "OptimismPortal2", _name: "OptimismPortal2",
_sel: OptimismPortal2.finalizeWithdrawalTransaction.selector, _sel: IOptimismPortal2.finalizeWithdrawalTransaction.selector,
_pausable: true _pausable: true
}); });
_addSpec({ _addSpec({
_name: "OptimismPortal2", _name: "OptimismPortal2",
_sel: OptimismPortal2.finalizeWithdrawalTransactionExternalProof.selector, _sel: IOptimismPortal2.finalizeWithdrawalTransactionExternalProof.selector,
_pausable: true _pausable: true
}); });
_addSpec({ _name: "OptimismPortal2", _sel: _getSel("finalizedWithdrawals(bytes32)") }); _addSpec({ _name: "OptimismPortal2", _sel: _getSel("finalizedWithdrawals(bytes32)") });
...@@ -355,7 +363,11 @@ contract Specification_Test is CommonTest { ...@@ -355,7 +363,11 @@ contract Specification_Test is CommonTest {
_addSpec({ _name: "OptimismPortal2", _sel: _getSel("minimumGasLimit(uint64)") }); _addSpec({ _name: "OptimismPortal2", _sel: _getSel("minimumGasLimit(uint64)") });
_addSpec({ _name: "OptimismPortal2", _sel: _getSel("params()") }); _addSpec({ _name: "OptimismPortal2", _sel: _getSel("params()") });
_addSpec({ _name: "OptimismPortal2", _sel: _getSel("paused()") }); _addSpec({ _name: "OptimismPortal2", _sel: _getSel("paused()") });
_addSpec({ _name: "OptimismPortal2", _sel: OptimismPortal2.proveWithdrawalTransaction.selector, _pausable: true }); _addSpec({
_name: "OptimismPortal2",
_sel: IOptimismPortal2.proveWithdrawalTransaction.selector,
_pausable: true
});
_addSpec({ _name: "OptimismPortal2", _sel: _getSel("provenWithdrawals(bytes32,address)") }); _addSpec({ _name: "OptimismPortal2", _sel: _getSel("provenWithdrawals(bytes32,address)") });
_addSpec({ _name: "OptimismPortal2", _sel: _getSel("superchainConfig()") }); _addSpec({ _name: "OptimismPortal2", _sel: _getSel("superchainConfig()") });
_addSpec({ _name: "OptimismPortal2", _sel: _getSel("systemConfig()") }); _addSpec({ _name: "OptimismPortal2", _sel: _getSel("systemConfig()") });
...@@ -419,23 +431,23 @@ contract Specification_Test is CommonTest { ...@@ -419,23 +431,23 @@ contract Specification_Test is CommonTest {
_addSpec({ _name: "SystemConfig", _sel: _getSel("VERSION()") }); _addSpec({ _name: "SystemConfig", _sel: _getSel("VERSION()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("batcherHash()") }); _addSpec({ _name: "SystemConfig", _sel: _getSel("batcherHash()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("gasLimit()") }); _addSpec({ _name: "SystemConfig", _sel: _getSel("gasLimit()") });
_addSpec({ _name: "SystemConfig", _sel: SystemConfig.initialize.selector }); _addSpec({ _name: "SystemConfig", _sel: ISystemConfig.initialize.selector });
_addSpec({ _name: "SystemConfig", _sel: SystemConfig.minimumGasLimit.selector }); _addSpec({ _name: "SystemConfig", _sel: ISystemConfig.minimumGasLimit.selector });
_addSpec({ _name: "SystemConfig", _sel: _getSel("overhead()") }); _addSpec({ _name: "SystemConfig", _sel: _getSel("overhead()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("owner()") }); _addSpec({ _name: "SystemConfig", _sel: _getSel("owner()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("renounceOwnership()"), _auth: Role.SYSTEMCONFIGOWNER }); _addSpec({ _name: "SystemConfig", _sel: _getSel("renounceOwnership()"), _auth: Role.SYSTEMCONFIGOWNER });
_addSpec({ _name: "SystemConfig", _sel: SystemConfig.resourceConfig.selector }); _addSpec({ _name: "SystemConfig", _sel: ISystemConfig.resourceConfig.selector });
_addSpec({ _name: "SystemConfig", _sel: _getSel("scalar()") }); _addSpec({ _name: "SystemConfig", _sel: _getSel("scalar()") });
_addSpec({ _name: "SystemConfig", _sel: SystemConfig.setBatcherHash.selector, _auth: Role.SYSTEMCONFIGOWNER }); _addSpec({ _name: "SystemConfig", _sel: ISystemConfig.setBatcherHash.selector, _auth: Role.SYSTEMCONFIGOWNER });
_addSpec({ _name: "SystemConfig", _sel: SystemConfig.setGasConfig.selector, _auth: Role.SYSTEMCONFIGOWNER }); _addSpec({ _name: "SystemConfig", _sel: ISystemConfig.setGasConfig.selector, _auth: Role.SYSTEMCONFIGOWNER });
_addSpec({ _name: "SystemConfig", _sel: SystemConfig.setGasLimit.selector, _auth: Role.SYSTEMCONFIGOWNER }); _addSpec({ _name: "SystemConfig", _sel: ISystemConfig.setGasLimit.selector, _auth: Role.SYSTEMCONFIGOWNER });
_addSpec({ _addSpec({
_name: "SystemConfig", _name: "SystemConfig",
_sel: SystemConfig.setUnsafeBlockSigner.selector, _sel: ISystemConfig.setUnsafeBlockSigner.selector,
_auth: Role.SYSTEMCONFIGOWNER _auth: Role.SYSTEMCONFIGOWNER
}); });
_addSpec({ _name: "SystemConfig", _sel: _getSel("transferOwnership(address)"), _auth: Role.SYSTEMCONFIGOWNER }); _addSpec({ _name: "SystemConfig", _sel: _getSel("transferOwnership(address)"), _auth: Role.SYSTEMCONFIGOWNER });
_addSpec({ _name: "SystemConfig", _sel: SystemConfig.unsafeBlockSigner.selector }); _addSpec({ _name: "SystemConfig", _sel: ISystemConfig.unsafeBlockSigner.selector });
_addSpec({ _name: "SystemConfig", _sel: _getSel("version()") }); _addSpec({ _name: "SystemConfig", _sel: _getSel("version()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("l1CrossDomainMessenger()") }); _addSpec({ _name: "SystemConfig", _sel: _getSel("l1CrossDomainMessenger()") });
_addSpec({ _name: "SystemConfig", _sel: _getSel("l1ERC721Bridge()") }); _addSpec({ _name: "SystemConfig", _sel: _getSel("l1ERC721Bridge()") });
...@@ -471,27 +483,31 @@ contract Specification_Test is CommonTest { ...@@ -471,27 +483,31 @@ contract Specification_Test is CommonTest {
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("VERSION()") }); _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("VERSION()") });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("batcherHash()") }); _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("batcherHash()") });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("gasLimit()") }); _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("gasLimit()") });
_addSpec({ _name: "SystemConfigInterop", _sel: SystemConfig.initialize.selector }); _addSpec({ _name: "SystemConfigInterop", _sel: ISystemConfig.initialize.selector });
_addSpec({ _name: "SystemConfigInterop", _sel: SystemConfig.minimumGasLimit.selector }); _addSpec({ _name: "SystemConfigInterop", _sel: ISystemConfig.minimumGasLimit.selector });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("overhead()") }); _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("overhead()") });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("owner()") }); _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("owner()") });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("renounceOwnership()"), _auth: Role.SYSTEMCONFIGOWNER }); _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("renounceOwnership()"), _auth: Role.SYSTEMCONFIGOWNER });
_addSpec({ _name: "SystemConfigInterop", _sel: SystemConfig.resourceConfig.selector }); _addSpec({ _name: "SystemConfigInterop", _sel: ISystemConfig.resourceConfig.selector });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("scalar()") }); _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("scalar()") });
_addSpec({ _addSpec({
_name: "SystemConfigInterop", _name: "SystemConfigInterop",
_sel: SystemConfig.setBatcherHash.selector, _sel: ISystemConfig.setBatcherHash.selector,
_auth: Role.SYSTEMCONFIGOWNER
});
_addSpec({
_name: "SystemConfigInterop",
_sel: ISystemConfig.setGasConfig.selector,
_auth: Role.SYSTEMCONFIGOWNER _auth: Role.SYSTEMCONFIGOWNER
}); });
_addSpec({ _addSpec({
_name: "SystemConfigInterop", _name: "SystemConfigInterop",
_sel: SystemConfig.setGasConfig.selector, _sel: ISystemConfig.setGasLimit.selector,
_auth: Role.SYSTEMCONFIGOWNER _auth: Role.SYSTEMCONFIGOWNER
}); });
_addSpec({ _name: "SystemConfigInterop", _sel: SystemConfig.setGasLimit.selector, _auth: Role.SYSTEMCONFIGOWNER });
_addSpec({ _addSpec({
_name: "SystemConfigInterop", _name: "SystemConfigInterop",
_sel: SystemConfig.setUnsafeBlockSigner.selector, _sel: ISystemConfig.setUnsafeBlockSigner.selector,
_auth: Role.SYSTEMCONFIGOWNER _auth: Role.SYSTEMCONFIGOWNER
}); });
_addSpec({ _addSpec({
...@@ -499,7 +515,7 @@ contract Specification_Test is CommonTest { ...@@ -499,7 +515,7 @@ contract Specification_Test is CommonTest {
_sel: _getSel("transferOwnership(address)"), _sel: _getSel("transferOwnership(address)"),
_auth: Role.SYSTEMCONFIGOWNER _auth: Role.SYSTEMCONFIGOWNER
}); });
_addSpec({ _name: "SystemConfigInterop", _sel: SystemConfig.unsafeBlockSigner.selector }); _addSpec({ _name: "SystemConfigInterop", _sel: ISystemConfig.unsafeBlockSigner.selector });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("version()") }); _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("version()") });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("l1CrossDomainMessenger()") }); _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("l1CrossDomainMessenger()") });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("l1ERC721Bridge()") }); _addSpec({ _name: "SystemConfigInterop", _sel: _getSel("l1ERC721Bridge()") });
......
...@@ -3,8 +3,8 @@ pragma solidity 0.8.15; ...@@ -3,8 +3,8 @@ pragma solidity 0.8.15;
import { StdUtils } from "forge-std/StdUtils.sol"; import { StdUtils } from "forge-std/StdUtils.sol";
import { Vm } from "forge-std/Vm.sol"; import { Vm } from "forge-std/Vm.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol"; import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol"; import { IL1CrossDomainMessenger } from "src/L1/interfaces/IL1CrossDomainMessenger.sol";
import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol"; import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
...@@ -20,12 +20,12 @@ contract RelayActor is StdUtils { ...@@ -20,12 +20,12 @@ contract RelayActor is StdUtils {
bytes32[] public hashes; bytes32[] public hashes;
bool public reverted = false; bool public reverted = false;
OptimismPortal op; IOptimismPortal op;
L1CrossDomainMessenger xdm; IL1CrossDomainMessenger xdm;
Vm vm; Vm vm;
bool doFail; bool doFail;
constructor(OptimismPortal _op, L1CrossDomainMessenger _xdm, Vm _vm, bool _doFail) { constructor(IOptimismPortal _op, IL1CrossDomainMessenger _xdm, Vm _vm, bool _doFail) {
op = _op; op = _op;
xdm = _xdm; xdm = _xdm;
vm = _vm; vm = _vm;
......
...@@ -4,8 +4,9 @@ pragma solidity 0.8.15; ...@@ -4,8 +4,9 @@ pragma solidity 0.8.15;
import { StdUtils } from "forge-std/Test.sol"; import { StdUtils } from "forge-std/Test.sol";
import { Vm } from "forge-std/Vm.sol"; import { Vm } from "forge-std/Vm.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol"; import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol"; import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { CommonTest } from "test/setup/CommonTest.sol"; import { CommonTest } from "test/setup/CommonTest.sol";
...@@ -14,10 +15,10 @@ import { Types } from "src/libraries/Types.sol"; ...@@ -14,10 +15,10 @@ import { Types } from "src/libraries/Types.sol";
contract OptimismPortal_Depositor is StdUtils, ResourceMetering { contract OptimismPortal_Depositor is StdUtils, ResourceMetering {
Vm internal vm; Vm internal vm;
OptimismPortal internal portal; IOptimismPortal internal portal;
bool public failedToComplete; bool public failedToComplete;
constructor(Vm _vm, OptimismPortal _portal) { constructor(Vm _vm, IOptimismPortal _portal) {
vm = _vm; vm = _vm;
portal = _portal; portal = _portal;
initialize(); initialize();
...@@ -31,9 +32,11 @@ contract OptimismPortal_Depositor is StdUtils, ResourceMetering { ...@@ -31,9 +32,11 @@ contract OptimismPortal_Depositor is StdUtils, ResourceMetering {
return _resourceConfig(); return _resourceConfig();
} }
function _resourceConfig() internal pure override returns (ResourceMetering.ResourceConfig memory) { function _resourceConfig() internal pure override returns (ResourceMetering.ResourceConfig memory config_) {
ResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG(); IResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG();
return rcfg; assembly ("memory-safe") {
config_ := rcfg
}
} }
// A test intended to identify any unexpected halting conditions // A test intended to identify any unexpected halting conditions
......
...@@ -4,10 +4,10 @@ pragma solidity 0.8.15; ...@@ -4,10 +4,10 @@ pragma solidity 0.8.15;
import { StdUtils } from "forge-std/Test.sol"; import { StdUtils } from "forge-std/Test.sol";
import { Vm } from "forge-std/Vm.sol"; import { Vm } from "forge-std/Vm.sol";
import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol"; import { IOptimismPortal2 } from "src/L1/interfaces/IOptimismPortal2.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol"; import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol"; import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { CommonTest } from "test/setup/CommonTest.sol"; import { CommonTest } from "test/setup/CommonTest.sol";
...@@ -20,10 +20,10 @@ import "src/libraries/PortalErrors.sol"; ...@@ -20,10 +20,10 @@ import "src/libraries/PortalErrors.sol";
contract OptimismPortal2_Depositor is StdUtils, ResourceMetering { contract OptimismPortal2_Depositor is StdUtils, ResourceMetering {
Vm internal vm; Vm internal vm;
OptimismPortal2 internal portal; IOptimismPortal2 internal portal;
bool public failedToComplete; bool public failedToComplete;
constructor(Vm _vm, OptimismPortal2 _portal) { constructor(Vm _vm, IOptimismPortal2 _portal) {
vm = _vm; vm = _vm;
portal = _portal; portal = _portal;
initialize(); initialize();
...@@ -37,9 +37,11 @@ contract OptimismPortal2_Depositor is StdUtils, ResourceMetering { ...@@ -37,9 +37,11 @@ contract OptimismPortal2_Depositor is StdUtils, ResourceMetering {
return _resourceConfig(); return _resourceConfig();
} }
function _resourceConfig() internal pure override returns (ResourceMetering.ResourceConfig memory) { function _resourceConfig() internal pure override returns (ResourceMetering.ResourceConfig memory config_) {
ResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG(); IResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG();
return rcfg; assembly ("memory-safe") {
config_ := rcfg
}
} }
// A test intended to identify any unexpected halting conditions // A test intended to identify any unexpected halting conditions
......
...@@ -8,6 +8,7 @@ import { StdInvariant } from "forge-std/StdInvariant.sol"; ...@@ -8,6 +8,7 @@ import { StdInvariant } from "forge-std/StdInvariant.sol";
import { Arithmetic } from "src/libraries/Arithmetic.sol"; import { Arithmetic } from "src/libraries/Arithmetic.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol"; import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { InvariantTest } from "test/invariants/InvariantTest.sol"; import { InvariantTest } from "test/invariants/InvariantTest.sol";
...@@ -35,9 +36,11 @@ contract ResourceMetering_User is StdUtils, ResourceMetering { ...@@ -35,9 +36,11 @@ contract ResourceMetering_User is StdUtils, ResourceMetering {
return _resourceConfig(); return _resourceConfig();
} }
function _resourceConfig() internal pure override returns (ResourceMetering.ResourceConfig memory) { function _resourceConfig() internal pure override returns (ResourceMetering.ResourceConfig memory config_) {
ResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG(); IResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG();
return rcfg; assembly ("memory-safe") {
config_ := rcfg
}
} }
/// @notice Takes the necessary parameters to allow us to burn arbitrary amounts of gas to test /// @notice Takes the necessary parameters to allow us to burn arbitrary amounts of gas to test
......
...@@ -3,15 +3,16 @@ pragma solidity 0.8.15; ...@@ -3,15 +3,16 @@ pragma solidity 0.8.15;
import { Test } from "forge-std/Test.sol"; import { Test } from "forge-std/Test.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol"; import { SystemConfig } from "src/L1/SystemConfig.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { Proxy } from "src/universal/Proxy.sol"; import { Proxy } from "src/universal/Proxy.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
contract SystemConfig_GasLimitBoundaries_Invariant is Test { contract SystemConfig_GasLimitBoundaries_Invariant is Test {
SystemConfig public config; ISystemConfig public config;
function setUp() external { function setUp() external {
Proxy proxy = new Proxy(msg.sender); Proxy proxy = new Proxy(msg.sender);
SystemConfig configImpl = new SystemConfig(); ISystemConfig configImpl = ISystemConfig(address(new SystemConfig()));
vm.prank(msg.sender); vm.prank(msg.sender);
proxy.upgradeToAndCall( proxy.upgradeToAndCall(
...@@ -27,7 +28,7 @@ contract SystemConfig_GasLimitBoundaries_Invariant is Test { ...@@ -27,7 +28,7 @@ contract SystemConfig_GasLimitBoundaries_Invariant is Test {
address(1), // unsafe block signer address(1), // unsafe block signer
Constants.DEFAULT_RESOURCE_CONFIG(), Constants.DEFAULT_RESOURCE_CONFIG(),
address(0), // _batchInbox address(0), // _batchInbox
SystemConfig.Addresses({ // _addrs ISystemConfig.Addresses({ // _addrs
l1CrossDomainMessenger: address(0), l1CrossDomainMessenger: address(0),
l1ERC721Bridge: address(0), l1ERC721Bridge: address(0),
l1StandardBridge: address(0), l1StandardBridge: address(0),
...@@ -40,7 +41,7 @@ contract SystemConfig_GasLimitBoundaries_Invariant is Test { ...@@ -40,7 +41,7 @@ contract SystemConfig_GasLimitBoundaries_Invariant is Test {
) )
); );
config = SystemConfig(address(proxy)); config = ISystemConfig(address(proxy));
// Set the target contract to the `config` // Set the target contract to the `config`
targetContract(address(config)); targetContract(address(config));
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Testing
import { console2 as console } from "forge-std/console2.sol"; import { console2 as console } from "forge-std/console2.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Vm } from "forge-std/Vm.sol";
import { Preinstalls } from "src/libraries/Preinstalls.sol";
// Scripts
import { DeployConfig } from "scripts/deploy/DeployConfig.s.sol";
import { Deploy } from "scripts/deploy/Deploy.s.sol";
import { Fork, LATEST_FORK } from "scripts/libraries/Config.sol";
import { L2Genesis, L1Dependencies } from "scripts/L2Genesis.s.sol";
import { OutputMode, Fork, ForkUtils } from "scripts/libraries/Config.sol";
import { Executables } from "scripts/libraries/Executables.sol";
// Contracts
import { L2CrossDomainMessenger } from "src/L2/L2CrossDomainMessenger.sol"; import { L2CrossDomainMessenger } from "src/L2/L2CrossDomainMessenger.sol";
import { L2StandardBridgeInterop } from "src/L2/L2StandardBridgeInterop.sol"; import { L2StandardBridgeInterop } from "src/L2/L2StandardBridgeInterop.sol";
import { L2ToL1MessagePasser } from "src/L2/L2ToL1MessagePasser.sol"; import { L2ToL1MessagePasser } from "src/L2/L2ToL1MessagePasser.sol";
...@@ -18,31 +28,30 @@ import { GovernanceToken } from "src/governance/GovernanceToken.sol"; ...@@ -18,31 +28,30 @@ import { GovernanceToken } from "src/governance/GovernanceToken.sol";
import { OptimismMintableERC20Factory } from "src/universal/OptimismMintableERC20Factory.sol"; import { OptimismMintableERC20Factory } from "src/universal/OptimismMintableERC20Factory.sol";
import { StandardBridge } from "src/universal/StandardBridge.sol"; import { StandardBridge } from "src/universal/StandardBridge.sol";
import { FeeVault } from "src/universal/FeeVault.sol"; import { FeeVault } from "src/universal/FeeVault.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol";
import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol"; import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol"; import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol";
import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol"; import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol";
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol";
import { DeployConfig } from "scripts/deploy/DeployConfig.s.sol";
import { Deploy } from "scripts/deploy/Deploy.s.sol";
import { Fork, LATEST_FORK } from "scripts/libraries/Config.sol";
import { L2Genesis, L1Dependencies } from "scripts/L2Genesis.s.sol";
import { OutputMode, Fork, ForkUtils } from "scripts/libraries/Config.sol";
import { IL2OutputOracle } from "src/L1/interfaces/IL2OutputOracle.sol";
import { ProtocolVersions } from "src/L1/ProtocolVersions.sol"; import { ProtocolVersions } from "src/L1/ProtocolVersions.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { L1StandardBridge } from "src/L1/L1StandardBridge.sol"; import { L1StandardBridge } from "src/L1/L1StandardBridge.sol";
import { AddressManager } from "src/legacy/AddressManager.sol"; import { AddressManager } from "src/legacy/AddressManager.sol";
import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import { Executables } from "scripts/libraries/Executables.sol";
import { Vm } from "forge-std/Vm.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { DataAvailabilityChallenge } from "src/L1/DataAvailabilityChallenge.sol";
import { WETH } from "src/L2/WETH.sol"; import { WETH } from "src/L2/WETH.sol";
import { SuperchainWETH } from "src/L2/SuperchainWETH.sol"; import { SuperchainWETH } from "src/L2/SuperchainWETH.sol";
import { ETHLiquidity } from "src/L2/ETHLiquidity.sol"; import { ETHLiquidity } from "src/L2/ETHLiquidity.sol";
import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol";
// Libraries
import { Predeploys } from "src/libraries/Predeploys.sol";
import { Preinstalls } from "src/libraries/Preinstalls.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
// Interfaces
import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
import { IOptimismPortal2 } from "src/L1/interfaces/IOptimismPortal2.sol";
import { IL1CrossDomainMessenger } from "src/L1/interfaces/IL1CrossDomainMessenger.sol";
import { IL2OutputOracle } from "src/L1/interfaces/IL2OutputOracle.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { IDataAvailabilityChallenge } from "src/L1/interfaces/IDataAvailabilityChallenge.sol";
/// @title Setup /// @title Setup
/// @dev This contact is responsible for setting up the contracts in state. It currently /// @dev This contact is responsible for setting up the contracts in state. It currently
...@@ -65,20 +74,20 @@ contract Setup { ...@@ -65,20 +74,20 @@ contract Setup {
// @notice Allows users of Setup to override what L2 genesis is being created. // @notice Allows users of Setup to override what L2 genesis is being created.
Fork l2Fork = LATEST_FORK; Fork l2Fork = LATEST_FORK;
OptimismPortal optimismPortal; IOptimismPortal optimismPortal;
OptimismPortal2 optimismPortal2; IOptimismPortal2 optimismPortal2;
DisputeGameFactory disputeGameFactory; DisputeGameFactory disputeGameFactory;
DelayedWETH delayedWeth; DelayedWETH delayedWeth;
IL2OutputOracle l2OutputOracle; IL2OutputOracle l2OutputOracle;
SystemConfig systemConfig; ISystemConfig systemConfig;
L1StandardBridge l1StandardBridge; L1StandardBridge l1StandardBridge;
L1CrossDomainMessenger l1CrossDomainMessenger; IL1CrossDomainMessenger l1CrossDomainMessenger;
AddressManager addressManager; AddressManager addressManager;
L1ERC721Bridge l1ERC721Bridge; L1ERC721Bridge l1ERC721Bridge;
OptimismMintableERC20Factory l1OptimismMintableERC20Factory; OptimismMintableERC20Factory l1OptimismMintableERC20Factory;
ProtocolVersions protocolVersions; ProtocolVersions protocolVersions;
SuperchainConfig superchainConfig; ISuperchainConfig superchainConfig;
DataAvailabilityChallenge dataAvailabilityChallenge; IDataAvailabilityChallenge dataAvailabilityChallenge;
AnchorStateRegistry anchorStateRegistry; AnchorStateRegistry anchorStateRegistry;
L2CrossDomainMessenger l2CrossDomainMessenger = L2CrossDomainMessenger l2CrossDomainMessenger =
...@@ -131,20 +140,20 @@ contract Setup { ...@@ -131,20 +140,20 @@ contract Setup {
deploy.run(); deploy.run();
console.log("Setup: completed L1 deployment, registering addresses now"); console.log("Setup: completed L1 deployment, registering addresses now");
optimismPortal = OptimismPortal(deploy.mustGetAddress("OptimismPortalProxy")); optimismPortal = IOptimismPortal(deploy.mustGetAddress("OptimismPortalProxy"));
optimismPortal2 = OptimismPortal2(deploy.mustGetAddress("OptimismPortalProxy")); optimismPortal2 = IOptimismPortal2(deploy.mustGetAddress("OptimismPortalProxy"));
disputeGameFactory = DisputeGameFactory(deploy.mustGetAddress("DisputeGameFactoryProxy")); disputeGameFactory = DisputeGameFactory(deploy.mustGetAddress("DisputeGameFactoryProxy"));
delayedWeth = DelayedWETH(deploy.mustGetAddress("DelayedWETHProxy")); delayedWeth = DelayedWETH(deploy.mustGetAddress("DelayedWETHProxy"));
l2OutputOracle = IL2OutputOracle(deploy.mustGetAddress("L2OutputOracleProxy")); l2OutputOracle = IL2OutputOracle(deploy.mustGetAddress("L2OutputOracleProxy"));
systemConfig = SystemConfig(deploy.mustGetAddress("SystemConfigProxy")); systemConfig = ISystemConfig(deploy.mustGetAddress("SystemConfigProxy"));
l1StandardBridge = L1StandardBridge(deploy.mustGetAddress("L1StandardBridgeProxy")); l1StandardBridge = L1StandardBridge(deploy.mustGetAddress("L1StandardBridgeProxy"));
l1CrossDomainMessenger = L1CrossDomainMessenger(deploy.mustGetAddress("L1CrossDomainMessengerProxy")); l1CrossDomainMessenger = IL1CrossDomainMessenger(deploy.mustGetAddress("L1CrossDomainMessengerProxy"));
addressManager = AddressManager(deploy.mustGetAddress("AddressManager")); addressManager = AddressManager(deploy.mustGetAddress("AddressManager"));
l1ERC721Bridge = L1ERC721Bridge(deploy.mustGetAddress("L1ERC721BridgeProxy")); l1ERC721Bridge = L1ERC721Bridge(deploy.mustGetAddress("L1ERC721BridgeProxy"));
l1OptimismMintableERC20Factory = l1OptimismMintableERC20Factory =
OptimismMintableERC20Factory(deploy.mustGetAddress("OptimismMintableERC20FactoryProxy")); OptimismMintableERC20Factory(deploy.mustGetAddress("OptimismMintableERC20FactoryProxy"));
protocolVersions = ProtocolVersions(deploy.mustGetAddress("ProtocolVersionsProxy")); protocolVersions = ProtocolVersions(deploy.mustGetAddress("ProtocolVersionsProxy"));
superchainConfig = SuperchainConfig(deploy.mustGetAddress("SuperchainConfigProxy")); superchainConfig = ISuperchainConfig(deploy.mustGetAddress("SuperchainConfigProxy"));
anchorStateRegistry = AnchorStateRegistry(deploy.mustGetAddress("AnchorStateRegistryProxy")); anchorStateRegistry = AnchorStateRegistry(deploy.mustGetAddress("AnchorStateRegistryProxy"));
vm.label(address(l2OutputOracle), "L2OutputOracle"); vm.label(address(l2OutputOracle), "L2OutputOracle");
...@@ -174,7 +183,7 @@ contract Setup { ...@@ -174,7 +183,7 @@ contract Setup {
if (deploy.cfg().useAltDA()) { if (deploy.cfg().useAltDA()) {
dataAvailabilityChallenge = dataAvailabilityChallenge =
DataAvailabilityChallenge(deploy.mustGetAddress("DataAvailabilityChallengeProxy")); IDataAvailabilityChallenge(deploy.mustGetAddress("DataAvailabilityChallengeProxy"));
vm.label(address(dataAvailabilityChallenge), "DataAvailabilityChallengeProxy"); vm.label(address(dataAvailabilityChallenge), "DataAvailabilityChallengeProxy");
vm.label(deploy.mustGetAddress("DataAvailabilityChallenge"), "DataAvailabilityChallenge"); vm.label(deploy.mustGetAddress("DataAvailabilityChallenge"), "DataAvailabilityChallenge");
} }
......
...@@ -11,7 +11,7 @@ import { Predeploys } from "src/libraries/Predeploys.sol"; ...@@ -11,7 +11,7 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
import { Hashing } from "src/libraries/Hashing.sol"; import { Hashing } from "src/libraries/Hashing.sol";
import { Encoding } from "src/libraries/Encoding.sol"; import { Encoding } from "src/libraries/Encoding.sol";
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol"; import { IL1CrossDomainMessenger } from "src/L1/interfaces/IL1CrossDomainMessenger.sol";
// CrossDomainMessenger_Test is for testing functionality which is common to both the L1 and L2 // CrossDomainMessenger_Test is for testing functionality which is common to both the L1 and L2
// CrossDomainMessenger contracts. For simplicity, we use the L1 Messenger as the test contract. // CrossDomainMessenger contracts. For simplicity, we use the L1 Messenger as the test contract.
...@@ -45,11 +45,11 @@ contract CrossDomainMessenger_BaseGas_Test is Bridge_Initializer { ...@@ -45,11 +45,11 @@ contract CrossDomainMessenger_BaseGas_Test is Bridge_Initializer {
contract ExternalRelay is Test { contract ExternalRelay is Test {
address internal op; address internal op;
address internal fuzzedSender; address internal fuzzedSender;
L1CrossDomainMessenger internal l1CrossDomainMessenger; IL1CrossDomainMessenger internal l1CrossDomainMessenger;
event FailedRelayedMessage(bytes32 indexed msgHash); event FailedRelayedMessage(bytes32 indexed msgHash);
constructor(L1CrossDomainMessenger _l1Messenger, address _op) { constructor(IL1CrossDomainMessenger _l1Messenger, address _op) {
l1CrossDomainMessenger = _l1Messenger; l1CrossDomainMessenger = _l1Messenger;
op = _op; op = _op;
} }
......
...@@ -6,11 +6,11 @@ import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol"; ...@@ -6,11 +6,11 @@ import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol";
import { Executables } from "scripts/libraries/Executables.sol"; import { Executables } from "scripts/libraries/Executables.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol"; import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol"; import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { SystemConfigInterop } from "src/L1/SystemConfigInterop.sol"; import { SystemConfigInterop } from "src/L1/SystemConfigInterop.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol"; import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol";
import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol"; import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol";
import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol"; import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol";
import { PermissionedDisputeGame } from "src/dispute/PermissionedDisputeGame.sol"; import { PermissionedDisputeGame } from "src/dispute/PermissionedDisputeGame.sol";
...@@ -108,7 +108,7 @@ contract Initializer_Test is Bridge_Initializer { ...@@ -108,7 +108,7 @@ contract Initializer_Test is Bridge_Initializer {
InitializeableContract({ InitializeableContract({
name: "DelayedWETH", name: "DelayedWETH",
target: deploy.mustGetAddress("DelayedWETH"), target: deploy.mustGetAddress("DelayedWETH"),
initCalldata: abi.encodeCall(delayedWeth.initialize, (address(0), SuperchainConfig(address(0)))) initCalldata: abi.encodeCall(delayedWeth.initialize, (address(0), ISuperchainConfig(address(0))))
}) })
); );
// DelayedWETHProxy // DelayedWETHProxy
...@@ -116,7 +116,7 @@ contract Initializer_Test is Bridge_Initializer { ...@@ -116,7 +116,7 @@ contract Initializer_Test is Bridge_Initializer {
InitializeableContract({ InitializeableContract({
name: "DelayedWETHProxy", name: "DelayedWETHProxy",
target: address(delayedWeth), target: address(delayedWeth),
initCalldata: abi.encodeCall(delayedWeth.initialize, (address(0), SuperchainConfig(address(0)))) initCalldata: abi.encodeCall(delayedWeth.initialize, (address(0), ISuperchainConfig(address(0))))
}) })
); );
// L2OutputOracleImpl // L2OutputOracleImpl
...@@ -181,7 +181,7 @@ contract Initializer_Test is Bridge_Initializer { ...@@ -181,7 +181,7 @@ contract Initializer_Test is Bridge_Initializer {
bytes32(0), bytes32(0),
1, 1,
address(0), address(0),
ResourceMetering.ResourceConfig({ IResourceMetering.ResourceConfig({
maxResourceLimit: 1, maxResourceLimit: 1,
elasticityMultiplier: 1, elasticityMultiplier: 1,
baseFeeMaxChangeDenominator: 2, baseFeeMaxChangeDenominator: 2,
...@@ -190,7 +190,7 @@ contract Initializer_Test is Bridge_Initializer { ...@@ -190,7 +190,7 @@ contract Initializer_Test is Bridge_Initializer {
maximumBaseFee: 0 maximumBaseFee: 0
}), }),
address(0), address(0),
SystemConfig.Addresses({ ISystemConfig.Addresses({
l1CrossDomainMessenger: address(0), l1CrossDomainMessenger: address(0),
l1ERC721Bridge: address(0), l1ERC721Bridge: address(0),
l1StandardBridge: address(0), l1StandardBridge: address(0),
...@@ -217,7 +217,7 @@ contract Initializer_Test is Bridge_Initializer { ...@@ -217,7 +217,7 @@ contract Initializer_Test is Bridge_Initializer {
bytes32(0), bytes32(0),
1, 1,
address(0), address(0),
ResourceMetering.ResourceConfig({ IResourceMetering.ResourceConfig({
maxResourceLimit: 1, maxResourceLimit: 1,
elasticityMultiplier: 1, elasticityMultiplier: 1,
baseFeeMaxChangeDenominator: 2, baseFeeMaxChangeDenominator: 2,
...@@ -226,7 +226,7 @@ contract Initializer_Test is Bridge_Initializer { ...@@ -226,7 +226,7 @@ contract Initializer_Test is Bridge_Initializer {
maximumBaseFee: 0 maximumBaseFee: 0
}), }),
address(0), address(0),
SystemConfig.Addresses({ ISystemConfig.Addresses({
l1CrossDomainMessenger: address(0), l1CrossDomainMessenger: address(0),
l1ERC721Bridge: address(0), l1ERC721Bridge: address(0),
l1StandardBridge: address(0), l1StandardBridge: address(0),
...@@ -264,7 +264,9 @@ contract Initializer_Test is Bridge_Initializer { ...@@ -264,7 +264,9 @@ contract Initializer_Test is Bridge_Initializer {
InitializeableContract({ InitializeableContract({
name: "L2CrossDomainMessenger", name: "L2CrossDomainMessenger",
target: address(l2CrossDomainMessenger), target: address(l2CrossDomainMessenger),
initCalldata: abi.encodeCall(l2CrossDomainMessenger.initialize, (l1CrossDomainMessenger)) initCalldata: abi.encodeCall(
l2CrossDomainMessenger.initialize, (CrossDomainMessenger(address(l1CrossDomainMessenger)))
)
}) })
); );
// L1StandardBridgeImpl // L1StandardBridgeImpl
...@@ -273,7 +275,8 @@ contract Initializer_Test is Bridge_Initializer { ...@@ -273,7 +275,8 @@ contract Initializer_Test is Bridge_Initializer {
name: "L1StandardBridge", name: "L1StandardBridge",
target: deploy.mustGetAddress("L1StandardBridge"), target: deploy.mustGetAddress("L1StandardBridge"),
initCalldata: abi.encodeCall( initCalldata: abi.encodeCall(
l1StandardBridge.initialize, (l1CrossDomainMessenger, superchainConfig, systemConfig) l1StandardBridge.initialize,
(ICrossDomainMessenger(address(l1CrossDomainMessenger)), superchainConfig, systemConfig)
) )
}) })
); );
...@@ -283,7 +286,8 @@ contract Initializer_Test is Bridge_Initializer { ...@@ -283,7 +286,8 @@ contract Initializer_Test is Bridge_Initializer {
name: "L1StandardBridgeProxy", name: "L1StandardBridgeProxy",
target: address(l1StandardBridge), target: address(l1StandardBridge),
initCalldata: abi.encodeCall( initCalldata: abi.encodeCall(
l1StandardBridge.initialize, (l1CrossDomainMessenger, superchainConfig, systemConfig) l1StandardBridge.initialize,
(ICrossDomainMessenger(address(l1CrossDomainMessenger)), superchainConfig, systemConfig)
) )
}) })
); );
...@@ -308,7 +312,9 @@ contract Initializer_Test is Bridge_Initializer { ...@@ -308,7 +312,9 @@ contract Initializer_Test is Bridge_Initializer {
InitializeableContract({ InitializeableContract({
name: "L1ERC721Bridge", name: "L1ERC721Bridge",
target: deploy.mustGetAddress("L1ERC721Bridge"), target: deploy.mustGetAddress("L1ERC721Bridge"),
initCalldata: abi.encodeCall(l1ERC721Bridge.initialize, (l1CrossDomainMessenger, superchainConfig)) initCalldata: abi.encodeCall(
l1ERC721Bridge.initialize, (ICrossDomainMessenger(address(l1CrossDomainMessenger)), superchainConfig)
)
}) })
); );
// L1ERC721BridgeProxy // L1ERC721BridgeProxy
...@@ -316,7 +322,9 @@ contract Initializer_Test is Bridge_Initializer { ...@@ -316,7 +322,9 @@ contract Initializer_Test is Bridge_Initializer {
InitializeableContract({ InitializeableContract({
name: "L1ERC721BridgeProxy", name: "L1ERC721BridgeProxy",
target: address(l1ERC721Bridge), target: address(l1ERC721Bridge),
initCalldata: abi.encodeCall(l1ERC721Bridge.initialize, (l1CrossDomainMessenger, superchainConfig)) initCalldata: abi.encodeCall(
l1ERC721Bridge.initialize, (ICrossDomainMessenger(address(l1CrossDomainMessenger)), superchainConfig)
)
}) })
); );
// L2ERC721Bridge // L2ERC721Bridge
...@@ -366,7 +374,7 @@ contract Initializer_Test is Bridge_Initializer { ...@@ -366,7 +374,7 @@ contract Initializer_Test is Bridge_Initializer {
target: address(anchorStateRegistry), target: address(anchorStateRegistry),
initCalldata: abi.encodeCall( initCalldata: abi.encodeCall(
anchorStateRegistry.initialize, anchorStateRegistry.initialize,
(new AnchorStateRegistry.StartingAnchorRoot[](1), SuperchainConfig(address(0))) (new AnchorStateRegistry.StartingAnchorRoot[](1), ISuperchainConfig(address(0)))
) )
}) })
); );
...@@ -377,7 +385,7 @@ contract Initializer_Test is Bridge_Initializer { ...@@ -377,7 +385,7 @@ contract Initializer_Test is Bridge_Initializer {
target: address(anchorStateRegistry), target: address(anchorStateRegistry),
initCalldata: abi.encodeCall( initCalldata: abi.encodeCall(
anchorStateRegistry.initialize, anchorStateRegistry.initialize,
(new AnchorStateRegistry.StartingAnchorRoot[](1), SuperchainConfig(address(0))) (new AnchorStateRegistry.StartingAnchorRoot[](1), ISuperchainConfig(address(0)))
) )
}) })
); );
......
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