Commit 92ed8a8e authored by Maurelian's avatar Maurelian

ctb: Remove unit tests in favor of fuzzing system config

parent 237a351f
......@@ -290,10 +290,7 @@ SequencerFeeVault_Test:test_minWithdrawalAmount_succeeds() (gas: 5420)
SequencerFeeVault_Test:test_receive_succeeds() (gas: 17336)
SequencerFeeVault_Test:test_withdraw_notEnough_reverts() (gas: 9310)
SequencerFeeVault_Test:test_withdraw_succeeds() (gas: 135878)
SystemConfig_Initialize_TestFail:test_initialize_lowGasLimit_reverts() (gas: 61634)
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_Initialize_TestFail:test_initialize_lowGasLimit_reverts() (gas: 61707)
SystemConfig_Setters_TestFail:test_setBatcherHash_notOwner_reverts() (gas: 10501)
SystemConfig_Setters_TestFail:test_setGasConfig_notOwner_reverts() (gas: 10576)
SystemConfig_Setters_TestFail:test_setGasLimit_notOwner_reverts() (gas: 10592)
......@@ -21,12 +21,15 @@ contract SystemConfig_Init is CommonTest {
contract SystemConfig_Initialize_TestFail is CommonTest {
function test_initialize_lowGasLimit_reverts() external {
vm.expectRevert("SystemConfig: gas limit too low");
// The minimum gas limit defined in SystemConfig:
uint64 MINIMUM_GAS_LIMIT = 8_000_000;
new SystemConfig({
_owner: alice,
_overhead: 0,
_scalar: 0,
_batcherHash: bytes32(hex""),
_gasLimit: 7_999_999
_gasLimit: MINIMUM_GAS_LIMIT - 1
});
}
}
......@@ -55,43 +58,15 @@ contract SystemConfig_Setters_Test is SystemConfig_Init {
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 {
vm.expectEmit(true, true, true, true);
emit ConfigUpdate(0, SystemConfig.UpdateType.BATCHER, abi.encode(newBatcherHash));
vm.prank(alice);
vm.prank(sysConf.owner());
sysConf.setBatcherHash(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 {
vm.expectEmit(true, true, true, true);
emit ConfigUpdate(
......@@ -100,23 +75,12 @@ contract SystemConfig_Setters_Test is SystemConfig_Init {
abi.encode(newOverhead, newScalar)
);
vm.prank(alice);
vm.prank(sysConf.owner());
sysConf.setGasConfig(newOverhead, newScalar);
assertEq(sysConf.overhead(), newOverhead);
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 {
uint64 minimumGasLimit = sysConf.MINIMUM_GAS_LIMIT();
newGasLimit = uint64(
......@@ -126,7 +90,7 @@ contract SystemConfig_Setters_Test is SystemConfig_Init {
vm.expectEmit(true, true, true, true);
emit ConfigUpdate(0, SystemConfig.UpdateType.GAS_LIMIT, abi.encode(newGasLimit));
vm.prank(alice);
vm.prank(sysConf.owner());
sysConf.setGasLimit(newGasLimit);
assertEq(sysConf.gasLimit(), newGasLimit);
}
......
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