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
fd430e79
Unverified
Commit
fd430e79
authored
Apr 13, 2023
by
mergify[bot]
Committed by
GitHub
Apr 13, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into jg/fix_reset_loop
parents
14e2c25e
ef722130
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
91 deletions
+6
-91
systemconfig.go
op-bindings/bindings/systemconfig.go
+1
-1
systemconfig_more.go
op-bindings/bindings/systemconfig_more.go
+1
-1
SystemConfig.sol
packages/contracts-bedrock/contracts/L1/SystemConfig.sol
+3
-3
OptimismPortal.t.sol
...ges/contracts-bedrock/contracts/test/OptimismPortal.t.sol
+0
-85
SystemConfig.t.sol
packages/contracts-bedrock/contracts/test/SystemConfig.t.sol
+1
-1
No files found.
op-bindings/bindings/systemconfig.go
View file @
fd430e79
This diff is collapsed.
Click to expand it.
op-bindings/bindings/systemconfig_more.go
View file @
fd430e79
This diff is collapsed.
Click to expand it.
packages/contracts-bedrock/contracts/L1/SystemConfig.sol
View file @
fd430e79
...
@@ -80,7 +80,7 @@ contract SystemConfig is OwnableUpgradeable, Semver {
...
@@ -80,7 +80,7 @@ contract SystemConfig is OwnableUpgradeable, Semver {
event ConfigUpdate(uint256 indexed version, UpdateType indexed updateType, bytes data);
event ConfigUpdate(uint256 indexed version, UpdateType indexed updateType, bytes data);
/**
/**
* @custom:semver 1.
3
.0
* @custom:semver 1.
2
.0
*
*
* @param _owner Initial owner of the contract.
* @param _owner Initial owner of the contract.
* @param _overhead Initial overhead value.
* @param _overhead Initial overhead value.
...
@@ -98,7 +98,7 @@ contract SystemConfig is OwnableUpgradeable, Semver {
...
@@ -98,7 +98,7 @@ contract SystemConfig is OwnableUpgradeable, Semver {
uint64 _gasLimit,
uint64 _gasLimit,
address _unsafeBlockSigner,
address _unsafeBlockSigner,
ResourceMetering.ResourceConfig memory _config
ResourceMetering.ResourceConfig memory _config
) Semver(1,
3
, 0) {
) Semver(1,
2
, 0) {
initialize({
initialize({
_owner: _owner,
_owner: _owner,
_overhead: _overhead,
_overhead: _overhead,
...
@@ -270,7 +270,7 @@ contract SystemConfig is OwnableUpgradeable, Semver {
...
@@ -270,7 +270,7 @@ contract SystemConfig is OwnableUpgradeable, Semver {
"SystemConfig: min base fee must be less than max base"
"SystemConfig: min base fee must be less than max base"
);
);
// Base fee change denominator must be greater than 0.
// Base fee change denominator must be greater than 0.
require(_config.baseFeeMaxChangeDenominator >
1, "SystemConfig: denominator must be larger than 1
");
require(_config.baseFeeMaxChangeDenominator >
0, "SystemConfig: denominator cannot be 0
");
// Max resource limit plus system tx gas must be less than or equal to the L2 gas limit.
// Max resource limit plus system tx gas must be less than or equal to the L2 gas limit.
// The gas limit must be increased before these values can be increased.
// The gas limit must be increased before these values can be increased.
require(
require(
...
...
packages/contracts-bedrock/contracts/test/OptimismPortal.t.sol
View file @
fd430e79
...
@@ -1085,88 +1085,3 @@ contract OptimismPortalUpgradeable_Test is Portal_Initializer {
...
@@ -1085,88 +1085,3 @@ contract OptimismPortalUpgradeable_Test is Portal_Initializer {
assertEq(slot21Expected, slot21After);
assertEq(slot21Expected, slot21After);
}
}
}
}
/**
* @title OptimismPortalResourceFuzz_Test
* @dev Test various values of the resource metering config to ensure that deposits cannot be
* broken by changing the config.
*/
contract OptimismPortalResourceFuzz_Test is Portal_Initializer {
/**
* @dev The max gas limit observed throughout this test. Setting this too high can cause
* the test to take too long to run.
*/
uint256 constant MAX_GAS_LIMIT = 30_000_000;
/**
* @dev Test that various values of the resource metering config will not break deposits.
*/
function testFuzz_systemConfigDeposit_succeeds(
uint32 _maxResourceLimit,
uint8 _elasticityMultiplier,
uint8 _baseFeeMaxChangeDenominator,
uint32 _minimumBaseFee,
uint32 _systemTxMaxGas,
uint128 _maximumBaseFee,
uint64 _gasLimit,
uint64 _prevBoughtGas,
uint128 _prevBaseFee,
uint8 _blockDiff
) external {
// Get the set system gas limit
uint64 gasLimit = systemConfig.gasLimit();
// Bound resource config
_maxResourceLimit = uint32(bound(_maxResourceLimit, 21000, MAX_GAS_LIMIT / 8));
_gasLimit = uint64(bound( _gasLimit, 21000, _maxResourceLimit));
_prevBaseFee = uint128(bound(_prevBaseFee, 0, 5 gwei));
// Prevent values that would cause reverts
vm.assume(gasLimit >= _gasLimit);
vm.assume(_minimumBaseFee < _maximumBaseFee);
vm.assume(_baseFeeMaxChangeDenominator > 1);
vm.assume(uint256(_maxResourceLimit) + uint256(_systemTxMaxGas) <= gasLimit);
vm.assume(_elasticityMultiplier > 0);
vm.assume(
((_maxResourceLimit / _elasticityMultiplier) * _elasticityMultiplier) == _maxResourceLimit
);
_prevBoughtGas = uint64(bound(_prevBoughtGas, 0, _maxResourceLimit - _gasLimit));
_blockDiff = uint8(bound(_blockDiff, 0, 3));
// Create a resource config to mock the call to the system config with
ResourceMetering.ResourceConfig memory rcfg = ResourceMetering.ResourceConfig({
maxResourceLimit: _maxResourceLimit,
elasticityMultiplier: _elasticityMultiplier,
baseFeeMaxChangeDenominator: _baseFeeMaxChangeDenominator,
minimumBaseFee: _minimumBaseFee,
systemTxMaxGas: _systemTxMaxGas,
maximumBaseFee: _maximumBaseFee
});
vm.mockCall(
address(systemConfig),
abi.encodeWithSelector(systemConfig.resourceConfig.selector),
abi.encode(rcfg)
);
// Set the resource params
uint256 _prevBlockNum = block.number - _blockDiff;
vm.store(
address(op),
bytes32(uint256(1)),
bytes32((_prevBlockNum << 192) | (uint256(_prevBoughtGas) << 128) | _prevBaseFee)
);
// Ensure that the storage setting is correct
(uint128 prevBaseFee, uint64 prevBoughtGas, uint64 prevBlockNum) = op.params();
assertEq(prevBaseFee, _prevBaseFee);
assertEq(prevBoughtGas, _prevBoughtGas);
assertEq(prevBlockNum, _prevBlockNum);
// Do a deposit, should not revert
op.depositTransaction{ gas: MAX_GAS_LIMIT }({
_to: address(0x20),
_value: 0x40,
_gasLimit: _gasLimit,
_isCreation: false,
_data: hex""
});
}
}
packages/contracts-bedrock/contracts/test/SystemConfig.t.sol
View file @
fd430e79
...
@@ -110,7 +110,7 @@ contract SystemConfig_Setters_TestFail is SystemConfig_Init {
...
@@ -110,7 +110,7 @@ contract SystemConfig_Setters_TestFail is SystemConfig_Init {
maximumBaseFee: 2 gwei
maximumBaseFee: 2 gwei
});
});
vm.prank(sysConf.owner());
vm.prank(sysConf.owner());
vm.expectRevert("SystemConfig: denominator
must be larger than 1
");
vm.expectRevert("SystemConfig: denominator
cannot be 0
");
sysConf.setResourceConfig(config);
sysConf.setResourceConfig(config);
}
}
...
...
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