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

Upgrade web3 dependency #1064

Merged
merged 6 commits into from
Apr 19, 2021
Merged

Upgrade web3 dependency #1064

merged 6 commits into from
Apr 19, 2021

Conversation

skellet0r
Copy link
Collaborator

@skellet0r skellet0r commented Apr 19, 2021

What I did

Upgrade web3 dependency to 5.18.0, replace soon to be deprecated methods, and add additional middleware to maintain backwards compatibility (SolidityError/ContractLogicError)

A majority of this is just some grepppppping to change method names from camelCase to snake_case :)

Related issue: #1048 #1010

Additional Info:

In the 5.13.0 release of web3, there is a new error formatter middleware for eth_call and eth_estimateGas rpc methods, this formatter instead of passing along the rpc response, instead it raises a ContractLogicError with a (pretty meh) message, but granted it's for end users. For brownie, all we have to really do is bypass that middlware by adding our own prior to it, and raise a ValueError with the appropriate RPCError dict. This is then used to raise a VirtualMachineError when a transaction reverts etc ....

References: ethereum/web3.py#941 ethereum/web3.py#1814

How I did it

Used pip-compile -P web3 {,requirements-dev.in,requirements-windows.in}

How to verify it

Since this is supposed to be mainly upgrading the dependencies and not adding any new features, the entire test suite should pass across all builds.

I've also tested using multiple different repos which utilize brownie (the curvefi org of tests)

Checklist

  • I have confirmed that my PR passes all linting checks and tests

Using the -r option previously only appended the packages listed in the
base requirements.in file to the requirements-dev.in. However, this
leads to incompatibilities between the two set of requirements as when
compiling the requirements-dev we get the most up to date packages
available instead of the constrained ones.
Newly constrained dev requirements.
Replace all instances of deprecated web3.eth methods with their new methods.
@skellet0r skellet0r mentioned this pull request Apr 19, 2021
1 task
Copy link
Member

@iamdefinitelyahuman iamdefinitelyahuman left a comment

Choose a reason for hiding this comment

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

Wow, did not expect such a huge diff.

Thank you for doing this 🙏

@iamdefinitelyahuman iamdefinitelyahuman merged commit 6f25248 into eth-brownie:master Apr 19, 2021
@skellet0r skellet0r deleted the feat/upgrade-web3 branch April 19, 2021 23:54
@skellet0r
Copy link
Collaborator Author

Closes #1048

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