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
304884d7
Commit
304884d7
authored
Mar 22, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
contracts-bedrock: more polish
parent
e0c5cb1c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
26 deletions
+16
-26
OptimismPortal.sol
packages/contracts-bedrock/contracts/L1/OptimismPortal.sol
+4
-21
SystemConfig.sol
packages/contracts-bedrock/contracts/L1/SystemConfig.sol
+12
-5
No files found.
packages/contracts-bedrock/contracts/L1/OptimismPortal.sol
View file @
304884d7
...
...
@@ -206,28 +206,11 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
// Intentionally empty.
}
// TODO: I don't like having so many return args but I also don't like
// wrapping them into a struct
/**
* @notice
*/
function resourceConfig() public view override returns (SystemConfig.ResourceConfig memory) {
(
uint32 maxResourceLimit,
uint8 elasticityMultiplier,
uint8 baseFeeMaxChangeDenominator,
uint32 minimumBaseFee,
uint32 systemTxMaxGas,
uint128 maximumBaseFee
) = SYSTEM_CONFIG.resourceConfig();
SystemConfig.ResourceConfig memory config = SystemConfig.ResourceConfig({
maxResourceLimit: maxResourceLimit,
elasticityMultiplier: elasticityMultiplier,
baseFeeMaxChangeDenominator: baseFeeMaxChangeDenominator,
minimumBaseFee: minimumBaseFee,
systemTxMaxGas: systemTxMaxGas,
maximumBaseFee: maximumBaseFee
});
return config;
return SYSTEM_CONFIG.resourceConfig();
}
/**
...
...
packages/contracts-bedrock/contracts/L1/SystemConfig.sol
View file @
304884d7
...
...
@@ -82,7 +82,10 @@ contract SystemConfig is OwnableUpgradeable, Semver {
*/
uint64 public gasLimit;
ResourceConfig public resourceConfig;
/**
* @notice
*/
ResourceConfig internal _resourceConfig;
/**
* @notice Emitted when configuration is updated
...
...
@@ -141,7 +144,7 @@ contract SystemConfig is OwnableUpgradeable, Semver {
bytes32 _batcherHash,
uint64 _gasLimit,
address _unsafeBlockSigner,
ResourceConfig memory _
resourceC
onfig
ResourceConfig memory _
c
onfig
) public initializer {
__Ownable_init();
transferOwnership(_owner);
...
...
@@ -150,7 +153,7 @@ contract SystemConfig is OwnableUpgradeable, Semver {
batcherHash = _batcherHash;
gasLimit = _gasLimit;
_setUnsafeBlockSigner(_unsafeBlockSigner);
_setResourceConfig(_
resourceC
onfig);
_setResourceConfig(_
c
onfig);
require(_gasLimit >= minimumGasLimit(), "SystemConfig: gas limit too low");
}
...
...
@@ -235,6 +238,10 @@ contract SystemConfig is OwnableUpgradeable, Semver {
}
}
function resourceConfig() external view returns (ResourceConfig memory) {
return _resourceConfig;
}
function setResourceConfig(ResourceConfig memory _config) external onlyOwner {
_setResourceConfig(_config);
...
...
@@ -247,10 +254,10 @@ contract SystemConfig is OwnableUpgradeable, Semver {
require(_config.baseFeeMaxChangeDenominator > 0);
require(_config.maxResourceLimit + _config.systemTxMaxGas <= gasLimit);
resourceConfig = _config;
_
resourceConfig = _config;
}
function minimumGasLimit() public view returns (uint256) {
return
resourceConfig.maxResourceLimit +
resourceConfig.systemTxMaxGas;
return
_resourceConfig.maxResourceLimit + _
resourceConfig.systemTxMaxGas;
}
}
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