Commit c267d98b authored by Michael Amadi's avatar Michael Amadi Committed by GitHub

improve tests SystemConfig (#12938)

* improve tests

* improve tests

* fixes
parent b01b93ee
......@@ -255,6 +255,19 @@ contract SystemConfig_Init_ResourceConfig is SystemConfig_Init {
_initializeWithResourceConfig(config, "SystemConfig: gas limit too low");
}
/// @dev Tests that `setResourceConfig` reverts if the gas limit is too low.
function test_setResourceConfig_elasticityMultiplierIs0_reverts() external {
IResourceMetering.ResourceConfig memory config = IResourceMetering.ResourceConfig({
maxResourceLimit: 20_000_000,
elasticityMultiplier: 0,
baseFeeMaxChangeDenominator: 8,
systemTxMaxGas: 1_000_000,
minimumBaseFee: 1 gwei,
maximumBaseFee: 2 gwei
});
_initializeWithResourceConfig(config, "SystemConfig: elasticity multiplier cannot be 0");
}
/// @dev Tests that `setResourceConfig` reverts if the elasticity multiplier
/// and max resource limit are configured such that there is a loss of precision.
function test_setResourceConfig_badPrecision_reverts() external {
......
......@@ -26,6 +26,19 @@ contract SystemConfigInterop_Test is CommonTest {
super.setUp();
}
/// @dev Tests that when the decimals is not 18, initialization reverts.
function test_initialize_decimalsIsNot18_reverts(uint8 decimals) external {
vm.assume(decimals != 18);
address _token = address(L1Token);
vm.mockCall(_token, abi.encodeCall(ERC20.name, ()), abi.encode("Token"));
vm.mockCall(_token, abi.encodeCall(ERC20.symbol, ()), abi.encode("TKN"));
vm.mockCall(_token, abi.encodeCall(ERC20.decimals, ()), abi.encode(decimals));
vm.expectRevert("SystemConfig: bad decimals of gas paying token");
_cleanStorageAndInit(_token);
}
/// @dev Tests that the gas paying token can be set.
function testFuzz_setGasPayingToken_succeeds(
address _token,
......
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