diff --git a/packages/contracts-bedrock/interfaces/L1/IOptimismPortalInterop.sol b/packages/contracts-bedrock/interfaces/L1/IOptimismPortalInterop.sol index 91ee7f7d0d7e5..6dec13a8335c9 100644 --- a/packages/contracts-bedrock/interfaces/L1/IOptimismPortalInterop.sol +++ b/packages/contracts-bedrock/interfaces/L1/IOptimismPortalInterop.sol @@ -10,7 +10,6 @@ import { ISuperchainConfig } from "interfaces/L1/ISuperchainConfig.sol"; import { ConfigType } from "interfaces/L2/IL1BlockInterop.sol"; interface IOptimismPortalInterop { - error CustomGasTokenNotSupported(); error AlreadyFinalized(); error BadTarget(); error Blacklisted(); diff --git a/packages/contracts-bedrock/interfaces/L1/ISystemConfig.sol b/packages/contracts-bedrock/interfaces/L1/ISystemConfig.sol index f34385d1ed248..e687a17e048bb 100644 --- a/packages/contracts-bedrock/interfaces/L1/ISystemConfig.sol +++ b/packages/contracts-bedrock/interfaces/L1/ISystemConfig.sol @@ -3,7 +3,6 @@ pragma solidity ^0.8.0; import { IResourceMetering } from "interfaces/L1/IResourceMetering.sol"; -/// @notice This interface corresponds to the Custom Gas Token version of the SystemConfig contract. interface ISystemConfig { enum UpdateType { BATCHER, diff --git a/packages/contracts-bedrock/interfaces/L2/IETHLiquidity.sol b/packages/contracts-bedrock/interfaces/L2/IETHLiquidity.sol index 77c1c0b3caf25..cd87ad5c1d448 100644 --- a/packages/contracts-bedrock/interfaces/L2/IETHLiquidity.sol +++ b/packages/contracts-bedrock/interfaces/L2/IETHLiquidity.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.0; interface IETHLiquidity { - error NotCustomGasToken(); error Unauthorized(); event LiquidityBurned(address indexed caller, uint256 value); diff --git a/packages/contracts-bedrock/interfaces/L2/IL1Block.sol b/packages/contracts-bedrock/interfaces/L2/IL1Block.sol index a43b3c7c39639..ecac79801000a 100644 --- a/packages/contracts-bedrock/interfaces/L2/IL1Block.sol +++ b/packages/contracts-bedrock/interfaces/L2/IL1Block.sol @@ -2,26 +2,21 @@ pragma solidity ^0.8.0; 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 baseFeeScalar() external view returns (uint32); function basefee() external view returns (uint256); function batcherHash() external view returns (bytes32); function blobBaseFee() external view returns (uint256); function blobBaseFeeScalar() external view returns (uint32); - function gasPayingToken() external view returns (address addr_, uint8 decimals_); - function gasPayingTokenName() external view returns (string memory name_); - function gasPayingTokenSymbol() external view returns (string memory symbol_); + function gasPayingToken() external pure returns (address addr_, uint8 decimals_); + function gasPayingTokenName() external pure returns (string memory name_); + function gasPayingTokenSymbol() external pure returns (string memory symbol_); 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 l1FeeScalar() external view returns (uint256); function number() external view returns (uint64); function sequenceNumber() external view returns (uint64); - function setGasPayingToken(address _token, uint8 _decimals, bytes32 _name, bytes32 _symbol) external; function setL1BlockValues( uint64 _number, uint64 _timestamp, diff --git a/packages/contracts-bedrock/interfaces/L2/IL1BlockInterop.sol b/packages/contracts-bedrock/interfaces/L2/IL1BlockInterop.sol index dd72e3fa6f894..dea7ad721e0b2 100644 --- a/packages/contracts-bedrock/interfaces/L2/IL1BlockInterop.sol +++ b/packages/contracts-bedrock/interfaces/L2/IL1BlockInterop.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.0; enum ConfigType { - SET_GAS_PAYING_TOKEN, ADD_DEPENDENCY, REMOVE_DEPENDENCY } @@ -17,7 +16,6 @@ interface IL1BlockInterop { event DependencyAdded(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 baseFeeScalar() external view returns (uint32); @@ -27,11 +25,11 @@ interface IL1BlockInterop { function blobBaseFeeScalar() external view returns (uint32); function dependencySetSize() external view returns (uint8); function depositsComplete() external; - function gasPayingToken() external view returns (address addr_, uint8 decimals_); - function gasPayingTokenName() external view returns (string memory name_); - function gasPayingTokenSymbol() external view returns (string memory symbol_); + function gasPayingToken() external pure returns (address addr_, uint8 decimals_); + function gasPayingTokenName() external pure returns (string memory name_); + function gasPayingTokenSymbol() external pure returns (string memory symbol_); 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 isInDependencySet(uint256 _chainId) external view returns (bool); function l1FeeOverhead() external view returns (uint256); @@ -39,7 +37,6 @@ interface IL1BlockInterop { function number() external view returns (uint64); function sequenceNumber() external view returns (uint64); function setConfig(ConfigType _type, bytes memory _value) external; - function setGasPayingToken(address _token, uint8 _decimals, bytes32 _name, bytes32 _symbol) external; function setL1BlockValues( uint64 _number, uint64 _timestamp, diff --git a/packages/contracts-bedrock/interfaces/L2/ISuperchainWETH.sol b/packages/contracts-bedrock/interfaces/L2/ISuperchainWETH.sol index a6b6ef3ce7bf7..e646807b8d158 100644 --- a/packages/contracts-bedrock/interfaces/L2/ISuperchainWETH.sol +++ b/packages/contracts-bedrock/interfaces/L2/ISuperchainWETH.sol @@ -7,7 +7,6 @@ import { ISemver } from "interfaces/universal/ISemver.sol"; interface ISuperchainWETH is IWETH98, IERC7802, ISemver { error Unauthorized(); - error NotCustomGasToken(); error InvalidCrossDomainSender(); error ZeroAddress(); @@ -16,7 +15,7 @@ interface ISuperchainWETH is IWETH98, IERC7802, ISemver { event RelayETH(address indexed from, address indexed to, uint256 amount, uint256 source); 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 sendETH(address _to, uint256 _chainId) external payable returns (bytes32 msgHash_); function relayETH(address _from, address _to, uint256 _amount) external; diff --git a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol index 024e36c15afbb..acced24495bde 100644 --- a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol @@ -210,12 +210,6 @@ contract Deploy is Deployer { ); vm.stopPrank(); - if (cfg.useCustomGasToken()) { - // Reset the systemconfig then reinitialize it with the custom gas token - resetInitializedProxy("SystemConfig"); - initializeSystemConfig(); - } - if (cfg.useAltDA()) { bytes32 typeHash = keccak256(bytes(cfg.daCommitmentType())); bytes32 keccakHash = keccak256(bytes("KeccakCommitment")); @@ -501,11 +495,6 @@ contract Deploy is Deployer { bytes32 batcherHash = bytes32(uint256(uint160(cfg.batchSenderAddress()))); - address customGasTokenAddress = Constants.ETHER; - if (cfg.useCustomGasToken()) { - customGasTokenAddress = cfg.customGasTokenAddress(); - } - IProxyAdmin proxyAdmin = IProxyAdmin(payable(artifacts.mustGetAddress("ProxyAdmin"))); proxyAdmin.upgradeAndCall({ _proxy: payable(systemConfigProxy), diff --git a/packages/contracts-bedrock/scripts/deploy/DeployConfig.s.sol b/packages/contracts-bedrock/scripts/deploy/DeployConfig.s.sol index 99daaa7e3d0f7..6a55abc6eb752 100644 --- a/packages/contracts-bedrock/scripts/deploy/DeployConfig.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/DeployConfig.s.sol @@ -85,9 +85,6 @@ contract DeployConfig is Script { uint256 public daBondSize; uint256 public daResolverRefundPercentage; - bool public useCustomGasToken; - address public customGasTokenAddress; - bool public useInterop; bool public useUpgradedFork; @@ -171,9 +168,6 @@ contract DeployConfig is Script { daBondSize = _readOr(_json, "$.daBondSize", 1000000000); daResolverRefundPercentage = _readOr(_json, "$.daResolverRefundPercentage", 0); - useCustomGasToken = _readOr(_json, "$.useCustomGasToken", false); - customGasTokenAddress = _readOr(_json, "$.customGasTokenAddress", address(0)); - useInterop = _readOr(_json, "$.useInterop", false); useUpgradedFork; } @@ -232,12 +226,6 @@ contract DeployConfig is Script { 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 /// @dev When true, the forked system WILL be upgraded in setUp(). /// When false, the forked system WILL NOT be upgraded in setUp(). diff --git a/packages/contracts-bedrock/snapshots/.gas-snapshot b/packages/contracts-bedrock/snapshots/.gas-snapshot index 87a5af9334469..2ef02f5b3923e 100644 --- a/packages/contracts-bedrock/snapshots/.gas-snapshot +++ b/packages/contracts-bedrock/snapshots/.gas-snapshot @@ -1,13 +1,13 @@ -GasBenchMark_L1BlockInterop_DepositsComplete:test_depositsComplete_benchmark() (gas: 7589) -GasBenchMark_L1BlockInterop_DepositsComplete_Warm:test_depositsComplete_benchmark() (gas: 5589) -GasBenchMark_L1BlockInterop_SetValuesInterop:test_setL1BlockValuesInterop_benchmark() (gas: 175722) +GasBenchMark_L1BlockInterop_DepositsComplete:test_depositsComplete_benchmark() (gas: 7567) +GasBenchMark_L1BlockInterop_DepositsComplete_Warm:test_depositsComplete_benchmark() (gas: 5567) +GasBenchMark_L1BlockInterop_SetValuesInterop:test_setL1BlockValuesInterop_benchmark() (gas: 175700) GasBenchMark_L1BlockInterop_SetValuesInterop_Warm:test_setL1BlockValuesInterop_benchmark() (gas: 5144) -GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (gas: 158553) -GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7619) -GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 356487) -GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2954716) -GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 551627) -GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4063775) -GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 450267) -GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3496188) -GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 59798) \ No newline at end of file +GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (gas: 158487) +GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7597) +GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 356475) +GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2954682) +GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 551585) +GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4063778) +GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 450277) +GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3496176) +GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 59843) \ No newline at end of file diff --git a/packages/contracts-bedrock/snapshots/abi/ETHLiquidity.json b/packages/contracts-bedrock/snapshots/abi/ETHLiquidity.json index 5fd386c52e5ae..72385798e5f89 100644 --- a/packages/contracts-bedrock/snapshots/abi/ETHLiquidity.json +++ b/packages/contracts-bedrock/snapshots/abi/ETHLiquidity.json @@ -70,11 +70,6 @@ "name": "LiquidityMinted", "type": "event" }, - { - "inputs": [], - "name": "NotCustomGasToken", - "type": "error" - }, { "inputs": [], "name": "Unauthorized", diff --git a/packages/contracts-bedrock/snapshots/abi/L1Block.json b/packages/contracts-bedrock/snapshots/abi/L1Block.json index 020c9e942c757..8ab5df00fcdd7 100644 --- a/packages/contracts-bedrock/snapshots/abi/L1Block.json +++ b/packages/contracts-bedrock/snapshots/abi/L1Block.json @@ -92,7 +92,7 @@ "type": "uint8" } ], - "stateMutability": "view", + "stateMutability": "pure", "type": "function" }, { @@ -105,7 +105,7 @@ "type": "string" } ], - "stateMutability": "view", + "stateMutability": "pure", "type": "function" }, { @@ -118,7 +118,7 @@ "type": "string" } ], - "stateMutability": "view", + "stateMutability": "pure", "type": "function" }, { @@ -140,11 +140,11 @@ "outputs": [ { "internalType": "bool", - "name": "", + "name": "is_", "type": "bool" } ], - "stateMutability": "view", + "stateMutability": "pure", "type": "function" }, { @@ -199,34 +199,6 @@ "stateMutability": "view", "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": [ { @@ -307,41 +279,5 @@ ], "stateMutability": "pure", "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 diff --git a/packages/contracts-bedrock/snapshots/abi/L1BlockInterop.json b/packages/contracts-bedrock/snapshots/abi/L1BlockInterop.json index ab089f0cec555..3e838b5d80767 100644 --- a/packages/contracts-bedrock/snapshots/abi/L1BlockInterop.json +++ b/packages/contracts-bedrock/snapshots/abi/L1BlockInterop.json @@ -112,7 +112,7 @@ "type": "uint8" } ], - "stateMutability": "view", + "stateMutability": "pure", "type": "function" }, { @@ -125,7 +125,7 @@ "type": "string" } ], - "stateMutability": "view", + "stateMutability": "pure", "type": "function" }, { @@ -138,7 +138,7 @@ "type": "string" } ], - "stateMutability": "view", + "stateMutability": "pure", "type": "function" }, { @@ -160,11 +160,11 @@ "outputs": [ { "internalType": "bool", - "name": "", + "name": "is_", "type": "bool" } ], - "stateMutability": "view", + "stateMutability": "pure", "type": "function" }, { @@ -269,34 +269,6 @@ "stateMutability": "nonpayable", "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": [ { @@ -411,37 +383,6 @@ "name": "DependencyRemoved", "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": [], "name": "AlreadyDependency", diff --git a/packages/contracts-bedrock/snapshots/abi/OptimismPortalInterop.json b/packages/contracts-bedrock/snapshots/abi/OptimismPortalInterop.json index b99b23ad029ff..2dd27e68eaff9 100644 --- a/packages/contracts-bedrock/snapshots/abi/OptimismPortalInterop.json +++ b/packages/contracts-bedrock/snapshots/abi/OptimismPortalInterop.json @@ -785,11 +785,6 @@ "name": "ContentLengthMismatch", "type": "error" }, - { - "inputs": [], - "name": "CustomGasTokenNotSupported", - "type": "error" - }, { "inputs": [], "name": "EmptyItem", diff --git a/packages/contracts-bedrock/snapshots/abi/SuperchainWETH.json b/packages/contracts-bedrock/snapshots/abi/SuperchainWETH.json index e8df09a806406..24b27063f3423 100644 --- a/packages/contracts-bedrock/snapshots/abi/SuperchainWETH.json +++ b/packages/contracts-bedrock/snapshots/abi/SuperchainWETH.json @@ -305,7 +305,7 @@ "inputs": [ { "internalType": "uint256", - "name": "_amount", + "name": "wad", "type": "uint256" } ], @@ -519,11 +519,6 @@ "name": "InvalidCrossDomainSender", "type": "error" }, - { - "inputs": [], - "name": "NotCustomGasToken", - "type": "error" - }, { "inputs": [], "name": "Unauthorized", diff --git a/packages/contracts-bedrock/snapshots/abi/WETH.json b/packages/contracts-bedrock/snapshots/abi/WETH.json index 03cf2880ccce0..0f97edfd828d3 100644 --- a/packages/contracts-bedrock/snapshots/abi/WETH.json +++ b/packages/contracts-bedrock/snapshots/abi/WETH.json @@ -104,7 +104,7 @@ "type": "string" } ], - "stateMutability": "view", + "stateMutability": "pure", "type": "function" }, { @@ -117,7 +117,7 @@ "type": "string" } ], - "stateMutability": "view", + "stateMutability": "pure", "type": "function" }, { diff --git a/packages/contracts-bedrock/snapshots/semver-lock.json b/packages/contracts-bedrock/snapshots/semver-lock.json index c520e6e699e3a..d628cf9021694 100644 --- a/packages/contracts-bedrock/snapshots/semver-lock.json +++ b/packages/contracts-bedrock/snapshots/semver-lock.json @@ -4,16 +4,16 @@ "sourceCodeHash": "0xae49c741c8cd546981ab59b85b88e9fc1055c4fae085e7078d601b42464f86e6" }, "src/L1/L1CrossDomainMessenger.sol": { - "initCodeHash": "0xcff231ee7465984e853572c5050e761f746575d78f709eba65c982178de3e718", - "sourceCodeHash": "0x9726b6f646269f4288ff8dc1b8228dedbdf960e90df1d11793bc534297328e96" + "initCodeHash": "0x2364c7a72eb76c0d154836ef0b1fdac695c25d4f9bbae4b5a4cf37d4609652e8", + "sourceCodeHash": "0xe450b4c93a285f683614841eb0042ac937bb250067183854d3cc20b78f587bd1" }, "src/L1/L1ERC721Bridge.sol": { "initCodeHash": "0x280488bce8b4fb364740c59de14c423851902088f384e077bccc79b9df48528a", "sourceCodeHash": "0xe12b9e6c4e4ac2e2c9a03f07c7689f6bf2231922536072812cf1f37a5a276e73" }, "src/L1/L1StandardBridge.sol": { - "initCodeHash": "0xe69e972e18930d3feaaad20b8e0e15625df9a71ad8304ee7d89c17d32644e152", - "sourceCodeHash": "0xc6613d35d1ad95cbef26a503a10b5dd8663ceb80426f8c528835d39f79e4b4cf" + "initCodeHash": "0x09c6337af41d036219fc4679b862e221887eca434b18d483332c37caeff9abca", + "sourceCodeHash": "0x2dd7bf6cbce655b1023a3ad071523bf455aa13fad5d02e1e434af71728cd794c" }, "src/L1/OPContractsManager.sol": { "initCodeHash": "0xa277d25e1aae34f68e9e8a0814c34f6adada5248992dc5e62831ef0082f130fb", @@ -28,8 +28,8 @@ "sourceCodeHash": "0xf215a31954f2ef166cfb26d20e466c62fafa235a08fc42c55131dcb81998ff01" }, "src/L1/OptimismPortalInterop.sol": { - "initCodeHash": "0x057c56174304f3773654fed39abf5fab70d9446f531d07fdb225b738a680ad46", - "sourceCodeHash": "0xc04a7f9c14a13ec3587f5cc351c8e9f27fbbe9f1291a1aba07de29edbeef418a" + "initCodeHash": "0x9f185554099af7d887217d2eda37477880a6526851dde821a4a1ddec4aa4e704", + "sourceCodeHash": "0x14b5644f8400be1ee656662d654b05f90baf5c24c6623cb22e72f92b883b2986" }, "src/L1/ProtocolVersions.sol": { "initCodeHash": "0x0000ec89712d8b4609873f1ba76afffd4205bf9110818995c90134dbec12e91e", @@ -44,8 +44,8 @@ "sourceCodeHash": "0x0cfa6d791e217bd6650e1155ead95781505cd364b698cbea44c7684b1e506d57" }, "src/L1/SystemConfigInterop.sol": { - "initCodeHash": "0xa5a43846dbf17233c3ac5bb845798b3dbb95e4773249e9b74cb88626a5e77132", - "sourceCodeHash": "0x893478f9816eb4e0764ed275a3ff27d8b9aa264ce5c5f4f0011cecfcc3638e47" + "initCodeHash": "0x77334e463e8415a6995cd87f1d69e98c65c6e815ec60cc30d2eb55303808aa8e", + "sourceCodeHash": "0x6324e4d4d87d8308f6ce6ca3759366a63b8ddb08c7fa78b6d295c14384a88289" }, "src/L2/BaseFeeVault.sol": { "initCodeHash": "0xc403d4c555d8e69a2699e01d192ae7327136701fa02da10a6d75a584b3c364c9", @@ -56,40 +56,40 @@ "sourceCodeHash": "0x661d7659f09b7f909e8bd5e6c41e8c98f2091036ed2123b7e18a1a74120bd849" }, "src/L2/ETHLiquidity.sol": { - "initCodeHash": "0xdc7075deb7e7c407e6ec3be33ce352ee4a9ca0e82f4bffeb360c93b395a2452f", - "sourceCodeHash": "0x92bf6a7a13d1331cbfed35e22130b54b00576bd31de5feb309dfadef2a0b7dd9" + "initCodeHash": "0x776ece4a1bb24d97287806769470327641da240b083898a90943e2844957cc46", + "sourceCodeHash": "0xe5c08ce62327113e4bbaf29f47e5f1ddfad6fbd63c07132eedfba5af5325f331" }, "src/L2/GasPriceOracle.sol": { "initCodeHash": "0x83d50e3b34cd1b4de32f1cced28796b07aefc526cc17ceb1903ad55f4abc90b7", "sourceCodeHash": "0x305c72d7be9149fce7095bd4641a1a19acada3126fbc43599f674cadbf6e7d6c" }, "src/L2/L1Block.sol": { - "initCodeHash": "0x22f9b9277e33dc27df8366c2dd6e8340d294947b57116db35c6d14c41225633f", - "sourceCodeHash": "0xffb6cf768097b2d6cb6ecb2d6463c176af9acd70415aa0d2e4f017758f737eee" + "initCodeHash": "0xc4c2f3ceaa2738a326f7c3e449c45bc642c0810f4c21332b261bb3a3b3f4397e", + "sourceCodeHash": "0x0d72e0709675fdef8b22255000f49d895ee57a7c682cfbc60a5e272b03d38115" }, "src/L2/L1BlockInterop.sol": { - "initCodeHash": "0x67e99306d9a09cac587f65cfa2c0de55da9eca184fd1fc3f4b885d2c47114483", - "sourceCodeHash": "0x9493f90136917fc95d2ac942f061c1b9cffeff6d327afb46fe4e69784e7f2100" + "initCodeHash": "0xb2782f1ca0fa0899aa5e879471d9e9044e032e7f931fedcff7803c9a43f8a735", + "sourceCodeHash": "0x01017177d32f567df0273acb1561043d97cf0a36308a95917e0f402682ae5209" }, "src/L2/L1FeeVault.sol": { "initCodeHash": "0x6745b7be3895a5e8d373df0066d931bae29c47672ac46c2f5829bd0052cc6d9e", "sourceCodeHash": "0xd0471c328c1d17c5863261322bf8d5aff2e7e9e3a1135631a993aa75667621df" }, "src/L2/L2CrossDomainMessenger.sol": { - "initCodeHash": "0xa6adb9d117af95f1a8be066b67a56ed8a029dd692ca363d636ad251ec9179945", - "sourceCodeHash": "0x74882c3cca14807219789b5b2b264ebd17479b409042c09db2da52736f9de36e" + "initCodeHash": "0x6117d2ca80029c802b1e5cc36341f03ec48efd07df0251121d3faf5e93aa5901", + "sourceCodeHash": "0x48001529220d274c5cd2e84787239b6d2244780d23894e0a8e96550a40be18fe" }, "src/L2/L2ERC721Bridge.sol": { "initCodeHash": "0xea899e672803634b98d619174bf85dc8b3f7e6407bb7306eb72ed4c8eefce0c0", "sourceCodeHash": "0xea896e18eceb9ba6e8125e9f3371549787e082db4b26d642b279b5697651d473" }, "src/L2/L2StandardBridge.sol": { - "initCodeHash": "0xde3b3a1aa0056d25ab3f4ad6e29b9d56c4740b29cd9bef36588d849ffc0178f6", - "sourceCodeHash": "0x6c32dba4550b9c82d80666796e89c77799c21001691a116663970508121be03b" + "initCodeHash": "0xbc702854c3b6da0e5c476fabc29b1a2464bee3a1ebda7175232a5c41d7ace5e6", + "sourceCodeHash": "0x0a2ea11f3114fd1c62fae90feec5032930afc898ac75af52a67a5266eeeedf9b" }, "src/L2/L2StandardBridgeInterop.sol": { - "initCodeHash": "0xb8df14bf93beb53be269c641c80b50d6ad872894da49d5f60d0b976e0ba8839e", - "sourceCodeHash": "0x3b35ee19099fc4ffb111a4cd774434c414e56d33017cce47fdba3f712e2429b1" + "initCodeHash": "0x38977293cf77c047b1c3f0df5848ee9d52f742ddc7916b67c4f714c103a5a2a5", + "sourceCodeHash": "0xd0f5eaf7c8f1d14f2f997f634e279d0c4fd6843cb20b0e7eb9b9c757da591d38" }, "src/L2/L2ToL1MessagePasser.sol": { "initCodeHash": "0xf9d82084dcef31a3737a76d8ee4e5842ea190d0f77ed4678adb3bbb95217050f", @@ -132,12 +132,12 @@ "sourceCodeHash": "0xcd2b49cb7cf6d18616ee8bec9183fe5b5b460941875bc0b4158c4d5390ec3b0c" }, "src/L2/SuperchainWETH.sol": { - "initCodeHash": "0x6ded8aeea6edf7e0ead7b0d2a12ef236f1fb7d21980a1dd564cbe86affca7927", - "sourceCodeHash": "0x11d711704a5afcae6076d017ee001b25bc705728973b1ad2e6a32274a8475f50" + "initCodeHash": "0x545686820e440d72529c815b7406844272d5ec33b741b2be6ebbe3a3db1ca8ad", + "sourceCodeHash": "0x6145e61cc0a0c95db882a76ecffea15c358c2b574d5157e53b85a69908701613" }, "src/L2/WETH.sol": { - "initCodeHash": "0x480d4f8dbec1b0d3211bccbbdfb69796f3e90c784f724b1bbfd4703b0aafdeba", - "sourceCodeHash": "0xe9964aa66db1dfc86772958b4c9276697e67f7055529a43e6a49a055009bc995" + "initCodeHash": "0x38b396fc35d72e8013bad2fe8d7dea5285499406d4c4b62e27c54252e1e0f00a", + "sourceCodeHash": "0xf4f83ca89d2519045a2916c670bda66f39b431a13921e639a5342bfc6157b178" }, "src/cannon/MIPS.sol": { "initCodeHash": "0x7d0fc7c7b51b74fa2611aaa8cc1a5967e2e48f0726ea894eb2c43f36b0ff2ab7", diff --git a/packages/contracts-bedrock/src/L1/L1CrossDomainMessenger.sol b/packages/contracts-bedrock/src/L1/L1CrossDomainMessenger.sol index a74f7edd37e17..8b19a466ee8f3 100644 --- a/packages/contracts-bedrock/src/L1/L1CrossDomainMessenger.sol +++ b/packages/contracts-bedrock/src/L1/L1CrossDomainMessenger.sol @@ -6,7 +6,6 @@ import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol"; // Libraries import { Predeploys } from "src/libraries/Predeploys.sol"; -import { Constants } from "src/libraries/Constants.sol"; // Interfaces import { ISemver } from "interfaces/universal/ISemver.sol"; @@ -32,8 +31,8 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver { address private spacer_253_0_20; /// @notice Semantic version. - /// @custom:semver 2.4.1-beta.7 - string public constant version = "2.4.1-beta.7"; + /// @custom:semver 2.4.1-beta.8 + string public constant version = "2.4.1-beta.8"; /// @notice Constructs the L1CrossDomainMessenger contract. constructor() { @@ -49,13 +48,6 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, ISemver { __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. /// Public getter is legacy and will be removed in the future. Use `portal()` instead. /// @return Contract of the OptimismPortal on this chain. diff --git a/packages/contracts-bedrock/src/L1/L1StandardBridge.sol b/packages/contracts-bedrock/src/L1/L1StandardBridge.sol index 42dfcc2813484..0062f6602728a 100644 --- a/packages/contracts-bedrock/src/L1/L1StandardBridge.sol +++ b/packages/contracts-bedrock/src/L1/L1StandardBridge.sol @@ -6,7 +6,6 @@ import { StandardBridge } from "src/universal/StandardBridge.sol"; // Libraries import { Predeploys } from "src/libraries/Predeploys.sol"; -import { Constants } from "src/libraries/Constants.sol"; // Interfaces import { ISemver } from "interfaces/universal/ISemver.sol"; @@ -75,8 +74,8 @@ contract L1StandardBridge is StandardBridge, ISemver { ); /// @notice Semantic version. - /// @custom:semver 2.2.1-beta.7 - string public constant version = "2.2.1-beta.7"; + /// @custom:semver 2.2.1-beta.8 + string public constant version = "2.2.1-beta.8"; /// @notice Address of the SuperchainConfig contract. ISuperchainConfig public superchainConfig; @@ -112,13 +111,6 @@ contract L1StandardBridge is StandardBridge, ISemver { _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 /// @notice Deposits some amount of ETH into the sender's account on L2. /// @param _minGasLimit Minimum gas limit for the deposit message on L2. diff --git a/packages/contracts-bedrock/src/L1/OptimismPortalInterop.sol b/packages/contracts-bedrock/src/L1/OptimismPortalInterop.sol index 44b6f4b1ecf96..88e67aabf9d85 100644 --- a/packages/contracts-bedrock/src/L1/OptimismPortalInterop.sol +++ b/packages/contracts-bedrock/src/L1/OptimismPortalInterop.sol @@ -12,9 +12,6 @@ import { Unauthorized } from "src/libraries/PortalErrors.sol"; // Interfaces 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 /// @title OptimismPortalInterop /// @notice The OptimismPortal is a low-level contract responsible for passing messages between L1 @@ -28,9 +25,9 @@ contract OptimismPortalInterop is OptimismPortal2 { OptimismPortal2(_proofMaturityDelaySeconds, _disputeGameFinalityDelaySeconds) { } - /// @custom:semver +interop-beta.9 + /// @custom:semver +interop-beta.10 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. @@ -38,7 +35,6 @@ contract OptimismPortalInterop is OptimismPortal2 { /// @param _value Encoded value of the configuration. function setConfig(ConfigType _type, bytes memory _value) external { 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. // This value must be large enough to cover the cost of calling `L1Block.setConfig`. diff --git a/packages/contracts-bedrock/src/L1/SystemConfigInterop.sol b/packages/contracts-bedrock/src/L1/SystemConfigInterop.sol index 92c78ee9dda8f..d344184f71da6 100644 --- a/packages/contracts-bedrock/src/L1/SystemConfigInterop.sol +++ b/packages/contracts-bedrock/src/L1/SystemConfigInterop.sol @@ -65,9 +65,9 @@ contract SystemConfigInterop is SystemConfig { Storage.setAddress(DEPENDENCY_MANAGER_SLOT, _dependencyManager); } - /// @custom:semver +interop-beta.11 + /// @custom:semver +interop-beta.12 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. diff --git a/packages/contracts-bedrock/src/L2/ETHLiquidity.sol b/packages/contracts-bedrock/src/L2/ETHLiquidity.sol index 2b876d1e52877..5a8c97f819b8e 100644 --- a/packages/contracts-bedrock/src/L2/ETHLiquidity.sol +++ b/packages/contracts-bedrock/src/L2/ETHLiquidity.sol @@ -5,12 +5,11 @@ pragma solidity 0.8.15; import { SafeSend } from "src/universal/SafeSend.sol"; // 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"; // Interfaces import { ISemver } from "interfaces/universal/ISemver.sol"; -import { IL1Block } from "interfaces/L2/IL1Block.sol"; /// @custom:proxied true /// @custom:predeploy 0x4200000000000000000000000000000000000025 @@ -25,13 +24,12 @@ contract ETHLiquidity is ISemver { event LiquidityMinted(address indexed caller, uint256 value); /// @notice Semantic version. - /// @custom:semver 1.0.0-beta.5 - string public constant version = "1.0.0-beta.5"; + /// @custom:semver 1.0.0-beta.6 + string public constant version = "1.0.0-beta.6"; /// @notice Allows an address to lock ETH liquidity into this contract. function burn() external payable { if (msg.sender != Predeploys.SUPERCHAIN_WETH) revert Unauthorized(); - if (IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken(); emit LiquidityBurned(msg.sender, msg.value); } @@ -39,7 +37,6 @@ contract ETHLiquidity is ISemver { /// @param _amount The amount of liquidity to unlock. function mint(uint256 _amount) external { if (msg.sender != Predeploys.SUPERCHAIN_WETH) revert Unauthorized(); - if (IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken(); new SafeSend{ value: _amount }(payable(msg.sender)); emit LiquidityMinted(msg.sender, _amount); } diff --git a/packages/contracts-bedrock/src/L2/L1Block.sol b/packages/contracts-bedrock/src/L2/L1Block.sol index 3767b80988da7..81b942446ceaa 100644 --- a/packages/contracts-bedrock/src/L2/L1Block.sol +++ b/packages/contracts-bedrock/src/L2/L1Block.sol @@ -3,7 +3,6 @@ pragma solidity 0.8.15; // Libraries import { Constants } from "src/libraries/Constants.sol"; -import { GasPayingToken, IGasToken } from "src/libraries/GasPayingToken.sol"; import { NotDepositor } from "src/libraries/L1BlockErrors.sol"; // Interfaces @@ -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 /// set by the "depositor" account, a special system address. Depositor account transactions /// are created by the protocol whenever we move to a new epoch. -contract L1Block is ISemver, IGasToken { - /// @notice Event emitted when the gas paying token is set. - event GasPayingTokenSet(address indexed token, uint8 indexed decimals, bytes32 name, bytes32 symbol); - +contract L1Block is ISemver { /// @notice Address of the special depositor account. function DEPOSITOR_ACCOUNT() public pure returns (address addr_) { addr_ = Constants.DEPOSITOR_ACCOUNT; @@ -60,34 +56,35 @@ contract L1Block is ISemver, IGasToken { /// @notice The latest L1 blob base fee. 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) { - return "1.5.1-beta.5"; + return "1.5.1-beta.6"; } /// @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 view returns (address addr_, uint8 decimals_) { - (addr_, decimals_) = GasPayingToken.getToken(); + function gasPayingToken() public pure returns (address addr_, uint8 decimals_) { + addr_ = Constants.ETHER; + decimals_ = 18; } /// @notice Returns the gas paying token name. /// If nothing is set in state, then it means ether is used. - function gasPayingTokenName() public view returns (string memory name_) { - name_ = GasPayingToken.getName(); + /// This function cannot be removed because WETH depends on it. + function gasPayingTokenName() public pure returns (string memory name_) { + name_ = "Ether"; } /// @notice Returns the gas paying token symbol. /// If nothing is set in state, then it means ether is used. - function gasPayingTokenSymbol() public view returns (string memory symbol_) { - symbol_ = GasPayingToken.getSymbol(); + /// This function cannot be removed because WETH depends on it. + function gasPayingTokenSymbol() public pure returns (string memory symbol_) { + symbol_ = "ETH"; } /// @notice Getter for custom gas token paying networks. Returns true if the /// network uses a custom gas token. - function isCustomGasToken() public view returns (bool) { - (address token,) = gasPayingToken(); - return token != Constants.ETHER; + function isCustomGasToken() public pure returns (bool is_) { + is_ = false; } /// @custom:legacy @@ -170,15 +167,4 @@ contract L1Block is ISemver, IGasToken { 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 }); - } } diff --git a/packages/contracts-bedrock/src/L2/L1BlockInterop.sol b/packages/contracts-bedrock/src/L2/L1BlockInterop.sol index 7b92b202a052d..3cc03c1ef5349 100644 --- a/packages/contracts-bedrock/src/L2/L1BlockInterop.sol +++ b/packages/contracts-bedrock/src/L2/L1BlockInterop.sol @@ -6,7 +6,6 @@ import { L1Block } from "src/L2/L1Block.sol"; // Libraries import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; -import { GasPayingToken } from "src/libraries/GasPayingToken.sol"; import { StaticConfig } from "src/libraries/StaticConfig.sol"; import { Predeploys } from "src/libraries/Predeploys.sol"; import { @@ -19,11 +18,9 @@ import { } from "src/libraries/L1BlockErrors.sol"; /// @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 REMOVE_DEPENDENCY Represents the config type for removing a chain from the interop dependency set. enum ConfigType { - SET_GAS_PAYING_TOKEN, ADD_DEPENDENCY, REMOVE_DEPENDENCY } @@ -49,9 +46,9 @@ contract L1BlockInterop is L1Block { /// keccak256(abi.encode(uint256(keccak256("l1Block.identifier.isDeposit")) - 1)) & ~bytes32(uint256(0xff)) 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) { - 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. @@ -107,25 +104,13 @@ contract L1BlockInterop is L1Block { function setConfig(ConfigType _type, bytes calldata _value) external { if (msg.sender != DEPOSITOR_ACCOUNT()) revert NotDepositor(); - if (_type == ConfigType.SET_GAS_PAYING_TOKEN) { - _setGasPayingToken(_value); - } else if (_type == ConfigType.ADD_DEPENDENCY) { + if (_type == ConfigType.ADD_DEPENDENCY) { _addDependency(_value); } else if (_type == ConfigType.REMOVE_DEPENDENCY) { _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. /// @param _value The encoded value with which to add the dependency. function _addDependency(bytes calldata _value) internal { diff --git a/packages/contracts-bedrock/src/L2/L2CrossDomainMessenger.sol b/packages/contracts-bedrock/src/L2/L2CrossDomainMessenger.sol index 58143132d713b..8c5af32f016ea 100644 --- a/packages/contracts-bedrock/src/L2/L2CrossDomainMessenger.sol +++ b/packages/contracts-bedrock/src/L2/L2CrossDomainMessenger.sol @@ -11,7 +11,6 @@ import { Predeploys } from "src/libraries/Predeploys.sol"; // Interfaces import { ISemver } from "interfaces/universal/ISemver.sol"; import { IL2ToL1MessagePasser } from "interfaces/L2/IL2ToL1MessagePasser.sol"; -import { IL1Block } from "interfaces/L2/IL1Block.sol"; /// @custom:proxied true /// @custom:predeploy 0x4200000000000000000000000000000000000007 @@ -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 /// level message passing contracts. contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver { - /// @custom:semver 2.1.1-beta.7 - string public constant version = "2.1.1-beta.7"; + /// @custom:semver 2.1.1-beta.8 + string public constant version = "2.1.1-beta.8"; /// @notice Constructs the L2CrossDomainMessenger contract. constructor() { @@ -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 function _isOtherMessenger() internal view override returns (bool) { return AddressAliasHelper.undoL1ToL2Alias(msg.sender) == address(otherMessenger); diff --git a/packages/contracts-bedrock/src/L2/L2StandardBridge.sol b/packages/contracts-bedrock/src/L2/L2StandardBridge.sol index 6acff3790a8ef..7fe46d67b7fa9 100644 --- a/packages/contracts-bedrock/src/L2/L2StandardBridge.sol +++ b/packages/contracts-bedrock/src/L2/L2StandardBridge.sol @@ -11,7 +11,6 @@ import { Predeploys } from "src/libraries/Predeploys.sol"; import { ISemver } from "interfaces/universal/ISemver.sol"; import { ICrossDomainMessenger } from "interfaces/universal/ICrossDomainMessenger.sol"; import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol"; -import { IL1Block } from "interfaces/L2/IL1Block.sol"; /// @custom:proxied true /// @custom:predeploy 0x4200000000000000000000000000000000000010 @@ -58,9 +57,9 @@ contract L2StandardBridge is StandardBridge, ISemver { ); /// @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) { - return "1.11.1-beta.7"; + return "1.11.1-beta.8"; } /// @notice Constructs the L2StandardBridge contract. @@ -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 /// @notice Initiates a withdrawal from L2 to L1. /// This function only works with OptimismMintableERC20 tokens or ether. Use the @@ -109,7 +103,6 @@ contract L2StandardBridge is StandardBridge, ISemver { virtual onlyEOA { - require(isCustomGasToken() == false, "L2StandardBridge: not supported with custom gas token"); _initiateWithdrawal(_l2Token, msg.sender, msg.sender, _amount, _minGasLimit, _extraData); } @@ -138,7 +131,6 @@ contract L2StandardBridge is StandardBridge, ISemver { payable virtual { - require(isCustomGasToken() == false, "L2StandardBridge: not supported with custom gas token"); _initiateWithdrawal(_l2Token, msg.sender, _to, _amount, _minGasLimit, _extraData); } diff --git a/packages/contracts-bedrock/src/L2/L2StandardBridgeInterop.sol b/packages/contracts-bedrock/src/L2/L2StandardBridgeInterop.sol index 589454b724723..0ac13b27f8bb2 100644 --- a/packages/contracts-bedrock/src/L2/L2StandardBridgeInterop.sol +++ b/packages/contracts-bedrock/src/L2/L2StandardBridgeInterop.sol @@ -39,9 +39,9 @@ contract L2StandardBridgeInterop is L2StandardBridge { event Converted(address indexed from, address indexed to, address indexed caller, uint256 amount); /// @notice Semantic version. - /// @custom:semver +interop-beta.7 + /// @custom:semver +interop-beta.8 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. diff --git a/packages/contracts-bedrock/src/L2/SuperchainWETH.sol b/packages/contracts-bedrock/src/L2/SuperchainWETH.sol index ab6ff44a33aba..989d6d55ca25a 100644 --- a/packages/contracts-bedrock/src/L2/SuperchainWETH.sol +++ b/packages/contracts-bedrock/src/L2/SuperchainWETH.sol @@ -5,7 +5,7 @@ pragma solidity 0.8.15; import { WETH98 } from "src/universal/WETH98.sol"; // 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 { Preinstalls } from "src/libraries/Preinstalls.sol"; import { SafeSend } from "src/universal/SafeSend.sol"; @@ -13,7 +13,6 @@ import { SafeSend } from "src/universal/SafeSend.sol"; // Interfaces import { ISemver } from "interfaces/universal/ISemver.sol"; import { IL2ToL2CrossDomainMessenger } from "interfaces/L2/IL2ToL2CrossDomainMessenger.sol"; -import { IL1Block } from "interfaces/L2/IL1Block.sol"; import { IETHLiquidity } from "interfaces/L2/IETHLiquidity.sol"; import { IERC7802, IERC165 } from "interfaces/L2/IERC7802.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; @@ -43,20 +42,8 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver { event RelayETH(address indexed from, address indexed to, uint256 amount, uint256 source); /// @notice Semantic version. - /// @custom:semver 1.0.0-beta.13 - string public constant version = "1.0.0-beta.13"; - - /// @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); - } + /// @custom:semver 1.0.0-beta.14 + string public constant version = "1.0.0-beta.14"; /// @inheritdoc WETH98 function allowance(address owner, address spender) public view override returns (uint256) { @@ -89,10 +76,8 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver { _mint(_to, _amount); // Withdraw from ETHLiquidity contract. - if (!IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) { - // NOTE: 'mint' will soon change to 'withdraw'. - IETHLiquidity(Predeploys.ETH_LIQUIDITY).mint(_amount); - } + // NOTE: 'mint' will soon change to 'withdraw'. + IETHLiquidity(Predeploys.ETH_LIQUIDITY).mint(_amount); emit CrosschainMint(_to, _amount, msg.sender); } @@ -106,10 +91,8 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver { _burn(_from, _amount); // Deposit to ETHLiquidity contract. - if (!IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) { - // NOTE: 'burn' will soon change to 'deposit'. - IETHLiquidity(Predeploys.ETH_LIQUIDITY).burn{ value: _amount }(); - } + // NOTE: 'burn' will soon change to 'deposit'. + IETHLiquidity(Predeploys.ETH_LIQUIDITY).burn{ value: _amount }(); emit CrosschainBurn(_from, _amount, msg.sender); } @@ -127,10 +110,6 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver { function sendETH(address _to, uint256 _chainId) external payable returns (bytes32 msgHash_) { if (_to == address(0)) revert ZeroAddress(); - if (IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) { - revert NotCustomGasToken(); - } - // NOTE: 'burn' will soon change to 'deposit'. IETHLiquidity(Predeploys.ETH_LIQUIDITY).burn{ value: msg.value }(); @@ -155,16 +134,11 @@ contract SuperchainWETH is WETH98, IERC7802, ISemver { if (crossDomainMessageSender != address(this)) revert InvalidCrossDomainSender(); - if (IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) { - // Since ETH is not the native asset on custom gas token chains, send SuperchainWETH to the recipient. - _mint(_to, _amount); - } else { - // NOTE: 'mint' will soon change to 'withdraw'. - IETHLiquidity(Predeploys.ETH_LIQUIDITY).mint(_amount); + // 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. - new SafeSend{ value: _amount }(payable(_to)); - } + // This is a forced ETH send to the recipient, the recipient should NOT expect to be called. + new SafeSend{ value: _amount }(payable(_to)); emit RelayETH(_from, _to, _amount, source); } diff --git a/packages/contracts-bedrock/src/L2/WETH.sol b/packages/contracts-bedrock/src/L2/WETH.sol index 5dc716fca569b..558beaaa8d890 100644 --- a/packages/contracts-bedrock/src/L2/WETH.sol +++ b/packages/contracts-bedrock/src/L2/WETH.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. /// 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 { - /// @custom:semver 1.1.0-beta.4 - string public constant version = "1.1.0-beta.4"; + /// @custom:semver 1.1.0-beta.5 + string public constant version = "1.1.0-beta.5"; /// @notice Returns the name of the wrapped native asset. Will be "Wrapped 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()); } /// @notice Returns the symbol of the wrapped native asset. Will be "WETH" if the /// 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()); } } diff --git a/packages/contracts-bedrock/src/libraries/PortalErrors.sol b/packages/contracts-bedrock/src/libraries/PortalErrors.sol index 6004066b397ee..9096a2938fdc1 100644 --- a/packages/contracts-bedrock/src/libraries/PortalErrors.sol +++ b/packages/contracts-bedrock/src/libraries/PortalErrors.sol @@ -9,8 +9,6 @@ error LargeCalldata(); error SmallGasLimit(); /// @notice Error for when a withdrawal transfer fails. 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. error NoValue(); /// @notice Error for an unauthorized CALLER. diff --git a/packages/contracts-bedrock/src/libraries/errors/CommonErrors.sol b/packages/contracts-bedrock/src/libraries/errors/CommonErrors.sol index 30ce96972a191..c04d915bd2326 100644 --- a/packages/contracts-bedrock/src/libraries/errors/CommonErrors.sol +++ b/packages/contracts-bedrock/src/libraries/errors/CommonErrors.sol @@ -4,12 +4,6 @@ pragma solidity ^0.8.0; /// @notice Error for an unauthorized CALLER. 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. error TransferFailed(); diff --git a/packages/contracts-bedrock/src/universal/CrossDomainMessenger.sol b/packages/contracts-bedrock/src/universal/CrossDomainMessenger.sol index 85d801f0a1a6c..65b781707febe 100644 --- a/packages/contracts-bedrock/src/universal/CrossDomainMessenger.sol +++ b/packages/contracts-bedrock/src/universal/CrossDomainMessenger.sol @@ -175,10 +175,6 @@ abstract contract CrossDomainMessenger is /// @param _message Message to trigger the target address with. /// @param _minGasLimit Minimum gas limit that the message can be executed with. 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 // 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 @@ -363,15 +359,6 @@ abstract contract CrossDomainMessenger is + 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. /// @param _otherMessenger CrossDomainMessenger contract on the other chain. function __CrossDomainMessenger_init(CrossDomainMessenger _otherMessenger) internal onlyInitializing { diff --git a/packages/contracts-bedrock/src/universal/StandardBridge.sol b/packages/contracts-bedrock/src/universal/StandardBridge.sol index 51316b82dac5a..0bfa5698ce8df 100644 --- a/packages/contracts-bedrock/src/universal/StandardBridge.sol +++ b/packages/contracts-bedrock/src/universal/StandardBridge.sol @@ -9,7 +9,6 @@ import { Address } from "@openzeppelin/contracts/utils/Address.sol"; import { ERC165Checker } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { SafeCall } from "src/libraries/SafeCall.sol"; -import { Constants } from "src/libraries/Constants.sol"; // Interfaces import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; @@ -135,15 +134,6 @@ abstract contract StandardBridge is Initializable { /// Must be implemented by contracts that inherit. 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. /// Public getter is legacy and will be removed in the future. Use `messenger` instead. /// @return Contract of the messenger on this domain. @@ -257,7 +247,6 @@ abstract contract StandardBridge is Initializable { onlyOtherBridge { 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(_to != address(this), "StandardBridge: cannot send to self"); require(_to != address(messenger), "StandardBridge: cannot send to messenger"); @@ -326,7 +315,6 @@ abstract contract StandardBridge is Initializable { ) internal { - require(isCustomGasToken() == false, "StandardBridge: cannot bridge ETH with custom gas token"); require(msg.value == _amount, "StandardBridge: bridging ETH must include sufficient ETH value"); // Emit the correct events. By default this will be _amount, but child diff --git a/packages/contracts-bedrock/test/L1/OptimismPortalInterop.t.sol b/packages/contracts-bedrock/test/L1/OptimismPortalInterop.t.sol index 07ca34969cd2f..df9100ce8817f 100644 --- a/packages/contracts-bedrock/test/L1/OptimismPortalInterop.t.sol +++ b/packages/contracts-bedrock/test/L1/OptimismPortalInterop.t.sol @@ -27,19 +27,6 @@ contract OptimismPortalInterop_Test is CommonTest { 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. function testFuzz_setConfig_addDependency_succeeds(bytes calldata _value) public { vm.expectEmit(address(optimismPortal2)); diff --git a/packages/contracts-bedrock/test/L2/ETHLiquidity.t.sol b/packages/contracts-bedrock/test/L2/ETHLiquidity.t.sol index 9814e776b2e5e..bae3601b5105e 100644 --- a/packages/contracts-bedrock/test/L2/ETHLiquidity.t.sol +++ b/packages/contracts-bedrock/test/L2/ETHLiquidity.t.sol @@ -5,7 +5,7 @@ pragma solidity 0.8.15; import { CommonTest } from "test/setup/CommonTest.sol"; // Error imports -import { Unauthorized, NotCustomGasToken } from "src/libraries/errors/CommonErrors.sol"; +import { Unauthorized } from "src/libraries/errors/CommonErrors.sol"; /// @title ETHLiquidity_Test /// @notice Contract for testing the ETHLiquidity contract. @@ -73,26 +73,6 @@ contract ETHLiquidity_Test is CommonTest { 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 /// 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 @@ -157,24 +137,4 @@ contract ETHLiquidity_Test is CommonTest { assertEq(address(ethLiquidity).balance, STARTING_LIQUIDITY_BALANCE); 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); - } } diff --git a/packages/contracts-bedrock/test/L2/L1Block.t.sol b/packages/contracts-bedrock/test/L2/L1Block.t.sol index d3e3b7d02e49a..4e9b0cb2f6f46 100644 --- a/packages/contracts-bedrock/test/L2/L1Block.t.sol +++ b/packages/contracts-bedrock/test/L2/L1Block.t.sol @@ -12,13 +12,29 @@ import "src/libraries/L1BlockErrors.sol"; contract L1BlockTest is CommonTest { address depositor; - event GasPayingTokenSet(address indexed token, uint8 indexed decimals, bytes32 name, bytes32 symbol); - /// @dev Sets up the test suite. function setUp() public virtual override { super.setUp(); 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 { @@ -164,50 +180,3 @@ contract L1BlockEcotone_Test is L1BlockTest { 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"); - } -} diff --git a/packages/contracts-bedrock/test/L2/L1BlockInterop.t.sol b/packages/contracts-bedrock/test/L2/L1BlockInterop.t.sol index 40dfa459e16d8..c569f42025f36 100644 --- a/packages/contracts-bedrock/test/L2/L1BlockInterop.t.sol +++ b/packages/contracts-bedrock/test/L2/L1BlockInterop.t.sol @@ -80,45 +80,6 @@ contract L1BlockInteropTest is CommonTest { 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. function testFuzz_setConfig_addDependency_succeeds(uint256 _chainId) public prankDepositor { vm.assume(_chainId != block.chainid); diff --git a/packages/contracts-bedrock/test/L2/L2CrossDomainMessenger.t.sol b/packages/contracts-bedrock/test/L2/L2CrossDomainMessenger.t.sol index ca1fd3c2d2d55..470c6d82d8599 100644 --- a/packages/contracts-bedrock/test/L2/L2CrossDomainMessenger.t.sol +++ b/packages/contracts-bedrock/test/L2/L2CrossDomainMessenger.t.sol @@ -16,7 +16,6 @@ import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol"; // Interfaces import { IL2CrossDomainMessenger } from "interfaces/L2/IL2CrossDomainMessenger.sol"; import { IL2ToL1MessagePasser } from "interfaces/L2/IL2ToL1MessagePasser.sol"; -import { IGasToken } from "src/libraries/GasPayingToken.sol"; contract L2CrossDomainMessenger_Test is CommonTest { /// @dev Receiver address for testing @@ -312,105 +311,4 @@ contract L2CrossDomainMessenger_Test is CommonTest { assertEq(l2CrossDomainMessenger.successfulMessages(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" - ); - } } diff --git a/packages/contracts-bedrock/test/L2/L2StandardBridge.t.sol b/packages/contracts-bedrock/test/L2/L2StandardBridge.t.sol index 70ccc5122e7d3..48d0f978d359b 100644 --- a/packages/contracts-bedrock/test/L2/L2StandardBridge.t.sol +++ b/packages/contracts-bedrock/test/L2/L2StandardBridge.t.sol @@ -20,7 +20,6 @@ import { ICrossDomainMessenger } from "interfaces/universal/ICrossDomainMessenge import { IStandardBridge } from "interfaces/universal/IStandardBridge.sol"; import { IL2ToL1MessagePasser } from "interfaces/L2/IL2ToL1MessagePasser.sol"; import { IL2StandardBridge } from "interfaces/L2/IL2StandardBridge.sol"; -import { IGasToken } from "src/libraries/GasPayingToken.sol"; contract L2StandardBridge_Test is CommonTest { using stdStorage for StdStorage; @@ -128,19 +127,6 @@ contract L2StandardBridge_Test is CommonTest { 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. function test_withdraw_insufficientValue_reverts() external { assertEq(address(l2ToL1MessagePasser).balance, 0); @@ -168,74 +154,6 @@ contract L2StandardBridge_Test is CommonTest { 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 /// successfully initiates a withdrawal. function test_withdraw_ether_succeeds() external { @@ -559,15 +477,6 @@ contract L2StandardBridge_Bridge_Test is CommonTest { 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. function testFuzz_bridgeETHTo_succeeds(uint256 _value, uint32 _minGasLimit, bytes calldata _extraData) external { uint256 nonce = l2CrossDomainMessenger.messageNonce(); @@ -604,20 +513,6 @@ contract L2StandardBridge_Bridge_Test is CommonTest { 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 { diff --git a/packages/contracts-bedrock/test/L2/SuperchainWETH.t.sol b/packages/contracts-bedrock/test/L2/SuperchainWETH.t.sol index bc59c76c116fc..e122e79794ae1 100644 --- a/packages/contracts-bedrock/test/L2/SuperchainWETH.t.sol +++ b/packages/contracts-bedrock/test/L2/SuperchainWETH.t.sol @@ -6,7 +6,7 @@ import { CommonTest } from "test/setup/CommonTest.sol"; // Libraries import { Predeploys } from "src/libraries/Predeploys.sol"; -import { NotCustomGasToken, Unauthorized, ZeroAddress } from "src/libraries/errors/CommonErrors.sol"; +import { Unauthorized, ZeroAddress } from "src/libraries/errors/CommonErrors.sol"; import { Preinstalls } from "src/libraries/Preinstalls.sol"; // Interfaces @@ -54,13 +54,12 @@ contract SuperchainWETH_Test is CommonTest { /// @notice Tests that the deposit function can be called on a non-custom gas token chain. /// @param _amount The amount of WETH to send. - function testFuzz_deposit_fromNonCustomGasTokenChain_succeeds(uint256 _amount) public { + function testFuzz_deposit_succeeds(uint256 _amount) public { // Assume _amount = bound(_amount, 0, type(uint248).max - 1); // Arrange vm.deal(alice, _amount); - _mockAndExpect(address(l1Block), abi.encodeCall(l1Block.isCustomGasToken, ()), abi.encode(false)); // Act vm.expectEmit(address(superchainWeth)); @@ -73,29 +72,9 @@ contract SuperchainWETH_Test is CommonTest { assertEq(superchainWeth.balanceOf(alice), _amount); } - /// @notice Tests that the deposit function reverts when called on a custom gas token chain. - /// @param _amount The amount of WETH to send. - function testFuzz_deposit_fromCustomGasTokenChain_fails(uint256 _amount) public { - // Assume - _amount = bound(_amount, 0, type(uint248).max - 1); - - // Arrange - vm.deal(address(alice), _amount); - _mockAndExpect(address(l1Block), abi.encodeCall(l1Block.isCustomGasToken, ()), abi.encode(true)); - - // Act - vm.prank(alice); - vm.expectRevert(NotCustomGasToken.selector); - superchainWeth.deposit{ value: _amount }(); - - // Assert - assertEq(alice.balance, _amount); - assertEq(superchainWeth.balanceOf(alice), 0); - } - /// @notice Tests that the withdraw function can be called on a non-custom gas token chain. /// @param _amount The amount of WETH to send. - function testFuzz_withdraw_fromNonCustomGasTokenChain_succeeds(uint256 _amount) public { + function testFuzz_withdraw_succeeds(uint256 _amount) public { // Assume _amount = bound(_amount, 0, type(uint248).max - 1); @@ -103,7 +82,6 @@ contract SuperchainWETH_Test is CommonTest { vm.deal(alice, _amount); vm.prank(alice); superchainWeth.deposit{ value: _amount }(); - _mockAndExpect(address(l1Block), abi.encodeCall(l1Block.isCustomGasToken, ()), abi.encode(false)); // Act vm.expectEmit(address(superchainWeth)); @@ -116,28 +94,6 @@ contract SuperchainWETH_Test is CommonTest { assertEq(superchainWeth.balanceOf(alice), 0); } - /// @notice Tests that the withdraw function reverts when called on a custom gas token chain. - /// @param _amount The amount of WETH to send. - function testFuzz_withdraw_fromCustomGasTokenChain_fails(uint256 _amount) public { - // Assume - _amount = bound(_amount, 0, type(uint248).max - 1); - - // Arrange - vm.deal(alice, _amount); - vm.prank(alice); - superchainWeth.deposit{ value: _amount }(); - _mockAndExpect(address(l1Block), abi.encodeCall(l1Block.isCustomGasToken, ()), abi.encode(true)); - - // Act - vm.prank(alice); - vm.expectRevert(NotCustomGasToken.selector); - superchainWeth.withdraw(_amount); - - // Assert - assertEq(alice.balance, 0); - assertEq(superchainWeth.balanceOf(alice), _amount); - } - /// @notice Tests the `crosschainMint` function reverts when the caller is not the `SuperchainTokenBridge`. function testFuzz_crosschainMint_callerNotBridge_reverts(address _caller, address _to, uint256 _amount) public { // Ensure the caller is not the bridge @@ -152,7 +108,7 @@ contract SuperchainWETH_Test is CommonTest { } /// @notice Tests the `crosschainMint` with non custom gas token succeeds and emits the `CrosschainMint` event. - function testFuzz_crosschainMint_fromBridgeNonCustomGasTokenChain_succeeds(address _to, uint256 _amount) public { + function testFuzz_crosschainMint_fromBridge_succeeds(address _to, uint256 _amount) public { // Ensure `_to` is not the zero address vm.assume(_to != ZERO_ADDRESS); _amount = bound(_amount, 0, type(uint248).max - 1); @@ -169,9 +125,6 @@ contract SuperchainWETH_Test is CommonTest { vm.expectEmit(address(superchainWeth)); emit CrosschainMint(_to, _amount, Predeploys.SUPERCHAIN_TOKEN_BRIDGE); - // Mock the `isCustomGasToken` function to return false - _mockAndExpect(address(l1Block), abi.encodeCall(l1Block.isCustomGasToken, ()), abi.encode(false)); - // Expect the call to the `mint` function in the `ETHLiquidity` contract vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(IETHLiquidity.mint, (_amount)), 1); @@ -185,39 +138,6 @@ contract SuperchainWETH_Test is CommonTest { assertEq(address(superchainWeth).balance, _amount); } - /// @notice Tests the `crosschainMint` with custom gas token succeeds and emits the `CrosschainMint` event. - function testFuzz_crosschainMint_fromBridgeCustomGasTokenChain_succeeds(address _to, uint256 _amount) public { - // Ensure `_to` is not the zero address - vm.assume(_to != ZERO_ADDRESS); - _amount = bound(_amount, 0, type(uint248).max - 1); - - // Get the balance of `_to` before the mint to compare later on the assertions - uint256 _toBalanceBefore = superchainWeth.balanceOf(_to); - - // Look for the emit of the `Transfer` event - vm.expectEmit(address(superchainWeth)); - emit Transfer(ZERO_ADDRESS, _to, _amount); - - // Look for the emit of the `CrosschainMint` event - vm.expectEmit(address(superchainWeth)); - emit CrosschainMint(_to, _amount, Predeploys.SUPERCHAIN_TOKEN_BRIDGE); - - // Mock the `isCustomGasToken` function to return false - _mockAndExpect(address(l1Block), abi.encodeCall(l1Block.isCustomGasToken, ()), abi.encode(true)); - - // Expect to not call the `mint` function in the `ETHLiquidity` contract - vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(IETHLiquidity.mint, (_amount)), 0); - - // Call the `mint` function with the bridge caller - vm.prank(Predeploys.SUPERCHAIN_TOKEN_BRIDGE); - superchainWeth.crosschainMint(_to, _amount); - - // Check the total supply and balance of `_to` after the mint were updated correctly - assertEq(superchainWeth.balanceOf(_to), _toBalanceBefore + _amount); - assertEq(superchainWeth.totalSupply(), 0); - assertEq(address(superchainWeth).balance, 0); - } - /// @notice Tests the `crosschainBurn` function reverts when the caller is not the `SuperchainTokenBridge`. function testFuzz_crosschainBurn_callerNotBridge_reverts(address _caller, address _from, uint256 _amount) public { // Ensure the caller is not the bridge @@ -233,7 +153,7 @@ contract SuperchainWETH_Test is CommonTest { /// @notice Tests the `crosschainBurn` with non custom gas token burns the amount and emits the `CrosschainBurn` /// event. - function testFuzz_crosschainBurn_fromBridgeNonCustomGasTokenChain_succeeds(address _from, uint256 _amount) public { + function testFuzz_crosschainBurn_succeeds(address _from, uint256 _amount) public { // Ensure `_from` is not the zero address vm.assume(_from != ZERO_ADDRESS); _amount = bound(_amount, 0, type(uint248).max - 1); @@ -255,9 +175,6 @@ contract SuperchainWETH_Test is CommonTest { vm.expectEmit(address(superchainWeth)); emit CrosschainBurn(_from, _amount, Predeploys.SUPERCHAIN_TOKEN_BRIDGE); - // Mock the `isCustomGasToken` function to return false - _mockAndExpect(address(l1Block), abi.encodeCall(l1Block.isCustomGasToken, ()), abi.encode(false)); - // Expect the call to the `burn` function in the `ETHLiquidity` contract vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(IETHLiquidity.burn, ()), 1); @@ -271,45 +188,6 @@ contract SuperchainWETH_Test is CommonTest { assertEq(address(superchainWeth).balance, 0); } - /// @notice Tests the `crosschainBurn` with custom gas token burns the amount and emits the `CrosschainBurn` - /// event. - function testFuzz_crosschainBurn_fromBridgeCustomGasTokenChain_succeeds(address _from, uint256 _amount) public { - // Ensure `_from` is not the zero address - vm.assume(_from != ZERO_ADDRESS); - _amount = bound(_amount, 0, type(uint248).max - 1); - - // Mock the `isCustomGasToken` function to return false - _mockAndExpect(address(l1Block), abi.encodeCall(l1Block.isCustomGasToken, ()), abi.encode(true)); - - // Mint some tokens to `_from` so then they can be burned - vm.prank(Predeploys.SUPERCHAIN_TOKEN_BRIDGE); - superchainWeth.crosschainMint(_from, _amount); - - // Get the total supply and balance of `_from` before the burn to compare later on the assertions - uint256 _totalSupplyBefore = superchainWeth.totalSupply(); - uint256 _fromBalanceBefore = superchainWeth.balanceOf(_from); - - // Look for the emit of the `Transfer` event - vm.expectEmit(address(superchainWeth)); - emit Transfer(_from, ZERO_ADDRESS, _amount); - - // Look for the emit of the `CrosschainBurn` event - vm.expectEmit(address(superchainWeth)); - emit CrosschainBurn(_from, _amount, Predeploys.SUPERCHAIN_TOKEN_BRIDGE); - - // Expect to not call the `burn` function in the `ETHLiquidity` contract - vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(IETHLiquidity.burn, ()), 0); - - // Call the `burn` function with the bridge caller - vm.prank(Predeploys.SUPERCHAIN_TOKEN_BRIDGE); - superchainWeth.crosschainBurn(_from, _amount); - - // Check the total supply and balance of `_from` after the burn were updated correctly - assertEq(superchainWeth.balanceOf(_from), _fromBalanceBefore - _amount); - assertEq(superchainWeth.totalSupply(), _totalSupplyBefore); - assertEq(address(superchainWeth).balance, 0); - } - /// @notice Tests that the `crosschainBurn` function reverts when called with insufficient balance. function testFuzz_crosschainBurn_insufficientBalance_fails(address _from, uint256 _amount) public { // Assume @@ -372,7 +250,7 @@ contract SuperchainWETH_Test is CommonTest { } /// @notice Test that the burn function reverts to protect against accidentally changing the visibility. - function testFuzz_calling_burnFuunction_reverts(address _caller, address _from, uint256 _amount) public { + function testFuzz_calling_burnFunction_reverts(address _caller, address _from, uint256 _amount) public { // Arrange // nosemgrep: sol-style-use-abi-encodecall bytes memory _calldata = abi.encodeWithSignature("burn(address,uint256)", _from, _amount); @@ -494,7 +372,7 @@ contract SuperchainWETH_Test is CommonTest { /// @notice Tests the `sendETH` function burns the sender ETH, sends the message, and emits the `SendETH` /// event. - function testFuzz_sendETH_fromNonCustomGasTokenChain_succeeds( + function testFuzz_sendETH_succeeds( address _sender, address _to, uint256 _amount, @@ -511,7 +389,6 @@ contract SuperchainWETH_Test is CommonTest { // Arrange vm.deal(_sender, _amount); - _mockAndExpect(address(l1Block), abi.encodeCall(l1Block.isCustomGasToken, ()), abi.encode(false)); // Get the total balance of `_sender` before the send to compare later on the assertions uint256 _senderBalanceBefore = _sender.balance; @@ -542,30 +419,6 @@ contract SuperchainWETH_Test is CommonTest { assertEq(_sender.balance, _senderBalanceBefore - _amount); } - /// @notice Tests the `sendETH` function reverts when called on a custom gas token chain. - function testFuzz_sendETH_fromCustomGasTokenChain_fails( - address _sender, - address _to, - uint256 _amount, - uint256 _chainId - ) - external - { - // Assume - vm.assume(_sender != ZERO_ADDRESS); - vm.assume(_to != ZERO_ADDRESS); - _amount = bound(_amount, 0, type(uint248).max - 1); - - // Arrange - vm.deal(_sender, _amount); - _mockAndExpect(address(l1Block), abi.encodeCall(l1Block.isCustomGasToken, ()), abi.encode(true)); - - // Call the `sendETH` function - vm.prank(_sender); - vm.expectRevert(NotCustomGasToken.selector); - superchainWeth.sendETH{ value: _amount }(_to, _chainId); - } - /// @notice Tests the `relayETH` function reverts when the caller is not the L2ToL2CrossDomainMessenger. function testFuzz_relayETH_notMessenger_reverts(address _caller, address _to, uint256 _amount) public { // Ensure the caller is not the messenger @@ -606,51 +459,6 @@ contract SuperchainWETH_Test is CommonTest { superchainWeth.relayETH(_crossDomainMessageSender, _to, _amount); } - /// @notice Tests the `relayETH` function succeeds and sends SuperchainWETH to the recipient on a custom gas token - /// chain. - function testFuzz_relayETH_fromCustomGasTokenChain_succeeds( - address _from, - address _to, - uint256 _amount, - uint256 _source - ) - public - { - // Assume - vm.assume(_to != ZERO_ADDRESS); - _amount = bound(_amount, 0, type(uint248).max - 1); - - // Get the balance of `_to` before the mint to compare later on the assertions - uint256 _toBalanceBefore = superchainWeth.balanceOf(_to); - - // Look for the emit of the `Transfer` event - vm.expectEmit(address(superchainWeth)); - emit Transfer(ZERO_ADDRESS, _to, _amount); - - // Look for the emit of the `RelayETH` event - vm.expectEmit(address(superchainWeth)); - emit RelayETH(_from, _to, _amount, _source); - - // Arrange - _mockAndExpect(address(l1Block), abi.encodeCall(l1Block.isCustomGasToken, ()), abi.encode(true)); - _mockAndExpect( - Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER, - abi.encodeCall(IL2ToL2CrossDomainMessenger.crossDomainMessageContext, ()), - abi.encode(address(superchainWeth), _source) - ); - // Expect to not call the `mint` function in the `ETHLiquidity` contract - vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(IETHLiquidity.mint, (_amount)), 0); - - // Act - vm.prank(Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER); - superchainWeth.relayETH(_from, _to, _amount); - - // Check the total supply and balance of `_to` after the mint were updated correctly - assertEq(superchainWeth.balanceOf(_to), _toBalanceBefore + _amount); - assertEq(superchainWeth.totalSupply(), 0); - assertEq(address(superchainWeth).balance, 0); - } - /// @notice Tests the `relayETH` function relays the proper amount of ETH and emits the `RelayETH` event. function testFuzz_relayETH_succeeds(address _from, address _to, uint256 _amount, uint256 _source) public { // Assume @@ -661,7 +469,6 @@ contract SuperchainWETH_Test is CommonTest { // Arrange vm.deal(address(superchainWeth), _amount); vm.deal(Predeploys.ETH_LIQUIDITY, _amount); - _mockAndExpect(address(l1Block), abi.encodeCall(l1Block.isCustomGasToken, ()), abi.encode(false)); _mockAndExpect( Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER, abi.encodeCall(IL2ToL2CrossDomainMessenger.crossDomainMessageContext, ()), diff --git a/packages/contracts-bedrock/test/L2/WETH.t.sol b/packages/contracts-bedrock/test/L2/WETH.t.sol index 84bb138d74fba..0a4985ca874ff 100644 --- a/packages/contracts-bedrock/test/L2/WETH.t.sol +++ b/packages/contracts-bedrock/test/L2/WETH.t.sol @@ -26,13 +26,11 @@ contract WETH_Test is CommonTest { /// @dev Tests that the name function returns the correct value. function test_name_ether_succeeds() external view { - assertFalse(l1Block.isCustomGasToken()); assertEq("Wrapped Ether", weth.name()); } /// @dev Tests that the symbol function returns the correct value. function test_symbol_ether_succeeds() external view { - assertFalse(l1Block.isCustomGasToken()); assertEq("WETH", weth.symbol()); } } diff --git a/packages/contracts-bedrock/test/setup/CommonTest.sol b/packages/contracts-bedrock/test/setup/CommonTest.sol index a69a33719d1ca..04763ad1d3d23 100644 --- a/packages/contracts-bedrock/test/setup/CommonTest.sol +++ b/packages/contracts-bedrock/test/setup/CommonTest.sol @@ -16,7 +16,6 @@ import { DeployUtils } from "scripts/libraries/DeployUtils.sol"; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; // Libraries -import { Constants } from "src/libraries/Constants.sol"; import { console } from "forge-std/console.sol"; // Interfaces @@ -34,7 +33,6 @@ contract CommonTest is Test, Setup, Events { FFIInterface constant ffi = FFIInterface(address(uint160(uint256(keccak256(abi.encode("optimism.ffi")))))); bool useAltDAOverride; - address customGasToken; bool useInteropOverride; /// @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 { if (useAltDAOverride) { deploy.cfg().setUseAltDA(true); } - if (customGasToken != address(0)) { - deploy.cfg().setUseCustomGasToken(customGasToken); - } if (useInteropOverride) { deploy.cfg().setUseInterop(true); } @@ -77,7 +72,7 @@ contract CommonTest is Test, Setup, Events { if (isForkTest()) { // Skip any test suite which uses a nonstandard configuration. - if (useAltDAOverride || customGasToken != address(0) || useInteropOverride) { + if (useAltDAOverride || useInteropOverride) { vm.skip(true); } } else { @@ -192,13 +187,6 @@ contract CommonTest is Test, Setup, Events { 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 function enableInterop() public { _checkNotDeployed("interop"); diff --git a/packages/contracts-bedrock/test/setup/DeployVariations.t.sol b/packages/contracts-bedrock/test/setup/DeployVariations.t.sol index c0a6293b25f08..6e08a10b1968d 100644 --- a/packages/contracts-bedrock/test/setup/DeployVariations.t.sol +++ b/packages/contracts-bedrock/test/setup/DeployVariations.t.sol @@ -3,9 +3,6 @@ pragma solidity 0.8.15; // Testing utilities import { CommonTest } from "test/setup/CommonTest.sol"; -import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; - -error CustomGasTokenNotSupported(); contract DeployVariations_Test is CommonTest { function setUp() public override { @@ -14,34 +11,22 @@ contract DeployVariations_Test is CommonTest { } // Enable features which should be possible to enable or disable regardless of other options. - function enableAddOns(bool _enableCGT, bool _enableAltDa) public { - if (_enableCGT) { - if (true) revert CustomGasTokenNotSupported(); - - ERC20 token = new ERC20("Silly", "SIL"); - super.enableCustomGasToken(address(token)); - } + function enableAddOns(bool _enableAltDa) public { if (_enableAltDa) { super.enableAltDA(); } } - /// @dev It should be possible to enable Fault Proofs with any mix of CGT and Alt-DA. - function testFuzz_enableFaultProofs_succeeds(bool _enableCGT, bool _enableAltDa) public virtual { - // We don't support CGT yet, so we need to set it to false - _enableCGT = false; - - enableAddOns(_enableCGT, _enableAltDa); + /// @dev It should be possible to enable Fault Proofs with Alt-DA. + function testFuzz_enableFaultProofs_succeeds(bool _enableAltDa) public virtual { + enableAddOns(_enableAltDa); super.setUp(); } - /// @dev It should be possible to enable Fault Proofs and Interop with any mix of CGT and Alt-DA. - function test_enableInteropAndFaultProofs_succeeds(bool _enableCGT, bool _enableAltDa) public virtual { - // We don't support CGT yet, so we need to set it to false - _enableCGT = false; - - enableAddOns(_enableCGT, _enableAltDa); + /// @dev It should be possible to enable Fault Proofs and Interop with Alt-DA. + function test_enableInteropAndFaultProofs_succeeds(bool _enableAltDa) public virtual { + enableAddOns(_enableAltDa); super.enableInterop(); super.setUp(); diff --git a/packages/contracts-bedrock/test/universal/StandardBridge.t.sol b/packages/contracts-bedrock/test/universal/StandardBridge.t.sol index be7f8a51107c7..d268e649ddab0 100644 --- a/packages/contracts-bedrock/test/universal/StandardBridge.t.sol +++ b/packages/contracts-bedrock/test/universal/StandardBridge.t.sol @@ -5,7 +5,6 @@ import { StandardBridge } from "src/universal/StandardBridge.sol"; import { CommonTest } from "test/setup/CommonTest.sol"; import { OptimismMintableERC20, ILegacyMintableERC20 } from "src/universal/OptimismMintableERC20.sol"; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; -import { Constants } from "src/libraries/Constants.sol"; /// @title StandardBridgeTester /// @notice Simple wrapper around the StandardBridge contract that exposes @@ -21,10 +20,6 @@ contract StandardBridgeTester is StandardBridge { return _isCorrectTokenPair(_mintableToken, _otherToken); } - function gasPayingToken() internal pure override returns (address, uint8) { - return (Constants.ETHER, 18); - } - receive() external payable override { } }