forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add a test to simplify deploy script testing (ethereum-optimism…
…#12235) * feat: Add a test to simplify deploy script testing * fix: lint * feat: Add clarifying comments to DeployVariations_Test
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
packages/contracts-bedrock/test/setup/DeployVariations.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.15; | ||
|
||
// Testing utilities | ||
import { CommonTest } from "test/setup/CommonTest.sol"; | ||
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
|
||
contract DeployVariations_Test is CommonTest { | ||
function setUp() public override { | ||
// Prevent calling the base CommonTest.setUp() function, as we will run it within the test functions | ||
// after setting the feature flags | ||
} | ||
|
||
// Enable features which should be possible to enable or disable regardless of other options. | ||
function enableAddOns(bool _enableCGT, bool _enableAltDa) public { | ||
if (_enableCGT) { | ||
ERC20 token = new ERC20("Silly", "SIL"); | ||
super.enableCustomGasToken(address(token)); | ||
} | ||
if (_enableAltDa) { | ||
super.enableAltDA(); | ||
} | ||
} | ||
|
||
/// @dev It should be possible to enable Fault Proofs with any mix of CGT and Alt-DA. | ||
function testFuzz_enableFaultProofs(bool _enableCGT, bool _enableAltDa) public virtual { | ||
enableAddOns(_enableCGT, _enableAltDa); | ||
super.enableFaultProofs(); | ||
super.setUp(); | ||
} | ||
|
||
/// @dev It should be possible to enable Fault Proofs and Interop with any mix of CGT and Alt-DA. | ||
function test_enableInteropAndFaultProofs(bool _enableCGT, bool _enableAltDa) public virtual { | ||
enableAddOns(_enableCGT, _enableAltDa); | ||
super.enableInterop(); | ||
super.enableFaultProofs(); | ||
super.setUp(); | ||
} | ||
} |