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
GasBenchMark_L1BlockIsthmus_SetValuesIsthmus_Warm:test_setL1BlockValuesIsthmus_benchmark() (gas: 5121)
GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (gas: 158531)
GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7597)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369356)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967496)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 564483)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4076526)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 466947)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3512629)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369242)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967382)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 564365)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4076580)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 467007)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3512689)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 72624)
GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 92973)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 68433)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 68903)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 68320)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 68962)
GasBenchMark_OptimismPortal:test_proveWithdrawalTransaction_benchmark() (gas: 155618)
\ No newline at end of file
# `OptimismPortal` Invariants
## 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.
## `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.
## `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.
## 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.
\ No newline at end of file
# `OptimismPortal2` Invariants
## 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.
## `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.
## `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.
## 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.
\ No newline at end of file
# `ResourceMetering` Invariants
## 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.
## 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.
## 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.
## 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.
## 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`
## 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`
## 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.
\ No newline at end of file
# `SystemConfig` Invariants
## 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.
\ No newline at end of file
......@@ -21,7 +21,7 @@ import { OptimismMintableERC721Factory } from "src/universal/OptimismMintableERC
import { BaseFeeVault } from "src/L2/BaseFeeVault.sol";
import { L1FeeVault } from "src/L2/L1FeeVault.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 { FeeVault } from "src/universal/FeeVault.sol";
import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
......@@ -277,10 +277,10 @@ contract L2Genesis is Deployer {
function setL2CrossDomainMessenger(address payable _l1CrossDomainMessengerProxy) public {
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({
_l1CrossDomainMessenger: L1CrossDomainMessenger(_l1CrossDomainMessengerProxy)
_l1CrossDomainMessenger: CrossDomainMessenger(_l1CrossDomainMessengerProxy)
});
}
......
......@@ -180,8 +180,24 @@ for interface_file in $JSON_FILES; do
interface_abi=$(jq '[.abi[] | select(.type != "constructor")]' < "$interface_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
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
echo "$contract_name" >> "$REPORTED_INTERFACES_FILE"
if ! is_excluded "$contract_name"; then
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
// Testing
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 { 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 { IL2OutputOracle } from "src/L1/interfaces/IL2OutputOracle.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol";
import { ProtocolVersion, ProtocolVersions } from "src/L1/ProtocolVersions.sol";
import { 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 { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol";
// Libraries
import { Constants } from "src/libraries/Constants.sol";
import { Predeploys } from "src/libraries/Predeploys.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 { console2 as console } from "forge-std/console2.sol";
library ChainAssertions {
Vm internal constant vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
......@@ -39,8 +48,8 @@ library ChainAssertions {
view
{
console.log("Running post-deploy assertions");
ResourceMetering.ResourceConfig memory rcfg = SystemConfig(_prox.SystemConfig).resourceConfig();
ResourceMetering.ResourceConfig memory dflt = Constants.DEFAULT_RESOURCE_CONFIG();
IResourceMetering.ResourceConfig memory rcfg = ISystemConfig(_prox.SystemConfig).resourceConfig();
IResourceMetering.ResourceConfig memory dflt = Constants.DEFAULT_RESOURCE_CONFIG();
require(keccak256(abi.encode(rcfg)) == keccak256(abi.encode(dflt)));
checkSystemConfig({ _contracts: _prox, _cfg: _cfg, _isProxy: true });
......@@ -62,12 +71,12 @@ library ChainAssertions {
/// @notice Asserts that the SystemConfig is setup correctly
function checkSystemConfig(Types.ContractSet memory _contracts, DeployConfig _cfg, bool _isProxy) internal view {
console.log("Running chain assertions on the SystemConfig");
SystemConfig config = SystemConfig(_contracts.SystemConfig);
ISystemConfig config = ISystemConfig(_contracts.SystemConfig);
// Check that the contract is initialized
assertSlotValueIsOne({ _contractAddress: address(config), _slot: 0, _offset: 0 });
ResourceMetering.ResourceConfig memory resourceConfig = config.resourceConfig();
IResourceMetering.ResourceConfig memory resourceConfig = config.resourceConfig();
if (_isProxy) {
require(config.owner() == _cfg.finalSystemOwner());
......@@ -78,7 +87,7 @@ library ChainAssertions {
require(config.unsafeBlockSigner() == _cfg.p2pSequencerAddress());
require(config.scalar() >> 248 == 1);
// 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.elasticityMultiplier == rconfig.elasticityMultiplier);
require(resourceConfig.baseFeeMaxChangeDenominator == rconfig.baseFeeMaxChangeDenominator);
......@@ -127,7 +136,7 @@ library ChainAssertions {
/// @notice Asserts that the L1CrossDomainMessenger is setup correctly
function checkL1CrossDomainMessenger(Types.ContractSet memory _contracts, Vm _vm, bool _isProxy) internal view {
console.log("Running chain assertions on the L1CrossDomainMessenger");
L1CrossDomainMessenger messenger = L1CrossDomainMessenger(_contracts.L1CrossDomainMessenger);
IL1CrossDomainMessenger messenger = IL1CrossDomainMessenger(_contracts.L1CrossDomainMessenger);
// Check that the contract is initialized
assertSlotValueIsOne({ _contractAddress: address(messenger), _slot: 0, _offset: 20 });
......@@ -201,7 +210,7 @@ library ChainAssertions {
if (_isProxy) {
require(weth.owner() == _expectedOwner);
require(weth.delay() == _cfg.faultGameWithdrawalDelay());
require(weth.config() == SuperchainConfig(_contracts.SuperchainConfig));
require(weth.config() == ISuperchainConfig(_contracts.SuperchainConfig));
} else {
require(weth.owner() == _expectedOwner);
require(weth.delay() == _cfg.faultGameWithdrawalDelay());
......@@ -227,7 +236,7 @@ library ChainAssertions {
if (_isProxy) {
require(weth.owner() == _expectedOwner);
require(weth.delay() == _cfg.faultGameWithdrawalDelay());
require(weth.config() == SuperchainConfig(_contracts.SuperchainConfig));
require(weth.config() == ISuperchainConfig(_contracts.SuperchainConfig));
} else {
require(weth.owner() == _expectedOwner);
require(weth.delay() == _cfg.faultGameWithdrawalDelay());
......@@ -322,7 +331,7 @@ library ChainAssertions {
function checkOptimismPortal(Types.ContractSet memory _contracts, DeployConfig _cfg, bool _isProxy) internal view {
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
assertSlotValueIsOne({ _contractAddress: address(portal), _slot: 0, _offset: 0 });
......@@ -337,7 +346,7 @@ library ChainAssertions {
require(address(portal.systemConfig()) == _contracts.SystemConfig);
require(portal.guardian() == guardian);
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);
} else {
require(address(portal.l2Oracle()) == address(0));
......@@ -358,7 +367,7 @@ library ChainAssertions {
{
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
assertSlotValueIsOne({ _contractAddress: address(portal), _slot: 0, _offset: 0 });
......@@ -373,7 +382,7 @@ library ChainAssertions {
require(address(portal.systemConfig()) == _contracts.SystemConfig);
require(portal.guardian() == guardian);
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);
} else {
require(address(portal.disputeGameFactory()) == address(0));
......@@ -422,7 +431,7 @@ library ChainAssertions {
view
{
console.log("Running chain assertions on the SuperchainConfig");
SuperchainConfig superchainConfig = SuperchainConfig(_contracts.SuperchainConfig);
ISuperchainConfig superchainConfig = ISuperchainConfig(_contracts.SuperchainConfig);
// Check that the contract is initialized
assertSlotValueIsOne({ _contractAddress: address(superchainConfig), _slot: 0, _offset: 0 });
......
......@@ -14,7 +14,7 @@ import { Deployer } from "scripts/deploy/Deployer.sol";
import { LivenessGuard } from "src/Safe/LivenessGuard.sol";
import { LivenessModule } from "src/Safe/LivenessModule.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";
......@@ -41,7 +41,7 @@ struct SecurityCouncilConfig {
/// @notice Configuration for the Deputy Guardian Module
struct DeputyGuardianModuleConfig {
address deputyGuardian;
SuperchainConfig superchainConfig;
ISuperchainConfig superchainConfig;
}
/// @notice Configuration for the Guardian Safe.
......@@ -89,7 +89,7 @@ contract DeployOwnership is Deploy {
safeConfig: SafeConfig({ threshold: 1, owners: exampleGuardianOwners }),
deputyGuardianModuleConfig: DeputyGuardianModuleConfig({
deputyGuardian: mustGetAddress("FoundationOperationsSafe"),
superchainConfig: SuperchainConfig(mustGetAddress("SuperchainConfig"))
superchainConfig: ISuperchainConfig(mustGetAddress("SuperchainConfig"))
})
});
}
......
......@@ -86,14 +86,14 @@ contract FPACOPS is Deploy, StdAssertions {
address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy");
Proxy(payable(wethProxy)).upgradeToAndCall(
mustGetAddress("DelayedWETH"),
abi.encodeCall(DelayedWETH.initialize, (msg.sender, SuperchainConfig(superchainConfigProxy)))
abi.encodeCall(DelayedWETH.initialize, (msg.sender, ISuperchainConfig(superchainConfigProxy)))
);
}
function initializeAnchorStateRegistryProxy() internal broadcast {
console.log("Initializing AnchorStateRegistryProxy with AnchorStateRegistry.");
address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy");
SuperchainConfig superchainConfig = SuperchainConfig(superchainConfigProxy);
ISuperchainConfig superchainConfig = ISuperchainConfig(superchainConfigProxy);
AnchorStateRegistry.StartingAnchorRoot[] memory roots = new AnchorStateRegistry.StartingAnchorRoot[](2);
roots[0] = AnchorStateRegistry.StartingAnchorRoot({
......
......@@ -134,7 +134,7 @@ contract FPACOPS2 is Deploy, StdAssertions {
address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy");
Proxy(payable(wethProxy)).upgradeToAndCall(
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 {
address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy");
Proxy(payable(wethProxy)).upgradeToAndCall(
mustGetAddress("DelayedWETH"),
abi.encodeCall(DelayedWETH.initialize, (msg.sender, SuperchainConfig(superchainConfigProxy)))
abi.encodeCall(DelayedWETH.initialize, (msg.sender, ISuperchainConfig(superchainConfigProxy)))
);
}
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
/// @title ISystemConfigV0
/// @notice Minimal interface of the Legacy SystemConfig containing only getters.
......@@ -14,6 +14,6 @@ interface ISystemConfigV0 {
function scalar() external view returns (uint256);
function batcherHash() external view returns (bytes32);
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);
}
......@@ -9,23 +9,23 @@
},
"src/L1/DataAvailabilityChallenge.sol": {
"initCodeHash": "0xcc96cf2e4d841adb7ecb9dd84abeb0893dd62d913c0d47ab5b66a893c6e47e88",
"sourceCodeHash": "0x3260f2721af58ab77d4eae50365f3afe021a03b6383139e69779ac40f511b792"
"sourceCodeHash": "0xce01773740f4d50ac77f868343d654f6ca24f85d2770eb7e4043e98f609b1c15"
},
"src/L1/DelayedVetoable.sol": {
"initCodeHash": "0xd504ab0568719a0fb960ebe73d0437645f5c4bd8f6619219858209ef002516dd",
"sourceCodeHash": "0x1806db090be1a0bd8cba1b0b44a4f1c28a3cfc58a174a025fc292163bfff8cee"
"sourceCodeHash": "0x60af558156543d639a0a92e983ad0f045aac1f9ac4c3adaa1d4d97b37175e03a"
},
"src/L1/L1CrossDomainMessenger.sol": {
"initCodeHash": "0x48db42620b9f16e0dec2355f4076314f82fd0f60ef04c10cdbc266eac9472515",
"sourceCodeHash": "0xca37e50dd6c1aa86bbc5f9ec640410bf234cd911158ba91af984fd2ed94c19c5"
"sourceCodeHash": "0xb77342e6b55b835e9597f7a1c4a2d52ddd56f5cfb7cd38da0bcc488c79a9011e"
},
"src/L1/L1ERC721Bridge.sol": {
"initCodeHash": "0xda80d225e332f9ab38d5f3ae655df3eea1dd56dbb523036a25c78859d2931ada",
"sourceCodeHash": "0xcef23f69992fa6cb5ad051858dbec924a06fa3b7b44f03caa2415804d6ce7bd0"
"sourceCodeHash": "0x0454bb88f7b52c362309935fa21ecc8be7bd6f0d888270b8a00677c60c1014cb"
},
"src/L1/L1StandardBridge.sol": {
"initCodeHash": "0x2868b09ecbe9f2bbc885605c2886b4c79f1c8e4171626c63776603b1b84698a8",
"sourceCodeHash": "0x35f27059e5a7421ddf6394f9739a8c9f434de17e1736644695791c19b8240e74"
"sourceCodeHash": "0xc03da137b3ea72e0109fb284229283b21a0303104afbe37d2fe86ad806392a7f"
},
"src/L1/L2OutputOracle.sol": {
"initCodeHash": "0x433fac9de52d8ce8fc3471b78ef6cc9cff1019f480c9ad91b6e09ab8738a8edb",
......@@ -36,16 +36,16 @@
"sourceCodeHash": "0x5182a2678dadb200dd255ecdfa395e5f7b1e1e27288e78ddf8802ab51ed2dd81"
},
"src/L1/OptimismPortal.sol": {
"initCodeHash": "0x6bf59539298b20221de6c51db21016be8d3278bdbe0be1cdd49638dc828e003e",
"sourceCodeHash": "0x07f6f4c0cc14be4aeb9a29ec4a238ea3748d5cb6b244e0054845a18308c16ab5"
"initCodeHash": "0xb7a7a28d5b3b88334e7cb4bc1c5fbbf9f691d934e907a2fed6a30e461eb1c0f6",
"sourceCodeHash": "0x17404b6cc3f62f66786c314e2abdf021a19c00845e2cbb2ec7796f2fa469991c"
},
"src/L1/OptimismPortal2.sol": {
"initCodeHash": "0x414ad1fdb6296ac32fc67ce01288b6e67bedd2ed239d7eb8ed40c7f55f9021f2",
"sourceCodeHash": "0xa70bdc0bb666baa731ab32c79a7b8b15cee23bd46ddfec5f259eaf19b5653fe1"
"initCodeHash": "0x6c1168834a0d2a23d9bfb995dd458ef5c2fd059c874d453988ef648de8300730",
"sourceCodeHash": "0xa8053edf2ddd421615c7570e5dbb435980b88e0f08e3189e2fc69b7a476e80a2"
},
"src/L1/OptimismPortalInterop.sol": {
"initCodeHash": "0x9222fba222d1ab66898eef09ecea3ea757e64c8ae98def4da7808cd7cc8f39a8",
"sourceCodeHash": "0x57353b84bbcb05634f135ad8090d96f07467dd3dbf159650714449d0667efc62"
"initCodeHash": "0xc95dd89962e301ce1fe773337463ea6e3b32b362971e5ad4f69e0881af7f4b7d",
"sourceCodeHash": "0xe6a7794799915f408cb57c73af266670de8a3f02408d3dbc2c97db25d3e42635"
},
"src/L1/ProtocolVersions.sol": {
"initCodeHash": "0x8f033874dd8b36615b2209d553660dcff1ff91ca2bad3ca1de7b441dbfba4842",
......@@ -57,11 +57,11 @@
},
"src/L1/SystemConfig.sol": {
"initCodeHash": "0x2fc36af5b3c493a423a19e0b597f6ff230b756b861b68099f3192d69b6088dc0",
"sourceCodeHash": "0xacffbb4e73d39a642adc24baaa50c92604f4c0b04ff31287e24a46bda5277033"
"sourceCodeHash": "0x06a50ac992175fdb434b13e8461893e83862c23ce399e697e6e8109728ad1a3d"
},
"src/L1/SystemConfigInterop.sol": {
"initCodeHash": "0xc5a3ffc59dd7bf1ef238087414cfa04b37f0d83fc9a4f5e6d62a1059a23359f3",
"sourceCodeHash": "0x272bcfafab62516609250c85cd73815bf0a243fdb9d34fc603f71e801299b57c"
"sourceCodeHash": "0xd7b6ebf03ead541917b1bdfcf1293ca3c8a8e3865b8a8548bee69956a4ce71cc"
},
"src/L2/BaseFeeVault.sol": {
"initCodeHash": "0x3bfcd57e25ad54b66c374f63e24e33a6cf107044aa8f5f69ef21202c380b5c5b",
......@@ -97,11 +97,11 @@
},
"src/L2/L2ERC721Bridge.sol": {
"initCodeHash": "0x827077e1a0ce6c8f9ee1196c409ea77d831efd440992b3969b05259083cdf0bd",
"sourceCodeHash": "0xaef911601556f93deac78cb3329fdcc1507ea248c3986548e76997938c43391b"
"sourceCodeHash": "0xdc5e08a5a9ee8d61e843ac630126629ccfedb49a3b0dd167863dd48d75629a95"
},
"src/L2/L2StandardBridge.sol": {
"initCodeHash": "0x01692b613e3d4e649d877a0fd8f0798a26401ba8ccc4cda0e61f1f9079729320",
"sourceCodeHash": "0x3efb2dabff452f5d2584839d1460183cb8aecd5456fbfa3a72d80de40df783b7"
"sourceCodeHash": "0x5c8e8ba3ecdae116f98caf67cca5fb3594bf7085e186f0a14bad1d6f143b6bc8"
},
"src/L2/L2StandardBridgeInterop.sol": {
"initCodeHash": "0x5c9ef6b0817f715d1b8b097f3fc19e33bc54453426ca12bb48e4cea143076339",
......@@ -133,7 +133,7 @@
},
"src/Safe/DeputyGuardianModule.sol": {
"initCodeHash": "0xce6cd0e4f21693a32e7a8ef463b8233b0dde83bdb426f5adc3eef822d4de7bec",
"sourceCodeHash": "0x45fdf6b414a6eae662392051a5e0acc5b95f23ca33f739ddfb35ae2e7ce81728"
"sourceCodeHash": "0x7b0f24df9af4cf5a52e23b98898b884d8175ad89cc24046d6463c3e9b3599d4d"
},
"src/Safe/LivenessGuard.sol": {
"initCodeHash": "0xfd74ff89e7b689b38ab97515d64429ffaf6c0cd1ea6488c6a4743a0665419c85",
......@@ -157,7 +157,7 @@
},
"src/dispute/AnchorStateRegistry.sol": {
"initCodeHash": "0x6198f305686e6fdfd94db7aeb840a12e263036dcdc234550db49d3f0b87039a8",
"sourceCodeHash": "0x384d4e7067d423dc32b8588341b61a504a28505aa5ed7dd76f115991be072ee0"
"sourceCodeHash": "0x8450bdccf5039bad48284c73c9cfa657cbcc0a435965d9e13ac88f388c591779"
},
"src/dispute/DisputeGameFactory.sol": {
"initCodeHash": "0xc1a10f65287c414076b68a7de6c238b91bc6252213187bdef35657d0f00f9382",
......@@ -169,7 +169,7 @@
},
"src/dispute/weth/DelayedWETH.sol": {
"initCodeHash": "0x3e687c928b6c890b91c82584ccb1fec47b025b8e58cd9cbfa65229b38b304bae",
"sourceCodeHash": "0x7ebe0d9771fc8adfd97386972a571eb1753065a202d4711c0b9587d99f3bd261"
"sourceCodeHash": "0x9d6667536161b3fa655dfb3e9a01db070cd0e84d800e34947b10b3b2168a3d56"
},
"src/legacy/DeployerWhitelist.sol": {
"initCodeHash": "0x0b8177ed75b69eddbb9ce6537683f69a9935efed86a1d6faa8feaafbd151c1bd",
......
......@@ -79,7 +79,7 @@
"type": "tuple[]"
},
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "_superchainConfig",
"type": "address"
}
......@@ -107,7 +107,7 @@
"name": "superchainConfig",
"outputs": [
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "",
"type": "address"
}
......
......@@ -90,7 +90,7 @@
"name": "config",
"outputs": [
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "",
"type": "address"
}
......@@ -157,7 +157,7 @@
"type": "address"
},
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "_config",
"type": "address"
}
......
......@@ -7,7 +7,7 @@
"type": "address"
},
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "_superchainConfig",
"type": "address"
},
......@@ -23,7 +23,7 @@
{
"inputs": [
{
"internalType": "contract OptimismPortal2",
"internalType": "contract IOptimismPortal2",
"name": "_portal",
"type": "address"
},
......@@ -92,7 +92,7 @@
{
"inputs": [
{
"internalType": "contract OptimismPortal2",
"internalType": "contract IOptimismPortal2",
"name": "_portal",
"type": "address"
},
......@@ -112,7 +112,7 @@
"name": "superchainConfig",
"outputs": [
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "superchainConfig_",
"type": "address"
}
......
......@@ -74,7 +74,7 @@
"name": "PORTAL",
"outputs": [
{
"internalType": "contract OptimismPortal",
"internalType": "contract IOptimismPortal",
"name": "",
"type": "address"
}
......@@ -180,17 +180,17 @@
{
"inputs": [
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "_superchainConfig",
"type": "address"
},
{
"internalType": "contract OptimismPortal",
"internalType": "contract IOptimismPortal",
"name": "_portal",
"type": "address"
},
{
"internalType": "contract SystemConfig",
"internalType": "contract ISystemConfig",
"name": "_systemConfig",
"type": "address"
}
......@@ -244,7 +244,7 @@
"name": "portal",
"outputs": [
{
"internalType": "contract OptimismPortal",
"internalType": "contract IOptimismPortal",
"name": "",
"type": "address"
}
......@@ -337,7 +337,7 @@
"name": "superchainConfig",
"outputs": [
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "",
"type": "address"
}
......@@ -350,7 +350,7 @@
"name": "systemConfig",
"outputs": [
{
"internalType": "contract SystemConfig",
"internalType": "contract ISystemConfig",
"name": "",
"type": "address"
}
......
......@@ -9,7 +9,7 @@
"name": "MESSENGER",
"outputs": [
{
"internalType": "contract CrossDomainMessenger",
"internalType": "contract ICrossDomainMessenger",
"name": "",
"type": "address"
}
......@@ -171,12 +171,12 @@
{
"inputs": [
{
"internalType": "contract CrossDomainMessenger",
"internalType": "contract ICrossDomainMessenger",
"name": "_messenger",
"type": "address"
},
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "_superchainConfig",
"type": "address"
}
......@@ -191,7 +191,7 @@
"name": "messenger",
"outputs": [
{
"internalType": "contract CrossDomainMessenger",
"internalType": "contract ICrossDomainMessenger",
"name": "",
"type": "address"
}
......@@ -230,7 +230,7 @@
"name": "superchainConfig",
"outputs": [
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "",
"type": "address"
}
......
......@@ -13,7 +13,7 @@
"name": "MESSENGER",
"outputs": [
{
"internalType": "contract CrossDomainMessenger",
"internalType": "contract ICrossDomainMessenger",
"name": "",
"type": "address"
}
......@@ -417,17 +417,17 @@
{
"inputs": [
{
"internalType": "contract CrossDomainMessenger",
"internalType": "contract ICrossDomainMessenger",
"name": "_messenger",
"type": "address"
},
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "_superchainConfig",
"type": "address"
},
{
"internalType": "contract SystemConfig",
"internalType": "contract ISystemConfig",
"name": "_systemConfig",
"type": "address"
}
......@@ -455,7 +455,7 @@
"name": "messenger",
"outputs": [
{
"internalType": "contract CrossDomainMessenger",
"internalType": "contract ICrossDomainMessenger",
"name": "",
"type": "address"
}
......@@ -494,7 +494,7 @@
"name": "superchainConfig",
"outputs": [
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "",
"type": "address"
}
......@@ -507,7 +507,7 @@
"name": "systemConfig",
"outputs": [
{
"internalType": "contract SystemConfig",
"internalType": "contract ISystemConfig",
"name": "",
"type": "address"
}
......
......@@ -9,7 +9,7 @@
"name": "MESSENGER",
"outputs": [
{
"internalType": "contract CrossDomainMessenger",
"internalType": "contract ICrossDomainMessenger",
"name": "",
"type": "address"
}
......@@ -157,7 +157,7 @@
"name": "messenger",
"outputs": [
{
"internalType": "contract CrossDomainMessenger",
"internalType": "contract ICrossDomainMessenger",
"name": "",
"type": "address"
}
......
......@@ -13,7 +13,7 @@
"name": "MESSENGER",
"outputs": [
{
"internalType": "contract CrossDomainMessenger",
"internalType": "contract ICrossDomainMessenger",
"name": "",
"type": "address"
}
......@@ -267,7 +267,7 @@
"name": "messenger",
"outputs": [
{
"internalType": "contract CrossDomainMessenger",
"internalType": "contract ICrossDomainMessenger",
"name": "",
"type": "address"
}
......
......@@ -8,7 +8,7 @@
"name": "MESSENGER",
"outputs": [
{
"internalType": "contract CrossDomainMessenger",
"internalType": "contract ICrossDomainMessenger",
"name": "",
"type": "address"
}
......@@ -285,7 +285,7 @@
"name": "messenger",
"outputs": [
{
"internalType": "contract CrossDomainMessenger",
"internalType": "contract ICrossDomainMessenger",
"name": "",
"type": "address"
}
......
......@@ -184,12 +184,12 @@
"type": "address"
},
{
"internalType": "contract SystemConfig",
"internalType": "contract ISystemConfig",
"name": "_systemConfig",
"type": "address"
},
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "_superchainConfig",
"type": "address"
}
......@@ -443,7 +443,7 @@
"name": "superchainConfig",
"outputs": [
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "",
"type": "address"
}
......@@ -456,7 +456,7 @@
"name": "systemConfig",
"outputs": [
{
"internalType": "contract SystemConfig",
"internalType": "contract ISystemConfig",
"name": "",
"type": "address"
}
......
......@@ -158,7 +158,7 @@
"name": "disputeGameFactory",
"outputs": [
{
"internalType": "contract DisputeGameFactory",
"internalType": "contract IDisputeGameFactory",
"name": "",
"type": "address"
}
......@@ -316,17 +316,17 @@
{
"inputs": [
{
"internalType": "contract DisputeGameFactory",
"internalType": "contract IDisputeGameFactory",
"name": "_disputeGameFactory",
"type": "address"
},
{
"internalType": "contract SystemConfig",
"internalType": "contract ISystemConfig",
"name": "_systemConfig",
"type": "address"
},
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "_superchainConfig",
"type": "address"
},
......@@ -648,7 +648,7 @@
"name": "superchainConfig",
"outputs": [
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "",
"type": "address"
}
......@@ -661,7 +661,7 @@
"name": "systemConfig",
"outputs": [
{
"internalType": "contract SystemConfig",
"internalType": "contract ISystemConfig",
"name": "",
"type": "address"
}
......
......@@ -158,7 +158,7 @@
"name": "disputeGameFactory",
"outputs": [
{
"internalType": "contract DisputeGameFactory",
"internalType": "contract IDisputeGameFactory",
"name": "",
"type": "address"
}
......@@ -316,17 +316,17 @@
{
"inputs": [
{
"internalType": "contract DisputeGameFactory",
"internalType": "contract IDisputeGameFactory",
"name": "_disputeGameFactory",
"type": "address"
},
{
"internalType": "contract SystemConfig",
"internalType": "contract ISystemConfig",
"name": "_systemConfig",
"type": "address"
},
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "_superchainConfig",
"type": "address"
},
......@@ -666,7 +666,7 @@
"name": "superchainConfig",
"outputs": [
{
"internalType": "contract SuperchainConfig",
"internalType": "contract ISuperchainConfig",
"name": "",
"type": "address"
}
......@@ -679,7 +679,7 @@
"name": "systemConfig",
"outputs": [
{
"internalType": "contract SystemConfig",
"internalType": "contract ISystemConfig",
"name": "",
"type": "address"
}
......@@ -949,11 +949,6 @@
"name": "Unauthorized",
"type": "error"
},
{
"inputs": [],
"name": "Unauthorized",
"type": "error"
},
{
"inputs": [],
"name": "UnexpectedList",
......
......@@ -321,7 +321,7 @@
"type": "uint128"
}
],
"internalType": "struct ResourceMetering.ResourceConfig",
"internalType": "struct IResourceMetering.ResourceConfig",
"name": "_config",
"type": "tuple"
},
......@@ -552,7 +552,7 @@
"type": "uint128"
}
],
"internalType": "struct ResourceMetering.ResourceConfig",
"internalType": "struct IResourceMetering.ResourceConfig",
"name": "",
"type": "tuple"
}
......
......@@ -342,7 +342,7 @@
"type": "uint128"
}
],
"internalType": "struct ResourceMetering.ResourceConfig",
"internalType": "struct IResourceMetering.ResourceConfig",
"name": "_config",
"type": "tuple"
},
......@@ -469,7 +469,7 @@
"type": "uint128"
}
],
"internalType": "struct ResourceMetering.ResourceConfig",
"internalType": "struct IResourceMetering.ResourceConfig",
"name": "_config",
"type": "tuple"
},
......@@ -713,7 +713,7 @@
"type": "uint128"
}
],
"internalType": "struct ResourceMetering.ResourceConfig",
"internalType": "struct IResourceMetering.ResourceConfig",
"name": "",
"type": "tuple"
}
......
......@@ -25,6 +25,6 @@
"label": "superchainConfig",
"offset": 0,
"slot": "2",
"type": "contract SuperchainConfig"
"type": "contract ISuperchainConfig"
}
]
\ No newline at end of file
......@@ -60,6 +60,6 @@
"label": "config",
"offset": 0,
"slot": "104",
"type": "contract SuperchainConfig"
"type": "contract ISuperchainConfig"
}
]
\ No newline at end of file
......@@ -130,20 +130,20 @@
"label": "superchainConfig",
"offset": 0,
"slot": "251",
"type": "contract SuperchainConfig"
"type": "contract ISuperchainConfig"
},
{
"bytes": "20",
"label": "portal",
"offset": 0,
"slot": "252",
"type": "contract OptimismPortal"
"type": "contract IOptimismPortal"
},
{
"bytes": "20",
"label": "systemConfig",
"offset": 0,
"slot": "253",
"type": "contract SystemConfig"
"type": "contract ISystemConfig"
}
]
\ No newline at end of file
......@@ -25,7 +25,7 @@
"label": "messenger",
"offset": 0,
"slot": "1",
"type": "contract CrossDomainMessenger"
"type": "contract ICrossDomainMessenger"
},
{
"bytes": "20",
......@@ -53,6 +53,6 @@
"label": "superchainConfig",
"offset": 0,
"slot": "50",
"type": "contract SuperchainConfig"
"type": "contract ISuperchainConfig"
}
]
\ No newline at end of file
......@@ -39,7 +39,7 @@
"label": "messenger",
"offset": 0,
"slot": "3",
"type": "contract CrossDomainMessenger"
"type": "contract ICrossDomainMessenger"
},
{
"bytes": "20",
......@@ -60,13 +60,13 @@
"label": "superchainConfig",
"offset": 0,
"slot": "50",
"type": "contract SuperchainConfig"
"type": "contract ISuperchainConfig"
},
{
"bytes": "20",
"label": "systemConfig",
"offset": 0,
"slot": "51",
"type": "contract SystemConfig"
"type": "contract ISystemConfig"
}
]
\ No newline at end of file
......@@ -25,7 +25,7 @@
"label": "messenger",
"offset": 0,
"slot": "1",
"type": "contract CrossDomainMessenger"
"type": "contract ICrossDomainMessenger"
},
{
"bytes": "20",
......
......@@ -39,7 +39,7 @@
"label": "messenger",
"offset": 0,
"slot": "3",
"type": "contract CrossDomainMessenger"
"type": "contract ICrossDomainMessenger"
},
{
"bytes": "20",
......
......@@ -39,7 +39,7 @@
"label": "messenger",
"offset": 0,
"slot": "3",
"type": "contract CrossDomainMessenger"
"type": "contract ICrossDomainMessenger"
},
{
"bytes": "20",
......
......@@ -60,7 +60,7 @@
"label": "superchainConfig",
"offset": 1,
"slot": "53",
"type": "contract SuperchainConfig"
"type": "contract ISuperchainConfig"
},
{
"bytes": "20",
......@@ -74,7 +74,7 @@
"label": "systemConfig",
"offset": 0,
"slot": "55",
"type": "contract SystemConfig"
"type": "contract ISystemConfig"
},
{
"bytes": "20",
......
......@@ -60,7 +60,7 @@
"label": "superchainConfig",
"offset": 1,
"slot": "53",
"type": "contract SuperchainConfig"
"type": "contract ISuperchainConfig"
},
{
"bytes": "20",
......@@ -74,14 +74,14 @@
"label": "systemConfig",
"offset": 0,
"slot": "55",
"type": "contract SystemConfig"
"type": "contract ISystemConfig"
},
{
"bytes": "20",
"label": "disputeGameFactory",
"offset": 0,
"slot": "56",
"type": "contract DisputeGameFactory"
"type": "contract IDisputeGameFactory"
},
{
"bytes": "32",
......
......@@ -60,7 +60,7 @@
"label": "superchainConfig",
"offset": 1,
"slot": "53",
"type": "contract SuperchainConfig"
"type": "contract ISuperchainConfig"
},
{
"bytes": "20",
......@@ -74,14 +74,14 @@
"label": "systemConfig",
"offset": 0,
"slot": "55",
"type": "contract SystemConfig"
"type": "contract ISystemConfig"
},
{
"bytes": "20",
"label": "disputeGameFactory",
"offset": 0,
"slot": "56",
"type": "contract DisputeGameFactory"
"type": "contract IDisputeGameFactory"
},
{
"bytes": "32",
......
......@@ -81,6 +81,6 @@
"label": "_resourceConfig",
"offset": 0,
"slot": "105",
"type": "struct ResourceMetering.ResourceConfig"
"type": "struct IResourceMetering.ResourceConfig"
}
]
\ No newline at end of file
......@@ -81,6 +81,6 @@
"label": "_resourceConfig",
"offset": 0,
"slot": "105",
"type": "struct ResourceMetering.ResourceConfig"
"type": "struct IResourceMetering.ResourceConfig"
}
]
\ No newline at end of file
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Contracts
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";
// Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol";
/// @dev An enum representing the status of a DA challenge.
enum ChallengeStatus {
Uninitialized,
......
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol";
/// @title DelayedVetoable
......
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import { Predeploys } from "src/libraries/Predeploys.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol";
// Contracts
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 { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
/// @custom:proxied true
/// @title L1CrossDomainMessenger
......@@ -15,14 +20,14 @@ import { SystemConfig } from "src/L1/SystemConfig.sol";
/// interface instead of interacting with lower-level contracts directly.
contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver {
/// @notice Contract of the SuperchainConfig.
SuperchainConfig public superchainConfig;
ISuperchainConfig public superchainConfig;
/// @notice Contract of the OptimismPortal.
/// @custom:network-specific
OptimismPortal public portal;
IOptimismPortal public portal;
/// @notice Address of the SystemConfig contract.
SystemConfig public systemConfig;
ISystemConfig public systemConfig;
/// @notice Semantic version.
/// @custom:semver 2.4.1-beta.1
......@@ -31,9 +36,9 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver {
/// @notice Constructs the L1CrossDomainMessenger contract.
constructor() CrossDomainMessenger() {
initialize({
_superchainConfig: SuperchainConfig(address(0)),
_portal: OptimismPortal(payable(address(0))),
_systemConfig: SystemConfig(address(0))
_superchainConfig: ISuperchainConfig(address(0)),
_portal: IOptimismPortal(payable(address(0))),
_systemConfig: ISystemConfig(address(0))
});
}
......@@ -42,9 +47,9 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver {
/// @param _portal Contract of the OptimismPortal contract on this network.
/// @param _systemConfig Contract of the SystemConfig contract on this network.
function initialize(
SuperchainConfig _superchainConfig,
OptimismPortal _portal,
SystemConfig _systemConfig
ISuperchainConfig _superchainConfig,
IOptimismPortal _portal,
ISystemConfig _systemConfig
)
public
initializer
......@@ -64,7 +69,7 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver {
/// Public getter is legacy and will be removed in the future. Use `portal()` instead.
/// @return Contract of the OptimismPortal on this chain.
/// @custom:legacy
function PORTAL() external view returns (OptimismPortal) {
function PORTAL() external view returns (IOptimismPortal) {
return portal;
}
......
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Contracts
import { ERC721Bridge } from "src/universal/ERC721Bridge.sol";
import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.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 { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
import { StandardBridge } from "src/universal/StandardBridge.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
/// @title L1ERC721Bridge
......@@ -22,7 +26,7 @@ contract L1ERC721Bridge is ERC721Bridge, ISemver {
mapping(address => mapping(address => mapping(uint256 => bool))) public deposits;
/// @notice Address of the SuperchainConfig contract.
SuperchainConfig public superchainConfig;
ISuperchainConfig public superchainConfig;
/// @notice Semantic version.
/// @custom:semver 2.1.1-beta.2
......@@ -30,13 +34,13 @@ contract L1ERC721Bridge is ERC721Bridge, ISemver {
/// @notice Constructs the L1ERC721Bridge contract.
constructor() ERC721Bridge() {
initialize({ _messenger: CrossDomainMessenger(address(0)), _superchainConfig: SuperchainConfig(address(0)) });
initialize({ _messenger: ICrossDomainMessenger(address(0)), _superchainConfig: ISuperchainConfig(address(0)) });
}
/// @notice Initializes the contract.
/// @param _messenger Contract of the CrossDomainMessenger 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;
__ERC721Bridge_init({ _messenger: _messenger, _otherBridge: ERC721Bridge(payable(Predeploys.L2_ERC721_BRIDGE)) });
}
......
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import { Predeploys } from "src/libraries/Predeploys.sol";
// Contracts
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 { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
/// @custom:proxied true
/// @title L1StandardBridge
......@@ -75,17 +79,17 @@ contract L1StandardBridge is StandardBridge, ISemver {
string public constant version = "2.2.1-beta.1";
/// @notice Address of the SuperchainConfig contract.
SuperchainConfig public superchainConfig;
ISuperchainConfig public superchainConfig;
/// @notice Address of the SystemConfig contract.
SystemConfig public systemConfig;
ISystemConfig public systemConfig;
/// @notice Constructs the L1StandardBridge contract.
constructor() StandardBridge() {
initialize({
_messenger: CrossDomainMessenger(address(0)),
_superchainConfig: SuperchainConfig(address(0)),
_systemConfig: SystemConfig(address(0))
_messenger: ICrossDomainMessenger(address(0)),
_superchainConfig: ISuperchainConfig(address(0)),
_systemConfig: ISystemConfig(address(0))
});
}
......@@ -93,9 +97,9 @@ contract L1StandardBridge is StandardBridge, ISemver {
/// @param _messenger Contract for the CrossDomainMessenger on this network.
/// @param _superchainConfig Contract for the SuperchainConfig on this network.
function initialize(
CrossDomainMessenger _messenger,
SuperchainConfig _superchainConfig,
SystemConfig _systemConfig
ICrossDomainMessenger _messenger,
ISuperchainConfig _superchainConfig,
ISystemConfig _systemConfig
)
public
initializer
......
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Contracts
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 { 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 { Types } from "src/libraries/Types.sol";
import { Hashing } from "src/libraries/Hashing.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 { AddressAliasHelper } from "src/vendor/AddressAliasHelper.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
/// @title OptimismPortal
/// @notice The OptimismPortal is a low-level contract responsible for passing messages between L1
......@@ -64,7 +70,7 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
bool private spacer_53_0_1;
/// @notice Contract of the Superchain Config.
SuperchainConfig public superchainConfig;
ISuperchainConfig public superchainConfig;
/// @notice Contract of the L2OutputOracle.
/// @custom:network-specific
......@@ -72,7 +78,7 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
/// @notice Contract of the SystemConfig.
/// @custom:network-specific
SystemConfig public systemConfig;
ISystemConfig public systemConfig;
/// @custom:spacer disputeGameFactory
/// @notice Spacer for backwards compatibility.
......@@ -137,8 +143,8 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
constructor() {
initialize({
_l2Oracle: IL2OutputOracle(address(0)),
_systemConfig: SystemConfig(address(0)),
_superchainConfig: SuperchainConfig(address(0))
_systemConfig: ISystemConfig(address(0)),
_superchainConfig: ISuperchainConfig(address(0))
});
}
......@@ -148,8 +154,8 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
/// @param _superchainConfig Contract of the SuperchainConfig.
function initialize(
IL2OutputOracle _l2Oracle,
SystemConfig _systemConfig,
SuperchainConfig _superchainConfig
ISystemConfig _systemConfig,
ISuperchainConfig _superchainConfig
)
public
initializer
......@@ -222,8 +228,16 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
/// Used internally by the ResourceMetering contract.
/// The SystemConfig is the source of truth for the resource config.
/// @return ResourceMetering ResourceConfig
function _resourceConfig() internal view override returns (ResourceMetering.ResourceConfig memory) {
return systemConfig.resourceConfig();
function _resourceConfig() internal view override returns (ResourceConfig memory) {
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.
......
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Contracts
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 { 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 { Types } from "src/libraries/Types.sol";
import { Hashing } from "src/libraries/Hashing.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 { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import "src/libraries/PortalErrors.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
/// @title OptimismPortal2
/// @notice The OptimismPortal is a low-level contract responsible for passing messages between L1
......@@ -74,7 +79,7 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
bool private spacer_53_0_1;
/// @notice Contract of the Superchain Config.
SuperchainConfig public superchainConfig;
ISuperchainConfig public superchainConfig;
/// @custom:legacy
/// @custom:spacer l2Oracle
......@@ -83,11 +88,11 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
/// @notice Contract of the SystemConfig.
/// @custom:network-specific
SystemConfig public systemConfig;
ISystemConfig public systemConfig;
/// @notice Address of the DisputeGameFactory.
/// @custom:network-specific
DisputeGameFactory public disputeGameFactory;
IDisputeGameFactory public disputeGameFactory;
/// @notice A mapping of withdrawal hashes to proof submitters to `ProvenWithdrawal` data.
mapping(bytes32 => mapping(address => ProvenWithdrawal)) public provenWithdrawals;
......@@ -164,9 +169,9 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
DISPUTE_GAME_FINALITY_DELAY_SECONDS = _disputeGameFinalityDelaySeconds;
initialize({
_disputeGameFactory: DisputeGameFactory(address(0)),
_systemConfig: SystemConfig(address(0)),
_superchainConfig: SuperchainConfig(address(0)),
_disputeGameFactory: IDisputeGameFactory(address(0)),
_systemConfig: ISystemConfig(address(0)),
_superchainConfig: ISuperchainConfig(address(0)),
_initialRespectedGameType: GameType.wrap(0)
});
}
......@@ -176,9 +181,9 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
/// @param _systemConfig Contract of the SystemConfig.
/// @param _superchainConfig Contract of the SuperchainConfig.
function initialize(
DisputeGameFactory _disputeGameFactory,
SystemConfig _systemConfig,
SuperchainConfig _superchainConfig,
IDisputeGameFactory _disputeGameFactory,
ISystemConfig _systemConfig,
ISuperchainConfig _superchainConfig,
GameType _initialRespectedGameType
)
public
......@@ -271,9 +276,12 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
/// @notice Getter for the resource config.
/// Used internally by the ResourceMetering contract.
/// The SystemConfig is the source of truth for the resource config.
/// @return ResourceMetering ResourceConfig
function _resourceConfig() internal view override returns (ResourceMetering.ResourceConfig memory) {
return systemConfig.resourceConfig();
/// @return config_ ResourceMetering ResourceConfig
function _resourceConfig() internal view override returns (ResourceMetering.ResourceConfig memory config_) {
IResourceMetering.ResourceConfig memory config = systemConfig.resourceConfig();
assembly ("memory-safe") {
config_ := config
}
}
/// @notice Proves a withdrawal transaction.
......
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Contracts
import { OptimismPortal2 } from "src/L1/OptimismPortal2.sol";
import { L1BlockIsthmus, ConfigType } from "src/L2/L1BlockIsthmus.sol";
// Libraries
import { Predeploys } from "src/libraries/Predeploys.sol";
import { Constants } from "src/libraries/Constants.sol";
import "src/libraries/PortalErrors.sol";
/// @custom:proxied true
/// @title OptimismPortalInterop
......@@ -12,9 +16,6 @@ import { Constants } from "src/libraries/Constants.sol";
/// 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.
contract OptimismPortalInterop is OptimismPortal2 {
/// @notice Thrown when a non-depositor account attempts update static configuration.
error Unauthorized();
constructor(
uint256 _proofMaturityDelaySeconds,
uint256 _disputeGameFinalityDelaySeconds
......
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Contracts
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
// Libraries
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { Burn } from "src/libraries/Burn.sol";
import { Arithmetic } from "src/libraries/Arithmetic.sol";
......
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Contracts
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
// Libraries
import { Storage } from "src/libraries/Storage.sol";
import { Constants } from "src/libraries/Constants.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.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
/// @title SystemConfig
......@@ -116,7 +121,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken {
/// @notice The configuration for the deposit fee market.
/// 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.
ResourceMetering.ResourceConfig internal _resourceConfig;
IResourceMetering.ResourceConfig internal _resourceConfig;
/// @notice Emitted when configuration is updated.
/// @param version SystemConfig version.
......@@ -144,7 +149,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken {
_batcherHash: bytes32(0),
_gasLimit: 1,
_unsafeBlockSigner: address(0),
_config: ResourceMetering.ResourceConfig({
_config: IResourceMetering.ResourceConfig({
maxResourceLimit: 1,
elasticityMultiplier: 1,
baseFeeMaxChangeDenominator: 2,
......@@ -184,7 +189,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken {
bytes32 _batcherHash,
uint64 _gasLimit,
address _unsafeBlockSigner,
ResourceMetering.ResourceConfig memory _config,
IResourceMetering.ResourceConfig memory _config,
address _batchInbox,
SystemConfig.Addresses memory _addresses
)
......@@ -318,7 +323,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken {
// Set the gas paying token in storage and in the OptimismPortal.
GasPayingToken.set({ _token: _token, _decimals: GAS_PAYING_TOKEN_DECIMALS, _name: name, _symbol: symbol });
OptimismPortal(payable(optimismPortal())).setGasPayingToken({
IOptimismPortal(payable(optimismPortal())).setGasPayingToken({
_token: _token,
_decimals: GAS_PAYING_TOKEN_DECIMALS,
_name: name,
......@@ -433,7 +438,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken {
/// @notice A getter for the resource config.
/// Ensures that the struct is returned instead of a tuple.
/// @return ResourceConfig
function resourceConfig() external view returns (ResourceMetering.ResourceConfig memory) {
function resourceConfig() external view returns (IResourceMetering.ResourceConfig memory) {
return _resourceConfig;
}
......@@ -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
/// for when the resource config is changed.
/// @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.
require(
_config.minimumBaseFee <= _config.maximumBaseFee, "SystemConfig: min base fee must be less than max base"
......
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import { Constants } from "src/libraries/Constants.sol";
import { OptimismPortalInterop as OptimismPortal } from "src/L1/OptimismPortalInterop.sol";
import { GasPayingToken } from "src/libraries/GasPayingToken.sol";
// Contracts
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 { 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 { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { Storage } from "src/libraries/Storage.sol";
// Interfaces
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
/// @custom:proxied true
/// @title SystemConfigInterop
/// @notice The SystemConfig contract is used to manage configuration of an Optimism network.
......@@ -41,7 +46,7 @@ contract SystemConfigInterop is SystemConfig {
bytes32 _batcherHash,
uint64 _gasLimit,
address _unsafeBlockSigner,
ResourceMetering.ResourceConfig memory _config,
IResourceMetering.ResourceConfig memory _config,
address _batchInbox,
SystemConfig.Addresses memory _addresses,
address _dependencyManager
......@@ -85,7 +90,7 @@ contract SystemConfigInterop is SystemConfig {
// Set the gas paying token in storage and in the OptimismPortal.
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,
StaticConfig.encodeSetGasPayingToken({
_token: _token,
......@@ -101,7 +106,7 @@ contract SystemConfigInterop is SystemConfig {
/// @param _chainId Chain ID of chain to add.
function addDependency(uint256 _chainId) external {
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)
);
}
......@@ -110,7 +115,7 @@ contract SystemConfigInterop is SystemConfig {
/// @param _chainId Chain ID of the chain to remove.
function removeDependency(uint256 _chainId) external {
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)
);
}
......
// 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";
import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.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 { Constants } from "src/libraries/Constants.sol";
import { Predeploys } from "src/libraries/Predeploys.sol";
......@@ -34,7 +34,7 @@ contract L2ERC721Bridge is ERC721Bridge, ISemver {
/// @param _l1ERC721Bridge Address of the ERC721 bridge contract on the other network.
function initialize(address payable _l1ERC721Bridge) public initializer {
__ERC721Bridge_init({
_messenger: CrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER),
_messenger: ICrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER),
_otherBridge: ERC721Bridge(_l1ERC721Bridge)
});
}
......
......@@ -5,7 +5,7 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
import { StandardBridge } from "src/universal/StandardBridge.sol";
import { ISemver } from "src/universal/interfaces/ISemver.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";
/// @custom:proxied true
......@@ -67,7 +67,7 @@ contract L2StandardBridge is StandardBridge, ISemver {
/// @param _otherBridge Contract for the corresponding bridge on the other chain.
function initialize(StandardBridge _otherBridge) public initializer {
__StandardBridge_init({
_messenger: CrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER),
_messenger: ICrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER),
_otherBridge: _otherBridge
});
}
......
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Safe
import { GnosisSafe as Safe } from "safe-contracts/GnosisSafe.sol";
import { Enum } from "safe-contracts/common/Enum.sol";
import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol";
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";
// Contracts
import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol";
// Libraries
import { Unauthorized } from "src/libraries/PortalErrors.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
/// @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
......@@ -39,7 +44,7 @@ contract DeputyGuardianModule is ISemver {
Safe internal immutable SAFE;
/// @notice The SuperchainConfig's address
SuperchainConfig internal immutable SUPERCHAIN_CONFIG;
ISuperchainConfig internal immutable SUPERCHAIN_CONFIG;
/// @notice The deputy guardian's address
address internal immutable DEPUTY_GUARDIAN;
......@@ -49,7 +54,7 @@ contract DeputyGuardianModule is ISemver {
string public constant version = "2.0.1-beta.1";
// Constructor to initialize the Safe and baseModule instances
constructor(Safe _safe, SuperchainConfig _superchainConfig, address _deputyGuardian) {
constructor(Safe _safe, ISuperchainConfig _superchainConfig, address _deputyGuardian) {
SAFE = _safe;
SUPERCHAIN_CONFIG = _superchainConfig;
DEPUTY_GUARDIAN = _deputyGuardian;
......@@ -63,7 +68,7 @@ contract DeputyGuardianModule is ISemver {
/// @notice Getter function for 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;
}
......@@ -131,10 +136,10 @@ contract DeputyGuardianModule is ISemver {
/// Only the deputy guardian can call this function.
/// @param _portal The `OptimismPortal2` contract instance.
/// @param _game The `IDisputeGame` contract instance.
function blacklistDisputeGame(OptimismPortal2 _portal, IDisputeGame _game) external {
function blacklistDisputeGame(IOptimismPortal2 _portal, IDisputeGame _game) external {
_onlyDeputyGuardian();
bytes memory data = abi.encodeCall(OptimismPortal2.blacklistDisputeGame, (_game));
bytes memory data = abi.encodeCall(IOptimismPortal2.blacklistDisputeGame, (_game));
(bool success, bytes memory returnData) =
SAFE.execTransactionFromModuleReturnData(address(_portal), 0, data, Enum.Operation.Call);
if (!success) {
......@@ -148,10 +153,10 @@ contract DeputyGuardianModule is ISemver {
/// Only the deputy guardian can call this function.
/// @param _portal The `OptimismPortal2` contract instance.
/// @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();
bytes memory data = abi.encodeCall(OptimismPortal2.setRespectedGameType, (_gameType));
bytes memory data = abi.encodeCall(IOptimismPortal2.setRespectedGameType, (_gameType));
(bool success, bytes memory returnData) =
SAFE.execTransactionFromModuleReturnData(address(_portal), 0, data, Enum.Operation.Call);
if (!success) {
......
......@@ -8,7 +8,7 @@ import { IAnchorStateRegistry } from "src/dispute/interfaces/IAnchorStateRegistr
import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol";
import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.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 { Unauthorized } from "src/libraries/errors/CommonErrors.sol";
......@@ -38,7 +38,7 @@ contract AnchorStateRegistry is Initializable, IAnchorStateRegistry, ISemver {
mapping(GameType => OutputRoot) public anchors;
/// @notice Address of the SuperchainConfig contract.
SuperchainConfig public superchainConfig;
ISuperchainConfig public superchainConfig;
/// @param _disputeGameFactory DisputeGameFactory address.
constructor(IDisputeGameFactory _disputeGameFactory) {
......@@ -51,7 +51,7 @@ contract AnchorStateRegistry is Initializable, IAnchorStateRegistry, ISemver {
/// @param _superchainConfig The address of the SuperchainConfig contract.
function initialize(
StartingAnchorRoot[] memory _startingAnchorRoots,
SuperchainConfig _superchainConfig
ISuperchainConfig _superchainConfig
)
public
initializer
......
......@@ -8,7 +8,7 @@ import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol";
import { IWETH } from "src/dispute/interfaces/IWETH.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
/// @title DelayedWETH
......@@ -32,18 +32,18 @@ contract DelayedWETH is OwnableUpgradeable, WETH98, IDelayedWETH, ISemver {
uint256 internal immutable DELAY_SECONDS;
/// @notice Address of the SuperchainConfig contract.
SuperchainConfig public config;
ISuperchainConfig public config;
/// @param _delay The delay for withdrawals in seconds.
constructor(uint256 _delay) {
DELAY_SECONDS = _delay;
initialize({ _owner: address(0), _config: SuperchainConfig(address(0)) });
initialize({ _owner: address(0), _config: ISuperchainConfig(address(0)) });
}
/// @notice Initializes the contract.
/// @param _owner The address of the owner.
/// @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();
_transferOwnership(_owner);
config = _config;
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
/// @title Constants
/// @notice Constants is a library for storing constants. Simple! Don't put everything in here, just
......@@ -39,8 +39,8 @@ library Constants {
/// @notice Returns the default values for the ResourceConfig. These are the recommended values
/// for a production network.
function DEFAULT_RESOURCE_CONFIG() internal pure returns (ResourceMetering.ResourceConfig memory) {
ResourceMetering.ResourceConfig memory config = ResourceMetering.ResourceConfig({
function DEFAULT_RESOURCE_CONFIG() internal pure returns (IResourceMetering.ResourceConfig memory) {
IResourceMetering.ResourceConfig memory config = IResourceMetering.ResourceConfig({
maxResourceLimit: 20_000_000,
elasticityMultiplier: 10,
baseFeeMaxChangeDenominator: 8,
......
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
......@@ -15,7 +14,7 @@ abstract contract ERC721Bridge is Initializable {
/// @notice Messenger contract on this domain.
/// @custom:network-specific
CrossDomainMessenger public messenger;
ICrossDomainMessenger public messenger;
/// @notice Contract of the bridge on the other network.
/// @custom:network-specific
......@@ -69,7 +68,7 @@ abstract contract ERC721Bridge is Initializable {
/// @param _messenger Contract of the CrossDomainMessenger on this network.
/// @param _otherBridge Contract of the ERC721 bridge on the other network.
function __ERC721Bridge_init(
CrossDomainMessenger _messenger,
ICrossDomainMessenger _messenger,
ERC721Bridge _otherBridge
)
internal
......@@ -83,7 +82,7 @@ abstract contract ERC721Bridge is Initializable {
/// Public getter is legacy and will be removed in the future. Use `messenger` instead.
/// @return Messenger contract on this domain.
/// @custom:legacy
function MESSENGER() external view returns (CrossDomainMessenger) {
function MESSENGER() external view returns (ICrossDomainMessenger) {
return messenger;
}
......
......@@ -7,7 +7,7 @@ import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { SafeCall } from "src/libraries/SafeCall.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 { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import { Constants } from "src/libraries/Constants.sol";
......@@ -38,7 +38,7 @@ abstract contract StandardBridge is Initializable {
/// @notice Messenger contract on this domain.
/// @custom:network-specific
CrossDomainMessenger public messenger;
ICrossDomainMessenger public messenger;
/// @notice Corresponding bridge on the other domain.
/// @custom:network-specific
......@@ -116,7 +116,7 @@ abstract contract StandardBridge is Initializable {
/// @param _messenger Contract for CrossDomainMessenger on this network.
/// @param _otherBridge Contract for the other StandardBridge contract.
function __StandardBridge_init(
CrossDomainMessenger _messenger,
ICrossDomainMessenger _messenger,
StandardBridge _otherBridge
)
internal
......@@ -143,7 +143,7 @@ abstract contract StandardBridge is Initializable {
/// Public getter is legacy and will be removed in the future. Use `messenger` instead.
/// @return Contract of the messenger on this domain.
/// @custom:legacy
function MESSENGER() external view returns (CrossDomainMessenger) {
function MESSENGER() external view returns (ICrossDomainMessenger) {
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
pragma solidity 0.8.15;
// Testing utilities
// Testing
import { Test } from "forge-std/Test.sol";
import { Vm } from "forge-std/Vm.sol";
import { CommonTest } from "test/setup/CommonTest.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 { SafeCall } from "src/libraries/SafeCall.sol";
import { L1BlockIsthmus } from "src/L2/L1BlockIsthmus.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.
function setPrevBaseFee(Vm _vm, address _op, uint128 _prevBaseFee) {
_vm.store(address(_op), bytes32(uint256(1)), bytes32((block.number << 192) | _prevBaseFee));
......@@ -182,7 +185,7 @@ contract GasBenchMark_L1StandardBridge_Finalize is Bridge_Initializer {
deal(address(L1Token), address(l1StandardBridge), 100, true);
vm.mockCall(
address(l1StandardBridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector),
abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l1StandardBridge.OTHER_BRIDGE()))
);
vm.startPrank(address(l1StandardBridge.messenger()));
......
......@@ -2,7 +2,6 @@
pragma solidity 0.8.15;
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
/// it is worthwhile to pull them into one location to ensure that the behavior is consistent.
......
......@@ -2,12 +2,12 @@
pragma solidity 0.8.15;
import {
DataAvailabilityChallenge,
IDataAvailabilityChallenge,
ChallengeStatus,
Challenge,
CommitmentType,
computeCommitmentKeccak256
} from "src/L1/DataAvailabilityChallenge.sol";
CommitmentType
} from "src/L1/interfaces/IDataAvailabilityChallenge.sol";
import { computeCommitmentKeccak256 } from "src/L1/DataAvailabilityChallenge.sol";
import { Proxy } from "src/universal/Proxy.sol";
import { CommonTest } from "test/setup/CommonTest.sol";
......@@ -145,7 +145,9 @@ contract DataAvailabilityChallengeTest is CommonTest {
uint256 actualBond = requiredBond - 1;
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"));
}
......@@ -160,7 +162,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
// Second challenge of the same hash/blockNumber fails
dataAvailabilityChallenge.deposit{ value: dataAvailabilityChallenge.bondSize() }();
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.ChallengeExists.selector));
vm.expectRevert(abi.encodeWithSelector(IDataAvailabilityChallenge.ChallengeExists.selector));
dataAvailabilityChallenge.challenge(0, challengedCommitment);
// Challenge succeed if the challenged block number is different
......@@ -181,7 +183,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
// Challenge fails because the current block number must be after the challenged block
dataAvailabilityChallenge.deposit{ value: dataAvailabilityChallenge.bondSize() }();
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.ChallengeWindowNotOpen.selector));
vm.expectRevert(abi.encodeWithSelector(IDataAvailabilityChallenge.ChallengeWindowNotOpen.selector));
dataAvailabilityChallenge.challenge(challengedBlockNumber, challengedCommitment);
}
......@@ -194,7 +196,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
// Challenge fails because the block number is after the challenge window
dataAvailabilityChallenge.deposit{ value: dataAvailabilityChallenge.bondSize() }();
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.ChallengeWindowNotOpen.selector));
vm.expectRevert(abi.encodeWithSelector(IDataAvailabilityChallenge.ChallengeWindowNotOpen.selector));
dataAvailabilityChallenge.challenge(challengedBlockNumber, challengedCommitment);
}
......@@ -287,7 +289,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
vm.roll(challengedBlockNumber + 1);
// 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);
}
......@@ -307,7 +309,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
dataAvailabilityChallenge.resolve(challengedBlockNumber, challengedCommitment, preImage);
// 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);
}
......@@ -327,7 +329,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
vm.roll(block.number + dataAvailabilityChallenge.resolveWindow() + 1);
// Resolving an expired challenge fails
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.ChallengeNotActive.selector));
vm.expectRevert(abi.encodeWithSelector(IDataAvailabilityChallenge.ChallengeNotActive.selector));
dataAvailabilityChallenge.resolve(challengedBlockNumber, challengedCommitment, preImage);
}
......@@ -347,7 +349,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
vm.roll(block.number + dataAvailabilityChallenge.resolveWindow() + 1);
// Resolve the challenge
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.ChallengeNotActive.selector));
vm.expectRevert(abi.encodeWithSelector(IDataAvailabilityChallenge.ChallengeNotActive.selector));
dataAvailabilityChallenge.resolve(challengedBlockNumber, challengedCommitment, preImage);
}
......@@ -405,7 +407,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
vm.roll(challengedBlockNumber + 1);
// 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);
}
......@@ -425,7 +427,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
dataAvailabilityChallenge.resolve(challengedBlockNumber, challengedCommitment, preImage);
// 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);
}
......@@ -469,7 +471,7 @@ contract DataAvailabilityChallengeTest is CommonTest {
vm.roll(block.number + dataAvailabilityChallenge.resolveWindow() - 1);
// 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);
}
......@@ -480,7 +482,9 @@ contract DataAvailabilityChallengeTest is CommonTest {
// Expect the challenge to fail because the bond is too low
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);
// Reduce the required bond
......@@ -500,7 +504,9 @@ contract DataAvailabilityChallengeTest is CommonTest {
function testSetResolverRefundPercentageFail() public {
address owner = dataAvailabilityChallenge.owner();
vm.expectRevert(abi.encodeWithSelector(DataAvailabilityChallenge.InvalidResolverRefundPercentage.selector, 101));
vm.expectRevert(
abi.encodeWithSelector(IDataAvailabilityChallenge.InvalidResolverRefundPercentage.selector, 101)
);
vm.prank(owner);
dataAvailabilityChallenge.setResolverRefundPercentage(101);
}
......@@ -520,13 +526,13 @@ contract DataAvailabilityChallengeTest is CommonTest {
dataAvailabilityChallenge.validateCommitment(validCommitment);
// 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"));
dataAvailabilityChallenge.validateCommitment(unknownType);
// Should revert if the commitment length does not match
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");
dataAvailabilityChallenge.validateCommitment(invalidLength);
......
......@@ -3,6 +3,7 @@ pragma solidity 0.8.15;
import { Test } from "forge-std/Test.sol";
import { DelayedVetoable } from "src/L1/DelayedVetoable.sol";
import { IDelayedVetoable } from "src/L1/interfaces/IDelayedVetoable.sol";
contract DelayedVetoable_Init is Test {
error Unauthorized(address expected, address actual);
......@@ -16,7 +17,7 @@ contract DelayedVetoable_Init is Test {
address initiator;
address vetoer;
uint256 operatingDelay = 14 days;
DelayedVetoable delayedVetoable;
IDelayedVetoable delayedVetoable;
function setUp() public {
initiator = makeAddr("initiator");
......@@ -25,12 +26,16 @@ contract DelayedVetoable_Init is Test {
vm.deal(initiator, 10000 ether);
vm.deal(vetoer, 10000 ether);
delayedVetoable = new DelayedVetoable({
initiator_: initiator,
vetoer_: vetoer,
target_: address(target),
operatingDelay_: operatingDelay
});
delayedVetoable = IDelayedVetoable(
address(
new DelayedVetoable({
initiator_: initiator,
vetoer_: vetoer,
target_: address(target),
operatingDelay_: operatingDelay
})
)
);
// 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
......
......@@ -13,10 +13,10 @@ import { Encoding } from "src/libraries/Encoding.sol";
import { Constants } from "src/libraries/Constants.sol";
// Target contract dependencies
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { IL1CrossDomainMessenger } from "src/L1/interfaces/IL1CrossDomainMessenger.sol";
import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
contract L1CrossDomainMessenger_Test is Bridge_Initializer {
/// @dev The receiver address
......@@ -29,7 +29,7 @@ contract L1CrossDomainMessenger_Test is Bridge_Initializer {
/// @notice Marked virtual to be overridden in
/// test/kontrol/deployment/DeploymentSummary.t.sol
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.PORTAL()), address(0));
assertEq(address(impl.portal()), address(0));
......@@ -60,7 +60,7 @@ contract L1CrossDomainMessenger_Test is Bridge_Initializer {
vm.expectCall(
address(optimismPortal),
abi.encodeWithSelector(
OptimismPortal.depositTransaction.selector,
IOptimismPortal.depositTransaction.selector,
Predeploys.L2_CROSS_DOMAIN_MESSENGER,
0,
l1CrossDomainMessenger.baseGas(hex"ff", 100),
......@@ -605,7 +605,7 @@ contract L1CrossDomainMessenger_Test is Bridge_Initializer {
/// @dev Tests that the superchain config is called by the messengers paused function
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();
}
......@@ -632,7 +632,7 @@ contract L1CrossDomainMessenger_Test is Bridge_Initializer {
vm.expectCall(
address(optimismPortal),
abi.encodeWithSelector(
OptimismPortal.depositTransaction.selector,
IOptimismPortal.depositTransaction.selector,
Predeploys.L2_CROSS_DOMAIN_MESSENGER,
0,
l1CrossDomainMessenger.baseGas(hex"ff", 100),
......@@ -770,7 +770,7 @@ contract L1CrossDomainMessenger_ReinitReentryTest is Bridge_Initializer {
// call the initializer function
l1CrossDomainMessenger.initialize(
SuperchainConfig(superchainConfig), OptimismPortal(optimismPortal), SystemConfig(systemConfig)
ISuperchainConfig(superchainConfig), IOptimismPortal(optimismPortal), ISystemConfig(systemConfig)
);
// attempt to re-replay the withdrawal
......
......@@ -8,8 +8,8 @@ import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
// Target contract dependencies
import { L2ERC721Bridge } from "src/L2/L2ERC721Bridge.sol";
import { Predeploys } from "src/libraries/Predeploys.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
// Target contract
import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol";
......@@ -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
/// `superchainConfig`.
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();
}
......@@ -352,7 +352,7 @@ contract L1ERC721Bridge_Pause_TestFail is Bridge_Initializer {
vm.mockCall(
address(l1ERC721Bridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector),
abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l1ERC721Bridge.otherBridge()))
);
}
......
......@@ -16,14 +16,13 @@ import { Constants } from "src/libraries/Constants.sol";
// Target contract dependencies
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 { IL2OutputOracle } from "src/L1/interfaces/IL2OutputOracle.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { L1Block } from "src/L2/L1Block.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 { MockERC20 } from "solmate/test/utils/mocks/MockERC20.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
......@@ -43,7 +42,7 @@ contract OptimismPortal_Test is CommonTest {
/// @notice Marked virtual to be overridden in
/// test/kontrol/deployment/DeploymentSummary.t.sol
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.systemConfig()), address(0));
assertEq(address(opImpl.superchainConfig()), address(0));
......@@ -170,7 +169,7 @@ contract OptimismPortal_Test is CommonTest {
_to = address(0);
}
vm.assume(_data.length <= 120_000);
ResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig();
IResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig();
_gasLimit =
uint64(bound(_gasLimit, optimismPortal.minimumGasLimit(uint64(_data.length)), rcfg.maxResourceLimit));
......@@ -1156,7 +1155,7 @@ contract OptimismPortalUpgradeable_Test is CommonTest {
/// @dev Tests that the proxy is initialized correctly.
function test_params_initValuesOnProxy_succeeds() external view {
(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(prevBoughtGas, 0);
......@@ -1240,7 +1239,7 @@ contract OptimismPortalResourceFuzz_Test is CommonTest {
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
ResourceMetering.ResourceConfig memory rcfg = ResourceMetering.ResourceConfig({
IResourceMetering.ResourceConfig memory rcfg = IResourceMetering.ResourceConfig({
maxResourceLimit: _maxResourceLimit,
elasticityMultiplier: _elasticityMultiplier,
baseFeeMaxChangeDenominator: _baseFeeMaxChangeDenominator,
......@@ -1299,7 +1298,7 @@ contract OptimismPortalWithMockERC20_Test is OptimismPortal_FinalizeWithdrawal_T
_to = address(0);
}
vm.assume(_data.length <= 120_000);
ResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig();
IResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig();
_gasLimit =
uint64(bound(_gasLimit, optimismPortal.minimumGasLimit(uint64(_data.length)), rcfg.maxResourceLimit));
......@@ -1514,7 +1513,7 @@ contract OptimismPortalWithMockERC20_Test is OptimismPortal_FinalizeWithdrawal_T
_to = address(0);
}
vm.assume(_data.length <= 120_000);
ResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig();
IResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig();
_gasLimit =
uint64(bound(_gasLimit, optimismPortal.minimumGasLimit(uint64(_data.length)), rcfg.maxResourceLimit));
......
......@@ -17,12 +17,11 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
// Target contract dependencies
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 { SystemConfig } from "src/L1/SystemConfig.sol";
import { L1Block } from "src/L2/L1Block.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 { MockERC20 } from "solmate/test/utils/mocks/MockERC20.sol";
......@@ -50,7 +49,7 @@ contract OptimismPortal2_Test is CommonTest {
/// @notice Marked virtual to be overridden in
/// test/kontrol/deployment/DeploymentSummary.t.sol
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.systemConfig()), address(0));
assertEq(address(opImpl.superchainConfig()), address(0));
......@@ -1404,7 +1403,7 @@ contract OptimismPortal2_Upgradeable_Test is CommonTest {
/// @dev Tests that the proxy is initialized correctly.
function test_params_initValuesOnProxy_succeeds() external view {
(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(prevBoughtGas, 0);
......@@ -1494,7 +1493,7 @@ contract OptimismPortal2_ResourceFuzz_Test is CommonTest {
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
ResourceMetering.ResourceConfig memory rcfg = ResourceMetering.ResourceConfig({
IResourceMetering.ResourceConfig memory rcfg = IResourceMetering.ResourceConfig({
maxResourceLimit: _maxResourceLimit,
elasticityMultiplier: _elasticityMultiplier,
baseFeeMaxChangeDenominator: _baseFeeMaxChangeDenominator,
......@@ -1553,7 +1552,7 @@ contract OptimismPortal2WithMockERC20_Test is OptimismPortal2_FinalizeWithdrawal
_to = address(0);
}
vm.assume(_data.length <= 120_000);
ResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig();
IResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig();
_gasLimit =
uint64(bound(_gasLimit, optimismPortal2.minimumGasLimit(uint64(_data.length)), rcfg.maxResourceLimit));
......@@ -1777,7 +1776,7 @@ contract OptimismPortal2WithMockERC20_Test is OptimismPortal2_FinalizeWithdrawal
_to = address(0);
}
vm.assume(_data.length <= 120_000);
ResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig();
IResourceMetering.ResourceConfig memory rcfg = systemConfig.resourceConfig();
_gasLimit =
uint64(bound(_gasLimit, optimismPortal2.minimumGasLimit(uint64(_data.length)), rcfg.maxResourceLimit));
......
......@@ -7,12 +7,16 @@ import { CommonTest } from "test/setup/CommonTest.sol";
// Libraries
import { Constants } from "src/libraries/Constants.sol";
import { Predeploys } from "src/libraries/Predeploys.sol";
import "src/libraries/PortalErrors.sol";
// Target contract dependencies
import "src/libraries/PortalErrors.sol";
import { OptimismPortalInterop } from "src/L1/OptimismPortalInterop.sol";
import { L1BlockIsthmus, ConfigType } from "src/L2/L1BlockIsthmus.sol";
// Interfaces
import { IOptimismPortalInterop } from "src/L1/interfaces/IOptimismPortalInterop.sol";
contract OptimismPortalInterop_Test is CommonTest {
/// @notice Marked virtual to be overridden in
/// test/kontrol/deployment/DeploymentSummary.t.sol
......@@ -91,7 +95,7 @@ contract OptimismPortalInterop_Test is CommonTest {
}
/// @dev Returns the OptimismPortalInterop instance.
function _optimismPortalInterop() internal view returns (OptimismPortalInterop) {
return OptimismPortalInterop(payable(address(optimismPortal)));
function _optimismPortalInterop() internal view returns (IOptimismPortalInterop) {
return IOptimismPortalInterop(payable(address(optimismPortal)));
}
}
......@@ -12,13 +12,22 @@ import { Proxy } from "src/universal/Proxy.sol";
// Target contract
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
contract MeterUser is ResourceMetering {
ResourceMetering.ResourceConfig public innerConfig;
constructor() {
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 {
......@@ -231,7 +240,15 @@ contract CustomMeterUser is ResourceMetering {
}
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) {
......
......@@ -12,6 +12,7 @@ import { Proxy } from "src/universal/Proxy.sol";
// Target contract
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
contract SuperchainConfig_Init_Test is CommonTest {
/// @dev Tests that initialization sets the correct values. These are defined in CommonTest.sol.
......@@ -23,16 +24,16 @@ contract SuperchainConfig_Init_Test is CommonTest {
/// @dev Tests that it can be intialized as paused.
function test_initialize_paused_succeeds() external {
Proxy newProxy = new Proxy(alice);
SuperchainConfig newImpl = new SuperchainConfig();
ISuperchainConfig newImpl = ISuperchainConfig(address(new SuperchainConfig()));
vm.startPrank(alice);
newProxy.upgradeToAndCall(
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());
assertEq(SuperchainConfig(address(newProxy)).guardian(), deploy.cfg().superchainConfigGuardian());
assertTrue(ISuperchainConfig(address(newProxy)).paused());
assertEq(ISuperchainConfig(address(newProxy)).guardian(), deploy.cfg().superchainConfigGuardian());
}
}
......
......@@ -10,9 +10,9 @@ import { StaticConfig } from "src/libraries/StaticConfig.sol";
import { GasPayingToken } from "src/libraries/GasPayingToken.sol";
// 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 { OptimismPortalInterop } from "src/L1/OptimismPortalInterop.sol";
import { IOptimismPortalInterop } from "src/L1/interfaces/IOptimismPortalInterop.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { ConfigType } from "src/L2/L1BlockIsthmus.sol";
......@@ -46,7 +46,7 @@ contract SystemConfigInterop_Test is CommonTest {
vm.expectCall(
address(optimismPortal),
abi.encodeCall(
OptimismPortalInterop.setConfig,
IOptimismPortalInterop.setConfig,
(
ConfigType.SET_GAS_PAYING_TOKEN,
StaticConfig.encodeSetGasPayingToken({
......@@ -67,7 +67,8 @@ contract SystemConfigInterop_Test is CommonTest {
vm.expectCall(
address(optimismPortal),
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 {
vm.expectCall(
address(optimismPortal),
abi.encodeCall(
OptimismPortalInterop.setConfig,
IOptimismPortalInterop.setConfig,
(ConfigType.REMOVE_DEPENDENCY, StaticConfig.encodeRemoveDependency(_chainId))
)
);
......@@ -118,7 +119,7 @@ contract SystemConfigInterop_Test is CommonTest {
_unsafeBlockSigner: address(1),
_config: Constants.DEFAULT_RESOURCE_CONFIG(),
_batchInbox: address(0),
_addresses: SystemConfig.Addresses({
_addresses: ISystemConfig.Addresses({
l1CrossDomainMessenger: address(0),
l1ERC721Bridge: address(0),
disputeGameFactory: address(0),
......
......@@ -16,7 +16,6 @@ import { Constants } from "src/libraries/Constants.sol";
import { L2CrossDomainMessenger } from "src/L2/L2CrossDomainMessenger.sol";
import { L2ToL1MessagePasser } from "src/L2/L2ToL1MessagePasser.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol";
contract L2CrossDomainMessenger_Test is Bridge_Initializer {
/// @dev Receiver address for testing
......
......@@ -7,7 +7,7 @@ import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
// Target contract is imported by the `Bridge_Initializer`
import { Bridge_Initializer } from "test/setup/Bridge_Initializer.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 { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
......@@ -60,7 +60,7 @@ contract L2StandardBridge_Test is Bridge_Initializer {
abi.encodeWithSelector(StandardBridge.finalizeBridgeETH.selector, alice, alice, 100, hex"");
uint64 baseGas = l2CrossDomainMessenger.baseGas(message, 200_000);
bytes memory withdrawalData = abi.encodeWithSelector(
CrossDomainMessenger.relayMessage.selector,
ICrossDomainMessenger.relayMessage.selector,
nonce,
address(l2StandardBridge),
address(l1StandardBridge),
......@@ -108,7 +108,7 @@ contract L2StandardBridge_Test is Bridge_Initializer {
vm.expectCall(
address(l2CrossDomainMessenger),
abi.encodeWithSelector(
CrossDomainMessenger.sendMessage.selector,
ICrossDomainMessenger.sendMessage.selector,
address(l1StandardBridge),
message,
200_000 // StandardBridge's RECEIVE_DEFAULT_GAS_LIMIT
......@@ -282,7 +282,7 @@ contract PreBridgeERC20 is Bridge_Initializer {
);
uint64 baseGas = l2CrossDomainMessenger.baseGas(message, 1000);
bytes memory withdrawalData = abi.encodeWithSelector(
CrossDomainMessenger.relayMessage.selector,
ICrossDomainMessenger.relayMessage.selector,
nonce,
address(l2StandardBridge),
address(l1StandardBridge),
......@@ -317,7 +317,7 @@ contract PreBridgeERC20 is Bridge_Initializer {
vm.expectCall(
address(l2CrossDomainMessenger),
abi.encodeWithSelector(CrossDomainMessenger.sendMessage.selector, address(l1StandardBridge), message, 1000)
abi.encodeWithSelector(ICrossDomainMessenger.sendMessage.selector, address(l1StandardBridge), message, 1000)
);
vm.expectCall(
......@@ -420,7 +420,7 @@ contract PreBridgeERC20To is Bridge_Initializer {
);
uint64 baseGas = l2CrossDomainMessenger.baseGas(message, 1000);
bytes memory withdrawalData = abi.encodeWithSelector(
CrossDomainMessenger.relayMessage.selector,
ICrossDomainMessenger.relayMessage.selector,
nonce,
address(l2StandardBridge),
address(l1StandardBridge),
......@@ -480,7 +480,7 @@ contract PreBridgeERC20To is Bridge_Initializer {
vm.expectCall(
address(l2CrossDomainMessenger),
abi.encodeWithSelector(CrossDomainMessenger.sendMessage.selector, address(l1StandardBridge), message, 1000)
abi.encodeWithSelector(ICrossDomainMessenger.sendMessage.selector, address(l1StandardBridge), message, 1000)
);
vm.expectCall(
......@@ -524,7 +524,7 @@ contract L2StandardBridge_Bridge_Test is Bridge_Initializer {
function test_finalizeBridgeETH_sendToSelf_reverts() external {
vm.mockCall(
address(l2StandardBridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector),
abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l2StandardBridge.OTHER_BRIDGE()))
);
vm.deal(address(l2CrossDomainMessenger), 100);
......@@ -537,7 +537,7 @@ contract L2StandardBridge_Bridge_Test is Bridge_Initializer {
function test_finalizeBridgeETH_sendToMessenger_reverts() external {
vm.mockCall(
address(l2StandardBridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector),
abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l2StandardBridge.OTHER_BRIDGE()))
);
vm.deal(address(l2CrossDomainMessenger), 100);
......@@ -563,7 +563,7 @@ contract L2StandardBridge_Bridge_Test is Bridge_Initializer {
address(l2CrossDomainMessenger),
_value,
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 {
vm.expectCall(
address(l2CrossDomainMessenger),
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 {
address messenger = address(l2StandardBridge.messenger());
vm.mockCall(
messenger,
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector),
abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l2StandardBridge.OTHER_BRIDGE()))
);
vm.deal(messenger, 100);
......@@ -674,7 +674,7 @@ contract L2StandardBridge_FinalizeBridgeETH_Test is Bridge_Initializer {
address messenger = address(l2StandardBridge.messenger());
vm.mockCall(
messenger,
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector),
abi.encodeWithSelector(ICrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l2StandardBridge.OTHER_BRIDGE()))
);
vm.deal(address(l2CrossDomainMessenger), 1);
......
......@@ -18,7 +18,6 @@ import { GuardManager } from "safe-contracts/base/GuardManager.sol";
import { LivenessGuard } from "src/Safe/LivenessGuard.sol";
import { LivenessModule } from "src/Safe/LivenessModule.sol";
import { DeputyGuardianModule } from "src/Safe/DeputyGuardianModule.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
contract DeployOwnershipTest is Test, DeployOwnership {
address internal constant SENTINEL_MODULES = address(0x1);
......
......@@ -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
/// the DeputyGuardianModule.
function test_noPortalCollisions_succeeds() external {
string[] memory excludes = new string[](3);
excludes[0] = "src/L1/OptimismPortal2.sol";
excludes[1] = "src/dispute/lib/*";
string[] memory excludes = new string[](5);
excludes[0] = "src/dispute/lib/*";
excludes[1] = "src/L1/OptimismPortal2.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);
for (uint256 i; i < abis.length; i++) {
for (uint256 j; j < abis[i].entries.length; j++) {
......
This diff is collapsed.
......@@ -3,8 +3,8 @@ pragma solidity 0.8.15;
import { StdUtils } from "forge-std/StdUtils.sol";
import { Vm } from "forge-std/Vm.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol";
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol";
import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
import { IL1CrossDomainMessenger } from "src/L1/interfaces/IL1CrossDomainMessenger.sol";
import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol";
import { Predeploys } from "src/libraries/Predeploys.sol";
import { Constants } from "src/libraries/Constants.sol";
......@@ -20,12 +20,12 @@ contract RelayActor is StdUtils {
bytes32[] public hashes;
bool public reverted = false;
OptimismPortal op;
L1CrossDomainMessenger xdm;
IOptimismPortal op;
IL1CrossDomainMessenger xdm;
Vm vm;
bool doFail;
constructor(OptimismPortal _op, L1CrossDomainMessenger _xdm, Vm _vm, bool _doFail) {
constructor(IOptimismPortal _op, IL1CrossDomainMessenger _xdm, Vm _vm, bool _doFail) {
op = _op;
xdm = _xdm;
vm = _vm;
......
......@@ -4,8 +4,9 @@ pragma solidity 0.8.15;
import { StdUtils } from "forge-std/Test.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 { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { Constants } from "src/libraries/Constants.sol";
import { CommonTest } from "test/setup/CommonTest.sol";
......@@ -14,10 +15,10 @@ import { Types } from "src/libraries/Types.sol";
contract OptimismPortal_Depositor is StdUtils, ResourceMetering {
Vm internal vm;
OptimismPortal internal portal;
IOptimismPortal internal portal;
bool public failedToComplete;
constructor(Vm _vm, OptimismPortal _portal) {
constructor(Vm _vm, IOptimismPortal _portal) {
vm = _vm;
portal = _portal;
initialize();
......@@ -31,9 +32,11 @@ contract OptimismPortal_Depositor is StdUtils, ResourceMetering {
return _resourceConfig();
}
function _resourceConfig() internal pure override returns (ResourceMetering.ResourceConfig memory) {
ResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG();
return rcfg;
function _resourceConfig() internal pure override returns (ResourceMetering.ResourceConfig memory config_) {
IResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG();
assembly ("memory-safe") {
config_ := rcfg
}
}
// A test intended to identify any unexpected halting conditions
......
......@@ -4,10 +4,10 @@ pragma solidity 0.8.15;
import { StdUtils } from "forge-std/Test.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 { SystemConfig } from "src/L1/SystemConfig.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { Constants } from "src/libraries/Constants.sol";
import { CommonTest } from "test/setup/CommonTest.sol";
......@@ -20,10 +20,10 @@ import "src/libraries/PortalErrors.sol";
contract OptimismPortal2_Depositor is StdUtils, ResourceMetering {
Vm internal vm;
OptimismPortal2 internal portal;
IOptimismPortal2 internal portal;
bool public failedToComplete;
constructor(Vm _vm, OptimismPortal2 _portal) {
constructor(Vm _vm, IOptimismPortal2 _portal) {
vm = _vm;
portal = _portal;
initialize();
......@@ -37,9 +37,11 @@ contract OptimismPortal2_Depositor is StdUtils, ResourceMetering {
return _resourceConfig();
}
function _resourceConfig() internal pure override returns (ResourceMetering.ResourceConfig memory) {
ResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG();
return rcfg;
function _resourceConfig() internal pure override returns (ResourceMetering.ResourceConfig memory config_) {
IResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG();
assembly ("memory-safe") {
config_ := rcfg
}
}
// A test intended to identify any unexpected halting conditions
......
......@@ -8,6 +8,7 @@ import { StdInvariant } from "forge-std/StdInvariant.sol";
import { Arithmetic } from "src/libraries/Arithmetic.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { Constants } from "src/libraries/Constants.sol";
import { InvariantTest } from "test/invariants/InvariantTest.sol";
......@@ -35,9 +36,11 @@ contract ResourceMetering_User is StdUtils, ResourceMetering {
return _resourceConfig();
}
function _resourceConfig() internal pure override returns (ResourceMetering.ResourceConfig memory) {
ResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG();
return rcfg;
function _resourceConfig() internal pure override returns (ResourceMetering.ResourceConfig memory config_) {
IResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG();
assembly ("memory-safe") {
config_ := rcfg
}
}
/// @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;
import { Test } from "forge-std/Test.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { Proxy } from "src/universal/Proxy.sol";
import { Constants } from "src/libraries/Constants.sol";
contract SystemConfig_GasLimitBoundaries_Invariant is Test {
SystemConfig public config;
ISystemConfig public config;
function setUp() external {
Proxy proxy = new Proxy(msg.sender);
SystemConfig configImpl = new SystemConfig();
ISystemConfig configImpl = ISystemConfig(address(new SystemConfig()));
vm.prank(msg.sender);
proxy.upgradeToAndCall(
......@@ -27,7 +28,7 @@ contract SystemConfig_GasLimitBoundaries_Invariant is Test {
address(1), // unsafe block signer
Constants.DEFAULT_RESOURCE_CONFIG(),
address(0), // _batchInbox
SystemConfig.Addresses({ // _addrs
ISystemConfig.Addresses({ // _addrs
l1CrossDomainMessenger: address(0),
l1ERC721Bridge: address(0),
l1StandardBridge: address(0),
......@@ -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`
targetContract(address(config));
......
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Testing
import { console2 as console } from "forge-std/console2.sol";
import { Predeploys } from "src/libraries/Predeploys.sol";
import { Preinstalls } from "src/libraries/Preinstalls.sol";
import { Vm } from "forge-std/Vm.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 { L2StandardBridgeInterop } from "src/L2/L2StandardBridgeInterop.sol";
import { L2ToL1MessagePasser } from "src/L2/L2ToL1MessagePasser.sol";
......@@ -18,31 +28,30 @@ import { GovernanceToken } from "src/governance/GovernanceToken.sol";
import { OptimismMintableERC20Factory } from "src/universal/OptimismMintableERC20Factory.sol";
import { StandardBridge } from "src/universal/StandardBridge.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 { DelayedWETH } from "src/dispute/weth/DelayedWETH.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 { SystemConfig } from "src/L1/SystemConfig.sol";
import { L1StandardBridge } from "src/L1/L1StandardBridge.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 { SuperchainWETH } from "src/L2/SuperchainWETH.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
/// @dev This contact is responsible for setting up the contracts in state. It currently
......@@ -65,20 +74,20 @@ contract Setup {
// @notice Allows users of Setup to override what L2 genesis is being created.
Fork l2Fork = LATEST_FORK;
OptimismPortal optimismPortal;
OptimismPortal2 optimismPortal2;
IOptimismPortal optimismPortal;
IOptimismPortal2 optimismPortal2;
DisputeGameFactory disputeGameFactory;
DelayedWETH delayedWeth;
IL2OutputOracle l2OutputOracle;
SystemConfig systemConfig;
ISystemConfig systemConfig;
L1StandardBridge l1StandardBridge;
L1CrossDomainMessenger l1CrossDomainMessenger;
IL1CrossDomainMessenger l1CrossDomainMessenger;
AddressManager addressManager;
L1ERC721Bridge l1ERC721Bridge;
OptimismMintableERC20Factory l1OptimismMintableERC20Factory;
ProtocolVersions protocolVersions;
SuperchainConfig superchainConfig;
DataAvailabilityChallenge dataAvailabilityChallenge;
ISuperchainConfig superchainConfig;
IDataAvailabilityChallenge dataAvailabilityChallenge;
AnchorStateRegistry anchorStateRegistry;
L2CrossDomainMessenger l2CrossDomainMessenger =
......@@ -131,20 +140,20 @@ contract Setup {
deploy.run();
console.log("Setup: completed L1 deployment, registering addresses now");
optimismPortal = OptimismPortal(deploy.mustGetAddress("OptimismPortalProxy"));
optimismPortal2 = OptimismPortal2(deploy.mustGetAddress("OptimismPortalProxy"));
optimismPortal = IOptimismPortal(deploy.mustGetAddress("OptimismPortalProxy"));
optimismPortal2 = IOptimismPortal2(deploy.mustGetAddress("OptimismPortalProxy"));
disputeGameFactory = DisputeGameFactory(deploy.mustGetAddress("DisputeGameFactoryProxy"));
delayedWeth = DelayedWETH(deploy.mustGetAddress("DelayedWETHProxy"));
l2OutputOracle = IL2OutputOracle(deploy.mustGetAddress("L2OutputOracleProxy"));
systemConfig = SystemConfig(deploy.mustGetAddress("SystemConfigProxy"));
systemConfig = ISystemConfig(deploy.mustGetAddress("SystemConfigProxy"));
l1StandardBridge = L1StandardBridge(deploy.mustGetAddress("L1StandardBridgeProxy"));
l1CrossDomainMessenger = L1CrossDomainMessenger(deploy.mustGetAddress("L1CrossDomainMessengerProxy"));
l1CrossDomainMessenger = IL1CrossDomainMessenger(deploy.mustGetAddress("L1CrossDomainMessengerProxy"));
addressManager = AddressManager(deploy.mustGetAddress("AddressManager"));
l1ERC721Bridge = L1ERC721Bridge(deploy.mustGetAddress("L1ERC721BridgeProxy"));
l1OptimismMintableERC20Factory =
OptimismMintableERC20Factory(deploy.mustGetAddress("OptimismMintableERC20FactoryProxy"));
protocolVersions = ProtocolVersions(deploy.mustGetAddress("ProtocolVersionsProxy"));
superchainConfig = SuperchainConfig(deploy.mustGetAddress("SuperchainConfigProxy"));
superchainConfig = ISuperchainConfig(deploy.mustGetAddress("SuperchainConfigProxy"));
anchorStateRegistry = AnchorStateRegistry(deploy.mustGetAddress("AnchorStateRegistryProxy"));
vm.label(address(l2OutputOracle), "L2OutputOracle");
......@@ -174,7 +183,7 @@ contract Setup {
if (deploy.cfg().useAltDA()) {
dataAvailabilityChallenge =
DataAvailabilityChallenge(deploy.mustGetAddress("DataAvailabilityChallengeProxy"));
IDataAvailabilityChallenge(deploy.mustGetAddress("DataAvailabilityChallengeProxy"));
vm.label(address(dataAvailabilityChallenge), "DataAvailabilityChallengeProxy");
vm.label(deploy.mustGetAddress("DataAvailabilityChallenge"), "DataAvailabilityChallenge");
}
......
......@@ -11,7 +11,7 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
import { Hashing } from "src/libraries/Hashing.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 contracts. For simplicity, we use the L1 Messenger as the test contract.
......@@ -45,11 +45,11 @@ contract CrossDomainMessenger_BaseGas_Test is Bridge_Initializer {
contract ExternalRelay is Test {
address internal op;
address internal fuzzedSender;
L1CrossDomainMessenger internal l1CrossDomainMessenger;
IL1CrossDomainMessenger internal l1CrossDomainMessenger;
event FailedRelayedMessage(bytes32 indexed msgHash);
constructor(L1CrossDomainMessenger _l1Messenger, address _op) {
constructor(IL1CrossDomainMessenger _l1Messenger, address _op) {
l1CrossDomainMessenger = _l1Messenger;
op = _op;
}
......
......@@ -6,11 +6,11 @@ import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol";
import { Executables } from "scripts/libraries/Executables.sol";
import { Constants } from "src/libraries/Constants.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 { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol";
import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol";
import { PermissionedDisputeGame } from "src/dispute/PermissionedDisputeGame.sol";
......@@ -108,7 +108,7 @@ contract Initializer_Test is Bridge_Initializer {
InitializeableContract({
name: "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
......@@ -116,7 +116,7 @@ contract Initializer_Test is Bridge_Initializer {
InitializeableContract({
name: "DelayedWETHProxy",
target: address(delayedWeth),
initCalldata: abi.encodeCall(delayedWeth.initialize, (address(0), SuperchainConfig(address(0))))
initCalldata: abi.encodeCall(delayedWeth.initialize, (address(0), ISuperchainConfig(address(0))))
})
);
// L2OutputOracleImpl
......@@ -181,7 +181,7 @@ contract Initializer_Test is Bridge_Initializer {
bytes32(0),
1,
address(0),
ResourceMetering.ResourceConfig({
IResourceMetering.ResourceConfig({
maxResourceLimit: 1,
elasticityMultiplier: 1,
baseFeeMaxChangeDenominator: 2,
......@@ -190,7 +190,7 @@ contract Initializer_Test is Bridge_Initializer {
maximumBaseFee: 0
}),
address(0),
SystemConfig.Addresses({
ISystemConfig.Addresses({
l1CrossDomainMessenger: address(0),
l1ERC721Bridge: address(0),
l1StandardBridge: address(0),
......@@ -217,7 +217,7 @@ contract Initializer_Test is Bridge_Initializer {
bytes32(0),
1,
address(0),
ResourceMetering.ResourceConfig({
IResourceMetering.ResourceConfig({
maxResourceLimit: 1,
elasticityMultiplier: 1,
baseFeeMaxChangeDenominator: 2,
......@@ -226,7 +226,7 @@ contract Initializer_Test is Bridge_Initializer {
maximumBaseFee: 0
}),
address(0),
SystemConfig.Addresses({
ISystemConfig.Addresses({
l1CrossDomainMessenger: address(0),
l1ERC721Bridge: address(0),
l1StandardBridge: address(0),
......@@ -264,7 +264,9 @@ contract Initializer_Test is Bridge_Initializer {
InitializeableContract({
name: "L2CrossDomainMessenger",
target: address(l2CrossDomainMessenger),
initCalldata: abi.encodeCall(l2CrossDomainMessenger.initialize, (l1CrossDomainMessenger))
initCalldata: abi.encodeCall(
l2CrossDomainMessenger.initialize, (CrossDomainMessenger(address(l1CrossDomainMessenger)))
)
})
);
// L1StandardBridgeImpl
......@@ -273,7 +275,8 @@ contract Initializer_Test is Bridge_Initializer {
name: "L1StandardBridge",
target: deploy.mustGetAddress("L1StandardBridge"),
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 {
name: "L1StandardBridgeProxy",
target: address(l1StandardBridge),
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 {
InitializeableContract({
name: "L1ERC721Bridge",
target: deploy.mustGetAddress("L1ERC721Bridge"),
initCalldata: abi.encodeCall(l1ERC721Bridge.initialize, (l1CrossDomainMessenger, superchainConfig))
initCalldata: abi.encodeCall(
l1ERC721Bridge.initialize, (ICrossDomainMessenger(address(l1CrossDomainMessenger)), superchainConfig)
)
})
);
// L1ERC721BridgeProxy
......@@ -316,7 +322,9 @@ contract Initializer_Test is Bridge_Initializer {
InitializeableContract({
name: "L1ERC721BridgeProxy",
target: address(l1ERC721Bridge),
initCalldata: abi.encodeCall(l1ERC721Bridge.initialize, (l1CrossDomainMessenger, superchainConfig))
initCalldata: abi.encodeCall(
l1ERC721Bridge.initialize, (ICrossDomainMessenger(address(l1CrossDomainMessenger)), superchainConfig)
)
})
);
// L2ERC721Bridge
......@@ -366,7 +374,7 @@ contract Initializer_Test is Bridge_Initializer {
target: address(anchorStateRegistry),
initCalldata: abi.encodeCall(
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 {
target: address(anchorStateRegistry),
initCalldata: abi.encodeCall(
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