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
9e98140f
Unverified
Commit
9e98140f
authored
Feb 28, 2023
by
mergify[bot]
Committed by
GitHub
Feb 28, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5008 from ethereum-optimism/fix/metering-readable-2
contracts-bedrock: ResourceMetering more readable
parents
d59924d3
feea0e52
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
ResourceMetering.sol
packages/contracts-bedrock/contracts/L1/ResourceMetering.sol
+14
-14
No files found.
packages/contracts-bedrock/contracts/L1/ResourceMetering.sol
View file @
9e98140f
...
...
@@ -96,11 +96,11 @@ abstract contract ResourceMetering is Initializable {
// Update base fee by adding the base fee delta and clamp the resulting value between
// min and max.
int256 newBaseFee = Arithmetic.clamp(
int256(uint256(params.prevBaseFee)) + baseFeeDelta,
MINIMUM_BASE_FEE,
MAXIMUM_BASE_FEE
);
int256 newBaseFee = Arithmetic.clamp(
{
_value:
int256(uint256(params.prevBaseFee)) + baseFeeDelta,
_min:
MINIMUM_BASE_FEE,
_max:
MAXIMUM_BASE_FEE
}
);
// If we skipped more than one block, we also need to account for every empty block.
// Empty block means there was no demand for deposits in that block, so we should
...
...
@@ -109,15 +109,15 @@ abstract contract ResourceMetering is Initializable {
// Update the base fee by repeatedly applying the exponent 1-(1/change_denominator)
// blockDiff - 1 times. Simulates multiple empty blocks. Clamp the resulting value
// between min and max.
newBaseFee = Arithmetic.clamp(
Arithmetic.cdexp(
newBaseFee,
BASE_FEE_MAX_CHANGE_DENOMINATOR,
int256(blockDiff - 1)
),
MINIMUM_BASE_FEE,
MAXIMUM_BASE_FEE
);
newBaseFee = Arithmetic.clamp(
{
_value: Arithmetic.cdexp({
_coefficient:
newBaseFee,
_denominator:
BASE_FEE_MAX_CHANGE_DENOMINATOR,
_exponent:
int256(blockDiff - 1)
}
),
_min:
MINIMUM_BASE_FEE,
_max:
MAXIMUM_BASE_FEE
}
);
}
// Update new base fee, reset bought gas, and update block number.
...
...
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