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
92ed8a8e
Unverified
Commit
92ed8a8e
authored
Dec 06, 2022
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ctb: Remove unit tests in favor of fuzzing system config
parent
237a351f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
47 deletions
+8
-47
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+1
-4
SystemConfig.t.sol
packages/contracts-bedrock/contracts/test/SystemConfig.t.sol
+7
-43
No files found.
packages/contracts-bedrock/.gas-snapshot
View file @
92ed8a8e
...
@@ -290,10 +290,7 @@ SequencerFeeVault_Test:test_minWithdrawalAmount_succeeds() (gas: 5420)
...
@@ -290,10 +290,7 @@ SequencerFeeVault_Test:test_minWithdrawalAmount_succeeds() (gas: 5420)
SequencerFeeVault_Test:test_receive_succeeds() (gas: 17336)
SequencerFeeVault_Test:test_receive_succeeds() (gas: 17336)
SequencerFeeVault_Test:test_withdraw_notEnough_reverts() (gas: 9310)
SequencerFeeVault_Test:test_withdraw_notEnough_reverts() (gas: 9310)
SequencerFeeVault_Test:test_withdraw_succeeds() (gas: 135878)
SequencerFeeVault_Test:test_withdraw_succeeds() (gas: 135878)
SystemConfig_Initialize_TestFail:test_initialize_lowGasLimit_reverts() (gas: 61634)
SystemConfig_Initialize_TestFail:test_initialize_lowGasLimit_reverts() (gas: 61707)
SystemConfig_Setters_Test:test_setBatcherHash_succeeds() (gas: 24298)
SystemConfig_Setters_Test:test_setGasConfig_succeeds() (gas: 30855)
SystemConfig_Setters_Test:test_setGasLimit_succeeds() (gas: 24435)
SystemConfig_Setters_TestFail:test_setBatcherHash_notOwner_reverts() (gas: 10501)
SystemConfig_Setters_TestFail:test_setBatcherHash_notOwner_reverts() (gas: 10501)
SystemConfig_Setters_TestFail:test_setGasConfig_notOwner_reverts() (gas: 10576)
SystemConfig_Setters_TestFail:test_setGasConfig_notOwner_reverts() (gas: 10576)
SystemConfig_Setters_TestFail:test_setGasLimit_notOwner_reverts() (gas: 10592)
SystemConfig_Setters_TestFail:test_setGasLimit_notOwner_reverts() (gas: 10592)
packages/contracts-bedrock/contracts/test/SystemConfig.t.sol
View file @
92ed8a8e
...
@@ -21,12 +21,15 @@ contract SystemConfig_Init is CommonTest {
...
@@ -21,12 +21,15 @@ contract SystemConfig_Init is CommonTest {
contract SystemConfig_Initialize_TestFail is CommonTest {
contract SystemConfig_Initialize_TestFail is CommonTest {
function test_initialize_lowGasLimit_reverts() external {
function test_initialize_lowGasLimit_reverts() external {
vm.expectRevert("SystemConfig: gas limit too low");
vm.expectRevert("SystemConfig: gas limit too low");
// The minimum gas limit defined in SystemConfig:
uint64 MINIMUM_GAS_LIMIT = 8_000_000;
new SystemConfig({
new SystemConfig({
_owner: alice,
_owner: alice,
_overhead: 0,
_overhead: 0,
_scalar: 0,
_scalar: 0,
_batcherHash: bytes32(hex""),
_batcherHash: bytes32(hex""),
_gasLimit:
7_999_999
_gasLimit:
MINIMUM_GAS_LIMIT - 1
});
});
}
}
}
}
...
@@ -55,43 +58,15 @@ contract SystemConfig_Setters_Test is SystemConfig_Init {
...
@@ -55,43 +58,15 @@ contract SystemConfig_Setters_Test is SystemConfig_Init {
bytes data
bytes data
);
);
function test_setBatcherHash_succeeds() external {
bytes32 newBatcherHash = bytes32(hex"1234");
vm.expectEmit(true, true, true, true);
emit ConfigUpdate(0, SystemConfig.UpdateType.BATCHER, abi.encode(newBatcherHash));
vm.prank(alice);
sysConf.setBatcherHash(newBatcherHash);
assertEq(sysConf.batcherHash(), newBatcherHash);
}
function testFuzz_setBatcherHash_succeeds(bytes32 newBatcherHash) external {
function testFuzz_setBatcherHash_succeeds(bytes32 newBatcherHash) external {
vm.expectEmit(true, true, true, true);
vm.expectEmit(true, true, true, true);
emit ConfigUpdate(0, SystemConfig.UpdateType.BATCHER, abi.encode(newBatcherHash));
emit ConfigUpdate(0, SystemConfig.UpdateType.BATCHER, abi.encode(newBatcherHash));
vm.prank(
alice
);
vm.prank(
sysConf.owner()
);
sysConf.setBatcherHash(newBatcherHash);
sysConf.setBatcherHash(newBatcherHash);
assertEq(sysConf.batcherHash(), newBatcherHash);
assertEq(sysConf.batcherHash(), newBatcherHash);
}
}
function test_setGasConfig_succeeds() external {
uint256 newOverhead = 1234;
uint256 newScalar = 5678;
vm.expectEmit(true, true, true, true);
emit ConfigUpdate(
0,
SystemConfig.UpdateType.GAS_CONFIG,
abi.encode(newOverhead, newScalar)
);
vm.prank(alice);
sysConf.setGasConfig(newOverhead, newScalar);
assertEq(sysConf.overhead(), newOverhead);
assertEq(sysConf.scalar(), newScalar);
}
function testFuzz_setGasConfig_succeeds(uint256 newOverhead, uint256 newScalar) external {
function testFuzz_setGasConfig_succeeds(uint256 newOverhead, uint256 newScalar) external {
vm.expectEmit(true, true, true, true);
vm.expectEmit(true, true, true, true);
emit ConfigUpdate(
emit ConfigUpdate(
...
@@ -100,23 +75,12 @@ contract SystemConfig_Setters_Test is SystemConfig_Init {
...
@@ -100,23 +75,12 @@ contract SystemConfig_Setters_Test is SystemConfig_Init {
abi.encode(newOverhead, newScalar)
abi.encode(newOverhead, newScalar)
);
);
vm.prank(
alice
);
vm.prank(
sysConf.owner()
);
sysConf.setGasConfig(newOverhead, newScalar);
sysConf.setGasConfig(newOverhead, newScalar);
assertEq(sysConf.overhead(), newOverhead);
assertEq(sysConf.overhead(), newOverhead);
assertEq(sysConf.scalar(), newScalar);
assertEq(sysConf.scalar(), newScalar);
}
}
function test_setGasLimit_succeeds() external {
uint64 newGasLimit = 9_876_543;
vm.expectEmit(true, true, true, true);
emit ConfigUpdate(0, SystemConfig.UpdateType.GAS_LIMIT, abi.encode(newGasLimit));
vm.prank(alice);
sysConf.setGasLimit(newGasLimit);
assertEq(sysConf.gasLimit(), newGasLimit);
}
function testFuzz_setGasLimit_succeeds(uint64 newGasLimit) external {
function testFuzz_setGasLimit_succeeds(uint64 newGasLimit) external {
uint64 minimumGasLimit = sysConf.MINIMUM_GAS_LIMIT();
uint64 minimumGasLimit = sysConf.MINIMUM_GAS_LIMIT();
newGasLimit = uint64(
newGasLimit = uint64(
...
@@ -126,7 +90,7 @@ contract SystemConfig_Setters_Test is SystemConfig_Init {
...
@@ -126,7 +90,7 @@ contract SystemConfig_Setters_Test is SystemConfig_Init {
vm.expectEmit(true, true, true, true);
vm.expectEmit(true, true, true, true);
emit ConfigUpdate(0, SystemConfig.UpdateType.GAS_LIMIT, abi.encode(newGasLimit));
emit ConfigUpdate(0, SystemConfig.UpdateType.GAS_LIMIT, abi.encode(newGasLimit));
vm.prank(
alice
);
vm.prank(
sysConf.owner()
);
sysConf.setGasLimit(newGasLimit);
sysConf.setGasLimit(newGasLimit);
assertEq(sysConf.gasLimit(), newGasLimit);
assertEq(sysConf.gasLimit(), newGasLimit);
}
}
...
...
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