Skip to content
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

Fix parsing gasLimit parameter when its value is > Long.MAX_VALUE #7116

Merged

Conversation

fab-10
Copy link
Contributor

@fab-10 fab-10 commented May 16, 2024

PR description

When calling eth_estimateGas with the gas field set to the maximum value 0xffffffffffffffff or anything greater than 0x7fffffffffffffff, the endpoint returns and error says parameters are invalid, due to the fact that we use a long to fix the value, and it cannot fit these values.
This is not the correct behavior, so the fix is to cap the value to Long.MAX_VALUE, in case the input field has a greater value, since in practice gas limit will not reach such value.
The deserializer has been rename to GasDeserializer since it is now specific to gas and not generic long values.

Fixed Issue(s)

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests

@fab-10 fab-10 changed the title Fix parsing gasLimit parameter when its value is > Long.MAX_VALUE Fix parsing gasLimit parameter when its value is > Long.MAX_VALUE May 16, 2024
@fab-10 fab-10 changed the title Fix parsing gasLimit parameter when its value is > Long.MAX_VALUE Fix parsing gasLimit parameter when its value is > Long.MAX_VALUE May 16, 2024
@fab-10 fab-10 force-pushed the fix-call-parameters-max-gas-limit-value branch from 0df9e68 to d821ac1 Compare May 16, 2024 12:12
Copy link
Contributor

@pinges pinges left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fab-10 fab-10 marked this pull request as ready for review May 16, 2024 13:22
@macfarla macfarla enabled auto-merge (squash) May 16, 2024 22:03
@macfarla macfarla merged commit 2f473b7 into hyperledger:main May 16, 2024
42 checks passed
@fab-10 fab-10 deleted the fix-call-parameters-max-gas-limit-value branch May 17, 2024 08:21
jflo pushed a commit to jflo/besu that referenced this pull request May 28, 2024
…perledger#7116)

Signed-off-by: Fabio Di Fabio <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]>
Signed-off-by: Justin Florentine <[email protected]>
matthew1001 pushed a commit to kaleido-io/besu that referenced this pull request Jun 7, 2024
jflo pushed a commit to jflo/besu that referenced this pull request Jun 10, 2024
…perledger#7116)

Signed-off-by: Fabio Di Fabio <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]>
Signed-off-by: Justin Florentine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants