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: return error when failing to decode output in parse_call_result #2691

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aalan3
Copy link

@aalan3 aalan3 commented Nov 29, 2023

Motivation

I ran into this issue when trying to decode the output for a call where the ABI had the incorrect type. I was calling many different ERC20 contracts for symbol() but found a contract that has a different return type, bytes32 instead of the expected string.

Without this change it's hard to understand which call is failing because the entire Multicall returns an error instead of individually for each call.

Solution

parse_call_result now returns Err(bytes) for each call output that fails to decode. It previously just returned an Err immediately from the failing decode function due to ?.

Not sure if it's still ideal to just return bytes since call and call_array will assume it's a revert.

The resulting different behaviour is that instead getting an error for call_raw() you would get an error when parsing the results similar to a regular revert error for example.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

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.

None yet

1 participant