Commit b29e0035 authored by Mark Tyneway's avatar Mark Tyneway

contracts-bedrock: fix setup chain in tests

parent a2db6cad
......@@ -50,7 +50,7 @@ contract CommonTest is Test {
FFIInterface ffi;
function _setUp() public {
function setUp() public virtual {
// Give alice and bob some ETH
vm.deal(alice, 1 << 16);
vm.deal(bob, 1 << 16);
......@@ -117,9 +117,8 @@ contract L2OutputOracle_Initializer is CommonTest {
vm.warp(oracle.computeL2Timestamp(_nextBlockNumber) + 1);
}
function setUp() public virtual {
_setUp();
function setUp() virtual override public {
super.setUp();
// By default the first block has timestamp and number zero, which will cause underflows in the
// tests, so we'll move forward to these block values.
initL1Time = startingTimestamp + 1;
......@@ -163,7 +162,7 @@ contract Portal_Initializer is L2OutputOracle_Initializer {
);
function setUp() public virtual override {
L2OutputOracle_Initializer.setUp();
super.setUp();
opImpl = new OptimismPortal(oracle, 7 days);
Proxy proxy = new Proxy(multisig);
......
......@@ -18,7 +18,8 @@ contract XDomainSetter is CrossDomainOwnable {
contract CrossDomainOwnable_Test is CommonTest {
XDomainSetter setter;
function setUp() external {
function setUp() override public {
super.setUp();
setter = new XDomainSetter();
}
......
......@@ -7,7 +7,7 @@ import { DeployerWhitelist } from "../legacy/DeployerWhitelist.sol";
contract DeployerWhitelist_Test is CommonTest {
DeployerWhitelist list;
function setUp() external {
function setUp() virtual override public {
list = new DeployerWhitelist();
}
......
......@@ -6,10 +6,6 @@ import { Types } from "../libraries/Types.sol";
import { Encoding } from "../libraries/Encoding.sol";
contract Encoding_Test is CommonTest {
function setUp() external {
_setUp();
}
function testFuzz_nonceVersioning_succeeds(uint240 _nonce, uint16 _version) external {
(uint240 nonce, uint16 version) = Encoding.decodeVersionedNonce(
Encoding.encodeVersionedNonce(_nonce, _version)
......
......@@ -25,7 +25,8 @@ contract GasPriceOracle_Test is CommonTest {
uint256 constant l1FeeOverhead = 310;
uint256 constant l1FeeScalar = 10;
function setUp() external {
function setUp() virtual override public {
super.setUp();
// place the L1Block contract at the predeploy address
vm.etch(Predeploys.L1_BLOCK_ATTRIBUTES, address(new L1Block()).code);
......
......@@ -9,7 +9,8 @@ contract GovernanceToken_Test is CommonTest {
address constant rando = address(0x5678);
GovernanceToken internal gov;
function setUp() external {
function setUp() virtual override public {
super.setUp();
vm.prank(owner);
gov = new GovernanceToken();
}
......
......@@ -7,10 +7,6 @@ import { Hashing } from "../libraries/Hashing.sol";
import { Encoding } from "../libraries/Encoding.sol";
contract Hashing_hashDepositSource_Test is CommonTest {
function setUp() external {
_setUp();
}
/**
* @notice Tests that hashDepositSource returns the correct hash in a simple case.
*/
......@@ -26,10 +22,6 @@ contract Hashing_hashDepositSource_Test is CommonTest {
}
contract Hashing_hashCrossDomainMessage_Test is CommonTest {
function setUp() external {
_setUp();
}
/**
* @notice Tests that hashCrossDomainMessage returns the correct hash in a simple case.
*/
......@@ -54,10 +46,6 @@ contract Hashing_hashCrossDomainMessage_Test is CommonTest {
}
contract Hashing_hashWithdrawal_Test is CommonTest {
function setUp() external {
_setUp();
}
/**
* @notice Tests that hashWithdrawal returns the correct hash in a simple case.
*/
......@@ -79,10 +67,6 @@ contract Hashing_hashWithdrawal_Test is CommonTest {
}
contract Hashing_hashOutputRootProof_Test is CommonTest {
function setUp() external {
_setUp();
}
/**
* @notice Tests that hashOutputRootProof returns the correct hash in a simple case.
*/
......@@ -112,10 +96,6 @@ contract Hashing_hashOutputRootProof_Test is CommonTest {
}
contract Hashing_hashDepositTransaction_Test is CommonTest {
function setUp() external {
_setUp();
}
/**
* @notice Tests that hashDepositTransaction returns the correct hash in a simple case.
*/
......
......@@ -9,7 +9,8 @@ contract L1BlockTest is CommonTest {
address depositor;
bytes32 immutable NON_ZERO_HASH = keccak256(abi.encode(1));
function setUp() external {
function setUp() virtual override public {
super.setUp();
lb = new L1Block();
depositor = lb.DEPOSITOR_ACCOUNT();
vm.prank(depositor);
......
......@@ -21,7 +21,8 @@ contract L2ToL1MessagePasserTest is CommonTest {
event WithdrawerBalanceBurnt(uint256 indexed amount);
function setUp() public virtual {
function setUp() public virtual override {
super.setUp();
messagePasser = new L2ToL1MessagePasser();
}
......
......@@ -8,7 +8,8 @@ import { Predeploys } from "../libraries/Predeploys.sol";
contract LegacyERC20ETH_Test is CommonTest {
LegacyERC20ETH eth;
function setUp() external {
function setUp() virtual override public {
super.setUp();
eth = new LegacyERC20ETH();
}
......
......@@ -8,7 +8,8 @@ import { Predeploys } from "../libraries/Predeploys.sol";
contract LegacyMessagePasser_Test is CommonTest {
LegacyMessagePasser messagePasser;
function setUp() external {
function setUp() virtual override public {
super.setUp();
messagePasser = new LegacyMessagePasser();
}
......
......@@ -5,10 +5,6 @@ import { CommonTest } from "./CommonTest.t.sol";
import { MerkleTrie } from "../libraries/trie/MerkleTrie.sol";
contract MerkleTrie_get_Test is CommonTest {
function setUp() public {
_setUp();
}
function test_get_validProof1_succeeds() external {
bytes32 root = 0xd582f99275e227a1cf4284899e5ff06ee56da8859be71b553397c69151bc942f;
bytes memory key = hex"6b6579326262";
......
......@@ -11,7 +11,9 @@ contract MintManager_Initializer is CommonTest {
GovernanceToken internal gov;
MintManager internal manager;
function setUp() external {
function setUp() virtual override public {
super.setUp();
vm.prank(owner);
gov = new GovernanceToken();
......
......@@ -21,8 +21,8 @@ contract ResourceMetering_Test is CommonTest {
MeterUser internal meter;
uint64 initialBlockNum;
function setUp() external {
_setUp();
function setUp() virtual override public {
super.setUp();
meter = new MeterUser();
initialBlockNum = uint64(block.number);
}
......
......@@ -19,7 +19,8 @@ contract Semver_Test is CommonTest {
/**
* @notice Deploy a Semver contract
*/
function setUp() external {
function setUp() virtual override public {
super.setUp();
semver = new Semver(7, 8, 0);
}
......
......@@ -28,13 +28,13 @@ contract SequencerFeeVault_Test is Bridge_Initializer {
}
function test_receive_succeeds() external {
assertEq(address(vault).balance, 0);
uint256 balance = address(vault).balance;
vm.prank(alice);
(bool success, ) = address(vault).call{ value: 100 }(hex"");
assertEq(success, true);
assertEq(address(vault).balance, 100);
assertEq(address(vault).balance, balance + 100);
}
function test_withdraw_notEnough_reverts() external {
......
......@@ -7,7 +7,8 @@ import { SystemConfig } from "../L1/SystemConfig.sol";
contract SystemConfig_Init is CommonTest {
SystemConfig sysConf;
function setUp() external {
function setUp() virtual override public {
super.setUp();
sysConf = new SystemConfig({
_owner: alice,
_overhead: 2100,
......
......@@ -94,7 +94,7 @@ contract RelayActor is StdUtils {
contract XDM_MinGasLimits is Messenger_Initializer {
RelayActor actor;
function setUp() public override {
function setUp() public virtual override {
// Set up the `L1CrossDomainMessenger` and `OptimismPortal` contracts.
super.setUp();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment