Skip to content

Commit

Permalink
feat: remove enableLegacyContracts (#13562)
Browse files Browse the repository at this point in the history
* feat: remove enableLegacyContracts

* feat: remove setUseFaultProofs

* feat: Remove useFaultProofs branch in Deploy._run()

* gas snapshot

* feat: remove useFaultProofs
  • Loading branch information
maurelian authored Jan 3, 2025
1 parent e0a3455 commit dd7f0fd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 35 deletions.
14 changes: 6 additions & 8 deletions packages/contracts-bedrock/scripts/deploy/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions packages/contracts-bedrock/scripts/deploy/DeployConfig.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions packages/contracts-bedrock/snapshots/.gas-snapshot
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
17 changes: 1 addition & 16 deletions packages/contracts-bedrock/test/setup/CommonTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
Expand All @@ -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 {
Expand Down Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion packages/contracts-bedrock/test/vendor/Initializable.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dd7f0fd

Please sign in to comment.