Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
a6a14b70
Unverified
Commit
a6a14b70
authored
Feb 22, 2023
by
Matthew Slipper
Committed by
GitHub
Feb 22, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4938 from ethereum-optimism/fix/test-setup
contracts-bedrock: fix setup chain in tests
parents
d1e99369
80399959
Changes
19
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
135 additions
and
154 deletions
+135
-154
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+105
-105
CommonTest.t.sol
packages/contracts-bedrock/contracts/test/CommonTest.t.sol
+4
-5
CrossDomainOwnable.t.sol
...contracts-bedrock/contracts/test/CrossDomainOwnable.t.sol
+2
-1
DeployerWhitelist.t.sol
.../contracts-bedrock/contracts/test/DeployerWhitelist.t.sol
+1
-1
Encoding.t.sol
packages/contracts-bedrock/contracts/test/Encoding.t.sol
+0
-4
GasPriceOracle.t.sol
...ges/contracts-bedrock/contracts/test/GasPriceOracle.t.sol
+2
-1
GovernanceToken.t.sol
...es/contracts-bedrock/contracts/test/GovernanceToken.t.sol
+2
-1
Hashing.t.sol
packages/contracts-bedrock/contracts/test/Hashing.t.sol
+0
-20
L1Block.t.sol
packages/contracts-bedrock/contracts/test/L1Block.t.sol
+2
-1
L2ToL1MessagePasser.t.sol
...ontracts-bedrock/contracts/test/L2ToL1MessagePasser.t.sol
+2
-1
LegacyERC20ETH.t.sol
...ges/contracts-bedrock/contracts/test/LegacyERC20ETH.t.sol
+2
-1
LegacyMessagePasser.t.sol
...ontracts-bedrock/contracts/test/LegacyMessagePasser.t.sol
+2
-1
MerkleTrie.t.sol
packages/contracts-bedrock/contracts/test/MerkleTrie.t.sol
+0
-4
MintManager.t.sol
packages/contracts-bedrock/contracts/test/MintManager.t.sol
+3
-1
ResourceMetering.t.sol
...s/contracts-bedrock/contracts/test/ResourceMetering.t.sol
+2
-2
Semver.t.sol
packages/contracts-bedrock/contracts/test/Semver.t.sol
+1
-1
SequencerFeeVault.t.sol
.../contracts-bedrock/contracts/test/SequencerFeeVault.t.sol
+2
-2
SystemConfig.t.sol
packages/contracts-bedrock/contracts/test/SystemConfig.t.sol
+2
-1
CrossDomainMessenger.t.sol
...rock/contracts/test/invariants/CrossDomainMessenger.t.sol
+1
-1
No files found.
packages/contracts-bedrock/.gas-snapshot
View file @
a6a14b70
This diff is collapsed.
Click to expand it.
packages/contracts-bedrock/contracts/test/CommonTest.t.sol
View file @
a6a14b70
...
@@ -50,7 +50,7 @@ contract CommonTest is Test {
...
@@ -50,7 +50,7 @@ contract CommonTest is Test {
FFIInterface ffi;
FFIInterface ffi;
function
_setUp() public
{
function
setUp() public virtual
{
// Give alice and bob some ETH
// Give alice and bob some ETH
vm.deal(alice, 1 << 16);
vm.deal(alice, 1 << 16);
vm.deal(bob, 1 << 16);
vm.deal(bob, 1 << 16);
...
@@ -117,9 +117,8 @@ contract L2OutputOracle_Initializer is CommonTest {
...
@@ -117,9 +117,8 @@ contract L2OutputOracle_Initializer is CommonTest {
vm.warp(oracle.computeL2Timestamp(_nextBlockNumber) + 1);
vm.warp(oracle.computeL2Timestamp(_nextBlockNumber) + 1);
}
}
function setUp() public virtual {
function setUp() public virtual override {
_setUp();
super.setUp();
// By default the first block has timestamp and number zero, which will cause underflows in the
// 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.
// tests, so we'll move forward to these block values.
initL1Time = startingTimestamp + 1;
initL1Time = startingTimestamp + 1;
...
@@ -163,7 +162,7 @@ contract Portal_Initializer is L2OutputOracle_Initializer {
...
@@ -163,7 +162,7 @@ contract Portal_Initializer is L2OutputOracle_Initializer {
);
);
function setUp() public virtual override {
function setUp() public virtual override {
L2OutputOracle_Initializ
er.setUp();
sup
er.setUp();
opImpl = new OptimismPortal(oracle, 7 days);
opImpl = new OptimismPortal(oracle, 7 days);
Proxy proxy = new Proxy(multisig);
Proxy proxy = new Proxy(multisig);
...
...
packages/contracts-bedrock/contracts/test/CrossDomainOwnable.t.sol
View file @
a6a14b70
...
@@ -18,7 +18,8 @@ contract XDomainSetter is CrossDomainOwnable {
...
@@ -18,7 +18,8 @@ contract XDomainSetter is CrossDomainOwnable {
contract CrossDomainOwnable_Test is CommonTest {
contract CrossDomainOwnable_Test is CommonTest {
XDomainSetter setter;
XDomainSetter setter;
function setUp() external {
function setUp() public override {
super.setUp();
setter = new XDomainSetter();
setter = new XDomainSetter();
}
}
...
...
packages/contracts-bedrock/contracts/test/DeployerWhitelist.t.sol
View file @
a6a14b70
...
@@ -7,7 +7,7 @@ import { DeployerWhitelist } from "../legacy/DeployerWhitelist.sol";
...
@@ -7,7 +7,7 @@ import { DeployerWhitelist } from "../legacy/DeployerWhitelist.sol";
contract DeployerWhitelist_Test is CommonTest {
contract DeployerWhitelist_Test is CommonTest {
DeployerWhitelist list;
DeployerWhitelist list;
function setUp()
external
{
function setUp()
public virtual override
{
list = new DeployerWhitelist();
list = new DeployerWhitelist();
}
}
...
...
packages/contracts-bedrock/contracts/test/Encoding.t.sol
View file @
a6a14b70
...
@@ -6,10 +6,6 @@ import { Types } from "../libraries/Types.sol";
...
@@ -6,10 +6,6 @@ import { Types } from "../libraries/Types.sol";
import { Encoding } from "../libraries/Encoding.sol";
import { Encoding } from "../libraries/Encoding.sol";
contract Encoding_Test is CommonTest {
contract Encoding_Test is CommonTest {
function setUp() external {
_setUp();
}
function testFuzz_nonceVersioning_succeeds(uint240 _nonce, uint16 _version) external {
function testFuzz_nonceVersioning_succeeds(uint240 _nonce, uint16 _version) external {
(uint240 nonce, uint16 version) = Encoding.decodeVersionedNonce(
(uint240 nonce, uint16 version) = Encoding.decodeVersionedNonce(
Encoding.encodeVersionedNonce(_nonce, _version)
Encoding.encodeVersionedNonce(_nonce, _version)
...
...
packages/contracts-bedrock/contracts/test/GasPriceOracle.t.sol
View file @
a6a14b70
...
@@ -25,7 +25,8 @@ contract GasPriceOracle_Test is CommonTest {
...
@@ -25,7 +25,8 @@ contract GasPriceOracle_Test is CommonTest {
uint256 constant l1FeeOverhead = 310;
uint256 constant l1FeeOverhead = 310;
uint256 constant l1FeeScalar = 10;
uint256 constant l1FeeScalar = 10;
function setUp() external {
function setUp() public virtual override {
super.setUp();
// place the L1Block contract at the predeploy address
// place the L1Block contract at the predeploy address
vm.etch(Predeploys.L1_BLOCK_ATTRIBUTES, address(new L1Block()).code);
vm.etch(Predeploys.L1_BLOCK_ATTRIBUTES, address(new L1Block()).code);
...
...
packages/contracts-bedrock/contracts/test/GovernanceToken.t.sol
View file @
a6a14b70
...
@@ -9,7 +9,8 @@ contract GovernanceToken_Test is CommonTest {
...
@@ -9,7 +9,8 @@ contract GovernanceToken_Test is CommonTest {
address constant rando = address(0x5678);
address constant rando = address(0x5678);
GovernanceToken internal gov;
GovernanceToken internal gov;
function setUp() external {
function setUp() public virtual override {
super.setUp();
vm.prank(owner);
vm.prank(owner);
gov = new GovernanceToken();
gov = new GovernanceToken();
}
}
...
...
packages/contracts-bedrock/contracts/test/Hashing.t.sol
View file @
a6a14b70
...
@@ -7,10 +7,6 @@ import { Hashing } from "../libraries/Hashing.sol";
...
@@ -7,10 +7,6 @@ import { Hashing } from "../libraries/Hashing.sol";
import { Encoding } from "../libraries/Encoding.sol";
import { Encoding } from "../libraries/Encoding.sol";
contract Hashing_hashDepositSource_Test is CommonTest {
contract Hashing_hashDepositSource_Test is CommonTest {
function setUp() external {
_setUp();
}
/**
/**
* @notice Tests that hashDepositSource returns the correct hash in a simple case.
* @notice Tests that hashDepositSource returns the correct hash in a simple case.
*/
*/
...
@@ -26,10 +22,6 @@ contract Hashing_hashDepositSource_Test is CommonTest {
...
@@ -26,10 +22,6 @@ contract Hashing_hashDepositSource_Test is CommonTest {
}
}
contract Hashing_hashCrossDomainMessage_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.
* @notice Tests that hashCrossDomainMessage returns the correct hash in a simple case.
*/
*/
...
@@ -54,10 +46,6 @@ contract Hashing_hashCrossDomainMessage_Test is CommonTest {
...
@@ -54,10 +46,6 @@ contract Hashing_hashCrossDomainMessage_Test is CommonTest {
}
}
contract Hashing_hashWithdrawal_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.
* @notice Tests that hashWithdrawal returns the correct hash in a simple case.
*/
*/
...
@@ -79,10 +67,6 @@ contract Hashing_hashWithdrawal_Test is CommonTest {
...
@@ -79,10 +67,6 @@ contract Hashing_hashWithdrawal_Test is CommonTest {
}
}
contract Hashing_hashOutputRootProof_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.
* @notice Tests that hashOutputRootProof returns the correct hash in a simple case.
*/
*/
...
@@ -112,10 +96,6 @@ contract Hashing_hashOutputRootProof_Test is CommonTest {
...
@@ -112,10 +96,6 @@ contract Hashing_hashOutputRootProof_Test is CommonTest {
}
}
contract Hashing_hashDepositTransaction_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.
* @notice Tests that hashDepositTransaction returns the correct hash in a simple case.
*/
*/
...
...
packages/contracts-bedrock/contracts/test/L1Block.t.sol
View file @
a6a14b70
...
@@ -9,7 +9,8 @@ contract L1BlockTest is CommonTest {
...
@@ -9,7 +9,8 @@ contract L1BlockTest is CommonTest {
address depositor;
address depositor;
bytes32 immutable NON_ZERO_HASH = keccak256(abi.encode(1));
bytes32 immutable NON_ZERO_HASH = keccak256(abi.encode(1));
function setUp() external {
function setUp() public virtual override {
super.setUp();
lb = new L1Block();
lb = new L1Block();
depositor = lb.DEPOSITOR_ACCOUNT();
depositor = lb.DEPOSITOR_ACCOUNT();
vm.prank(depositor);
vm.prank(depositor);
...
...
packages/contracts-bedrock/contracts/test/L2ToL1MessagePasser.t.sol
View file @
a6a14b70
...
@@ -21,7 +21,8 @@ contract L2ToL1MessagePasserTest is CommonTest {
...
@@ -21,7 +21,8 @@ contract L2ToL1MessagePasserTest is CommonTest {
event WithdrawerBalanceBurnt(uint256 indexed amount);
event WithdrawerBalanceBurnt(uint256 indexed amount);
function setUp() public virtual {
function setUp() public virtual override {
super.setUp();
messagePasser = new L2ToL1MessagePasser();
messagePasser = new L2ToL1MessagePasser();
}
}
...
...
packages/contracts-bedrock/contracts/test/LegacyERC20ETH.t.sol
View file @
a6a14b70
...
@@ -8,7 +8,8 @@ import { Predeploys } from "../libraries/Predeploys.sol";
...
@@ -8,7 +8,8 @@ import { Predeploys } from "../libraries/Predeploys.sol";
contract LegacyERC20ETH_Test is CommonTest {
contract LegacyERC20ETH_Test is CommonTest {
LegacyERC20ETH eth;
LegacyERC20ETH eth;
function setUp() external {
function setUp() public virtual override {
super.setUp();
eth = new LegacyERC20ETH();
eth = new LegacyERC20ETH();
}
}
...
...
packages/contracts-bedrock/contracts/test/LegacyMessagePasser.t.sol
View file @
a6a14b70
...
@@ -8,7 +8,8 @@ import { Predeploys } from "../libraries/Predeploys.sol";
...
@@ -8,7 +8,8 @@ import { Predeploys } from "../libraries/Predeploys.sol";
contract LegacyMessagePasser_Test is CommonTest {
contract LegacyMessagePasser_Test is CommonTest {
LegacyMessagePasser messagePasser;
LegacyMessagePasser messagePasser;
function setUp() external {
function setUp() public virtual override {
super.setUp();
messagePasser = new LegacyMessagePasser();
messagePasser = new LegacyMessagePasser();
}
}
...
...
packages/contracts-bedrock/contracts/test/MerkleTrie.t.sol
View file @
a6a14b70
...
@@ -5,10 +5,6 @@ import { CommonTest } from "./CommonTest.t.sol";
...
@@ -5,10 +5,6 @@ import { CommonTest } from "./CommonTest.t.sol";
import { MerkleTrie } from "../libraries/trie/MerkleTrie.sol";
import { MerkleTrie } from "../libraries/trie/MerkleTrie.sol";
contract MerkleTrie_get_Test is CommonTest {
contract MerkleTrie_get_Test is CommonTest {
function setUp() public {
_setUp();
}
function test_get_validProof1_succeeds() external {
function test_get_validProof1_succeeds() external {
bytes32 root = 0xd582f99275e227a1cf4284899e5ff06ee56da8859be71b553397c69151bc942f;
bytes32 root = 0xd582f99275e227a1cf4284899e5ff06ee56da8859be71b553397c69151bc942f;
bytes memory key = hex"6b6579326262";
bytes memory key = hex"6b6579326262";
...
...
packages/contracts-bedrock/contracts/test/MintManager.t.sol
View file @
a6a14b70
...
@@ -11,7 +11,9 @@ contract MintManager_Initializer is CommonTest {
...
@@ -11,7 +11,9 @@ contract MintManager_Initializer is CommonTest {
GovernanceToken internal gov;
GovernanceToken internal gov;
MintManager internal manager;
MintManager internal manager;
function setUp() external {
function setUp() public virtual override {
super.setUp();
vm.prank(owner);
vm.prank(owner);
gov = new GovernanceToken();
gov = new GovernanceToken();
...
...
packages/contracts-bedrock/contracts/test/ResourceMetering.t.sol
View file @
a6a14b70
...
@@ -21,8 +21,8 @@ contract ResourceMetering_Test is CommonTest {
...
@@ -21,8 +21,8 @@ contract ResourceMetering_Test is CommonTest {
MeterUser internal meter;
MeterUser internal meter;
uint64 initialBlockNum;
uint64 initialBlockNum;
function setUp()
external
{
function setUp()
public virtual override
{
_
setUp();
super.
setUp();
meter = new MeterUser();
meter = new MeterUser();
initialBlockNum = uint64(block.number);
initialBlockNum = uint64(block.number);
}
}
...
...
packages/contracts-bedrock/contracts/test/Semver.t.sol
View file @
a6a14b70
...
@@ -19,7 +19,7 @@ contract Semver_Test is CommonTest {
...
@@ -19,7 +19,7 @@ contract Semver_Test is CommonTest {
/**
/**
* @notice Deploy a Semver contract
* @notice Deploy a Semver contract
*/
*/
function setUp()
external
{
function setUp()
public virtual override
{
semver = new Semver(7, 8, 0);
semver = new Semver(7, 8, 0);
}
}
...
...
packages/contracts-bedrock/contracts/test/SequencerFeeVault.t.sol
View file @
a6a14b70
...
@@ -28,13 +28,13 @@ contract SequencerFeeVault_Test is Bridge_Initializer {
...
@@ -28,13 +28,13 @@ contract SequencerFeeVault_Test is Bridge_Initializer {
}
}
function test_receive_succeeds() external {
function test_receive_succeeds() external {
assertEq(address(vault).balance, 0)
;
uint256 balance = address(vault).balance
;
vm.prank(alice);
vm.prank(alice);
(bool success, ) = address(vault).call{ value: 100 }(hex"");
(bool success, ) = address(vault).call{ value: 100 }(hex"");
assertEq(success, true);
assertEq(success, true);
assertEq(address(vault).balance, 100);
assertEq(address(vault).balance,
balance +
100);
}
}
function test_withdraw_notEnough_reverts() external {
function test_withdraw_notEnough_reverts() external {
...
...
packages/contracts-bedrock/contracts/test/SystemConfig.t.sol
View file @
a6a14b70
...
@@ -7,7 +7,8 @@ import { SystemConfig } from "../L1/SystemConfig.sol";
...
@@ -7,7 +7,8 @@ import { SystemConfig } from "../L1/SystemConfig.sol";
contract SystemConfig_Init is CommonTest {
contract SystemConfig_Init is CommonTest {
SystemConfig sysConf;
SystemConfig sysConf;
function setUp() external {
function setUp() public virtual override {
super.setUp();
sysConf = new SystemConfig({
sysConf = new SystemConfig({
_owner: alice,
_owner: alice,
_overhead: 2100,
_overhead: 2100,
...
...
packages/contracts-bedrock/contracts/test/invariants/CrossDomainMessenger.t.sol
View file @
a6a14b70
...
@@ -94,7 +94,7 @@ contract RelayActor is StdUtils {
...
@@ -94,7 +94,7 @@ contract RelayActor is StdUtils {
contract XDM_MinGasLimits is Messenger_Initializer {
contract XDM_MinGasLimits is Messenger_Initializer {
RelayActor actor;
RelayActor actor;
function setUp() public override {
function setUp() public
virtual
override {
// Set up the `L1CrossDomainMessenger` and `OptimismPortal` contracts.
// Set up the `L1CrossDomainMessenger` and `OptimismPortal` contracts.
super.setUp();
super.setUp();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment