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: handle unknown selector error #4811

Merged
merged 2 commits into from
Feb 5, 2024
Merged

fix: handle unknown selector error #4811

merged 2 commits into from
Feb 5, 2024

Conversation

Wodann
Copy link
Member

@Wodann Wodann commented Feb 1, 2024

@Wodann Wodann added the area:edr label Feb 1, 2024
@Wodann Wodann requested a review from agostbiro February 1, 2024 20:09
@Wodann Wodann self-assigned this Feb 1, 2024
Copy link

changeset-bot bot commented Feb 1, 2024

⚠️ No Changeset found

Latest commit: 3e86c0d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Feb 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hardhat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 2, 2024 7:03pm

Comment on lines 406 to 408
_ => unreachable!(
"Since we are not validating, no other error can occur: {decode_error:?}"
),
Copy link
Member Author

Choose a reason for hiding this comment

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

@agostbiro you're more familiar with this code. Can we logically rule out that none of the other error variants can occur?

Copy link
Member

Choose a reason for hiding this comment

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

Based on my prior reading of the code for alloy_sol_types::GenericContractError::abi_decode when the validate argument is false, only alloy_sol_types::Error::TypeCheckFail error occurs, but the code is pretty complex and apparently alloy_sol_types::Error::UnknownSelector can occur as well. So it's probably safer to add a fallback where we just convert the error to string.

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed in 3e86c0d

Copy link
Member

@agostbiro agostbiro left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fixes @Wodann ! I left some comments

Comment on lines 406 to 408
_ => unreachable!(
"Since we are not validating, no other error can occur: {decode_error:?}"
),
Copy link
Member

Choose a reason for hiding this comment

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

Based on my prior reading of the code for alloy_sol_types::GenericContractError::abi_decode when the validate argument is false, only alloy_sol_types::Error::TypeCheckFail error occurs, but the code is pretty complex and apparently alloy_sol_types::Error::UnknownSelector can occur as well. So it's probably safer to add a fallback where we just convert the error to string.

crates/edr_provider/src/error.rs Show resolved Hide resolved
@agostbiro agostbiro merged commit 38320fa into edr/main Feb 5, 2024
48 of 49 checks passed
@agostbiro agostbiro deleted the edr/fix/281 branch February 5, 2024 09:35
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

entered unreachable code: Since we are not validating, no other error can occur
2 participants