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
43ccf8ea
Unverified
Commit
43ccf8ea
authored
Nov 22, 2024
by
Michael Amadi
Committed by
GitHub
Nov 22, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add more tests (#13036)
parent
38db6529
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
L2OutputOracle.t.sol
packages/contracts-bedrock/test/L1/L2OutputOracle.t.sol
+25
-0
GasPriceOracle.t.sol
packages/contracts-bedrock/test/L2/GasPriceOracle.t.sol
+20
-0
No files found.
packages/contracts-bedrock/test/L1/L2OutputOracle.t.sol
View file @
43ccf8ea
...
@@ -99,6 +99,31 @@ contract L2OutputOracle_getter_Test is L2OutputOracle_TestBase {
...
@@ -99,6 +99,31 @@ contract L2OutputOracle_getter_Test is L2OutputOracle_TestBase {
l2OutputOracle.getL2Output(nextOutputIndex + 1);
l2OutputOracle.getL2Output(nextOutputIndex + 1);
}
}
/// @dev Tests that `getL2OutputAfter` of an L2 block number returns the L2 output of the `getL2OutputIndexAfter` of
/// that block number.
function test_getL2OutputAfter_succeeds() external {
uint8 iterations = 5;
Types.OutputProposal memory output;
Types.OutputProposal memory expectedOutput;
for (uint8 i; i < iterations; i++) {
proposeAnotherOutput();
}
uint256 latestBlockNumber = l2OutputOracle.latestBlockNumber();
for (uint8 i = iterations - 1; i > 0; i--) {
uint256 index = l2OutputOracle.getL2OutputIndexAfter(latestBlockNumber);
output = l2OutputOracle.getL2OutputAfter(latestBlockNumber);
expectedOutput = l2OutputOracle.getL2Output(index);
assertEq(output.outputRoot, expectedOutput.outputRoot);
assertEq(output.timestamp, expectedOutput.timestamp);
assertEq(output.l2BlockNumber, expectedOutput.l2BlockNumber);
latestBlockNumber -= l2OutputOracle.SUBMISSION_INTERVAL();
}
}
/// @dev Tests that `getL2OutputIndexAfter` returns the correct value
/// @dev Tests that `getL2OutputIndexAfter` returns the correct value
/// when the input is the exact block number of the proposal.
/// when the input is the exact block number of the proposal.
function test_getL2OutputIndexAfter_sameBlock_succeeds() external {
function test_getL2OutputIndexAfter_sameBlock_succeeds() external {
...
...
packages/contracts-bedrock/test/L2/GasPriceOracle.t.sol
View file @
43ccf8ea
...
@@ -117,6 +117,26 @@ contract GasPriceOracleBedrock_Test is GasPriceOracle_Test {
...
@@ -117,6 +117,26 @@ contract GasPriceOracleBedrock_Test is GasPriceOracle_Test {
vm.expectRevert("GasPriceOracle: Fjord can only be activated after Ecotone");
vm.expectRevert("GasPriceOracle: Fjord can only be activated after Ecotone");
gasPriceOracle.setFjord();
gasPriceOracle.setFjord();
}
}
/// @dev Tests that `getL1Fee` returns the expected value when both fjord and ecotone are not active
function test_getL1Fee_whenFjordAndEcotoneNotActive_succeeds() external {
vm.store(address(gasPriceOracle), bytes32(uint256(0)), bytes32(0));
bytes memory data = hex"1111";
uint256 price = gasPriceOracle.getL1Fee(data);
assertEq(price, 28_600); // ((((16 * data.length(i.e 2)) * (68 * 16)) + l1FeeOverhead(i.e. 310)) *
// l1BaseFee(i.e. 2M) *
// l1FeeScalar(i.e. 10)) / 1e6
}
/// @dev Tests that `getL1GasUsed` returns the expected value when both fjord and ecotone are not active
function test_getL1GasUsed_whenFjordAndEcotoneNotActive_succeeds() external {
vm.store(address(gasPriceOracle), bytes32(uint256(0)), bytes32(0));
bytes memory data = hex"1111";
uint256 gas = gasPriceOracle.getL1GasUsed(data);
assertEq(gas, 1_430); // 1398 + (16 * data.length(i.e 2))
}
}
}
contract GasPriceOracleEcotone_Test is GasPriceOracle_Test {
contract GasPriceOracleEcotone_Test is GasPriceOracle_Test {
...
...
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