Skip to content

Commit bf0a5db

Browse files
tynessamlaf
authored andcommitted
contracts-bedrock: remove GCT code (ethereum-optimism#13921)
* contracts-bedrock: remove GCT code This commit removes the custom gas token code from the L2 contracts. The interop contracts were tightly integrated into this code, so the diff is quite large. We cannot remove the getters from the `L1Block` contract because chains did a genesis with `WETH` that calls out to the `L1Block` contract. `WETH` is not proxied, so we cannot modify the bytecode without an irregular state transition. Just going to leave the functions on `L1Block` for simplicity. Both the messenger and the bridge have the references to CGT removed. * l1block: test coverage * contracts-bedrock: more cleanup * compiler error * gas-snapshot * contracts-bedrock: remove dead imports * ctb: unused imports * snapshots: update * interfaces * ctb: fix
1 parent de3865c commit bf0a5db

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+142
-996
lines changed

packages/contracts-bedrock/interfaces/L1/IOptimismPortalInterop.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { ISuperchainConfig } from "interfaces/L1/ISuperchainConfig.sol";
1010
import { ConfigType } from "interfaces/L2/IL1BlockInterop.sol";
1111

1212
interface IOptimismPortalInterop {
13-
error CustomGasTokenNotSupported();
1413
error AlreadyFinalized();
1514
error BadTarget();
1615
error Blacklisted();

packages/contracts-bedrock/interfaces/L1/ISystemConfig.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ pragma solidity ^0.8.0;
33

44
import { IResourceMetering } from "interfaces/L1/IResourceMetering.sol";
55

6-
/// @notice This interface corresponds to the Custom Gas Token version of the SystemConfig contract.
76
interface ISystemConfig {
87
enum UpdateType {
98
BATCHER,

packages/contracts-bedrock/interfaces/L2/IETHLiquidity.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
pragma solidity ^0.8.0;
33

44
interface IETHLiquidity {
5-
error NotCustomGasToken();
65
error Unauthorized();
76

87
event LiquidityBurned(address indexed caller, uint256 value);

packages/contracts-bedrock/interfaces/L2/IL1Block.sol

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,21 @@
22
pragma solidity ^0.8.0;
33

44
interface IL1Block {
5-
error NotDepositor();
6-
7-
event GasPayingTokenSet(address indexed token, uint8 indexed decimals, bytes32 name, bytes32 symbol);
8-
95
function DEPOSITOR_ACCOUNT() external pure returns (address addr_);
106
function baseFeeScalar() external view returns (uint32);
117
function basefee() external view returns (uint256);
128
function batcherHash() external view returns (bytes32);
139
function blobBaseFee() external view returns (uint256);
1410
function blobBaseFeeScalar() external view returns (uint32);
15-
function gasPayingToken() external view returns (address addr_, uint8 decimals_);
16-
function gasPayingTokenName() external view returns (string memory name_);
17-
function gasPayingTokenSymbol() external view returns (string memory symbol_);
11+
function gasPayingToken() external pure returns (address addr_, uint8 decimals_);
12+
function gasPayingTokenName() external pure returns (string memory name_);
13+
function gasPayingTokenSymbol() external pure returns (string memory symbol_);
1814
function hash() external view returns (bytes32);
19-
function isCustomGasToken() external view returns (bool);
15+
function isCustomGasToken() external pure returns (bool is_);
2016
function l1FeeOverhead() external view returns (uint256);
2117
function l1FeeScalar() external view returns (uint256);
2218
function number() external view returns (uint64);
2319
function sequenceNumber() external view returns (uint64);
24-
function setGasPayingToken(address _token, uint8 _decimals, bytes32 _name, bytes32 _symbol) external;
2520
function setL1BlockValues(
2621
uint64 _number,
2722
uint64 _timestamp,

packages/contracts-bedrock/interfaces/L2/IL1BlockInterop.sol

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
pragma solidity ^0.8.0;
33

44
enum ConfigType {
5-
SET_GAS_PAYING_TOKEN,
65
ADD_DEPENDENCY,
76
REMOVE_DEPENDENCY
87
}
@@ -17,7 +16,6 @@ interface IL1BlockInterop {
1716

1817
event DependencyAdded(uint256 indexed chainId);
1918
event DependencyRemoved(uint256 indexed chainId);
20-
event GasPayingTokenSet(address indexed token, uint8 indexed decimals, bytes32 name, bytes32 symbol);
2119

2220
function DEPOSITOR_ACCOUNT() external pure returns (address addr_);
2321
function baseFeeScalar() external view returns (uint32);
@@ -27,19 +25,18 @@ interface IL1BlockInterop {
2725
function blobBaseFeeScalar() external view returns (uint32);
2826
function dependencySetSize() external view returns (uint8);
2927
function depositsComplete() external;
30-
function gasPayingToken() external view returns (address addr_, uint8 decimals_);
31-
function gasPayingTokenName() external view returns (string memory name_);
32-
function gasPayingTokenSymbol() external view returns (string memory symbol_);
28+
function gasPayingToken() external pure returns (address addr_, uint8 decimals_);
29+
function gasPayingTokenName() external pure returns (string memory name_);
30+
function gasPayingTokenSymbol() external pure returns (string memory symbol_);
3331
function hash() external view returns (bytes32);
34-
function isCustomGasToken() external view returns (bool);
32+
function isCustomGasToken() external pure returns (bool is_);
3533
function isDeposit() external view returns (bool isDeposit_);
3634
function isInDependencySet(uint256 _chainId) external view returns (bool);
3735
function l1FeeOverhead() external view returns (uint256);
3836
function l1FeeScalar() external view returns (uint256);
3937
function number() external view returns (uint64);
4038
function sequenceNumber() external view returns (uint64);
4139
function setConfig(ConfigType _type, bytes memory _value) external;
42-
function setGasPayingToken(address _token, uint8 _decimals, bytes32 _name, bytes32 _symbol) external;
4340
function setL1BlockValues(
4441
uint64 _number,
4542
uint64 _timestamp,

packages/contracts-bedrock/interfaces/L2/ISuperchainWETH.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { ISemver } from "interfaces/universal/ISemver.sol";
77

88
interface ISuperchainWETH is IWETH98, IERC7802, ISemver {
99
error Unauthorized();
10-
error NotCustomGasToken();
1110
error InvalidCrossDomainSender();
1211
error ZeroAddress();
1312

@@ -16,7 +15,7 @@ interface ISuperchainWETH is IWETH98, IERC7802, ISemver {
1615
event RelayETH(address indexed from, address indexed to, uint256 amount, uint256 source);
1716

1817
function balanceOf(address src) external view returns (uint256);
19-
function withdraw(uint256 _amount) external;
18+
function withdraw(uint256 wad) external;
2019
function supportsInterface(bytes4 _interfaceId) external view returns (bool);
2120
function sendETH(address _to, uint256 _chainId) external payable returns (bytes32 msgHash_);
2221
function relayETH(address _from, address _to, uint256 _amount) external;

packages/contracts-bedrock/scripts/deploy/Deploy.s.sol

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,6 @@ contract Deploy is Deployer {
210210
);
211211
vm.stopPrank();
212212

213-
if (cfg.useCustomGasToken()) {
214-
// Reset the systemconfig then reinitialize it with the custom gas token
215-
resetInitializedProxy("SystemConfig");
216-
initializeSystemConfig();
217-
}
218-
219213
if (cfg.useAltDA()) {
220214
bytes32 typeHash = keccak256(bytes(cfg.daCommitmentType()));
221215
bytes32 keccakHash = keccak256(bytes("KeccakCommitment"));
@@ -505,11 +499,6 @@ contract Deploy is Deployer {
505499

506500
bytes32 batcherHash = bytes32(uint256(uint160(cfg.batchSenderAddress())));
507501

508-
address customGasTokenAddress = Constants.ETHER;
509-
if (cfg.useCustomGasToken()) {
510-
customGasTokenAddress = cfg.customGasTokenAddress();
511-
}
512-
513502
IProxyAdmin proxyAdmin = IProxyAdmin(payable(artifacts.mustGetAddress("ProxyAdmin")));
514503
proxyAdmin.upgradeAndCall({
515504
_proxy: payable(systemConfigProxy),

packages/contracts-bedrock/scripts/deploy/DeployConfig.s.sol

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ contract DeployConfig is Script {
8585
uint256 public daBondSize;
8686
uint256 public daResolverRefundPercentage;
8787

88-
bool public useCustomGasToken;
89-
address public customGasTokenAddress;
90-
9188
bool public useInterop;
9289
bool public useUpgradedFork;
9390

@@ -171,9 +168,6 @@ contract DeployConfig is Script {
171168
daBondSize = _readOr(_json, "$.daBondSize", 1000000000);
172169
daResolverRefundPercentage = _readOr(_json, "$.daResolverRefundPercentage", 0);
173170

174-
useCustomGasToken = _readOr(_json, "$.useCustomGasToken", false);
175-
customGasTokenAddress = _readOr(_json, "$.customGasTokenAddress", address(0));
176-
177171
useInterop = _readOr(_json, "$.useInterop", false);
178172
useUpgradedFork;
179173
}
@@ -232,12 +226,6 @@ contract DeployConfig is Script {
232226
fundDevAccounts = _fundDevAccounts;
233227
}
234228

235-
/// @notice Allow the `useCustomGasToken` config to be overridden in testing environments
236-
function setUseCustomGasToken(address _token) public {
237-
useCustomGasToken = true;
238-
customGasTokenAddress = _token;
239-
}
240-
241229
/// @notice Allow the `useUpgradedFork` config to be overridden in testing environments
242230
/// @dev When true, the forked system WILL be upgraded in setUp().
243231
/// When false, the forked system WILL NOT be upgraded in setUp().
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
GasBenchMark_L1BlockInterop_DepositsComplete:test_depositsComplete_benchmark() (gas: 7589)
2-
GasBenchMark_L1BlockInterop_DepositsComplete_Warm:test_depositsComplete_benchmark() (gas: 5589)
3-
GasBenchMark_L1BlockInterop_SetValuesInterop:test_setL1BlockValuesInterop_benchmark() (gas: 175722)
1+
GasBenchMark_L1BlockInterop_DepositsComplete:test_depositsComplete_benchmark() (gas: 7567)
2+
GasBenchMark_L1BlockInterop_DepositsComplete_Warm:test_depositsComplete_benchmark() (gas: 5567)
3+
GasBenchMark_L1BlockInterop_SetValuesInterop:test_setL1BlockValuesInterop_benchmark() (gas: 175700)
44
GasBenchMark_L1BlockInterop_SetValuesInterop_Warm:test_setL1BlockValuesInterop_benchmark() (gas: 5144)
5-
GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (gas: 158553)
6-
GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7619)
7-
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 356487)
8-
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2954716)
9-
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 551627)
10-
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4063775)
11-
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 450267)
12-
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3496188)
13-
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 59798)
5+
GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (gas: 158487)
6+
GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7597)
7+
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 356475)
8+
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2954682)
9+
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 551585)
10+
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4063778)
11+
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 450277)
12+
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3496176)
13+
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 59843)

packages/contracts-bedrock/snapshots/abi/ETHLiquidity.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@
7070
"name": "LiquidityMinted",
7171
"type": "event"
7272
},
73-
{
74-
"inputs": [],
75-
"name": "NotCustomGasToken",
76-
"type": "error"
77-
},
7873
{
7974
"inputs": [],
8075
"name": "Unauthorized",

0 commit comments

Comments
 (0)