Commit d386df32 authored by Maurelian's avatar Maurelian Committed by GitHub

feat: Move proposeAnotherOutput to L2OutputOracle specific test file. (#13366)

* feat: Move proposeAnotherOutput to L2OutputOracle specific test file.

* fix: gas snapshot
parent 68c2e0d3
...@@ -5,7 +5,7 @@ GasBenchMark_L1BlockInterop_SetValuesInterop_Warm:test_setL1BlockValuesInterop_b ...@@ -5,7 +5,7 @@ GasBenchMark_L1BlockInterop_SetValuesInterop_Warm:test_setL1BlockValuesInterop_b
GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (gas: 158531) GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (gas: 158531)
GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7597) GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7597)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369280) GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369280)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967465) GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967420)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 564398) GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 564398)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4076613) GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4076613)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 467098) GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 467098)
...@@ -13,5 +13,5 @@ GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 351280 ...@@ -13,5 +13,5 @@ GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 351280
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 72664) GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 72664)
GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 92973) GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 92973)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 68422) GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 68422)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 68986) GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 69031)
GasBenchMark_OptimismPortal:test_proveWithdrawalTransaction_benchmark() (gas: 155565) GasBenchMark_OptimismPortal:test_proveWithdrawalTransaction_benchmark() (gas: 155610)
\ No newline at end of file \ No newline at end of file
...@@ -23,6 +23,28 @@ contract L2OutputOracle_TestBase is CommonTest { ...@@ -23,6 +23,28 @@ contract L2OutputOracle_TestBase is CommonTest {
super.setUp(); super.setUp();
} }
/// @dev Helper function to propose an output.
function proposeAnotherOutput() public {
bytes32 proposedOutput2 = keccak256(abi.encode());
uint256 nextBlockNumber = l2OutputOracle.nextBlockNumber();
uint256 nextOutputIndex = l2OutputOracle.nextOutputIndex();
warpToProposeTime(nextBlockNumber);
uint256 proposedNumber = l2OutputOracle.latestBlockNumber();
uint256 submissionInterval = deploy.cfg().l2OutputOracleSubmissionInterval();
// Ensure the submissionInterval is enforced
assertEq(nextBlockNumber, proposedNumber + submissionInterval);
vm.roll(nextBlockNumber + 1);
vm.expectEmit(true, true, true, true);
emit OutputProposed(proposedOutput2, nextOutputIndex, nextBlockNumber, block.timestamp);
address proposer = deploy.cfg().l2OutputOracleProposer();
vm.prank(proposer);
l2OutputOracle.proposeL2Output(proposedOutput2, nextBlockNumber, 0, 0);
}
/// @dev Tests that constructor sets the initial values correctly. /// @dev Tests that constructor sets the initial values correctly.
function test_constructor_succeeds() external { function test_constructor_succeeds() external {
IL2OutputOracle oracleImpl = IL2OutputOracle(address(new L2OutputOracle())); IL2OutputOracle oracleImpl = IL2OutputOracle(address(new L2OutputOracle()));
......
...@@ -170,28 +170,6 @@ contract CommonTest is Test, Setup, Events { ...@@ -170,28 +170,6 @@ contract CommonTest is Test, Setup, Events {
vm.warp(l2OutputOracle.computeL2Timestamp(_nextBlockNumber) + 1); vm.warp(l2OutputOracle.computeL2Timestamp(_nextBlockNumber) + 1);
} }
/// @dev Helper function to propose an output.
function proposeAnotherOutput() public {
bytes32 proposedOutput2 = keccak256(abi.encode());
uint256 nextBlockNumber = l2OutputOracle.nextBlockNumber();
uint256 nextOutputIndex = l2OutputOracle.nextOutputIndex();
warpToProposeTime(nextBlockNumber);
uint256 proposedNumber = l2OutputOracle.latestBlockNumber();
uint256 submissionInterval = deploy.cfg().l2OutputOracleSubmissionInterval();
// Ensure the submissionInterval is enforced
assertEq(nextBlockNumber, proposedNumber + submissionInterval);
vm.roll(nextBlockNumber + 1);
vm.expectEmit(true, true, true, true);
emit OutputProposed(proposedOutput2, nextOutputIndex, nextBlockNumber, block.timestamp);
address proposer = deploy.cfg().l2OutputOracleProposer();
vm.prank(proposer);
l2OutputOracle.proposeL2Output(proposedOutput2, nextBlockNumber, 0, 0);
}
function enableLegacyContracts() public { function enableLegacyContracts() public {
// Check if the system has already been deployed, based off of the heuristic that alice and bob have not been // 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. // set by the `setUp` function yet.
......
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