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 Internal error returned on eth_estimateGas #1478

Conversation

matkt
Copy link
Contributor

@matkt matkt commented Oct 20, 2020

Signed-off-by: Karim TAAM karim.t2am@gmail.com

PR description

Will return "execution reverted" in case of a revert instead of "Internal error"

{ "code": -32000, "message": "Execution reverted" }

Test performed (with and without reverted transaction)

  • on local Clique Network
  • on Rinkeby

Changelog

matkt added 2 commits October 20, 2020 11:02
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
@matkt matkt linked an issue Oct 20, 2020 that may be closed by this pull request
matkt added 5 commits October 20, 2020 15:24
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
@matkt matkt marked this pull request as ready for review October 27, 2020 14:51
Copy link
Contributor

@AbdelStark AbdelStark left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@@ -23,6 +23,8 @@

private Gas sStoreStipendNeeded = Gas.ZERO;

private boolean isReverted = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of storing the revert flag in the tracer is it possible to use org.hyperledger.besu.ethereum.mainnet.TransactionProcessor.Result#getRevertReason? (via org.hyperledger.besu.ethereum.transaction.TransactionSimulatorResult#getResult)? If a TX reverts without a reason do we get an empty revert reason or a revert reason with zero bytes?

Copy link
Contributor

Choose a reason for hiding this comment

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

Im thinking since this is only set by the revert operation and BLS precompiles that the optional will not be empty, at worst an optional of a zero length string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just tried again and indeed we don't have an empty. I thought I found a specific case where it didn't work. but after doing it again it seems ok with your technique

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch. I just updated the code to use getRevertReason

matkt added 2 commits October 27, 2020 19:36
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
@matkt matkt force-pushed the feature/internal-error-returned-on-eth-estimate-gas branch from d962e49 to 74c33df Compare October 28, 2020 11:15
@matkt matkt requested a review from shemnon October 28, 2020 12:31
@matkt matkt merged commit 83e0370 into hyperledger:master Oct 30, 2020
@matkt matkt deleted the feature/internal-error-returned-on-eth-estimate-gas branch November 20, 2020 10:01
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.

500 Internal error returned on eth_estimateGas
3 participants