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
c267d98b
Unverified
Commit
c267d98b
authored
Nov 15, 2024
by
Michael Amadi
Committed by
GitHub
Nov 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve tests SystemConfig (#12938)
* improve tests * improve tests * fixes
parent
b01b93ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
SystemConfig.t.sol
packages/contracts-bedrock/test/L1/SystemConfig.t.sol
+13
-0
SystemConfigInterop.t.sol
packages/contracts-bedrock/test/L1/SystemConfigInterop.t.sol
+13
-0
No files found.
packages/contracts-bedrock/test/L1/SystemConfig.t.sol
View file @
c267d98b
...
@@ -255,6 +255,19 @@ contract SystemConfig_Init_ResourceConfig is SystemConfig_Init {
...
@@ -255,6 +255,19 @@ contract SystemConfig_Init_ResourceConfig is SystemConfig_Init {
_initializeWithResourceConfig(config, "SystemConfig: gas limit too low");
_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
/// @dev Tests that `setResourceConfig` reverts if the elasticity multiplier
/// and max resource limit are configured such that there is a loss of precision.
/// and max resource limit are configured such that there is a loss of precision.
function test_setResourceConfig_badPrecision_reverts() external {
function test_setResourceConfig_badPrecision_reverts() external {
...
...
packages/contracts-bedrock/test/L1/SystemConfigInterop.t.sol
View file @
c267d98b
...
@@ -26,6 +26,19 @@ contract SystemConfigInterop_Test is CommonTest {
...
@@ -26,6 +26,19 @@ contract SystemConfigInterop_Test is CommonTest {
super.setUp();
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.
/// @dev Tests that the gas paying token can be set.
function testFuzz_setGasPayingToken_succeeds(
function testFuzz_setGasPayingToken_succeeds(
address _token,
address _token,
...
...
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