diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index da34f219..b1464798 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -26,5 +26,20 @@ jobs: - name: Install Requirements run: pip install -r requirements.txt + - name: Install Zksync dependencies + run: | + echo "Installing zkvyper and era_test_node" + # Install zkvyper and era_test_node from binary repositories + curl --location https://raw.githubusercontent.com/matter-labs/zkvyper-bin/66cc159d9b6af3b5616f6ed7199bd817bf42bf0a/linux-amd64/zkvyper-linux-amd64-musl-v1.4.0 \ + --silent --output /usr/local/bin/zkvyper && \ + chmod +x /usr/local/bin/zkvyper && \ + zkvyper --version + curl --location https://github.com/matter-labs/era-test-node/releases/download/v0.1.0-alpha.19/era_test_node-v0.1.0-alpha.19-x86_64-unknown-linux-gnu.tar.gz \ + --silent --output era_test_node.tar.gz && \ + tar --extract --file=era_test_node.tar.gz && \ + mv era_test_node /usr/local/bin/era_test_node && \ + era_test_node --version && \ + rm era_test_node.tar.gz + - name: Run Tests run: python -m pytest tests/unitary -n auto diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 11b0062b..709e165b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,4 +23,4 @@ repos: args: ["--profile", "black", --line-length=79] default_language_version: - python: python3.10.4 + python: python3.10 diff --git a/tests/conftest.py b/tests/conftest.py index de9151af..a4388ef9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,7 @@ +from shutil import which + import pytest +from boa_zksync.util import install_era_test_node, install_zkvyper_compiler pytest_plugins = [ "tests.fixtures.accounts", @@ -11,4 +14,8 @@ @pytest.fixture(scope="session") def is_zksync(): + if not which("zkvyper"): + install_zkvyper_compiler() + if not which("era_test_node"): + install_era_test_node() return True diff --git a/tests/fixtures/accounts.py b/tests/fixtures/accounts.py index 2e9c75fe..f6ed1863 100644 --- a/tests/fixtures/accounts.py +++ b/tests/fixtures/accounts.py @@ -5,8 +5,10 @@ from tests.utils.tokens import mint_for_testing -_era_accounts = [Account.from_key(private_key) - for public_key, private_key in EraTestNode.TEST_ACCOUNTS] +_era_accounts = [ + Account.from_key(private_key) + for public_key, private_key in EraTestNode.TEST_ACCOUNTS +] @pytest.fixture(scope="module") diff --git a/tests/integration/test_create2_deployment.py b/tests/integration/test_create2_deployment.py index 3fd808dc..62db6f7e 100644 --- a/tests/integration/test_create2_deployment.py +++ b/tests/integration/test_create2_deployment.py @@ -15,7 +15,6 @@ def forked_chain(is_zksync): rpc_url is not None ), "Provider url is not set, add RPC_ETHEREUM param to env" if is_zksync: - boa.interpret.disable_cache() boa_zksync.set_zksync_fork(rpc_url) else: boa.set_network_env(rpc_url) @@ -24,7 +23,7 @@ def forked_chain(is_zksync): @pytest.fixture(autouse=True) def set_balances(forked_chain): for acc in boa.env._accounts: - boa.env.set_balance(acc, 10 ** 25) + boa.env.set_balance(acc, 10**25) @pytest.fixture(scope="module") diff --git a/tests/unitary/conftest.py b/tests/unitary/conftest.py index 7f9e8cba..4e281c67 100644 --- a/tests/unitary/conftest.py +++ b/tests/unitary/conftest.py @@ -12,4 +12,3 @@ def zksync(is_zksync): for _public_key, private_key in EraTestNode.TEST_ACCOUNTS: boa.env.add_account(Account.from_key(private_key)) boa.env.eoa = EraTestNode.TEST_ACCOUNTS[0][0] - boa.interpret.disable_cache() # TODO: remove this line when zksync is stable