Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/contracts-bedrock/test/L1/SystemConfig.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
13 changes: 13 additions & 0 deletions packages/contracts-bedrock/test/L1/SystemConfigInterop.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down