Commit ef03df7e authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

contracts-bedrock: remove GCT code (#13921)

* contracts-bedrock: remove GCT code

This commit removes the custom gas token code from the L2 contracts.
The interop contracts were tightly integrated into this code,
so the diff is quite large.

We cannot remove the getters from the `L1Block` contract because
chains did a genesis with `WETH` that calls out to the `L1Block`
contract. `WETH` is not proxied, so we cannot modify the bytecode
without an irregular state transition. Just going to leave the
functions on `L1Block` for simplicity.

Both the messenger and the bridge have the references to CGT removed.

* l1block: test coverage

* contracts-bedrock: more cleanup

* compiler error

* gas-snapshot

* contracts-bedrock: remove dead imports

* ctb: unused imports

* snapshots: update

* interfaces

* ctb: fix
parent de3865c0
...@@ -10,7 +10,6 @@ import { ISuperchainConfig } from "interfaces/L1/ISuperchainConfig.sol"; ...@@ -10,7 +10,6 @@ import { ISuperchainConfig } from "interfaces/L1/ISuperchainConfig.sol";
import { ConfigType } from "interfaces/L2/IL1BlockInterop.sol"; import { ConfigType } from "interfaces/L2/IL1BlockInterop.sol";
interface IOptimismPortalInterop { interface IOptimismPortalInterop {
error CustomGasTokenNotSupported();
error AlreadyFinalized(); error AlreadyFinalized();
error BadTarget(); error BadTarget();
error Blacklisted(); error Blacklisted();
......
...@@ -3,7 +3,6 @@ pragma solidity ^0.8.0; ...@@ -3,7 +3,6 @@ pragma solidity ^0.8.0;
import { IResourceMetering } from "interfaces/L1/IResourceMetering.sol"; import { IResourceMetering } from "interfaces/L1/IResourceMetering.sol";
/// @notice This interface corresponds to the Custom Gas Token version of the SystemConfig contract.
interface ISystemConfig { interface ISystemConfig {
enum UpdateType { enum UpdateType {
BATCHER, BATCHER,
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
interface IETHLiquidity { interface IETHLiquidity {
error NotCustomGasToken();
error Unauthorized(); error Unauthorized();
event LiquidityBurned(address indexed caller, uint256 value); event LiquidityBurned(address indexed caller, uint256 value);
......
...@@ -2,26 +2,21 @@ ...@@ -2,26 +2,21 @@
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
interface IL1Block { interface IL1Block {
error NotDepositor();
event GasPayingTokenSet(address indexed token, uint8 indexed decimals, bytes32 name, bytes32 symbol);
function DEPOSITOR_ACCOUNT() external pure returns (address addr_); function DEPOSITOR_ACCOUNT() external pure returns (address addr_);
function baseFeeScalar() external view returns (uint32); function baseFeeScalar() external view returns (uint32);
function basefee() external view returns (uint256); function basefee() external view returns (uint256);
function batcherHash() external view returns (bytes32); function batcherHash() external view returns (bytes32);
function blobBaseFee() external view returns (uint256); function blobBaseFee() external view returns (uint256);
function blobBaseFeeScalar() external view returns (uint32); function blobBaseFeeScalar() external view returns (uint32);
function gasPayingToken() external view returns (address addr_, uint8 decimals_); function gasPayingToken() external pure returns (address addr_, uint8 decimals_);
function gasPayingTokenName() external view returns (string memory name_); function gasPayingTokenName() external pure returns (string memory name_);
function gasPayingTokenSymbol() external view returns (string memory symbol_); function gasPayingTokenSymbol() external pure returns (string memory symbol_);
function hash() external view returns (bytes32); function hash() external view returns (bytes32);
function isCustomGasToken() external view returns (bool); function isCustomGasToken() external pure returns (bool is_);
function l1FeeOverhead() external view returns (uint256); function l1FeeOverhead() external view returns (uint256);
function l1FeeScalar() external view returns (uint256); function l1FeeScalar() external view returns (uint256);
function number() external view returns (uint64); function number() external view returns (uint64);
function sequenceNumber() external view returns (uint64); function sequenceNumber() external view returns (uint64);
function setGasPayingToken(address _token, uint8 _decimals, bytes32 _name, bytes32 _symbol) external;
function setL1BlockValues( function setL1BlockValues(
uint64 _number, uint64 _number,
uint64 _timestamp, uint64 _timestamp,
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
enum ConfigType { enum ConfigType {
SET_GAS_PAYING_TOKEN,
ADD_DEPENDENCY, ADD_DEPENDENCY,
REMOVE_DEPENDENCY REMOVE_DEPENDENCY
} }
...@@ -17,7 +16,6 @@ interface IL1BlockInterop { ...@@ -17,7 +16,6 @@ interface IL1BlockInterop {
event DependencyAdded(uint256 indexed chainId); event DependencyAdded(uint256 indexed chainId);
event DependencyRemoved(uint256 indexed chainId); event DependencyRemoved(uint256 indexed chainId);
event GasPayingTokenSet(address indexed token, uint8 indexed decimals, bytes32 name, bytes32 symbol);
function DEPOSITOR_ACCOUNT() external pure returns (address addr_); function DEPOSITOR_ACCOUNT() external pure returns (address addr_);
function baseFeeScalar() external view returns (uint32); function baseFeeScalar() external view returns (uint32);
...@@ -27,11 +25,11 @@ interface IL1BlockInterop { ...@@ -27,11 +25,11 @@ interface IL1BlockInterop {
function blobBaseFeeScalar() external view returns (uint32); function blobBaseFeeScalar() external view returns (uint32);
function dependencySetSize() external view returns (uint8); function dependencySetSize() external view returns (uint8);
function depositsComplete() external; function depositsComplete() external;
function gasPayingToken() external view returns (address addr_, uint8 decimals_); function gasPayingToken() external pure returns (address addr_, uint8 decimals_);
function gasPayingTokenName() external view returns (string memory name_); function gasPayingTokenName() external pure returns (string memory name_);
function gasPayingTokenSymbol() external view returns (string memory symbol_); function gasPayingTokenSymbol() external pure returns (string memory symbol_);
function hash() external view returns (bytes32); function hash() external view returns (bytes32);
function isCustomGasToken() external view returns (bool); function isCustomGasToken() external pure returns (bool is_);
function isDeposit() external view returns (bool isDeposit_); function isDeposit() external view returns (bool isDeposit_);
function isInDependencySet(uint256 _chainId) external view returns (bool); function isInDependencySet(uint256 _chainId) external view returns (bool);
function l1FeeOverhead() external view returns (uint256); function l1FeeOverhead() external view returns (uint256);
...@@ -39,7 +37,6 @@ interface IL1BlockInterop { ...@@ -39,7 +37,6 @@ interface IL1BlockInterop {
function number() external view returns (uint64); function number() external view returns (uint64);
function sequenceNumber() external view returns (uint64); function sequenceNumber() external view returns (uint64);
function setConfig(ConfigType _type, bytes memory _value) external; function setConfig(ConfigType _type, bytes memory _value) external;
function setGasPayingToken(address _token, uint8 _decimals, bytes32 _name, bytes32 _symbol) external;
function setL1BlockValues( function setL1BlockValues(
uint64 _number, uint64 _number,
uint64 _timestamp, uint64 _timestamp,
......
...@@ -7,7 +7,6 @@ import { ISemver } from "interfaces/universal/ISemver.sol"; ...@@ -7,7 +7,6 @@ import { ISemver } from "interfaces/universal/ISemver.sol";
interface ISuperchainWETH is IWETH98, IERC7802, ISemver { interface ISuperchainWETH is IWETH98, IERC7802, ISemver {
error Unauthorized(); error Unauthorized();
error NotCustomGasToken();
error InvalidCrossDomainSender(); error InvalidCrossDomainSender();
error ZeroAddress(); error ZeroAddress();
...@@ -16,7 +15,7 @@ interface ISuperchainWETH is IWETH98, IERC7802, ISemver { ...@@ -16,7 +15,7 @@ interface ISuperchainWETH is IWETH98, IERC7802, ISemver {
event RelayETH(address indexed from, address indexed to, uint256 amount, uint256 source); event RelayETH(address indexed from, address indexed to, uint256 amount, uint256 source);
function balanceOf(address src) external view returns (uint256); function balanceOf(address src) external view returns (uint256);
function withdraw(uint256 _amount) external; function withdraw(uint256 wad) external;
function supportsInterface(bytes4 _interfaceId) external view returns (bool); function supportsInterface(bytes4 _interfaceId) external view returns (bool);
function sendETH(address _to, uint256 _chainId) external payable returns (bytes32 msgHash_); function sendETH(address _to, uint256 _chainId) external payable returns (bytes32 msgHash_);
function relayETH(address _from, address _to, uint256 _amount) external; function relayETH(address _from, address _to, uint256 _amount) external;
......
...@@ -210,12 +210,6 @@ contract Deploy is Deployer { ...@@ -210,12 +210,6 @@ contract Deploy is Deployer {
); );
vm.stopPrank(); vm.stopPrank();
if (cfg.useCustomGasToken()) {
// Reset the systemconfig then reinitialize it with the custom gas token
resetInitializedProxy("SystemConfig");
initializeSystemConfig();
}
if (cfg.useAltDA()) { if (cfg.useAltDA()) {
bytes32 typeHash = keccak256(bytes(cfg.daCommitmentType())); bytes32 typeHash = keccak256(bytes(cfg.daCommitmentType()));
bytes32 keccakHash = keccak256(bytes("KeccakCommitment")); bytes32 keccakHash = keccak256(bytes("KeccakCommitment"));
...@@ -505,11 +499,6 @@ contract Deploy is Deployer { ...@@ -505,11 +499,6 @@ contract Deploy is Deployer {
bytes32 batcherHash = bytes32(uint256(uint160(cfg.batchSenderAddress()))); bytes32 batcherHash = bytes32(uint256(uint160(cfg.batchSenderAddress())));
address customGasTokenAddress = Constants.ETHER;
if (cfg.useCustomGasToken()) {
customGasTokenAddress = cfg.customGasTokenAddress();
}
IProxyAdmin proxyAdmin = IProxyAdmin(payable(artifacts.mustGetAddress("ProxyAdmin"))); IProxyAdmin proxyAdmin = IProxyAdmin(payable(artifacts.mustGetAddress("ProxyAdmin")));
proxyAdmin.upgradeAndCall({ proxyAdmin.upgradeAndCall({
_proxy: payable(systemConfigProxy), _proxy: payable(systemConfigProxy),
......
...@@ -85,9 +85,6 @@ contract DeployConfig is Script { ...@@ -85,9 +85,6 @@ contract DeployConfig is Script {
uint256 public daBondSize; uint256 public daBondSize;
uint256 public daResolverRefundPercentage; uint256 public daResolverRefundPercentage;
bool public useCustomGasToken;
address public customGasTokenAddress;
bool public useInterop; bool public useInterop;
bool public useUpgradedFork; bool public useUpgradedFork;
...@@ -171,9 +168,6 @@ contract DeployConfig is Script { ...@@ -171,9 +168,6 @@ contract DeployConfig is Script {
daBondSize = _readOr(_json, "$.daBondSize", 1000000000); daBondSize = _readOr(_json, "$.daBondSize", 1000000000);
daResolverRefundPercentage = _readOr(_json, "$.daResolverRefundPercentage", 0); daResolverRefundPercentage = _readOr(_json, "$.daResolverRefundPercentage", 0);
useCustomGasToken = _readOr(_json, "$.useCustomGasToken", false);
customGasTokenAddress = _readOr(_json, "$.customGasTokenAddress", address(0));
useInterop = _readOr(_json, "$.useInterop", false); useInterop = _readOr(_json, "$.useInterop", false);
useUpgradedFork; useUpgradedFork;
} }
...@@ -232,12 +226,6 @@ contract DeployConfig is Script { ...@@ -232,12 +226,6 @@ contract DeployConfig is Script {
fundDevAccounts = _fundDevAccounts; fundDevAccounts = _fundDevAccounts;
} }
/// @notice Allow the `useCustomGasToken` config to be overridden in testing environments
function setUseCustomGasToken(address _token) public {
useCustomGasToken = true;
customGasTokenAddress = _token;
}
/// @notice Allow the `useUpgradedFork` config to be overridden in testing environments /// @notice Allow the `useUpgradedFork` config to be overridden in testing environments
/// @dev When true, the forked system WILL be upgraded in setUp(). /// @dev When true, the forked system WILL be upgraded in setUp().
/// When false, the forked system WILL NOT be upgraded in setUp(). /// When false, the forked system WILL NOT be upgraded in setUp().
......
GasBenchMark_L1BlockInterop_DepositsComplete:test_depositsComplete_benchmark() (gas: 7589) GasBenchMark_L1BlockInterop_DepositsComplete:test_depositsComplete_benchmark() (gas: 7567)
GasBenchMark_L1BlockInterop_DepositsComplete_Warm:test_depositsComplete_benchmark() (gas: 5589) GasBenchMark_L1BlockInterop_DepositsComplete_Warm:test_depositsComplete_benchmark() (gas: 5567)
GasBenchMark_L1BlockInterop_SetValuesInterop:test_setL1BlockValuesInterop_benchmark() (gas: 175722) GasBenchMark_L1BlockInterop_SetValuesInterop:test_setL1BlockValuesInterop_benchmark() (gas: 175700)
GasBenchMark_L1BlockInterop_SetValuesInterop_Warm:test_setL1BlockValuesInterop_benchmark() (gas: 5144) GasBenchMark_L1BlockInterop_SetValuesInterop_Warm:test_setL1BlockValuesInterop_benchmark() (gas: 5144)
GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (gas: 158553) GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (gas: 158487)
GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7619) GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7597)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 356487) GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 356475)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2954716) GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2954682)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 551627) GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 551585)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4063775) GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4063778)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 450267) GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 450277)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3496188) GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3496176)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 59798) GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 59843)
\ No newline at end of file \ No newline at end of file
...@@ -70,11 +70,6 @@ ...@@ -70,11 +70,6 @@
"name": "LiquidityMinted", "name": "LiquidityMinted",
"type": "event" "type": "event"
}, },
{
"inputs": [],
"name": "NotCustomGasToken",
"type": "error"
},
{ {
"inputs": [], "inputs": [],
"name": "Unauthorized", "name": "Unauthorized",
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
"type": "uint8" "type": "uint8"
} }
], ],
"stateMutability": "view", "stateMutability": "pure",
"type": "function" "type": "function"
}, },
{ {
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
"type": "string" "type": "string"
} }
], ],
"stateMutability": "view", "stateMutability": "pure",
"type": "function" "type": "function"
}, },
{ {
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
"type": "string" "type": "string"
} }
], ],
"stateMutability": "view", "stateMutability": "pure",
"type": "function" "type": "function"
}, },
{ {
...@@ -140,11 +140,11 @@ ...@@ -140,11 +140,11 @@
"outputs": [ "outputs": [
{ {
"internalType": "bool", "internalType": "bool",
"name": "", "name": "is_",
"type": "bool" "type": "bool"
} }
], ],
"stateMutability": "view", "stateMutability": "pure",
"type": "function" "type": "function"
}, },
{ {
...@@ -199,34 +199,6 @@ ...@@ -199,34 +199,6 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "address",
"name": "_token",
"type": "address"
},
{
"internalType": "uint8",
"name": "_decimals",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "_name",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "_symbol",
"type": "bytes32"
}
],
"name": "setGasPayingToken",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
...@@ -307,41 +279,5 @@ ...@@ -307,41 +279,5 @@
], ],
"stateMutability": "pure", "stateMutability": "pure",
"type": "function" "type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": true,
"internalType": "uint8",
"name": "decimals",
"type": "uint8"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "name",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "symbol",
"type": "bytes32"
}
],
"name": "GasPayingTokenSet",
"type": "event"
},
{
"inputs": [],
"name": "NotDepositor",
"type": "error"
} }
] ]
\ No newline at end of file
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
"type": "uint8" "type": "uint8"
} }
], ],
"stateMutability": "view", "stateMutability": "pure",
"type": "function" "type": "function"
}, },
{ {
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
"type": "string" "type": "string"
} }
], ],
"stateMutability": "view", "stateMutability": "pure",
"type": "function" "type": "function"
}, },
{ {
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
"type": "string" "type": "string"
} }
], ],
"stateMutability": "view", "stateMutability": "pure",
"type": "function" "type": "function"
}, },
{ {
...@@ -160,11 +160,11 @@ ...@@ -160,11 +160,11 @@
"outputs": [ "outputs": [
{ {
"internalType": "bool", "internalType": "bool",
"name": "", "name": "is_",
"type": "bool" "type": "bool"
} }
], ],
"stateMutability": "view", "stateMutability": "pure",
"type": "function" "type": "function"
}, },
{ {
...@@ -269,34 +269,6 @@ ...@@ -269,34 +269,6 @@
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "address",
"name": "_token",
"type": "address"
},
{
"internalType": "uint8",
"name": "_decimals",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "_name",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "_symbol",
"type": "bytes32"
}
],
"name": "setGasPayingToken",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
...@@ -411,37 +383,6 @@ ...@@ -411,37 +383,6 @@
"name": "DependencyRemoved", "name": "DependencyRemoved",
"type": "event" "type": "event"
}, },
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": true,
"internalType": "uint8",
"name": "decimals",
"type": "uint8"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "name",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "symbol",
"type": "bytes32"
}
],
"name": "GasPayingTokenSet",
"type": "event"
},
{ {
"inputs": [], "inputs": [],
"name": "AlreadyDependency", "name": "AlreadyDependency",
......
...@@ -785,11 +785,6 @@ ...@@ -785,11 +785,6 @@
"name": "ContentLengthMismatch", "name": "ContentLengthMismatch",
"type": "error" "type": "error"
}, },
{
"inputs": [],
"name": "CustomGasTokenNotSupported",
"type": "error"
},
{ {
"inputs": [], "inputs": [],
"name": "EmptyItem", "name": "EmptyItem",
......
...@@ -305,7 +305,7 @@ ...@@ -305,7 +305,7 @@
"inputs": [ "inputs": [
{ {
"internalType": "uint256", "internalType": "uint256",
"name": "_amount", "name": "wad",
"type": "uint256" "type": "uint256"
} }
], ],
...@@ -519,11 +519,6 @@ ...@@ -519,11 +519,6 @@
"name": "InvalidCrossDomainSender", "name": "InvalidCrossDomainSender",
"type": "error" "type": "error"
}, },
{
"inputs": [],
"name": "NotCustomGasToken",
"type": "error"
},
{ {
"inputs": [], "inputs": [],
"name": "Unauthorized", "name": "Unauthorized",
......
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
"type": "string" "type": "string"
} }
], ],
"stateMutability": "view", "stateMutability": "pure",
"type": "function" "type": "function"
}, },
{ {
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
"type": "string" "type": "string"
} }
], ],
"stateMutability": "view", "stateMutability": "pure",
"type": "function" "type": "function"
}, },
{ {
......
...@@ -4,16 +4,16 @@ ...@@ -4,16 +4,16 @@
"sourceCodeHash": "0xae49c741c8cd546981ab59b85b88e9fc1055c4fae085e7078d601b42464f86e6" "sourceCodeHash": "0xae49c741c8cd546981ab59b85b88e9fc1055c4fae085e7078d601b42464f86e6"
}, },
"src/L1/L1CrossDomainMessenger.sol": { "src/L1/L1CrossDomainMessenger.sol": {
"initCodeHash": "0xcff231ee7465984e853572c5050e761f746575d78f709eba65c982178de3e718", "initCodeHash": "0x2364c7a72eb76c0d154836ef0b1fdac695c25d4f9bbae4b5a4cf37d4609652e8",
"sourceCodeHash": "0x9726b6f646269f4288ff8dc1b8228dedbdf960e90df1d11793bc534297328e96" "sourceCodeHash": "0xe450b4c93a285f683614841eb0042ac937bb250067183854d3cc20b78f587bd1"
}, },
"src/L1/L1ERC721Bridge.sol": { "src/L1/L1ERC721Bridge.sol": {
"initCodeHash": "0x280488bce8b4fb364740c59de14c423851902088f384e077bccc79b9df48528a", "initCodeHash": "0x280488bce8b4fb364740c59de14c423851902088f384e077bccc79b9df48528a",
"sourceCodeHash": "0xe12b9e6c4e4ac2e2c9a03f07c7689f6bf2231922536072812cf1f37a5a276e73" "sourceCodeHash": "0xe12b9e6c4e4ac2e2c9a03f07c7689f6bf2231922536072812cf1f37a5a276e73"
}, },
"src/L1/L1StandardBridge.sol": { "src/L1/L1StandardBridge.sol": {
"initCodeHash": "0xe69e972e18930d3feaaad20b8e0e15625df9a71ad8304ee7d89c17d32644e152", "initCodeHash": "0x09c6337af41d036219fc4679b862e221887eca434b18d483332c37caeff9abca",
"sourceCodeHash": "0xc6613d35d1ad95cbef26a503a10b5dd8663ceb80426f8c528835d39f79e4b4cf" "sourceCodeHash": "0x2dd7bf6cbce655b1023a3ad071523bf455aa13fad5d02e1e434af71728cd794c"
}, },
"src/L1/OPContractsManager.sol": { "src/L1/OPContractsManager.sol": {
"initCodeHash": "0x9fc601820098fb3308ece91087c9209a4bff049f1f8d1e7c33a7a7a27cf5f96f", "initCodeHash": "0x9fc601820098fb3308ece91087c9209a4bff049f1f8d1e7c33a7a7a27cf5f96f",
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
"sourceCodeHash": "0xf215a31954f2ef166cfb26d20e466c62fafa235a08fc42c55131dcb81998ff01" "sourceCodeHash": "0xf215a31954f2ef166cfb26d20e466c62fafa235a08fc42c55131dcb81998ff01"
}, },
"src/L1/OptimismPortalInterop.sol": { "src/L1/OptimismPortalInterop.sol": {
"initCodeHash": "0x057c56174304f3773654fed39abf5fab70d9446f531d07fdb225b738a680ad46", "initCodeHash": "0x9f185554099af7d887217d2eda37477880a6526851dde821a4a1ddec4aa4e704",
"sourceCodeHash": "0xc04a7f9c14a13ec3587f5cc351c8e9f27fbbe9f1291a1aba07de29edbeef418a" "sourceCodeHash": "0x14b5644f8400be1ee656662d654b05f90baf5c24c6623cb22e72f92b883b2986"
}, },
"src/L1/ProtocolVersions.sol": { "src/L1/ProtocolVersions.sol": {
"initCodeHash": "0x0000ec89712d8b4609873f1ba76afffd4205bf9110818995c90134dbec12e91e", "initCodeHash": "0x0000ec89712d8b4609873f1ba76afffd4205bf9110818995c90134dbec12e91e",
...@@ -44,8 +44,8 @@ ...@@ -44,8 +44,8 @@
"sourceCodeHash": "0x0cfa6d791e217bd6650e1155ead95781505cd364b698cbea44c7684b1e506d57" "sourceCodeHash": "0x0cfa6d791e217bd6650e1155ead95781505cd364b698cbea44c7684b1e506d57"
}, },
"src/L1/SystemConfigInterop.sol": { "src/L1/SystemConfigInterop.sol": {
"initCodeHash": "0xa5a43846dbf17233c3ac5bb845798b3dbb95e4773249e9b74cb88626a5e77132", "initCodeHash": "0x77334e463e8415a6995cd87f1d69e98c65c6e815ec60cc30d2eb55303808aa8e",
"sourceCodeHash": "0x893478f9816eb4e0764ed275a3ff27d8b9aa264ce5c5f4f0011cecfcc3638e47" "sourceCodeHash": "0x6324e4d4d87d8308f6ce6ca3759366a63b8ddb08c7fa78b6d295c14384a88289"
}, },
"src/L2/BaseFeeVault.sol": { "src/L2/BaseFeeVault.sol": {
"initCodeHash": "0xc403d4c555d8e69a2699e01d192ae7327136701fa02da10a6d75a584b3c364c9", "initCodeHash": "0xc403d4c555d8e69a2699e01d192ae7327136701fa02da10a6d75a584b3c364c9",
...@@ -56,40 +56,40 @@ ...@@ -56,40 +56,40 @@
"sourceCodeHash": "0x661d7659f09b7f909e8bd5e6c41e8c98f2091036ed2123b7e18a1a74120bd849" "sourceCodeHash": "0x661d7659f09b7f909e8bd5e6c41e8c98f2091036ed2123b7e18a1a74120bd849"
}, },
"src/L2/ETHLiquidity.sol": { "src/L2/ETHLiquidity.sol": {
"initCodeHash": "0xdc7075deb7e7c407e6ec3be33ce352ee4a9ca0e82f4bffeb360c93b395a2452f", "initCodeHash": "0x776ece4a1bb24d97287806769470327641da240b083898a90943e2844957cc46",
"sourceCodeHash": "0x92bf6a7a13d1331cbfed35e22130b54b00576bd31de5feb309dfadef2a0b7dd9" "sourceCodeHash": "0xe5c08ce62327113e4bbaf29f47e5f1ddfad6fbd63c07132eedfba5af5325f331"
}, },
"src/L2/GasPriceOracle.sol": { "src/L2/GasPriceOracle.sol": {
"initCodeHash": "0x83d50e3b34cd1b4de32f1cced28796b07aefc526cc17ceb1903ad55f4abc90b7", "initCodeHash": "0x83d50e3b34cd1b4de32f1cced28796b07aefc526cc17ceb1903ad55f4abc90b7",
"sourceCodeHash": "0x305c72d7be9149fce7095bd4641a1a19acada3126fbc43599f674cadbf6e7d6c" "sourceCodeHash": "0x305c72d7be9149fce7095bd4641a1a19acada3126fbc43599f674cadbf6e7d6c"
}, },
"src/L2/L1Block.sol": { "src/L2/L1Block.sol": {
"initCodeHash": "0x22f9b9277e33dc27df8366c2dd6e8340d294947b57116db35c6d14c41225633f", "initCodeHash": "0xc4c2f3ceaa2738a326f7c3e449c45bc642c0810f4c21332b261bb3a3b3f4397e",
"sourceCodeHash": "0xffb6cf768097b2d6cb6ecb2d6463c176af9acd70415aa0d2e4f017758f737eee" "sourceCodeHash": "0x0d72e0709675fdef8b22255000f49d895ee57a7c682cfbc60a5e272b03d38115"
}, },
"src/L2/L1BlockInterop.sol": { "src/L2/L1BlockInterop.sol": {
"initCodeHash": "0x67e99306d9a09cac587f65cfa2c0de55da9eca184fd1fc3f4b885d2c47114483", "initCodeHash": "0xb2782f1ca0fa0899aa5e879471d9e9044e032e7f931fedcff7803c9a43f8a735",
"sourceCodeHash": "0x9493f90136917fc95d2ac942f061c1b9cffeff6d327afb46fe4e69784e7f2100" "sourceCodeHash": "0x01017177d32f567df0273acb1561043d97cf0a36308a95917e0f402682ae5209"
}, },
"src/L2/L1FeeVault.sol": { "src/L2/L1FeeVault.sol": {
"initCodeHash": "0x6745b7be3895a5e8d373df0066d931bae29c47672ac46c2f5829bd0052cc6d9e", "initCodeHash": "0x6745b7be3895a5e8d373df0066d931bae29c47672ac46c2f5829bd0052cc6d9e",
"sourceCodeHash": "0xd0471c328c1d17c5863261322bf8d5aff2e7e9e3a1135631a993aa75667621df" "sourceCodeHash": "0xd0471c328c1d17c5863261322bf8d5aff2e7e9e3a1135631a993aa75667621df"
}, },
"src/L2/L2CrossDomainMessenger.sol": { "src/L2/L2CrossDomainMessenger.sol": {
"initCodeHash": "0xa6adb9d117af95f1a8be066b67a56ed8a029dd692ca363d636ad251ec9179945", "initCodeHash": "0x6117d2ca80029c802b1e5cc36341f03ec48efd07df0251121d3faf5e93aa5901",
"sourceCodeHash": "0x74882c3cca14807219789b5b2b264ebd17479b409042c09db2da52736f9de36e" "sourceCodeHash": "0x48001529220d274c5cd2e84787239b6d2244780d23894e0a8e96550a40be18fe"
}, },
"src/L2/L2ERC721Bridge.sol": { "src/L2/L2ERC721Bridge.sol": {
"initCodeHash": "0xea899e672803634b98d619174bf85dc8b3f7e6407bb7306eb72ed4c8eefce0c0", "initCodeHash": "0xea899e672803634b98d619174bf85dc8b3f7e6407bb7306eb72ed4c8eefce0c0",
"sourceCodeHash": "0xea896e18eceb9ba6e8125e9f3371549787e082db4b26d642b279b5697651d473" "sourceCodeHash": "0xea896e18eceb9ba6e8125e9f3371549787e082db4b26d642b279b5697651d473"
}, },
"src/L2/L2StandardBridge.sol": { "src/L2/L2StandardBridge.sol": {
"initCodeHash": "0xde3b3a1aa0056d25ab3f4ad6e29b9d56c4740b29cd9bef36588d849ffc0178f6", "initCodeHash": "0xbc702854c3b6da0e5c476fabc29b1a2464bee3a1ebda7175232a5c41d7ace5e6",
"sourceCodeHash": "0x6c32dba4550b9c82d80666796e89c77799c21001691a116663970508121be03b" "sourceCodeHash": "0x0a2ea11f3114fd1c62fae90feec5032930afc898ac75af52a67a5266eeeedf9b"
}, },
"src/L2/L2StandardBridgeInterop.sol": { "src/L2/L2StandardBridgeInterop.sol": {
"initCodeHash": "0xb8df14bf93beb53be269c641c80b50d6ad872894da49d5f60d0b976e0ba8839e", "initCodeHash": "0x38977293cf77c047b1c3f0df5848ee9d52f742ddc7916b67c4f714c103a5a2a5",
"sourceCodeHash": "0x3b35ee19099fc4ffb111a4cd774434c414e56d33017cce47fdba3f712e2429b1" "sourceCodeHash": "0xd0f5eaf7c8f1d14f2f997f634e279d0c4fd6843cb20b0e7eb9b9c757da591d38"
}, },
"src/L2/L2ToL1MessagePasser.sol": { "src/L2/L2ToL1MessagePasser.sol": {
"initCodeHash": "0xf9d82084dcef31a3737a76d8ee4e5842ea190d0f77ed4678adb3bbb95217050f", "initCodeHash": "0xf9d82084dcef31a3737a76d8ee4e5842ea190d0f77ed4678adb3bbb95217050f",
...@@ -132,12 +132,12 @@ ...@@ -132,12 +132,12 @@
"sourceCodeHash": "0xcd2b49cb7cf6d18616ee8bec9183fe5b5b460941875bc0b4158c4d5390ec3b0c" "sourceCodeHash": "0xcd2b49cb7cf6d18616ee8bec9183fe5b5b460941875bc0b4158c4d5390ec3b0c"
}, },
"src/L2/SuperchainWETH.sol": { "src/L2/SuperchainWETH.sol": {
"initCodeHash": "0x6ded8aeea6edf7e0ead7b0d2a12ef236f1fb7d21980a1dd564cbe86affca7927", "initCodeHash": "0x545686820e440d72529c815b7406844272d5ec33b741b2be6ebbe3a3db1ca8ad",
"sourceCodeHash": "0x11d711704a5afcae6076d017ee001b25bc705728973b1ad2e6a32274a8475f50" "sourceCodeHash": "0x6145e61cc0a0c95db882a76ecffea15c358c2b574d5157e53b85a69908701613"
}, },
"src/L2/WETH.sol": { "src/L2/WETH.sol": {
"initCodeHash": "0x480d4f8dbec1b0d3211bccbbdfb69796f3e90c784f724b1bbfd4703b0aafdeba", "initCodeHash": "0x38b396fc35d72e8013bad2fe8d7dea5285499406d4c4b62e27c54252e1e0f00a",
"sourceCodeHash": "0xe9964aa66db1dfc86772958b4c9276697e67f7055529a43e6a49a055009bc995" "sourceCodeHash": "0xf4f83ca89d2519045a2916c670bda66f39b431a13921e639a5342bfc6157b178"
}, },
"src/cannon/MIPS.sol": { "src/cannon/MIPS.sol": {
"initCodeHash": "0x7d0fc7c7b51b74fa2611aaa8cc1a5967e2e48f0726ea894eb2c43f36b0ff2ab7", "initCodeHash": "0x7d0fc7c7b51b74fa2611aaa8cc1a5967e2e48f0726ea894eb2c43f36b0ff2ab7",
......
...@@ -6,7 +6,6 @@ import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol"; ...@@ -6,7 +6,6 @@ import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
// Libraries // Libraries
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { Constants } from "src/libraries/Constants.sol";
// Interfaces // Interfaces
import { ISemver } from "interfaces/universal/ISemver.sol"; import { ISemver } from "interfaces/universal/ISemver.sol";
...@@ -32,8 +31,8 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver { ...@@ -32,8 +31,8 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver {
address private spacer_253_0_20; address private spacer_253_0_20;
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 2.4.1-beta.7 /// @custom:semver 2.4.1-beta.8
string public constant version = "2.4.1-beta.7"; string public constant version = "2.4.1-beta.8";
/// @notice Constructs the L1CrossDomainMessenger contract. /// @notice Constructs the L1CrossDomainMessenger contract.
constructor() { constructor() {
...@@ -49,13 +48,6 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver { ...@@ -49,13 +48,6 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver {
__CrossDomainMessenger_init({ _otherMessenger: CrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER) }); __CrossDomainMessenger_init({ _otherMessenger: CrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER) });
} }
/// @inheritdoc CrossDomainMessenger
/// @dev This is added to maintain compatibility with the CrossDomainMessenger abstract contract and should always
/// return the ether address and 18 decimals.
function gasPayingToken() internal pure override returns (address addr_, uint8 decimals_) {
return (Constants.ETHER, 18);
}
/// @notice Getter function for the OptimismPortal contract on this chain. /// @notice Getter function for the OptimismPortal contract on this chain.
/// Public getter is legacy and will be removed in the future. Use `portal()` instead. /// Public getter is legacy and will be removed in the future. Use `portal()` instead.
/// @return Contract of the OptimismPortal on this chain. /// @return Contract of the OptimismPortal on this chain.
......
...@@ -6,7 +6,6 @@ import { StandardBridge } from "src/universal/StandardBridge.sol"; ...@@ -6,7 +6,6 @@ import { StandardBridge } from "src/universal/StandardBridge.sol";
// Libraries // Libraries
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { Constants } from "src/libraries/Constants.sol";
// Interfaces // Interfaces
import { ISemver } from "interfaces/universal/ISemver.sol"; import { ISemver } from "interfaces/universal/ISemver.sol";
...@@ -75,8 +74,8 @@ contract L1StandardBridge is StandardBridge, ISemver { ...@@ -75,8 +74,8 @@ contract L1StandardBridge is StandardBridge, ISemver {
); );
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 2.2.1-beta.7 /// @custom:semver 2.2.1-beta.8
string public constant version = "2.2.1-beta.7"; string public constant version = "2.2.1-beta.8";
/// @notice Address of the SuperchainConfig contract. /// @notice Address of the SuperchainConfig contract.
ISuperchainConfig public superchainConfig; ISuperchainConfig public superchainConfig;
...@@ -112,13 +111,6 @@ contract L1StandardBridge is StandardBridge, ISemver { ...@@ -112,13 +111,6 @@ contract L1StandardBridge is StandardBridge, ISemver {
_initiateETHDeposit(msg.sender, msg.sender, RECEIVE_DEFAULT_GAS_LIMIT, bytes("")); _initiateETHDeposit(msg.sender, msg.sender, RECEIVE_DEFAULT_GAS_LIMIT, bytes(""));
} }
/// @inheritdoc StandardBridge
/// @dev This is added to maintain compatibility with the CrossDomainMessenger abstract contract and should always
/// return the ether address and 18 decimals.
function gasPayingToken() internal pure override returns (address addr_, uint8 decimals_) {
return (Constants.ETHER, 18);
}
/// @custom:legacy /// @custom:legacy
/// @notice Deposits some amount of ETH into the sender's account on L2. /// @notice Deposits some amount of ETH into the sender's account on L2.
/// @param _minGasLimit Minimum gas limit for the deposit message on L2. /// @param _minGasLimit Minimum gas limit for the deposit message on L2.
......
...@@ -12,9 +12,6 @@ import { Unauthorized } from "src/libraries/PortalErrors.sol"; ...@@ -12,9 +12,6 @@ import { Unauthorized } from "src/libraries/PortalErrors.sol";
// Interfaces // Interfaces
import { IL1BlockInterop, ConfigType } from "interfaces/L2/IL1BlockInterop.sol"; import { IL1BlockInterop, ConfigType } from "interfaces/L2/IL1BlockInterop.sol";
/// @notice Error thrown when attempting to use custom gas token specific actions.
error CustomGasTokenNotSupported();
/// @custom:proxied true /// @custom:proxied true
/// @title OptimismPortalInterop /// @title OptimismPortalInterop
/// @notice The OptimismPortal is a low-level contract responsible for passing messages between L1 /// @notice The OptimismPortal is a low-level contract responsible for passing messages between L1
...@@ -28,9 +25,9 @@ contract OptimismPortalInterop is OptimismPortal2 { ...@@ -28,9 +25,9 @@ contract OptimismPortalInterop is OptimismPortal2 {
OptimismPortal2(_proofMaturityDelaySeconds, _disputeGameFinalityDelaySeconds) OptimismPortal2(_proofMaturityDelaySeconds, _disputeGameFinalityDelaySeconds)
{ } { }
/// @custom:semver +interop-beta.9 /// @custom:semver +interop-beta.10
function version() public pure override returns (string memory) { function version() public pure override returns (string memory) {
return string.concat(super.version(), "+interop-beta.9"); return string.concat(super.version(), "+interop-beta.10");
} }
/// @notice Sets static configuration options for the L2 system. /// @notice Sets static configuration options for the L2 system.
...@@ -38,7 +35,6 @@ contract OptimismPortalInterop is OptimismPortal2 { ...@@ -38,7 +35,6 @@ contract OptimismPortalInterop is OptimismPortal2 {
/// @param _value Encoded value of the configuration. /// @param _value Encoded value of the configuration.
function setConfig(ConfigType _type, bytes memory _value) external { function setConfig(ConfigType _type, bytes memory _value) external {
if (msg.sender != address(systemConfig)) revert Unauthorized(); if (msg.sender != address(systemConfig)) revert Unauthorized();
if (_type == ConfigType.SET_GAS_PAYING_TOKEN) revert CustomGasTokenNotSupported();
// Set L2 deposit gas as used without paying burning gas. Ensures that deposits cannot use too much L2 gas. // Set L2 deposit gas as used without paying burning gas. Ensures that deposits cannot use too much L2 gas.
// This value must be large enough to cover the cost of calling `L1Block.setConfig`. // This value must be large enough to cover the cost of calling `L1Block.setConfig`.
......
...@@ -65,9 +65,9 @@ contract SystemConfigInterop is SystemConfig { ...@@ -65,9 +65,9 @@ contract SystemConfigInterop is SystemConfig {
Storage.setAddress(DEPENDENCY_MANAGER_SLOT, _dependencyManager); Storage.setAddress(DEPENDENCY_MANAGER_SLOT, _dependencyManager);
} }
/// @custom:semver +interop-beta.11 /// @custom:semver +interop-beta.12
function version() public pure override returns (string memory) { function version() public pure override returns (string memory) {
return string.concat(super.version(), "+interop-beta.11"); return string.concat(super.version(), "+interop-beta.12");
} }
/// @notice Adds a chain to the interop dependency set. Can only be called by the dependency manager. /// @notice Adds a chain to the interop dependency set. Can only be called by the dependency manager.
......
...@@ -5,12 +5,11 @@ pragma solidity 0.8.15; ...@@ -5,12 +5,11 @@ pragma solidity 0.8.15;
import { SafeSend } from "src/universal/SafeSend.sol"; import { SafeSend } from "src/universal/SafeSend.sol";
// Libraries // Libraries
import { Unauthorized, NotCustomGasToken } from "src/libraries/errors/CommonErrors.sol"; import { Unauthorized } from "src/libraries/errors/CommonErrors.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
// Interfaces // Interfaces
import { ISemver } from "interfaces/universal/ISemver.sol"; import { ISemver } from "interfaces/universal/ISemver.sol";
import { IL1Block } from "interfaces/L2/IL1Block.sol";
/// @custom:proxied true /// @custom:proxied true
/// @custom:predeploy 0x4200000000000000000000000000000000000025 /// @custom:predeploy 0x4200000000000000000000000000000000000025
...@@ -25,13 +24,12 @@ contract ETHLiquidity is ISemver { ...@@ -25,13 +24,12 @@ contract ETHLiquidity is ISemver {
event LiquidityMinted(address indexed caller, uint256 value); event LiquidityMinted(address indexed caller, uint256 value);
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 1.0.0-beta.5 /// @custom:semver 1.0.0-beta.6
string public constant version = "1.0.0-beta.5"; string public constant version = "1.0.0-beta.6";
/// @notice Allows an address to lock ETH liquidity into this contract. /// @notice Allows an address to lock ETH liquidity into this contract.
function burn() external payable { function burn() external payable {
if (msg.sender != Predeploys.SUPERCHAIN_WETH) revert Unauthorized(); if (msg.sender != Predeploys.SUPERCHAIN_WETH) revert Unauthorized();
if (IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken();
emit LiquidityBurned(msg.sender, msg.value); emit LiquidityBurned(msg.sender, msg.value);
} }
...@@ -39,7 +37,6 @@ contract ETHLiquidity is ISemver { ...@@ -39,7 +37,6 @@ contract ETHLiquidity is ISemver {
/// @param _amount The amount of liquidity to unlock. /// @param _amount The amount of liquidity to unlock.
function mint(uint256 _amount) external { function mint(uint256 _amount) external {
if (msg.sender != Predeploys.SUPERCHAIN_WETH) revert Unauthorized(); if (msg.sender != Predeploys.SUPERCHAIN_WETH) revert Unauthorized();
if (IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken();
new SafeSend{ value: _amount }(payable(msg.sender)); new SafeSend{ value: _amount }(payable(msg.sender));
emit LiquidityMinted(msg.sender, _amount); emit LiquidityMinted(msg.sender, _amount);
} }
......
...@@ -3,7 +3,6 @@ pragma solidity 0.8.15; ...@@ -3,7 +3,6 @@ pragma solidity 0.8.15;
// Libraries // Libraries
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { GasPayingToken, IGasToken } from "src/libraries/GasPayingToken.sol";
import { NotDepositor } from "src/libraries/L1BlockErrors.sol"; import { NotDepositor } from "src/libraries/L1BlockErrors.sol";
// Interfaces // Interfaces
...@@ -16,10 +15,7 @@ import { ISemver } from "interfaces/universal/ISemver.sol"; ...@@ -16,10 +15,7 @@ import { ISemver } from "interfaces/universal/ISemver.sol";
/// Values within this contract are updated once per epoch (every L1 block) and can only be /// Values within this contract are updated once per epoch (every L1 block) and can only be
/// set by the "depositor" account, a special system address. Depositor account transactions /// set by the "depositor" account, a special system address. Depositor account transactions
/// are created by the protocol whenever we move to a new epoch. /// are created by the protocol whenever we move to a new epoch.
contract L1Block is ISemver, IGasToken { contract L1Block is ISemver {
/// @notice Event emitted when the gas paying token is set.
event GasPayingTokenSet(address indexed token, uint8 indexed decimals, bytes32 name, bytes32 symbol);
/// @notice Address of the special depositor account. /// @notice Address of the special depositor account.
function DEPOSITOR_ACCOUNT() public pure returns (address addr_) { function DEPOSITOR_ACCOUNT() public pure returns (address addr_) {
addr_ = Constants.DEPOSITOR_ACCOUNT; addr_ = Constants.DEPOSITOR_ACCOUNT;
...@@ -60,34 +56,35 @@ contract L1Block is ISemver, IGasToken { ...@@ -60,34 +56,35 @@ contract L1Block is ISemver, IGasToken {
/// @notice The latest L1 blob base fee. /// @notice The latest L1 blob base fee.
uint256 public blobBaseFee; uint256 public blobBaseFee;
/// @custom:semver 1.5.1-beta.5 /// @custom:semver 1.5.1-beta.6
function version() public pure virtual returns (string memory) { function version() public pure virtual returns (string memory) {
return "1.5.1-beta.5"; return "1.5.1-beta.6";
} }
/// @notice Returns the gas paying token, its decimals, name and symbol. /// @notice Returns the gas paying token, its decimals, name and symbol.
/// If nothing is set in state, then it means ether is used. function gasPayingToken() public pure returns (address addr_, uint8 decimals_) {
function gasPayingToken() public view returns (address addr_, uint8 decimals_) { addr_ = Constants.ETHER;
(addr_, decimals_) = GasPayingToken.getToken(); decimals_ = 18;
} }
/// @notice Returns the gas paying token name. /// @notice Returns the gas paying token name.
/// If nothing is set in state, then it means ether is used. /// If nothing is set in state, then it means ether is used.
function gasPayingTokenName() public view returns (string memory name_) { /// This function cannot be removed because WETH depends on it.
name_ = GasPayingToken.getName(); function gasPayingTokenName() public pure returns (string memory name_) {
name_ = "Ether";
} }
/// @notice Returns the gas paying token symbol. /// @notice Returns the gas paying token symbol.
/// If nothing is set in state, then it means ether is used. /// If nothing is set in state, then it means ether is used.
function gasPayingTokenSymbol() public view returns (string memory symbol_) { /// This function cannot be removed because WETH depends on it.
symbol_ = GasPayingToken.getSymbol(); function gasPayingTokenSymbol() public pure returns (string memory symbol_) {
symbol_ = "ETH";
} }
/// @notice Getter for custom gas token paying networks. Returns true if the /// @notice Getter for custom gas token paying networks. Returns true if the
/// network uses a custom gas token. /// network uses a custom gas token.
function isCustomGasToken() public view returns (bool) { function isCustomGasToken() public pure returns (bool is_) {
(address token,) = gasPayingToken(); is_ = false;
return token != Constants.ETHER;
} }
/// @custom:legacy /// @custom:legacy
...@@ -170,15 +167,4 @@ contract L1Block is ISemver, IGasToken { ...@@ -170,15 +167,4 @@ contract L1Block is ISemver, IGasToken {
sstore(batcherHash.slot, calldataload(132)) // bytes32 sstore(batcherHash.slot, calldataload(132)) // bytes32
} }
} }
/// @notice Sets the gas paying token for the L2 system. Can only be called by the special
/// depositor account. This function is not called on every L2 block but instead
/// only called by specially crafted L1 deposit transactions.
function setGasPayingToken(address _token, uint8 _decimals, bytes32 _name, bytes32 _symbol) external {
if (msg.sender != DEPOSITOR_ACCOUNT()) revert NotDepositor();
GasPayingToken.set({ _token: _token, _decimals: _decimals, _name: _name, _symbol: _symbol });
emit GasPayingTokenSet({ token: _token, decimals: _decimals, name: _name, symbol: _symbol });
}
} }
...@@ -6,7 +6,6 @@ import { L1Block } from "src/L2/L1Block.sol"; ...@@ -6,7 +6,6 @@ import { L1Block } from "src/L2/L1Block.sol";
// Libraries // Libraries
import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import { GasPayingToken } from "src/libraries/GasPayingToken.sol";
import { StaticConfig } from "src/libraries/StaticConfig.sol"; import { StaticConfig } from "src/libraries/StaticConfig.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { import {
...@@ -19,11 +18,9 @@ import { ...@@ -19,11 +18,9 @@ import {
} from "src/libraries/L1BlockErrors.sol"; } from "src/libraries/L1BlockErrors.sol";
/// @notice Enum representing different types of configurations that can be set on L1BlockInterop. /// @notice Enum representing different types of configurations that can be set on L1BlockInterop.
/// @custom:value SET_GAS_PAYING_TOKEN Represents the config type for setting the gas paying token.
/// @custom:value ADD_DEPENDENCY Represents the config type for adding a chain to the interop dependency set. /// @custom:value ADD_DEPENDENCY Represents the config type for adding a chain to the interop dependency set.
/// @custom:value REMOVE_DEPENDENCY Represents the config type for removing a chain from the interop dependency set. /// @custom:value REMOVE_DEPENDENCY Represents the config type for removing a chain from the interop dependency set.
enum ConfigType { enum ConfigType {
SET_GAS_PAYING_TOKEN,
ADD_DEPENDENCY, ADD_DEPENDENCY,
REMOVE_DEPENDENCY REMOVE_DEPENDENCY
} }
...@@ -49,9 +46,9 @@ contract L1BlockInterop is L1Block { ...@@ -49,9 +46,9 @@ contract L1BlockInterop is L1Block {
/// keccak256(abi.encode(uint256(keccak256("l1Block.identifier.isDeposit")) - 1)) & ~bytes32(uint256(0xff)) /// keccak256(abi.encode(uint256(keccak256("l1Block.identifier.isDeposit")) - 1)) & ~bytes32(uint256(0xff))
uint256 internal constant IS_DEPOSIT_SLOT = 0x921bd3a089295c6e5540e8fba8195448d253efd6f2e3e495b499b627dc36a300; uint256 internal constant IS_DEPOSIT_SLOT = 0x921bd3a089295c6e5540e8fba8195448d253efd6f2e3e495b499b627dc36a300;
/// @custom:semver +interop-beta.3 /// @custom:semver +interop-beta.4
function version() public pure override returns (string memory) { function version() public pure override returns (string memory) {
return string.concat(super.version(), "+interop-beta.3"); return string.concat(super.version(), "+interop-beta.4");
} }
/// @notice Returns whether the call was triggered from a a deposit or not. /// @notice Returns whether the call was triggered from a a deposit or not.
...@@ -107,25 +104,13 @@ contract L1BlockInterop is L1Block { ...@@ -107,25 +104,13 @@ contract L1BlockInterop is L1Block {
function setConfig(ConfigType _type, bytes calldata _value) external { function setConfig(ConfigType _type, bytes calldata _value) external {
if (msg.sender != DEPOSITOR_ACCOUNT()) revert NotDepositor(); if (msg.sender != DEPOSITOR_ACCOUNT()) revert NotDepositor();
if (_type == ConfigType.SET_GAS_PAYING_TOKEN) { if (_type == ConfigType.ADD_DEPENDENCY) {
_setGasPayingToken(_value);
} else if (_type == ConfigType.ADD_DEPENDENCY) {
_addDependency(_value); _addDependency(_value);
} else if (_type == ConfigType.REMOVE_DEPENDENCY) { } else if (_type == ConfigType.REMOVE_DEPENDENCY) {
_removeDependency(_value); _removeDependency(_value);
} }
} }
/// @notice Internal method to set the gas paying token.
/// @param _value The encoded value with which to set the gas paying token.
function _setGasPayingToken(bytes calldata _value) internal {
(address token, uint8 decimals, bytes32 name, bytes32 symbol) = StaticConfig.decodeSetGasPayingToken(_value);
GasPayingToken.set({ _token: token, _decimals: decimals, _name: name, _symbol: symbol });
emit GasPayingTokenSet({ token: token, decimals: decimals, name: name, symbol: symbol });
}
/// @notice Internal method to add a dependency to the interop dependency set. /// @notice Internal method to add a dependency to the interop dependency set.
/// @param _value The encoded value with which to add the dependency. /// @param _value The encoded value with which to add the dependency.
function _addDependency(bytes calldata _value) internal { function _addDependency(bytes calldata _value) internal {
......
...@@ -11,7 +11,6 @@ import { Predeploys } from "src/libraries/Predeploys.sol"; ...@@ -11,7 +11,6 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
// Interfaces // Interfaces
import { ISemver } from "interfaces/universal/ISemver.sol"; import { ISemver } from "interfaces/universal/ISemver.sol";
import { IL2ToL1MessagePasser } from "interfaces/L2/IL2ToL1MessagePasser.sol"; import { IL2ToL1MessagePasser } from "interfaces/L2/IL2ToL1MessagePasser.sol";
import { IL1Block } from "interfaces/L2/IL1Block.sol";
/// @custom:proxied true /// @custom:proxied true
/// @custom:predeploy 0x4200000000000000000000000000000000000007 /// @custom:predeploy 0x4200000000000000000000000000000000000007
...@@ -20,8 +19,8 @@ import { IL1Block } from "interfaces/L2/IL1Block.sol"; ...@@ -20,8 +19,8 @@ import { IL1Block } from "interfaces/L2/IL1Block.sol";
/// L2 on the L2 side. Users are generally encouraged to use this contract instead of lower /// L2 on the L2 side. Users are generally encouraged to use this contract instead of lower
/// level message passing contracts. /// level message passing contracts.
contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver { contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver {
/// @custom:semver 2.1.1-beta.7 /// @custom:semver 2.1.1-beta.8
string public constant version = "2.1.1-beta.7"; string public constant version = "2.1.1-beta.8";
/// @notice Constructs the L2CrossDomainMessenger contract. /// @notice Constructs the L2CrossDomainMessenger contract.
constructor() { constructor() {
...@@ -49,11 +48,6 @@ contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver { ...@@ -49,11 +48,6 @@ contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver {
); );
} }
/// @inheritdoc CrossDomainMessenger
function gasPayingToken() internal view override returns (address addr_, uint8 decimals_) {
(addr_, decimals_) = IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingToken();
}
/// @inheritdoc CrossDomainMessenger /// @inheritdoc CrossDomainMessenger
function _isOtherMessenger() internal view override returns (bool) { function _isOtherMessenger() internal view override returns (bool) {
return AddressAliasHelper.undoL1ToL2Alias(msg.sender) == address(otherMessenger); return AddressAliasHelper.undoL1ToL2Alias(msg.sender) == address(otherMessenger);
......
...@@ -11,7 +11,6 @@ import { Predeploys } from "src/libraries/Predeploys.sol"; ...@@ -11,7 +11,6 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
import { ISemver } from "interfaces/universal/ISemver.sol"; import { ISemver } from "interfaces/universal/ISemver.sol";
import { ICrossDomainMessenger } from "interfaces/universal/ICrossDomainMessenger.sol"; import { ICrossDomainMessenger } from "interfaces/universal/ICrossDomainMessenger.sol";
import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol"; import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol";
import { IL1Block } from "interfaces/L2/IL1Block.sol";
/// @custom:proxied true /// @custom:proxied true
/// @custom:predeploy 0x4200000000000000000000000000000000000010 /// @custom:predeploy 0x4200000000000000000000000000000000000010
...@@ -58,9 +57,9 @@ contract L2StandardBridge is StandardBridge, ISemver { ...@@ -58,9 +57,9 @@ contract L2StandardBridge is StandardBridge, ISemver {
); );
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 1.11.1-beta.7 /// @custom:semver 1.11.1-beta.8
function version() public pure virtual returns (string memory) { function version() public pure virtual returns (string memory) {
return "1.11.1-beta.7"; return "1.11.1-beta.8";
} }
/// @notice Constructs the L2StandardBridge contract. /// @notice Constructs the L2StandardBridge contract.
...@@ -84,11 +83,6 @@ contract L2StandardBridge is StandardBridge, ISemver { ...@@ -84,11 +83,6 @@ contract L2StandardBridge is StandardBridge, ISemver {
); );
} }
/// @inheritdoc StandardBridge
function gasPayingToken() internal view override returns (address addr_, uint8 decimals_) {
(addr_, decimals_) = IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingToken();
}
/// @custom:legacy /// @custom:legacy
/// @notice Initiates a withdrawal from L2 to L1. /// @notice Initiates a withdrawal from L2 to L1.
/// This function only works with OptimismMintableERC20 tokens or ether. Use the /// This function only works with OptimismMintableERC20 tokens or ether. Use the
...@@ -109,7 +103,6 @@ contract L2StandardBridge is StandardBridge, ISemver { ...@@ -109,7 +103,6 @@ contract L2StandardBridge is StandardBridge, ISemver {
virtual virtual
onlyEOA onlyEOA
{ {
require(isCustomGasToken() == false, "L2StandardBridge: not supported with custom gas token");
_initiateWithdrawal(_l2Token, msg.sender, msg.sender, _amount, _minGasLimit, _extraData); _initiateWithdrawal(_l2Token, msg.sender, msg.sender, _amount, _minGasLimit, _extraData);
} }
...@@ -138,7 +131,6 @@ contract L2StandardBridge is StandardBridge, ISemver { ...@@ -138,7 +131,6 @@ contract L2StandardBridge is StandardBridge, ISemver {
payable payable
virtual virtual
{ {
require(isCustomGasToken() == false, "L2StandardBridge: not supported with custom gas token");
_initiateWithdrawal(_l2Token, msg.sender, _to, _amount, _minGasLimit, _extraData); _initiateWithdrawal(_l2Token, msg.sender, _to, _amount, _minGasLimit, _extraData);
} }
......
...@@ -39,9 +39,9 @@ contract L2StandardBridgeInterop is L2StandardBridge { ...@@ -39,9 +39,9 @@ contract L2StandardBridgeInterop is L2StandardBridge {
event Converted(address indexed from, address indexed to, address indexed caller, uint256 amount); event Converted(address indexed from, address indexed to, address indexed caller, uint256 amount);
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver +interop-beta.7 /// @custom:semver +interop-beta.8
function version() public pure override returns (string memory) { function version() public pure override returns (string memory) {
return string.concat(super.version(), "+interop-beta.7"); return string.concat(super.version(), "+interop-beta.8");
} }
/// @notice Converts `amount` of `from` token to `to` token. /// @notice Converts `amount` of `from` token to `to` token.
......
...@@ -5,7 +5,7 @@ pragma solidity 0.8.15; ...@@ -5,7 +5,7 @@ pragma solidity 0.8.15;
import { WETH98 } from "src/universal/WETH98.sol"; import { WETH98 } from "src/universal/WETH98.sol";
// Libraries // Libraries
import { NotCustomGasToken, Unauthorized, ZeroAddress } from "src/libraries/errors/CommonErrors.sol"; import { Unauthorized, ZeroAddress } from "src/libraries/errors/CommonErrors.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { Preinstalls } from "src/libraries/Preinstalls.sol"; import { Preinstalls } from "src/libraries/Preinstalls.sol";
import { SafeSend } from "src/universal/SafeSend.sol"; import { SafeSend } from "src/universal/SafeSend.sol";
...@@ -13,7 +13,6 @@ import { SafeSend } from "src/universal/SafeSend.sol"; ...@@ -13,7 +13,6 @@ import { SafeSend } from "src/universal/SafeSend.sol";
// Interfaces // Interfaces
import { ISemver } from "interfaces/universal/ISemver.sol"; import { ISemver } from "interfaces/universal/ISemver.sol";
import { IL2ToL2CrossDomainMessenger } from "interfaces/L2/IL2ToL2CrossDomainMessenger.sol"; import { IL2ToL2CrossDomainMessenger } from "interfaces/L2/IL2ToL2CrossDomainMessenger.sol";
import { IL1Block } from "interfaces/L2/IL1Block.sol";
import { IETHLiquidity } from "interfaces/L2/IETHLiquidity.sol"; import { IETHLiquidity } from "interfaces/L2/IETHLiquidity.sol";
import { IERC7802, IERC165 } from "interfaces/L2/IERC7802.sol"; import { IERC7802, IERC165 } from "interfaces/L2/IERC7802.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
...@@ -43,20 +42,8 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver { ...@@ -43,20 +42,8 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver {
event RelayETH(address indexed from, address indexed to, uint256 amount, uint256 source); event RelayETH(address indexed from, address indexed to, uint256 amount, uint256 source);
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 1.0.0-beta.13 /// @custom:semver 1.0.0-beta.14
string public constant version = "1.0.0-beta.13"; string public constant version = "1.0.0-beta.14";
/// @inheritdoc WETH98
function deposit() public payable override {
if (IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken();
super.deposit();
}
/// @inheritdoc WETH98
function withdraw(uint256 _amount) public override {
if (IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken();
super.withdraw(_amount);
}
/// @inheritdoc WETH98 /// @inheritdoc WETH98
function allowance(address owner, address spender) public view override returns (uint256) { function allowance(address owner, address spender) public view override returns (uint256) {
...@@ -89,10 +76,8 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver { ...@@ -89,10 +76,8 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver {
_mint(_to, _amount); _mint(_to, _amount);
// Withdraw from ETHLiquidity contract. // Withdraw from ETHLiquidity contract.
if (!IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) { // NOTE: 'mint' will soon change to 'withdraw'.
// NOTE: 'mint' will soon change to 'withdraw'. IETHLiquidity(Predeploys.ETH_LIQUIDITY).mint(_amount);
IETHLiquidity(Predeploys.ETH_LIQUIDITY).mint(_amount);
}
emit CrosschainMint(_to, _amount, msg.sender); emit CrosschainMint(_to, _amount, msg.sender);
} }
...@@ -106,10 +91,8 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver { ...@@ -106,10 +91,8 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver {
_burn(_from, _amount); _burn(_from, _amount);
// Deposit to ETHLiquidity contract. // Deposit to ETHLiquidity contract.
if (!IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) { // NOTE: 'burn' will soon change to 'deposit'.
// NOTE: 'burn' will soon change to 'deposit'. IETHLiquidity(Predeploys.ETH_LIQUIDITY).burn{ value: _amount }();
IETHLiquidity(Predeploys.ETH_LIQUIDITY).burn{ value: _amount }();
}
emit CrosschainBurn(_from, _amount, msg.sender); emit CrosschainBurn(_from, _amount, msg.sender);
} }
...@@ -127,10 +110,6 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver { ...@@ -127,10 +110,6 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver {
function sendETH(address _to, uint256 _chainId) external payable returns (bytes32 msgHash_) { function sendETH(address _to, uint256 _chainId) external payable returns (bytes32 msgHash_) {
if (_to == address(0)) revert ZeroAddress(); if (_to == address(0)) revert ZeroAddress();
if (IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) {
revert NotCustomGasToken();
}
// NOTE: 'burn' will soon change to 'deposit'. // NOTE: 'burn' will soon change to 'deposit'.
IETHLiquidity(Predeploys.ETH_LIQUIDITY).burn{ value: msg.value }(); IETHLiquidity(Predeploys.ETH_LIQUIDITY).burn{ value: msg.value }();
...@@ -155,16 +134,11 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver { ...@@ -155,16 +134,11 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver {
if (crossDomainMessageSender != address(this)) revert InvalidCrossDomainSender(); if (crossDomainMessageSender != address(this)) revert InvalidCrossDomainSender();
if (IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) { // NOTE: 'mint' will soon change to 'withdraw'.
// Since ETH is not the native asset on custom gas token chains, send SuperchainWETH to the recipient. IETHLiquidity(Predeploys.ETH_LIQUIDITY).mint(_amount);
_mint(_to, _amount);
} else {
// NOTE: 'mint' will soon change to 'withdraw'.
IETHLiquidity(Predeploys.ETH_LIQUIDITY).mint(_amount);
// This is a forced ETH send to the recipient, the recipient should NOT expect to be called. // This is a forced ETH send to the recipient, the recipient should NOT expect to be called.
new SafeSend{ value: _amount }(payable(_to)); new SafeSend{ value: _amount }(payable(_to));
}
emit RelayETH(_from, _to, _amount, source); emit RelayETH(_from, _to, _amount, source);
} }
......
...@@ -13,19 +13,20 @@ import { IL1Block } from "interfaces/L2/IL1Block.sol"; ...@@ -13,19 +13,20 @@ import { IL1Block } from "interfaces/L2/IL1Block.sol";
/// @title WETH contract that reads the name and symbol from the L1Block contract. /// @title WETH contract that reads the name and symbol from the L1Block contract.
/// Allows for nice rendering of token names for chains using custom gas token. /// Allows for nice rendering of token names for chains using custom gas token.
/// This contract is not proxied and contains calls to the custom gas token methods.
contract WETH is WETH98, ISemver { contract WETH is WETH98, ISemver {
/// @custom:semver 1.1.0-beta.4 /// @custom:semver 1.1.0-beta.5
string public constant version = "1.1.0-beta.4"; string public constant version = "1.1.0-beta.5";
/// @notice Returns the name of the wrapped native asset. Will be "Wrapped Ether" /// @notice Returns the name of the wrapped native asset. Will be "Wrapped Ether"
/// if the native asset is Ether. /// if the native asset is Ether.
function name() external view override returns (string memory name_) { function name() external pure override returns (string memory name_) {
name_ = string.concat("Wrapped ", IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingTokenName()); name_ = string.concat("Wrapped ", IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingTokenName());
} }
/// @notice Returns the symbol of the wrapped native asset. Will be "WETH" if the /// @notice Returns the symbol of the wrapped native asset. Will be "WETH" if the
/// native asset is Ether. /// native asset is Ether.
function symbol() external view override returns (string memory symbol_) { function symbol() external pure override returns (string memory symbol_) {
symbol_ = string.concat("W", IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingTokenSymbol()); symbol_ = string.concat("W", IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingTokenSymbol());
} }
} }
...@@ -9,8 +9,6 @@ error LargeCalldata(); ...@@ -9,8 +9,6 @@ error LargeCalldata();
error SmallGasLimit(); error SmallGasLimit();
/// @notice Error for when a withdrawal transfer fails. /// @notice Error for when a withdrawal transfer fails.
error TransferFailed(); error TransferFailed();
/// @notice Error for when a method is called that only works when using a custom gas token.
error OnlyCustomGasToken();
/// @notice Error for when a method cannot be called with non zero CALLVALUE. /// @notice Error for when a method cannot be called with non zero CALLVALUE.
error NoValue(); error NoValue();
/// @notice Error for an unauthorized CALLER. /// @notice Error for an unauthorized CALLER.
......
...@@ -4,12 +4,6 @@ pragma solidity ^0.8.0; ...@@ -4,12 +4,6 @@ pragma solidity ^0.8.0;
/// @notice Error for an unauthorized CALLER. /// @notice Error for an unauthorized CALLER.
error Unauthorized(); error Unauthorized();
/// @notice Error for when a method is called that only works when using a custom gas token.
error OnlyCustomGasToken();
/// @notice Error for when a method is called that only works when NOT using a custom gas token.
error NotCustomGasToken();
/// @notice Error for when a transfer via call fails. /// @notice Error for when a transfer via call fails.
error TransferFailed(); error TransferFailed();
......
...@@ -175,10 +175,6 @@ abstract contract CrossDomainMessenger is ...@@ -175,10 +175,6 @@ abstract contract CrossDomainMessenger is
/// @param _message Message to trigger the target address with. /// @param _message Message to trigger the target address with.
/// @param _minGasLimit Minimum gas limit that the message can be executed with. /// @param _minGasLimit Minimum gas limit that the message can be executed with.
function sendMessage(address _target, bytes calldata _message, uint32 _minGasLimit) external payable { function sendMessage(address _target, bytes calldata _message, uint32 _minGasLimit) external payable {
if (isCustomGasToken()) {
require(msg.value == 0, "CrossDomainMessenger: cannot send value with custom gas token");
}
// Triggers a message to the other messenger. Note that the amount of gas provided to the // Triggers a message to the other messenger. Note that the amount of gas provided to the
// message is the amount of gas requested by the user PLUS the base gas value. We want to // message is the amount of gas requested by the user PLUS the base gas value. We want to
// guarantee the property that the call to the target contract will always have at least // guarantee the property that the call to the target contract will always have at least
...@@ -363,15 +359,6 @@ abstract contract CrossDomainMessenger is ...@@ -363,15 +359,6 @@ abstract contract CrossDomainMessenger is
+ RELAY_GAS_CHECK_BUFFER; + RELAY_GAS_CHECK_BUFFER;
} }
/// @notice Returns the address of the gas token and the token's decimals.
function gasPayingToken() internal view virtual returns (address, uint8);
/// @notice Returns whether the chain uses a custom gas token or not.
function isCustomGasToken() internal view returns (bool) {
(address token,) = gasPayingToken();
return token != Constants.ETHER;
}
/// @notice Initializer. /// @notice Initializer.
/// @param _otherMessenger CrossDomainMessenger contract on the other chain. /// @param _otherMessenger CrossDomainMessenger contract on the other chain.
function __CrossDomainMessenger_init(CrossDomainMessenger _otherMessenger) internal onlyInitializing { function __CrossDomainMessenger_init(CrossDomainMessenger _otherMessenger) internal onlyInitializing {
......
...@@ -9,7 +9,6 @@ import { Address } from "@openzeppelin/contracts/utils/Address.sol"; ...@@ -9,7 +9,6 @@ import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { SafeCall } from "src/libraries/SafeCall.sol"; import { SafeCall } from "src/libraries/SafeCall.sol";
import { Constants } from "src/libraries/Constants.sol";
// Interfaces // Interfaces
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
...@@ -135,15 +134,6 @@ abstract contract StandardBridge is Initializable { ...@@ -135,15 +134,6 @@ abstract contract StandardBridge is Initializable {
/// Must be implemented by contracts that inherit. /// Must be implemented by contracts that inherit.
receive() external payable virtual; receive() external payable virtual;
/// @notice Returns the address of the custom gas token and the token's decimals.
function gasPayingToken() internal view virtual returns (address, uint8);
/// @notice Returns whether the chain uses a custom gas token or not.
function isCustomGasToken() internal view returns (bool) {
(address token,) = gasPayingToken();
return token != Constants.ETHER;
}
/// @notice Getter for messenger contract. /// @notice Getter for messenger contract.
/// Public getter is legacy and will be removed in the future. Use `messenger` instead. /// Public getter is legacy and will be removed in the future. Use `messenger` instead.
/// @return Contract of the messenger on this domain. /// @return Contract of the messenger on this domain.
...@@ -257,7 +247,6 @@ abstract contract StandardBridge is Initializable { ...@@ -257,7 +247,6 @@ abstract contract StandardBridge is Initializable {
onlyOtherBridge onlyOtherBridge
{ {
require(paused() == false, "StandardBridge: paused"); require(paused() == false, "StandardBridge: paused");
require(isCustomGasToken() == false, "StandardBridge: cannot bridge ETH with custom gas token");
require(msg.value == _amount, "StandardBridge: amount sent does not match amount required"); require(msg.value == _amount, "StandardBridge: amount sent does not match amount required");
require(_to != address(this), "StandardBridge: cannot send to self"); require(_to != address(this), "StandardBridge: cannot send to self");
require(_to != address(messenger), "StandardBridge: cannot send to messenger"); require(_to != address(messenger), "StandardBridge: cannot send to messenger");
...@@ -326,7 +315,6 @@ abstract contract StandardBridge is Initializable { ...@@ -326,7 +315,6 @@ abstract contract StandardBridge is Initializable {
) )
internal internal
{ {
require(isCustomGasToken() == false, "StandardBridge: cannot bridge ETH with custom gas token");
require(msg.value == _amount, "StandardBridge: bridging ETH must include sufficient ETH value"); require(msg.value == _amount, "StandardBridge: bridging ETH must include sufficient ETH value");
// Emit the correct events. By default this will be _amount, but child // Emit the correct events. By default this will be _amount, but child
......
...@@ -27,19 +27,6 @@ contract OptimismPortalInterop_Test is CommonTest { ...@@ -27,19 +27,6 @@ contract OptimismPortalInterop_Test is CommonTest {
assert(bytes(_optimismPortalInterop().version()).length > 0); assert(bytes(_optimismPortalInterop().version()).length > 0);
} }
/// @dev Tests that the config for the gas paying token cannot be set.
function testFuzz_setConfig_gasPayingToken_reverts(bytes calldata _value) public {
vm.prank(address(_optimismPortalInterop().systemConfig()));
vm.expectRevert(IOptimismPortalInterop.CustomGasTokenNotSupported.selector);
_optimismPortalInterop().setConfig(ConfigType.SET_GAS_PAYING_TOKEN, _value);
}
/// @dev Tests that setting the gas paying token config as not the system config reverts.
function testFuzz_setConfig_gasPayingTokenButNotSystemConfig_reverts(bytes calldata _value) public {
vm.expectRevert(Unauthorized.selector);
_optimismPortalInterop().setConfig(ConfigType.SET_GAS_PAYING_TOKEN, _value);
}
/// @dev Tests that the config for adding a dependency can be set. /// @dev Tests that the config for adding a dependency can be set.
function testFuzz_setConfig_addDependency_succeeds(bytes calldata _value) public { function testFuzz_setConfig_addDependency_succeeds(bytes calldata _value) public {
vm.expectEmit(address(optimismPortal2)); vm.expectEmit(address(optimismPortal2));
......
...@@ -5,7 +5,7 @@ pragma solidity 0.8.15; ...@@ -5,7 +5,7 @@ pragma solidity 0.8.15;
import { CommonTest } from "test/setup/CommonTest.sol"; import { CommonTest } from "test/setup/CommonTest.sol";
// Error imports // Error imports
import { Unauthorized, NotCustomGasToken } from "src/libraries/errors/CommonErrors.sol"; import { Unauthorized } from "src/libraries/errors/CommonErrors.sol";
/// @title ETHLiquidity_Test /// @title ETHLiquidity_Test
/// @notice Contract for testing the ETHLiquidity contract. /// @notice Contract for testing the ETHLiquidity contract.
...@@ -73,26 +73,6 @@ contract ETHLiquidity_Test is CommonTest { ...@@ -73,26 +73,6 @@ contract ETHLiquidity_Test is CommonTest {
assertEq(address(ethLiquidity).balance, STARTING_LIQUIDITY_BALANCE); assertEq(address(ethLiquidity).balance, STARTING_LIQUIDITY_BALANCE);
} }
/// @notice Tests that the burn function reverts when called on a custom gas token chain.
/// @param _amount Amount of ETH (in wei) to call the burn function with.
function testFuzz_burn_fromCustomGasTokenChain_fails(uint256 _amount) public {
// Assume
_amount = bound(_amount, 0, type(uint248).max - 1);
// Arrange
vm.deal(address(superchainWeth), _amount);
vm.mockCall(address(l1Block), abi.encodeCall(l1Block.isCustomGasToken, ()), abi.encode(true));
// Act
vm.prank(address(superchainWeth));
vm.expectRevert(NotCustomGasToken.selector);
ethLiquidity.burn{ value: _amount }();
// Assert
assertEq(address(superchainWeth).balance, _amount);
assertEq(address(ethLiquidity).balance, STARTING_LIQUIDITY_BALANCE);
}
/// @notice Tests that the mint function fails when the amount requested is greater than the /// @notice Tests that the mint function fails when the amount requested is greater than the
/// available balance. In practice this should never happen because the starting /// available balance. In practice this should never happen because the starting
/// balance is expected to be uint248 wei, the total ETH supply is far less than that /// balance is expected to be uint248 wei, the total ETH supply is far less than that
...@@ -157,24 +137,4 @@ contract ETHLiquidity_Test is CommonTest { ...@@ -157,24 +137,4 @@ contract ETHLiquidity_Test is CommonTest {
assertEq(address(ethLiquidity).balance, STARTING_LIQUIDITY_BALANCE); assertEq(address(ethLiquidity).balance, STARTING_LIQUIDITY_BALANCE);
assertEq(superchainWeth.balanceOf(address(ethLiquidity)), 0); assertEq(superchainWeth.balanceOf(address(ethLiquidity)), 0);
} }
/// @notice Tests that the mint function reverts when called on a custom gas token chain.
/// @param _amount Amount of ETH (in wei) to call the mint function with.
function testFuzz_mint_fromCustomGasTokenChain_fails(uint256 _amount) public {
// Assume
_amount = bound(_amount, 0, type(uint248).max - 1);
// Arrange
vm.mockCall(address(l1Block), abi.encodeCall(l1Block.isCustomGasToken, ()), abi.encode(true));
// Act
vm.prank(address(superchainWeth));
vm.expectRevert(NotCustomGasToken.selector);
ethLiquidity.mint(_amount);
// Assert
assertEq(address(superchainWeth).balance, 0);
assertEq(address(ethLiquidity).balance, STARTING_LIQUIDITY_BALANCE);
assertEq(superchainWeth.balanceOf(address(ethLiquidity)), 0);
}
} }
...@@ -12,13 +12,29 @@ import "src/libraries/L1BlockErrors.sol"; ...@@ -12,13 +12,29 @@ import "src/libraries/L1BlockErrors.sol";
contract L1BlockTest is CommonTest { contract L1BlockTest is CommonTest {
address depositor; address depositor;
event GasPayingTokenSet(address indexed token, uint8 indexed decimals, bytes32 name, bytes32 symbol);
/// @dev Sets up the test suite. /// @dev Sets up the test suite.
function setUp() public virtual override { function setUp() public virtual override {
super.setUp(); super.setUp();
depositor = l1Block.DEPOSITOR_ACCOUNT(); depositor = l1Block.DEPOSITOR_ACCOUNT();
} }
function test_isCustomGasToken_succeeds() external view {
assertFalse(l1Block.isCustomGasToken());
}
function test_gasPayingToken_succeeds() external view {
(address token, uint8 decimals) = l1Block.gasPayingToken();
assertEq(token, Constants.ETHER);
assertEq(uint256(decimals), uint256(18));
}
function test_gasPayingTokenName_succeeds() external view {
assertEq("Ether", l1Block.gasPayingTokenName());
}
function test_gasPayingTokenSymbol_succeeds() external view {
assertEq("ETH", l1Block.gasPayingTokenSymbol());
}
} }
contract L1BlockBedrock_Test is L1BlockTest { contract L1BlockBedrock_Test is L1BlockTest {
...@@ -164,50 +180,3 @@ contract L1BlockEcotone_Test is L1BlockTest { ...@@ -164,50 +180,3 @@ contract L1BlockEcotone_Test is L1BlockTest {
assertEq(data, expReturn); assertEq(data, expReturn);
} }
} }
contract L1BlockCustomGasToken_Test is L1BlockTest {
function testFuzz_setGasPayingToken_succeeds(
address _token,
uint8 _decimals,
string calldata _name,
string calldata _symbol
)
external
{
vm.assume(_token != address(0));
vm.assume(_token != Constants.ETHER);
// Using vm.assume() would cause too many test rejections.
string memory name = _name;
if (bytes(_name).length > 32) {
name = _name[:32];
}
bytes32 b32name = bytes32(abi.encodePacked(name));
// Using vm.assume() would cause too many test rejections.
string memory symbol = _symbol;
if (bytes(_symbol).length > 32) {
symbol = _symbol[:32];
}
bytes32 b32symbol = bytes32(abi.encodePacked(symbol));
vm.expectEmit(address(l1Block));
emit GasPayingTokenSet({ token: _token, decimals: _decimals, name: b32name, symbol: b32symbol });
vm.prank(depositor);
l1Block.setGasPayingToken({ _token: _token, _decimals: _decimals, _name: b32name, _symbol: b32symbol });
(address token, uint8 decimals) = l1Block.gasPayingToken();
assertEq(token, _token);
assertEq(decimals, _decimals);
assertEq(name, l1Block.gasPayingTokenName());
assertEq(symbol, l1Block.gasPayingTokenSymbol());
assertTrue(l1Block.isCustomGasToken());
}
function test_setGasPayingToken_isDepositor_reverts() external {
vm.expectRevert(NotDepositor.selector);
l1Block.setGasPayingToken(address(this), 18, "Test", "TST");
}
}
...@@ -80,45 +80,6 @@ contract L1BlockInteropTest is CommonTest { ...@@ -80,45 +80,6 @@ contract L1BlockInteropTest is CommonTest {
assertEq(_l1BlockInterop().dependencySetSize(), 0); assertEq(_l1BlockInterop().dependencySetSize(), 0);
} }
/// @dev Tests that the config for setting the gas paying token succeeds.
function testFuzz_setConfig_gasPayingToken_succeeds(
address _token,
uint8 _decimals,
bytes32 _name,
bytes32 _symbol
)
public
prankDepositor
{
vm.assume(_token != address(vm));
vm.expectEmit(address(l1Block));
emit GasPayingTokenSet({ token: _token, decimals: _decimals, name: _name, symbol: _symbol });
_l1BlockInterop().setConfig(
ConfigType.SET_GAS_PAYING_TOKEN,
StaticConfig.encodeSetGasPayingToken({ _token: _token, _decimals: _decimals, _name: _name, _symbol: _symbol })
);
}
/// @dev Tests that setting the gas paying token config as not the depositor reverts.
function testFuzz_setConfig_gasPayingTokenButNotDepositor_reverts(
address _token,
uint8 _decimals,
bytes32 _name,
bytes32 _symbol
)
public
{
vm.assume(_token != address(vm));
vm.expectRevert(NotDepositor.selector);
_l1BlockInterop().setConfig(
ConfigType.SET_GAS_PAYING_TOKEN,
StaticConfig.encodeSetGasPayingToken({ _token: _token, _decimals: _decimals, _name: _name, _symbol: _symbol })
);
}
/// @dev Tests that the config for adding a dependency can be set. /// @dev Tests that the config for adding a dependency can be set.
function testFuzz_setConfig_addDependency_succeeds(uint256 _chainId) public prankDepositor { function testFuzz_setConfig_addDependency_succeeds(uint256 _chainId) public prankDepositor {
vm.assume(_chainId != block.chainid); vm.assume(_chainId != block.chainid);
......
...@@ -16,7 +16,6 @@ import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol"; ...@@ -16,7 +16,6 @@ import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
// Interfaces // Interfaces
import { IL2CrossDomainMessenger } from "interfaces/L2/IL2CrossDomainMessenger.sol"; import { IL2CrossDomainMessenger } from "interfaces/L2/IL2CrossDomainMessenger.sol";
import { IL2ToL1MessagePasser } from "interfaces/L2/IL2ToL1MessagePasser.sol"; import { IL2ToL1MessagePasser } from "interfaces/L2/IL2ToL1MessagePasser.sol";
import { IGasToken } from "src/libraries/GasPayingToken.sol";
contract L2CrossDomainMessenger_Test is CommonTest { contract L2CrossDomainMessenger_Test is CommonTest {
/// @dev Receiver address for testing /// @dev Receiver address for testing
...@@ -312,105 +311,4 @@ contract L2CrossDomainMessenger_Test is CommonTest { ...@@ -312,105 +311,4 @@ contract L2CrossDomainMessenger_Test is CommonTest {
assertEq(l2CrossDomainMessenger.successfulMessages(hash), true); assertEq(l2CrossDomainMessenger.successfulMessages(hash), true);
assertEq(l2CrossDomainMessenger.failedMessages(hash), true); assertEq(l2CrossDomainMessenger.failedMessages(hash), true);
} }
/// @dev Tests that sendMessage succeeds with a custom gas token when the call value is zero.
function test_sendMessage_customGasTokenButNoValue_succeeds() external {
// Mock the gasPayingToken function to return a custom gas token
vm.mockCall(address(l1Block), abi.encodeCall(IGasToken.gasPayingToken, ()), abi.encode(address(1), uint8(2)));
bytes memory xDomainCallData =
Encoding.encodeCrossDomainMessage(l2CrossDomainMessenger.messageNonce(), alice, recipient, 0, 100, hex"ff");
vm.expectCall(
address(l2ToL1MessagePasser),
abi.encodeCall(
IL2ToL1MessagePasser.initiateWithdrawal,
(address(l1CrossDomainMessenger), l2CrossDomainMessenger.baseGas(hex"ff", 100), xDomainCallData)
)
);
// MessagePassed event
vm.expectEmit(true, true, true, true);
emit MessagePassed(
l2ToL1MessagePasser.messageNonce(),
address(l2CrossDomainMessenger),
address(l1CrossDomainMessenger),
0,
l2CrossDomainMessenger.baseGas(hex"ff", 100),
xDomainCallData,
Hashing.hashWithdrawal(
Types.WithdrawalTransaction({
nonce: l2ToL1MessagePasser.messageNonce(),
sender: address(l2CrossDomainMessenger),
target: address(l1CrossDomainMessenger),
value: 0,
gasLimit: l2CrossDomainMessenger.baseGas(hex"ff", 100),
data: xDomainCallData
})
)
);
vm.prank(alice);
l2CrossDomainMessenger.sendMessage(recipient, hex"ff", uint32(100));
}
/// @dev Tests that the sendMessage reverts when call value is non-zero with custom gas token.
function test_sendMessage_customGasTokenWithValue_reverts() external {
// Mock the gasPayingToken function to return a custom gas token
vm.mockCall(address(l1Block), abi.encodeCall(IGasToken.gasPayingToken, ()), abi.encode(address(1), uint8(2)));
vm.expectRevert("CrossDomainMessenger: cannot send value with custom gas token");
l2CrossDomainMessenger.sendMessage{ value: 1 }(recipient, hex"ff", uint32(100));
}
/// @dev Tests that the relayMessage succeeds with a custom gas token when the call value is zero.
function test_relayMessage_customGasTokenAndNoValue_succeeds() external {
// Mock the gasPayingToken function to return a custom gas token
vm.mockCall(address(l1Block), abi.encodeCall(IGasToken.gasPayingToken, ()), abi.encode(address(1), uint8(2)));
address target = address(0xabcd);
address sender = address(l1CrossDomainMessenger);
address caller = AddressAliasHelper.applyL1ToL2Alias(address(l1CrossDomainMessenger));
vm.expectCall(target, hex"1111");
vm.prank(caller);
vm.expectEmit(true, true, true, true);
bytes32 hash =
Hashing.hashCrossDomainMessage(Encoding.encodeVersionedNonce(0, 1), sender, target, 0, 0, hex"1111");
emit RelayedMessage(hash);
l2CrossDomainMessenger.relayMessage(
Encoding.encodeVersionedNonce(0, 1), // nonce
sender,
target,
0, // value
0,
hex"1111"
);
// the message hash is in the successfulMessages mapping
assert(l2CrossDomainMessenger.successfulMessages(hash));
// it is not in the received messages mapping
assertEq(l2CrossDomainMessenger.failedMessages(hash), false);
}
/// @dev Tests that the relayMessage reverts when call value is non-zero with custom gas token.
/// The L1CrossDomainMessenger `sendMessage` function cannot send value with a custom gas token.
function test_relayMessage_customGasTokenWithValue_reverts() external virtual {
// Mock the gasPayingToken function to return a custom gas token
vm.mockCall(address(l1Block), abi.encodeCall(IGasToken.gasPayingToken, ()), abi.encode(address(1), uint8(2)));
vm.expectRevert("CrossDomainMessenger: value must be zero unless message is from a system address");
l2CrossDomainMessenger.relayMessage{ value: 1 }(
Encoding.encodeVersionedNonce({ _nonce: 0, _version: 1 }),
address(0xabcd),
address(0xabcd),
1, // value
0,
hex"1111"
);
}
} }
...@@ -20,7 +20,6 @@ import { ICrossDomainMessenger } from "interfaces/universal/ICrossDomainMessenge ...@@ -20,7 +20,6 @@ import { ICrossDomainMessenger } from "interfaces/universal/ICrossDomainMessenge
import { IStandardBridge } from "interfaces/universal/IStandardBridge.sol"; import { IStandardBridge } from "interfaces/universal/IStandardBridge.sol";
import { IL2ToL1MessagePasser } from "interfaces/L2/IL2ToL1MessagePasser.sol"; import { IL2ToL1MessagePasser } from "interfaces/L2/IL2ToL1MessagePasser.sol";
import { IL2StandardBridge } from "interfaces/L2/IL2StandardBridge.sol"; import { IL2StandardBridge } from "interfaces/L2/IL2StandardBridge.sol";
import { IGasToken } from "src/libraries/GasPayingToken.sol";
contract L2StandardBridge_Test is CommonTest { contract L2StandardBridge_Test is CommonTest {
using stdStorage for StdStorage; using stdStorage for StdStorage;
...@@ -128,19 +127,6 @@ contract L2StandardBridge_Test is CommonTest { ...@@ -128,19 +127,6 @@ contract L2StandardBridge_Test is CommonTest {
assertEq(address(l2ToL1MessagePasser).balance, 100); assertEq(address(l2ToL1MessagePasser).balance, 100);
} }
/// @dev Tests that the receive function reverts with custom gas token.
function testFuzz_receive_customGasToken_reverts(uint256 _value) external {
vm.prank(alice, alice);
vm.mockCall(address(l1Block), abi.encodeCall(IGasToken.gasPayingToken, ()), abi.encode(address(1), uint8(2)));
vm.deal(alice, _value);
(bool success, bytes memory data) = address(l2StandardBridge).call{ value: _value }(hex"");
assertFalse(success);
assembly {
data := add(data, 0x04)
}
assertEq(abi.decode(data, (string)), "StandardBridge: cannot bridge ETH with custom gas token");
}
/// @dev Tests that `withdraw` reverts if the amount is not equal to the value sent. /// @dev Tests that `withdraw` reverts if the amount is not equal to the value sent.
function test_withdraw_insufficientValue_reverts() external { function test_withdraw_insufficientValue_reverts() external {
assertEq(address(l2ToL1MessagePasser).balance, 0); assertEq(address(l2ToL1MessagePasser).balance, 0);
...@@ -168,74 +154,6 @@ contract L2StandardBridge_Test is CommonTest { ...@@ -168,74 +154,6 @@ contract L2StandardBridge_Test is CommonTest {
l2StandardBridge.withdrawTo{ value: 100 }(address(L2Token), alice, 100, 1, hex""); l2StandardBridge.withdrawTo{ value: 100 }(address(L2Token), alice, 100, 1, hex"");
} }
/// @dev Tests that `withdraw` reverts with custom gas token.
function test_withdraw_customGasToken_reverts() external {
vm.mockCall(address(l1Block), abi.encodeCall(IGasToken.gasPayingToken, ()), abi.encode(address(1), uint8(18)));
vm.expectRevert("L2StandardBridge: not supported with custom gas token");
vm.prank(alice, alice);
l2StandardBridge.withdraw(address(Predeploys.LEGACY_ERC20_ETH), 1, 1, hex"");
}
/// @dev Tests that `withdraw` reverts with custom gas token.
function test_withdrawERC20_customGasToken_reverts() external {
vm.mockCall(address(l1Block), abi.encodeCall(IGasToken.gasPayingToken, ()), abi.encode(address(1), uint8(18)));
vm.expectRevert("L2StandardBridge: not supported with custom gas token");
vm.prank(alice, alice);
l2StandardBridge.withdraw(address(L1Token), 1, 1, hex"");
}
/// @dev Tests that `withdraw` reverts with custom gas token.
function test_withdrawERC20WithValue_customGasToken_reverts() external {
vm.deal(alice, 1 ether);
vm.mockCall(address(l1Block), abi.encodeCall(IGasToken.gasPayingToken, ()), abi.encode(address(1), uint8(18)));
vm.expectRevert("L2StandardBridge: not supported with custom gas token");
vm.prank(alice, alice);
l2StandardBridge.withdraw{ value: 1 ether }(address(L1Token), 1, 1, hex"");
}
/// @dev Tests that `withdraw` with value reverts with custom gas token.
function test_withdraw_customGasTokenWithValue_reverts() external {
vm.deal(alice, 1 ether);
vm.mockCall(address(l1Block), abi.encodeCall(IGasToken.gasPayingToken, ()), abi.encode(address(1), uint8(18)));
vm.expectRevert("L2StandardBridge: not supported with custom gas token");
vm.prank(alice, alice);
l2StandardBridge.withdraw{ value: 1 ether }(address(Predeploys.LEGACY_ERC20_ETH), 1, 1, hex"");
}
/// @dev Tests that `withdrawTo` reverts with custom gas token.
function test_withdrawTo_customGasToken_reverts() external {
vm.mockCall(address(l1Block), abi.encodeCall(IGasToken.gasPayingToken, ()), abi.encode(address(1), uint8(18)));
vm.expectRevert("L2StandardBridge: not supported with custom gas token");
vm.prank(alice, alice);
l2StandardBridge.withdrawTo(address(Predeploys.LEGACY_ERC20_ETH), bob, 1, 1, hex"");
}
/// @dev Tests that `withdrawTo` reverts with custom gas token.
function test_withdrawToERC20_customGasToken_reverts() external {
vm.mockCall(address(l1Block), abi.encodeCall(IGasToken.gasPayingToken, ()), abi.encode(address(1), uint8(18)));
vm.expectRevert("L2StandardBridge: not supported with custom gas token");
vm.prank(alice, alice);
l2StandardBridge.withdrawTo(address(L2Token), bob, 1, 1, hex"");
}
/// @dev Tests that `withdrawTo` reverts with custom gas token.
function test_withdrawToERC20WithValue_customGasToken_reverts() external {
vm.deal(alice, 1 ether);
vm.mockCall(address(l1Block), abi.encodeCall(IGasToken.gasPayingToken, ()), abi.encode(address(1), uint8(18)));
vm.expectRevert("L2StandardBridge: not supported with custom gas token");
vm.prank(alice, alice);
l2StandardBridge.withdrawTo{ value: 1 ether }(address(L2Token), bob, 1, 1, hex"");
}
/// @dev Tests that `withdrawTo` with value reverts with custom gas token.
function test_withdrawTo_customGasTokenWithValue_reverts() external {
vm.deal(alice, 1 ether);
vm.mockCall(address(l1Block), abi.encodeCall(IGasToken.gasPayingToken, ()), abi.encode(address(1), uint8(18)));
vm.expectRevert("L2StandardBridge: not supported with custom gas token");
vm.prank(alice, alice);
l2StandardBridge.withdrawTo{ value: 1 ether }(address(Predeploys.LEGACY_ERC20_ETH), bob, 1, 1, hex"");
}
/// @dev Tests that the legacy `withdraw` interface on the L2StandardBridge /// @dev Tests that the legacy `withdraw` interface on the L2StandardBridge
/// successfully initiates a withdrawal. /// successfully initiates a withdrawal.
function test_withdraw_ether_succeeds() external { function test_withdraw_ether_succeeds() external {
...@@ -559,15 +477,6 @@ contract L2StandardBridge_Bridge_Test is CommonTest { ...@@ -559,15 +477,6 @@ contract L2StandardBridge_Bridge_Test is CommonTest {
l2StandardBridge.bridgeETH{ value: _value }(_minGasLimit, _extraData); l2StandardBridge.bridgeETH{ value: _value }(_minGasLimit, _extraData);
} }
/// @dev Tests that bridging reverts with custom gas token.
function test_bridgeETH_customGasToken_reverts() external {
vm.prank(alice, alice);
vm.mockCall(address(l1Block), abi.encodeCall(IGasToken.gasPayingToken, ()), abi.encode(address(1), uint8(2)));
vm.expectRevert("StandardBridge: cannot bridge ETH with custom gas token");
l2StandardBridge.bridgeETH(50000, hex"dead");
}
/// @dev Tests that bridging ETH to a different address succeeds. /// @dev Tests that bridging ETH to a different address succeeds.
function testFuzz_bridgeETHTo_succeeds(uint256 _value, uint32 _minGasLimit, bytes calldata _extraData) external { function testFuzz_bridgeETHTo_succeeds(uint256 _value, uint32 _minGasLimit, bytes calldata _extraData) external {
uint256 nonce = l2CrossDomainMessenger.messageNonce(); uint256 nonce = l2CrossDomainMessenger.messageNonce();
...@@ -604,20 +513,6 @@ contract L2StandardBridge_Bridge_Test is CommonTest { ...@@ -604,20 +513,6 @@ contract L2StandardBridge_Bridge_Test is CommonTest {
l2StandardBridge.bridgeETHTo{ value: _value }(bob, _minGasLimit, _extraData); l2StandardBridge.bridgeETHTo{ value: _value }(bob, _minGasLimit, _extraData);
} }
/// @dev Tests that bridging reverts with custom gas token.
function testFuzz_bridgeETHTo_customGasToken_reverts(
uint256 _value,
uint32 _minGasLimit,
bytes calldata _extraData
)
external
{
vm.mockCall(address(l1Block), abi.encodeCall(IGasToken.gasPayingToken, ()), abi.encode(address(1), uint8(2)));
vm.expectRevert("StandardBridge: cannot bridge ETH with custom gas token");
vm.deal(address(this), _value);
l2StandardBridge.bridgeETHTo{ value: _value }(bob, _minGasLimit, _extraData);
}
} }
contract L2StandardBridge_FinalizeBridgeETH_Test is CommonTest { contract L2StandardBridge_FinalizeBridgeETH_Test is CommonTest {
......
...@@ -26,13 +26,11 @@ contract WETH_Test is CommonTest { ...@@ -26,13 +26,11 @@ contract WETH_Test is CommonTest {
/// @dev Tests that the name function returns the correct value. /// @dev Tests that the name function returns the correct value.
function test_name_ether_succeeds() external view { function test_name_ether_succeeds() external view {
assertFalse(l1Block.isCustomGasToken());
assertEq("Wrapped Ether", weth.name()); assertEq("Wrapped Ether", weth.name());
} }
/// @dev Tests that the symbol function returns the correct value. /// @dev Tests that the symbol function returns the correct value.
function test_symbol_ether_succeeds() external view { function test_symbol_ether_succeeds() external view {
assertFalse(l1Block.isCustomGasToken());
assertEq("WETH", weth.symbol()); assertEq("WETH", weth.symbol());
} }
} }
...@@ -16,7 +16,6 @@ import { DeployUtils } from "scripts/libraries/DeployUtils.sol"; ...@@ -16,7 +16,6 @@ import { DeployUtils } from "scripts/libraries/DeployUtils.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
// Libraries // Libraries
import { Constants } from "src/libraries/Constants.sol";
import { console } from "forge-std/console.sol"; import { console } from "forge-std/console.sol";
// Interfaces // Interfaces
...@@ -34,7 +33,6 @@ contract CommonTest is Test, Setup, Events { ...@@ -34,7 +33,6 @@ contract CommonTest is Test, Setup, Events {
FFIInterface constant ffi = FFIInterface(address(uint160(uint256(keccak256(abi.encode("optimism.ffi")))))); FFIInterface constant ffi = FFIInterface(address(uint160(uint256(keccak256(abi.encode("optimism.ffi"))))));
bool useAltDAOverride; bool useAltDAOverride;
address customGasToken;
bool useInteropOverride; bool useInteropOverride;
/// @dev This value is only used in forked tests. During forked tests, the default is to perform the upgrade before /// @dev This value is only used in forked tests. During forked tests, the default is to perform the upgrade before
...@@ -65,9 +63,6 @@ contract CommonTest is Test, Setup, Events { ...@@ -65,9 +63,6 @@ contract CommonTest is Test, Setup, Events {
if (useAltDAOverride) { if (useAltDAOverride) {
deploy.cfg().setUseAltDA(true); deploy.cfg().setUseAltDA(true);
} }
if (customGasToken != address(0)) {
deploy.cfg().setUseCustomGasToken(customGasToken);
}
if (useInteropOverride) { if (useInteropOverride) {
deploy.cfg().setUseInterop(true); deploy.cfg().setUseInterop(true);
} }
...@@ -77,7 +72,7 @@ contract CommonTest is Test, Setup, Events { ...@@ -77,7 +72,7 @@ contract CommonTest is Test, Setup, Events {
if (isForkTest()) { if (isForkTest()) {
// Skip any test suite which uses a nonstandard configuration. // Skip any test suite which uses a nonstandard configuration.
if (useAltDAOverride || customGasToken != address(0) || useInteropOverride) { if (useAltDAOverride || useInteropOverride) {
vm.skip(true); vm.skip(true);
} }
} else { } else {
...@@ -192,13 +187,6 @@ contract CommonTest is Test, Setup, Events { ...@@ -192,13 +187,6 @@ contract CommonTest is Test, Setup, Events {
useAltDAOverride = true; useAltDAOverride = true;
} }
/// @dev Sets a custom gas token for testing. Cannot be ETH.
function enableCustomGasToken(address _token) public {
_checkNotDeployed("custom gas token");
require(_token != Constants.ETHER, "CommonTest: Cannot set gas token to ETHER");
customGasToken = _token;
}
/// @dev Enables interoperability mode for testing /// @dev Enables interoperability mode for testing
function enableInterop() public { function enableInterop() public {
_checkNotDeployed("interop"); _checkNotDeployed("interop");
......
...@@ -3,9 +3,6 @@ pragma solidity 0.8.15; ...@@ -3,9 +3,6 @@ pragma solidity 0.8.15;
// Testing utilities // Testing utilities
import { CommonTest } from "test/setup/CommonTest.sol"; import { CommonTest } from "test/setup/CommonTest.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
error CustomGasTokenNotSupported();
contract DeployVariations_Test is CommonTest { contract DeployVariations_Test is CommonTest {
function setUp() public override { function setUp() public override {
...@@ -14,34 +11,22 @@ contract DeployVariations_Test is CommonTest { ...@@ -14,34 +11,22 @@ contract DeployVariations_Test is CommonTest {
} }
// Enable features which should be possible to enable or disable regardless of other options. // Enable features which should be possible to enable or disable regardless of other options.
function enableAddOns(bool _enableCGT, bool _enableAltDa) public { function enableAddOns(bool _enableAltDa) public {
if (_enableCGT) {
if (true) revert CustomGasTokenNotSupported();
ERC20 token = new ERC20("Silly", "SIL");
super.enableCustomGasToken(address(token));
}
if (_enableAltDa) { if (_enableAltDa) {
super.enableAltDA(); super.enableAltDA();
} }
} }
/// @dev It should be possible to enable Fault Proofs with any mix of CGT and Alt-DA. /// @dev It should be possible to enable Fault Proofs with Alt-DA.
function testFuzz_enableFaultProofs_succeeds(bool _enableCGT, bool _enableAltDa) public virtual { function testFuzz_enableFaultProofs_succeeds(bool _enableAltDa) public virtual {
// We don't support CGT yet, so we need to set it to false enableAddOns(_enableAltDa);
_enableCGT = false;
enableAddOns(_enableCGT, _enableAltDa);
super.setUp(); super.setUp();
} }
/// @dev It should be possible to enable Fault Proofs and Interop with any mix of CGT and Alt-DA. /// @dev It should be possible to enable Fault Proofs and Interop with Alt-DA.
function test_enableInteropAndFaultProofs_succeeds(bool _enableCGT, bool _enableAltDa) public virtual { function test_enableInteropAndFaultProofs_succeeds(bool _enableAltDa) public virtual {
// We don't support CGT yet, so we need to set it to false enableAddOns(_enableAltDa);
_enableCGT = false;
enableAddOns(_enableCGT, _enableAltDa);
super.enableInterop(); super.enableInterop();
super.setUp(); super.setUp();
......
...@@ -5,7 +5,6 @@ import { StandardBridge } from "src/universal/StandardBridge.sol"; ...@@ -5,7 +5,6 @@ import { StandardBridge } from "src/universal/StandardBridge.sol";
import { CommonTest } from "test/setup/CommonTest.sol"; import { CommonTest } from "test/setup/CommonTest.sol";
import { OptimismMintableERC20, ILegacyMintableERC20 } from "src/universal/OptimismMintableERC20.sol"; import { OptimismMintableERC20, ILegacyMintableERC20 } from "src/universal/OptimismMintableERC20.sol";
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { Constants } from "src/libraries/Constants.sol";
/// @title StandardBridgeTester /// @title StandardBridgeTester
/// @notice Simple wrapper around the StandardBridge contract that exposes /// @notice Simple wrapper around the StandardBridge contract that exposes
...@@ -21,10 +20,6 @@ contract StandardBridgeTester is StandardBridge { ...@@ -21,10 +20,6 @@ contract StandardBridgeTester is StandardBridge {
return _isCorrectTokenPair(_mintableToken, _otherToken); return _isCorrectTokenPair(_mintableToken, _otherToken);
} }
function gasPayingToken() internal pure override returns (address, uint8) {
return (Constants.ETHER, 18);
}
receive() external payable override { } receive() external payable override { }
} }
......
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