Commit 38d1bd77 authored by Mark Tyneway's avatar Mark Tyneway

contracts-bedrock: cleanup tests

Move some event declarations into higher level contracts
and delete a setUp function that was doing nothing but calling
super.setUp.

This allows us to more easily reuse the events across different
tests.
parent 0c3493e2
...@@ -103,6 +103,15 @@ contract L2OutputOracle_Initializer is CommonTest { ...@@ -103,6 +103,15 @@ contract L2OutputOracle_Initializer is CommonTest {
// Test data // Test data
uint256 initL1Time; uint256 initL1Time;
event OutputProposed(
bytes32 indexed outputRoot,
uint256 indexed l2OutputIndex,
uint256 indexed l2BlockNumber,
uint256 l1Timestamp
);
event OutputsDeleted(uint256 indexed prevNextOutputIndex, uint256 indexed newNextOutputIndex);
// Advance the evm's time to meet the L2OutputOracle's requirements for proposeL2Output // Advance the evm's time to meet the L2OutputOracle's requirements for proposeL2Output
function warpToProposeTime(uint256 _nextBlockNumber) public { function warpToProposeTime(uint256 _nextBlockNumber) public {
vm.warp(oracle.computeL2Timestamp(_nextBlockNumber) + 1); vm.warp(oracle.computeL2Timestamp(_nextBlockNumber) + 1);
...@@ -146,6 +155,13 @@ contract Portal_Initializer is L2OutputOracle_Initializer { ...@@ -146,6 +155,13 @@ contract Portal_Initializer is L2OutputOracle_Initializer {
OptimismPortal opImpl; OptimismPortal opImpl;
OptimismPortal op; OptimismPortal op;
event WithdrawalFinalized(bytes32 indexed withdrawalHash, bool success);
event WithdrawalProven(
bytes32 indexed withdrawalHash,
address indexed from,
address indexed to
);
function setUp() public virtual override { function setUp() public virtual override {
L2OutputOracle_Initializer.setUp(); L2OutputOracle_Initializer.setUp();
......
...@@ -10,17 +10,6 @@ import { Types } from "../libraries/Types.sol"; ...@@ -10,17 +10,6 @@ import { Types } from "../libraries/Types.sol";
contract L2OutputOracleTest is L2OutputOracle_Initializer { contract L2OutputOracleTest is L2OutputOracle_Initializer {
bytes32 proposedOutput1 = keccak256(abi.encode(1)); bytes32 proposedOutput1 = keccak256(abi.encode(1));
event OutputProposed(
bytes32 indexed outputRoot,
uint256 indexed l2OutputIndex,
uint256 indexed l2BlockNumber,
uint256 l1Timestamp
);
function setUp() public override {
super.setUp();
}
function test_constructor_succeeds() external { function test_constructor_succeeds() external {
assertEq(oracle.PROPOSER(), proposer); assertEq(oracle.PROPOSER(), proposer);
assertEq(oracle.CHALLENGER(), owner); assertEq(oracle.CHALLENGER(), owner);
...@@ -335,8 +324,6 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer { ...@@ -335,8 +324,6 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
* Delete Tests - Happy Path * * Delete Tests - Happy Path *
*****************************/ *****************************/
event OutputsDeleted(uint256 indexed prevNextOutputIndex, uint256 indexed newNextOutputIndex);
function test_deleteOutputs_singleOutput_succeeds() external { function test_deleteOutputs_singleOutput_succeeds() external {
test_proposeL2Output_proposeAnotherOutput_succeeds(); test_proposeL2Output_proposeAnotherOutput_succeeds();
test_proposeL2Output_proposeAnotherOutput_succeeds(); test_proposeL2Output_proposeAnotherOutput_succeeds();
......
...@@ -289,13 +289,6 @@ contract OptimismPortal_FinalizeWithdrawal_Test is Portal_Initializer { ...@@ -289,13 +289,6 @@ contract OptimismPortal_FinalizeWithdrawal_Test is Portal_Initializer {
bytes[] _withdrawalProof; bytes[] _withdrawalProof;
Types.OutputRootProof internal _outputRootProof; Types.OutputRootProof internal _outputRootProof;
event WithdrawalFinalized(bytes32 indexed withdrawalHash, bool success);
event WithdrawalProven(
bytes32 indexed withdrawalHash,
address indexed from,
address indexed to
);
// Use a constructor to set the storage vars above, so as to minimize the number of ffi calls. // Use a constructor to set the storage vars above, so as to minimize the number of ffi calls.
constructor() { constructor() {
super.setUp(); 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