From dd7f0fd2fa8b464f93b3963642666d888d6d7a98 Mon Sep 17 00:00:00 2001 From: Maurelian Date: Fri, 3 Jan 2025 15:06:20 -0500 Subject: [PATCH] feat: remove enableLegacyContracts (#13562) * feat: remove enableLegacyContracts * feat: remove setUseFaultProofs * feat: Remove useFaultProofs branch in Deploy._run() * gas snapshot * feat: remove useFaultProofs --- .../scripts/deploy/Deploy.s.sol | 14 ++++++-------- .../scripts/deploy/DeployConfig.s.sol | 7 ------- .../contracts-bedrock/snapshots/.gas-snapshot | 6 +++--- .../contracts-bedrock/test/setup/CommonTest.sol | 17 +---------------- .../test/vendor/Initializable.t.sol | 1 - 5 files changed, 10 insertions(+), 35 deletions(-) diff --git a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol index bd26fd6f1ead..6a7519263985 100644 --- a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol @@ -207,14 +207,12 @@ contract Deploy is Deployer { // Deploy Current OPChain Contracts deployOpChain(); - // Apply modifications for non-standard configurations not supported by the OPCM deployment - if (cfg.useFaultProofs()) { - vm.startPrank(ISuperchainConfig(mustGetAddress("SuperchainConfigProxy")).guardian()); - IOptimismPortal2(mustGetAddress("OptimismPortalProxy")).setRespectedGameType( - GameType.wrap(uint32(cfg.respectedGameType())) - ); - vm.stopPrank(); - } + // Set the respected game type according to the deploy config + vm.startPrank(ISuperchainConfig(mustGetAddress("SuperchainConfigProxy")).guardian()); + IOptimismPortal2(mustGetAddress("OptimismPortalProxy")).setRespectedGameType( + GameType.wrap(uint32(cfg.respectedGameType())) + ); + vm.stopPrank(); if (cfg.useCustomGasToken()) { // Reset the systemconfig then reinitialize it with the custom gas token diff --git a/packages/contracts-bedrock/scripts/deploy/DeployConfig.s.sol b/packages/contracts-bedrock/scripts/deploy/DeployConfig.s.sol index 0eed85d9511c..cf8e4d38739b 100644 --- a/packages/contracts-bedrock/scripts/deploy/DeployConfig.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/DeployConfig.s.sol @@ -78,7 +78,6 @@ contract DeployConfig is Script { uint256 public proofMaturityDelaySeconds; uint256 public disputeGameFinalityDelaySeconds; uint256 public respectedGameType; - bool public useFaultProofs; bool public useAltDA; string public daCommitmentType; uint256 public daChallengeWindow; @@ -148,7 +147,6 @@ contract DeployConfig is Script { requiredProtocolVersion = stdJson.readUint(_json, "$.requiredProtocolVersion"); recommendedProtocolVersion = stdJson.readUint(_json, "$.recommendedProtocolVersion"); - useFaultProofs = _readOr(_json, "$.useFaultProofs", false); proofMaturityDelaySeconds = _readOr(_json, "$.proofMaturityDelaySeconds", 0); disputeGameFinalityDelaySeconds = _readOr(_json, "$.disputeGameFinalityDelaySeconds", 0); respectedGameType = _readOr(_json, "$.respectedGameType", 0); @@ -222,11 +220,6 @@ contract DeployConfig is Script { useAltDA = _useAltDA; } - /// @notice Allow the `useFaultProofs` config to be overridden in testing environments - function setUseFaultProofs(bool _useFaultProofs) public { - useFaultProofs = _useFaultProofs; - } - /// @notice Allow the `useInterop` config to be overridden in testing environments function setUseInterop(bool _useInterop) public { useInterop = _useInterop; diff --git a/packages/contracts-bedrock/snapshots/.gas-snapshot b/packages/contracts-bedrock/snapshots/.gas-snapshot index f22930eef922..08785045bb50 100644 --- a/packages/contracts-bedrock/snapshots/.gas-snapshot +++ b/packages/contracts-bedrock/snapshots/.gas-snapshot @@ -1,10 +1,10 @@ GasBenchMark_L1BlockInterop_DepositsComplete:test_depositsComplete_benchmark() (gas: 7567) GasBenchMark_L1BlockInterop_DepositsComplete_Warm:test_depositsComplete_benchmark() (gas: 5567) -GasBenchMark_L1BlockInterop_SetValuesInterop:test_setL1BlockValuesInterop_benchmark() (gas: 175722) -GasBenchMark_L1BlockInterop_SetValuesInterop_Warm:test_setL1BlockValuesInterop_benchmark() (gas: 5144) +GasBenchMark_L1BlockInterop_SetValuesInterop:test_setL1BlockValuesInterop_benchmark() (gas: 175677) +GasBenchMark_L1BlockInterop_SetValuesInterop_Warm:test_setL1BlockValuesInterop_benchmark() (gas: 5099) GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (gas: 158531) GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7597) -GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369235) +GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369280) GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967442) GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 564429) GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4076577) diff --git a/packages/contracts-bedrock/test/setup/CommonTest.sol b/packages/contracts-bedrock/test/setup/CommonTest.sol index f99f975dc27d..aea7c629b695 100644 --- a/packages/contracts-bedrock/test/setup/CommonTest.sol +++ b/packages/contracts-bedrock/test/setup/CommonTest.sol @@ -34,7 +34,6 @@ contract CommonTest is Test, Setup, Events { FFIInterface constant ffi = FFIInterface(address(uint160(uint256(keccak256(abi.encode("optimism.ffi")))))); bool useAltDAOverride; - bool useLegacyContracts; address customGasToken; bool useInteropOverride; @@ -60,10 +59,6 @@ contract CommonTest is Test, Setup, Events { if (useAltDAOverride) { deploy.cfg().setUseAltDA(true); } - // We default to fault proofs unless explicitly disabled by useLegacyContracts - if (!useLegacyContracts) { - deploy.cfg().setUseFaultProofs(true); - } if (customGasToken != address(0)) { deploy.cfg().setUseCustomGasToken(customGasToken); } @@ -73,7 +68,7 @@ contract CommonTest is Test, Setup, Events { if (isForkTest()) { // Skip any test suite which uses a nonstandard configuration. - if (useAltDAOverride || useLegacyContracts || customGasToken != address(0) || useInteropOverride) { + if (useAltDAOverride || customGasToken != address(0) || useInteropOverride) { vm.skip(true); } } else { @@ -171,16 +166,6 @@ contract CommonTest is Test, Setup, Events { emit TransactionDeposited(_from, _to, 0, abi.encodePacked(_mint, _value, _gasLimit, _isCreation, _data)); } - function enableLegacyContracts() public { - // Check if the system has already been deployed, based off of the heuristic that alice and bob have not been - // set by the `setUp` function yet. - if (!(alice == address(0) && bob == address(0))) { - revert("CommonTest: Cannot enable fault proofs after deployment. Consider overriding `setUp`."); - } - - useLegacyContracts = true; - } - function enableAltDA() public { // Check if the system has already been deployed, based off of the heuristic that alice and bob have not been // set by the `setUp` function yet. diff --git a/packages/contracts-bedrock/test/vendor/Initializable.t.sol b/packages/contracts-bedrock/test/vendor/Initializable.t.sol index bbe1f38fbf72..d8e06d29d602 100644 --- a/packages/contracts-bedrock/test/vendor/Initializable.t.sol +++ b/packages/contracts-bedrock/test/vendor/Initializable.t.sol @@ -44,7 +44,6 @@ contract Initializer_Test is CommonTest { function setUp() public override { super.enableAltDA(); - super.enableLegacyContracts(); super.setUp(); // Initialize the `contracts` array with the addresses of the contracts to test, the