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

Update web3py exception handling in proxies #6653

Closed
1 of 3 tasks
karlb opened this issue Nov 6, 2020 · 1 comment
Closed
1 of 3 tasks

Update web3py exception handling in proxies #6653

karlb opened this issue Nov 6, 2020 · 1 comment
Assignees

Comments

@karlb
Copy link
Contributor

karlb commented Nov 6, 2020

Our proxies use the pattern

estimated_transaction = self.client.estimate_gas(...)
if estimated_transaction is not None:
    # error handling

But from what I recently observed, web3py does not return None in error cases (or at least not in all of them), but a ValueError. This requires changing the pattern to

try:
    estimated_transaction = self.client.estimate_gas(...)
except ValueError:
    # error handling
  • Verify the changed behavior
  • Devise a pattern to handle all relevant cases (other errors might cause other exceptions, or still return None)
  • Implement pattern in all proxies

Alternatively, we could take advantage of ethereum/web3.py#941 and use the returned revert messages. This could make large parts of the error handling code unnecessary. But for that to work well, we need to add revert messages to the contracts first.

@karlb
Copy link
Contributor Author

karlb commented Nov 6, 2020

This error only occurs on master and is fixed by #6657

@karlb karlb closed this as completed Nov 6, 2020
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

No branches or pull requests

1 participant