-
Notifications
You must be signed in to change notification settings - Fork 836
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
Append ABI-decoded revert reason to message field in error responses #5706
Conversation
|
Signed-off-by: Matthew Whitehead <[email protected]>
c967d1a
to
c86967a
Compare
c86967a
to
b369fd8
Compare
Signed-off-by: Matthew Whitehead <[email protected]>
b369fd8
to
d3b445c
Compare
Signed-off-by: Matthew Whitehead <[email protected]>
Working through a failing unit test that passes locally... |
Signed-off-by: Matthew Whitehead <[email protected]>
ee1fe1d
to
48d97f6
Compare
bd8fbe4
to
e769fc2
Compare
Signed-off-by: Matthew Whitehead <[email protected]>
e769fc2
to
43abcd7
Compare
Signed-off-by: Matthew Whitehead <[email protected]>
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.
LGTM - thanks for the detailed PR description 👍
@@ -29,6 +38,9 @@ public class JsonRpcErrorResponse implements JsonRpcResponse { | |||
private final JsonRpcError error; | |||
@JsonIgnore private final RpcErrorType errorType; | |||
|
|||
// Encoding of "Error(string)" to check for at the start of the revert reason |
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.
Is the "Error(string)" prefix Besu-specific or in a spec?
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.
This is an ethereum standard for the way revert reasons are encoded.
…yperledger#5706) Signed-off-by: Matthew Whitehead <[email protected]> Signed-off-by: Simon Dudley <[email protected]>
…yperledger#5706) Signed-off-by: Matthew Whitehead <[email protected]> Signed-off-by: Simon Dudley <[email protected]>
…yperledger#5706) Signed-off-by: Matthew Whitehead <[email protected]> Signed-off-by: Simon Dudley <[email protected]>
…yperledger#5706) Signed-off-by: Matthew Whitehead <[email protected]> Signed-off-by: Simon Dudley <[email protected]> Signed-off-by: garyschulte <[email protected]>
…yperledger#5706) Signed-off-by: Matthew Whitehead <[email protected]> Signed-off-by: Simon Dudley <[email protected]>
PR description
Todo:
This PR does the following:
JsonRpcErrorResponse
to decode revert reasonsreason
toJsonRpcError
which can optionally be setreason
to the response fromJsonRpcError.getMessage()
so that whenever the message for a JSON RPC error is retrieved, any reason that is set is included e.g.Execution reverted: ERC20: transfer amount exceeds balance
Note: this is proposed as a change to existing behaviour. I have assumed (rightly or wrongly) that existing applications will most likely use
startsWith("Execution reverted")
or other language equivalent, to parse error responses today. The fact that Quorum returns errors in this format (and that there isn't an option to exclude the decoded reason) suggests that any application not usingstartsWith
semantics for error parsing is already brittle to different ethereum clients. It could be made configurable in Besu (perhaps with a--exclude-decoded-reason
or similar option) but my personal view is to treat this as a fix to existing behaviour and document it in the changelog accordingly. I'm open to other opinions on this from reviewers.Example error response before this PR:
Example error response with this PR:
Fixed Issue(s)
Fixes #5705