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

Re-think Revert Reason Parsing #3053

Closed
kclowes opened this issue Jul 20, 2023 · 1 comment · Fixed by #3087
Closed

Re-think Revert Reason Parsing #3053

kclowes opened this issue Jul 20, 2023 · 1 comment · Fixed by #3087

Comments

@kclowes
Copy link
Collaborator

kclowes commented Jul 20, 2023

What was wrong?

Many nodes/networks return error data in different formats that doesn't comply with the JSON-RPC error spec. raise_contract_logic_error_on_revert attempts to parse the errors, and is getting unwieldy. It returns unexpected errors when parsing fails.

How can it be fixed?

One option is to check if the error returned matches the JSON-RPC error spec. If it does, parse the error and return the parsed message. If we go this route, I think we should still keep the data attribute on ContractLogicError so that users can pass along the raw data to other contracts if they'd like. If the response doesn't match the spec, we'd return some message that indicates that we can't parse it, along with the raw error data. I'm also open to other ideas.

@reedsa
Copy link
Contributor

reedsa commented Aug 28, 2023

I'm considering working on this and using jsonschema to validate the error response. If the error does not follow convention, an exception will be raised with the original error data.

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 a pull request may close this issue.

2 participants