-
Notifications
You must be signed in to change notification settings - Fork 879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suppress ComparisonOutOfRange errorprone warning in AbstractGasLimitSpecification #6727
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cca7490
Refactor AbstractGasLimitSpecification
usmansaleem df223fd
Merge remote-tracking branch 'upstream/main' into cq_gaslimitspec
usmansaleem e8bfa27
test: Add unit test to cover max gas limit
usmansaleem 6d029fc
Add suppression for ComparisonOutOfRange
usmansaleem d98a6a1
test: Use Long.MAX_VALUE
usmansaleem b480e29
Merge remote-tracking branch 'upstream/main' into cq_gaslimitspec
usmansaleem 02d00a5
Merge remote-tracking branch 'upstream/main' into cq_gaslimitspec
usmansaleem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you point to which tests this is covered by please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/TargetingGasLimitCalculatorTest.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I find this errorprone check odd - wouldn't this code break if we ever changed the DEFAULT_MAX to be something other than Long.MAX_VALUE?
I don't think the test coverage is good enough to pick up on that either.
Better to suppress the warning in this case IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree it seems safer to suppress this warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To counter-argue, if we jump from long to BigInteger for example, then the targetGasLimit would also change from long to BigInteger. What is the value
DEFAULT_GAS_MAX_LIMIT
as per the spec? Here it seems to be bounded by the variable type we are using i.e. Long.MAX_VALUE.I'll close this PR and will add the suppression when we bring in the updated errorprone library dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't find a max value in the spec, was looking here: https://ethereum.github.io/execution-specs/src/ethereum/shanghai/fork.py.html#ethereum.shanghai.fork.check_gas_limit:0
It's UInt so unspecified arbitrary size https://ethereum.github.io/execution-specs/src/ethereum/base_types.py.html
I was more thinking if a future spec introduced a specific max value to enforce something in the protocol.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I'll add a unit test instead to cover the max value.