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 error_code decoding #1758

Merged
merged 1 commit into from
May 4, 2024

Conversation

YoshihitoAso
Copy link
Contributor

@YoshihitoAso YoshihitoAso commented Mar 27, 2024

What I did

Related issue: #1757

How I did it

Please refer to diff.

Checklist

  • I have confirmed that my PR passes all linting checks
  • I have included test cases
  • I have updated the documentation
  • I have added an entry to the changelog

@YoshihitoAso YoshihitoAso marked this pull request as ready for review March 27, 2024 04:16
@@ -283,7 +283,7 @@ def decode_typed_error(data: str) -> str:
selector = data[:10]
if selector == "0x4e487b71":
# special case, solidity compiler panics
error_code = int(data[4:].hex(), 16)
error_code = int(HexBytes(data[10:]).hex(), 16)
Copy link
Member

Choose a reason for hiding this comment

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

I think this is a safer approach, in some cases the returned data is already formatted to HexBytes. Not sure why it's inconsistent to begin with..

Suggested change
error_code = int(HexBytes(data[10:]).hex(), 16)
error_code = int(HexBytes(data)[4:].hex(), 16)

Copy link
Member

Choose a reason for hiding this comment

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

ahh wait i didn't zoom out enough... your approach is correct

@iamdefinitelyahuman iamdefinitelyahuman merged commit 0620d2e into eth-brownie:master May 4, 2024
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