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

refactor[test]: bypass eth-tester and interface with evm backend directly #3846

Merged
merged 109 commits into from
May 2, 2024

Conversation

DanielSchiavini
Copy link
Contributor

@DanielSchiavini DanielSchiavini commented Mar 8, 2024

Depends on #3904 paradigmxyz/pyrevm#13 paradigmxyz/pyrevm#16

What I did

Refactor the test suite to use evm backend directly. Got rid of eth-tester and added support for pyrevm.

How I did it

  • Copy the new ABI parser from titanoboa
  • Install pyrevm and update tests
  • Create an env interface that is implemented with both py-evm and py-revm
  • Remove eth_tester

How to verify it

Tests should pass

Commit message

Refactor the test suite to use the EVM backend directly. Get rid of
`eth-tester` and `web3`, add support for pyrevm.

How:
- Create a `BaseEnv` abstraction which has both `py-evm` and `pyrevm`
  backends
- Implementing multiple backends gives us flexibility between EVM
  backends (especially if there is feature disparity between backends,
  e.g. regarding EIP implementation), and additionally serves as a form
  of differential testing by using different backend implementations.
- Add `ABIContract` abstraction to interface between EVM and contracts
- `BaseEnv` and `ABIContract` are substantially "inspired by" titanoboa,
  but we did not introduce titanoboa as a dependency because it
  increases the coupling between `vyper` and `titanoboa` repos.
- Install pyrevm and update tests
- Remove `eth-tester` and `web3` dependencies

Misc/refactoring:
- Prune a bunch of unneeded functionality in `tests/conftest.py`
  - `tx_failed()` does not need to snapshot (that is handled by
    reverting)
  - Protect every test with `env.anchor()`
  - Remove unneeded `get_contract*` duplicate implementations

Description for the changelog

N/A

Cute Animal Picture

image

tests/revm/abi_contract.py Fixed Show fixed Hide fixed
tests/revm/abi_contract.py Fixed Show fixed Hide fixed
tests/revm/abi_contract.py Fixed Show fixed Hide fixed
@DanielSchiavini DanielSchiavini changed the title chore: pyrevm chore: vyper tests with pyrevm Mar 22, 2024
@codecov-commenter
Copy link

codecov-commenter commented Mar 22, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 88.63%. Comparing base (2b5ce30) to head (e6f871e).

❗ Current head e6f871e differs from pull request most recent head 3bb3fbb. Consider uploading reports for the commit 3bb3fbb to get more accurate results

Files Patch % Lines
vyper/cli/vyper_json.py 0.00% 0 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3846      +/-   ##
==========================================
- Coverage   90.81%   88.63%   -2.18%     
==========================================
  Files          98       98              
  Lines       14867    14866       -1     
  Branches     3309     3310       +1     
==========================================
- Hits        13501    13177     -324     
- Misses        945     1210     +265     
- Partials      421      479      +58     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@DanielSchiavini DanielSchiavini changed the title chore: vyper tests with pyrevm chore[test]: vyper tests with pyrevm Mar 25, 2024
tests/revm/abi_contract.py Fixed Show resolved Hide resolved
Copy link
Member

@charles-cooper charles-cooper left a comment

Choose a reason for hiding this comment

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

incredible. thank you!!!

@charles-cooper charles-cooper changed the title refactor[test]: refactor test suite to use evm backend directly refactor[test]: bypass eth-tester and interface with evm backend directly May 2, 2024
@charles-cooper charles-cooper merged commit 097aecf into vyperlang:master May 2, 2024
153 checks passed
@DanielSchiavini DanielSchiavini deleted the revm branch May 2, 2024 14:54
@charles-cooper
Copy link
Member

note: this brings average test time from ~14mins to 3-7mins. and i think it opens up a lot of low-hanging fruit to improve CI performance too!

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.

3 participants