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 decoding errors gracefully #4

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

Conversation

oilnam
Copy link

@oilnam oilnam commented May 11, 2021

Description: Decoding errors on sub-calls should not break the entire multicall.

Current behavior: a single decoding error on a sub-call results in the whole multicall breaking, returning an error.

Proposed behavior: a single decoding error on a sub-call will mark the sub-call as failed, without impacting all other calls.

Decoding errors can happen for a variety of reasons, for example if Geth doesn't return any data. I added a test with two calls to demonstrate the new behavior, where the broken calls is targeting a contract that self-distructed.

PS thanks for open sourcing this! 🙏

Decoding errors on sub-calls should not break the entire multicall
@valer-cara valer-cara requested a review from bowd May 11, 2021 13:09
@bowd
Copy link
Collaborator

bowd commented May 19, 2021

@oilnam Hey, thanks for looking into this and taking the time to open the PR!
Yeah what you're saying makes a lot of sense, the whole thing shouldn't error out on a single decode issue.
But I think the implementation would need to satisfy two additional properties to make sense:

  1. There is a way to differentiate between the view call reverting on-chain or because of a revert error.
  2. The decode error isn't lost.

I would also not overwrite the Success property because that's tied to the response struct from the Multicall contract and changing that could lead to confusion.

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