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

[draft] update boa #54

Draft
wants to merge 9 commits into
base: lending
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ packages = []
python = ">=3.10,<4"
vyper = "0.3.10"
poetry = "^1"
titanoboa = {git = "https://github.com/vyperlang/titanoboa.git", rev = "375052479b5a164a3f84489810eebb15fb43737a"}
titanoboa = {git = "https://github.com/vyperlang/titanoboa.git", rev = "574409ed71b0c8fe75f25aea05b786a27f1d644a"}
hypothesis = "^6.99.0"
pdbpp = "^0.10.3"
jedi = "^0.19.0"
Expand Down
15 changes: 15 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
uv
vyper==0.3.10
#poetry~=1.7
eth-abi==4.1.0
titanoboa @ git+https://github.com/vyperlang/titanoboa.git@574409ed71b0c8fe75f25aea05b786a27f1d644a
pytest~=7.4.0
hypothesis~=6.82.0
pdbpp
jedi
pytest-xdist
pytest-forked
ipython
eth_account
cytoolz

11 changes: 9 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
from typing import Any, Callable

import boa
from boa.environment import Env
import pytest
from hypothesis import settings


boa.env.enable_fast_mode()


PRICE = 3000

Expand All @@ -18,6 +17,7 @@
settings.load_profile(os.getenv(u"HYPOTHESIS_PROFILE", "default"))



def approx(x1: int, x2: int, precision: int, abs_precision=None):
if precision >= 1:
return True
Expand All @@ -33,6 +33,13 @@ def approx(x1: int, x2: int, precision: int, abs_precision=None):
return result or (abs(log(x1 / x2)) <= precision)


# fresh env for each worker, so xdist workers do not trample each other
@pytest.fixture(scope="session", autouse=True)
def fresh_env():
with boa.swap_env(Env()):
boa.env.enable_fast_mode()
yield

@pytest.fixture(scope="session")
def accounts():
return [boa.env.generate_address() for _ in range(10)]
Expand Down