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

Handle CallWithFlashbotsSignature returning non-JSONRPC error #28

Merged
merged 2 commits into from
Jun 27, 2024

Conversation

ryanschneider
Copy link
Contributor

Currently, if the CallWithFlashbotsSignature receiver returns JSON that is neither a JSONRPC response or the {"error":"some error"} format, then CallWithFlashbotsSignature will return nil, nil.

This adds a new TestCallWithFlashbotsSignature that exhibits the issue, as well as a fix: after unmarshaling the response, we check that the id and jsonrpc fields are set correctly, if they aren't we can assume that the response was non-JSONRPC (and was also not a RelayErrorResponse since that path was already checked as well.

This could happen if for example the relay returns a JSON payload alongside a HTTP error, so I included the HTTP status code in the returned error.

flashbotsrpc.go Outdated Show resolved Hide resolved
Co-authored-by: Chris Hager <chris@linuxuser.at>
Copy link
Owner

@metachris metachris left a comment

Choose a reason for hiding this comment

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

thanks a bunch!

@metachris metachris merged commit bb36bda into metachris:master Jun 27, 2024
2 checks passed
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.

2 participants