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
2f9facab
Unverified
Commit
2f9facab
authored
Dec 08, 2022
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ctb: Fix inconsistent casing on base fee vars
parent
540030be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
32 deletions
+32
-32
FuzzResourceMetering.sol
...tracts-bedrock/contracts/echidna/FuzzResourceMetering.sol
+32
-32
No files found.
packages/contracts-bedrock/contracts/echidna/FuzzResourceMetering.sol
View file @
2f9facab
...
...
@@ -6,11 +6,11 @@ import { StdUtils } from "forge-std/Test.sol";
contract EchidnaFuzzResourceMetering is ResourceMetering, StdUtils {
bool failedMaxGasPerBlock;
bool failedRaiseBase
f
ee;
bool failedLowerBase
f
ee;
bool failedNeverBelowMinBase
f
ee;
bool failedMaxRaiseBase
f
eePerBlock;
bool failedMaxLowerBase
f
eePerBlock;
bool failedRaiseBase
F
ee;
bool failedLowerBase
F
ee;
bool failedNeverBelowMinBase
F
ee;
bool failedMaxRaiseBase
F
eePerBlock;
bool failedMaxLowerBase
F
eePerBlock;
constructor() {
initialize();
...
...
@@ -32,7 +32,7 @@ contract EchidnaFuzzResourceMetering is ResourceMetering, StdUtils {
// check that the last block's base fee hasn't dropped below the minimum
if (cachedPrevBaseFee < uint256(MINIMUM_BASE_FEE)) {
failedNeverBelowMinBase
f
ee = true;
failedNeverBelowMinBase
F
ee = true;
}
// check that the last block didn't consume more than the max amount of gas
if (cachedPrevBoughtGas > uint256(MAX_RESOURCE_LIMIT)) {
...
...
@@ -42,7 +42,7 @@ contract EchidnaFuzzResourceMetering is ResourceMetering, StdUtils {
// Part2: we perform the gas burn
// force the gasToBurn into the correct range based on whether we intend to
// raise or lower the base
f
ee after this block, respectively
// raise or lower the base
F
ee after this block, respectively
uint256 gasToBurn;
if (_raiseBaseFee) {
gasToBurn = bound(
...
...
@@ -59,38 +59,38 @@ contract EchidnaFuzzResourceMetering is ResourceMetering, StdUtils {
// Part 3: we run checks and modify our invariant flags based on the updated params values
// Calculate the maximum allowed baseFee change (per block)
uint256 maxBase
f
eeChange = cachedPrevBaseFee / uint256(BASE_FEE_MAX_CHANGE_DENOMINATOR);
uint256 maxBase
F
eeChange = cachedPrevBaseFee / uint256(BASE_FEE_MAX_CHANGE_DENOMINATOR);
// If the last block used more than the target amount of gas (and there were no
// empty blocks in between), ensure this block's base
f
ee increased, but not by
// empty blocks in between), ensure this block's base
F
ee increased, but not by
// more than the max amount per block
if (
(cachedPrevBoughtGas > uint256(TARGET_RESOURCE_LIMIT)) &&
(uint256(params.prevBlockNum) - cachedPrevBlockNum == 1)
) {
failedRaiseBase
fee = failedRaiseBasef
ee || (params.prevBaseFee <= cachedPrevBaseFee);
failedMaxRaiseBase
f
eePerBlock =
failedMaxRaiseBase
f
eePerBlock ||
((uint256(params.prevBaseFee) - cachedPrevBaseFee) < maxBase
f
eeChange);
failedRaiseBase
Fee = failedRaiseBaseF
ee || (params.prevBaseFee <= cachedPrevBaseFee);
failedMaxRaiseBase
F
eePerBlock =
failedMaxRaiseBase
F
eePerBlock ||
((uint256(params.prevBaseFee) - cachedPrevBaseFee) < maxBase
F
eeChange);
}
// If the last blocked used less than the target amount of gas ensure this block's base
f
ee
// If the last blocked used less than the target amount of gas ensure this block's base
F
ee
// decreased, but not by more than the max amount
if (
(cachedPrevBoughtGas < uint256(TARGET_RESOURCE_LIMIT)) ||
(uint256(params.prevBlockNum) - cachedPrevBlockNum > 1)
) {
failedLowerBase
f
ee =
failedLowerBase
f
ee ||
failedLowerBase
F
ee =
failedLowerBase
F
ee ||
(uint256(params.prevBaseFee) > cachedPrevBaseFee);
if (params.prevBlockNum - cachedPrevBlockNum == 1) {
failedMaxLowerBase
f
eePerBlock =
failedMaxLowerBase
f
eePerBlock ||
((cachedPrevBaseFee - uint256(params.prevBaseFee)) < maxBase
f
eeChange);
failedMaxLowerBase
F
eePerBlock =
failedMaxLowerBase
F
eePerBlock ||
((cachedPrevBaseFee - uint256(params.prevBaseFee)) < maxBase
F
eeChange);
}
// Update the maxBase
f
eeChange to account for multiple blocks having passed
maxBase
f
eeChange = uint256(
// Update the maxBase
F
eeChange to account for multiple blocks having passed
maxBase
F
eeChange = uint256(
Arithmetic.cdexp(
int256(cachedPrevBaseFee),
BASE_FEE_MAX_CHANGE_DENOMINATOR,
...
...
@@ -98,25 +98,25 @@ contract EchidnaFuzzResourceMetering is ResourceMetering, StdUtils {
)
);
if (params.prevBlockNum - cachedPrevBlockNum > 1) {
failedMaxLowerBase
f
eePerBlock =
failedMaxLowerBase
f
eePerBlock ||
((cachedPrevBaseFee - uint256(params.prevBaseFee)) < maxBase
f
eeChange);
failedMaxLowerBase
F
eePerBlock =
failedMaxLowerBase
F
eePerBlock ||
((cachedPrevBaseFee - uint256(params.prevBaseFee)) < maxBase
F
eeChange);
}
}
}
function _burnInternal(uint64 _gasToBurn) private metered(_gasToBurn) {}
function echidna_high_usage_raise_base
f
ee() public view returns (bool) {
return !failedRaiseBase
f
ee;
function echidna_high_usage_raise_base
F
ee() public view returns (bool) {
return !failedRaiseBase
F
ee;
}
function echidna_low_usage_lower_base
f
ee() public view returns (bool) {
return !failedLowerBase
f
ee;
function echidna_low_usage_lower_base
F
ee() public view returns (bool) {
return !failedLowerBase
F
ee;
}
function echidna_never_below_min_base
f
ee() public view returns (bool) {
return !failedNeverBelowMinBase
f
ee;
function echidna_never_below_min_base
F
ee() public view returns (bool) {
return !failedNeverBelowMinBase
F
ee;
}
function echidna_never_above_max_gas_limit() public view returns (bool) {
...
...
@@ -124,10 +124,10 @@ contract EchidnaFuzzResourceMetering is ResourceMetering, StdUtils {
}
function echidna_never_exceed_max_increase() public view returns (bool) {
return !failedMaxRaiseBase
f
eePerBlock;
return !failedMaxRaiseBase
F
eePerBlock;
}
function echidna_never_exceed_max_decrease() public view returns (bool) {
return !failedMaxLowerBase
f
eePerBlock;
return !failedMaxLowerBase
F
eePerBlock;
}
}
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