diff --git a/backend/tests/conftest.py b/backend/tests/conftest.py index 39f1990e5a..155a7f3e03 100644 --- a/backend/tests/conftest.py +++ b/backend/tests/conftest.py @@ -108,6 +108,15 @@ def pytest_collection_modifyitems(config, items): item.add_marker(skip_api) +def random_string() -> str: + import random + import string + + length_of_string = 6 + characters = string.ascii_letters + string.digits + return "".join(random.choices(characters, k=length_of_string)) + + @pytest.fixture def flask_client() -> FlaskClient: """An application for the integration / API tests.""" diff --git a/localenv/docker-apitest.yaml b/localenv/docker-apitest.yaml index e44805616e..6b91efc809 100644 --- a/localenv/docker-apitest.yaml +++ b/localenv/docker-apitest.yaml @@ -1,5 +1,6 @@ version: "3.8" services: + anvil: image: octant/anvil:latest platform: linux/amd64 @@ -8,7 +9,6 @@ services: networks: - octant - #### SUBGRAPH graph-node: image: graphprotocol/graph-node:v0.26.0 platform: linux/amd64 @@ -33,6 +33,7 @@ services: ipfs: 'ipfs:5001' ethereum: localhost:http://anvil:8545 GRAPH_LOG: info + ipfs: image: ipfs/go-ipfs:v0.10.0 platform: linux/amd64 @@ -57,16 +58,16 @@ services: POSTGRES_PASSWORD: let-me-in POSTGRES_DB: graph-node - contracts-deployer: - image: octant/contracts-deployer:latest - depends_on: - - anvil + + multideployer: + image: octant/multideployer:latest networks: - octant + depends_on: + - anvil + - graph-node ports: - - '8546:8546' - healthcheck: - test: ["CMD", "curl", "-f", "localhost:8546"] + - '8022:8022' environment: RPC_URL: http://anvil:8545 NETWORK: localhost @@ -76,20 +77,11 @@ services: PROPOSALS_CID: QmXq3Eaz5xQF51J7mWzxDmfrVjDuGdhnirthttJ9Q2WTF8 PROPOSALS_ADDRESSES: 0x13aB14d9f8a40a0a19f7c8Ba8B23a3F12D25fD12,0x50b641Fb1CC42bE8a292263c68f0612b8182dA51,0x519a0307b7364D21aB1227bf37689271233B3F93,0x5a873cB89BAd323b1acfd998C36aAc6b1a90a91d,0x608309bF063599DdaaF79409879917032377AC44,0x6d614D51D1Ed4eE97A37614F431771Fdb92D5Ae7,0x839a14166Af647F9DD5CdeA616c0354286Cc1593,0xBfD2704FEbD0d6A3f82Ed338731Fdf63077F76Fa,0xdE49c0928ECC3cfb5d07F69f5C82949168Fc6805,0xeAe7825257E71ba345FFcC54D0581ccE819738B9,0x13aB14d9f8a40a0a19f7c8Ba8B23a3F12D25fD12,0x50b641Fb1CC42bE8a292263c68f0612b8182dA51,0x519a0307b7364D21aB1227bf37689271233B3F93,0x5a873cB89BAd323b1acfd998C36aAc6b1a90a91d,0x608309bF063599DdaaF79409879917032377AC44,0x6d614D51D1Ed4eE97A37614F431771Fdb92D5Ae7,0x839a14166Af647F9DD5CdeA616c0354286Cc1593,0xBfD2704FEbD0d6A3f82Ed338731Fdf63077F76Fa,0xdE49c0928ECC3cfb5d07F69f5C82949168Fc6805,0xeAe7825257E71ba345FFcC54D0581ccE819738B9 - subgraph-deployer: - image: octant/subgraph-deployer:latest - depends_on: - - contracts-deployer - - graph-node - networks: - - octant - environment: LOCAL_CONTRACTS: true - CONTRACTS_DEPLOYER_URL: http://contracts-deployer:8546 - NETWORK: localhost IPFS_URL: http://ipfs:5001 - SUBGRAPH_URL: http://graph-node:8020 + SUBGRAPH_ADMIN_URL: http://graph-node:8020 + SUBGRAPH_QUERY_URL: http://graph-node:8000 backend-postgres: image: 'postgres:13' diff --git a/localenv/multideployer/Dockerfile b/localenv/multideployer/Dockerfile new file mode 100644 index 0000000000..758ab79406 --- /dev/null +++ b/localenv/multideployer/Dockerfile @@ -0,0 +1,16 @@ +FROM octant/contracts:latest as hardhat +FROM octant/subgraph:latest as graph + +RUN apk add curl python3 bash + +WORKDIR /app + +RUN mkdir /hardhat/ +COPY --from=hardhat /app/ /hardhat/ + +COPY --chmod=+x entrypoint.sh . +COPY --chmod=+x wait_for_subgraph.sh . +COPY --chmod=+x wait_for_graph_rpc.sh . +COPY server.py /app/server.py + +ENTRYPOINT ["./entrypoint.sh"] diff --git a/localenv/multideployer/entrypoint.sh b/localenv/multideployer/entrypoint.sh new file mode 100755 index 0000000000..8ebb11592b --- /dev/null +++ b/localenv/multideployer/entrypoint.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env sh + +set -ueo pipefail + +export LOCAL_RPC_URL=${RPC_URL} +export PORT=${PORT:-8546} + +wait_for_rpc(){ + curl --retry-connrefused --retry 10 --retry-delay 1 \ + -s -X POST "${RPC_URL}" \ + -H "Content-Type: application/json" \ + --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' +} + +echo "" +echo "waiting for anvil RPC..." +wait_for_rpc +echo "" +echo "anvil is ready!" + +python3 /app/server.py diff --git a/localenv/multideployer/poetry.lock b/localenv/multideployer/poetry.lock new file mode 100644 index 0000000000..86bfae786b --- /dev/null +++ b/localenv/multideployer/poetry.lock @@ -0,0 +1,147 @@ +# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. + +[[package]] +name = "black" +version = "23.12.1" +description = "The uncompromising code formatter." +optional = false +python-versions = ">=3.8" +files = [ + {file = "black-23.12.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e0aaf6041986767a5e0ce663c7a2f0e9eaf21e6ff87a5f95cbf3675bfd4c41d2"}, + {file = "black-23.12.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c88b3711d12905b74206227109272673edce0cb29f27e1385f33b0163c414bba"}, + {file = "black-23.12.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a920b569dc6b3472513ba6ddea21f440d4b4c699494d2e972a1753cdc25df7b0"}, + {file = "black-23.12.1-cp310-cp310-win_amd64.whl", hash = "sha256:3fa4be75ef2a6b96ea8d92b1587dd8cb3a35c7e3d51f0738ced0781c3aa3a5a3"}, + {file = "black-23.12.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:8d4df77958a622f9b5a4c96edb4b8c0034f8434032ab11077ec6c56ae9f384ba"}, + {file = "black-23.12.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:602cfb1196dc692424c70b6507593a2b29aac0547c1be9a1d1365f0d964c353b"}, + {file = "black-23.12.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9c4352800f14be5b4864016882cdba10755bd50805c95f728011bcb47a4afd59"}, + {file = "black-23.12.1-cp311-cp311-win_amd64.whl", hash = "sha256:0808494f2b2df923ffc5723ed3c7b096bd76341f6213989759287611e9837d50"}, + {file = "black-23.12.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:25e57fd232a6d6ff3f4478a6fd0580838e47c93c83eaf1ccc92d4faf27112c4e"}, + {file = "black-23.12.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2d9e13db441c509a3763a7a3d9a49ccc1b4e974a47be4e08ade2a228876500ec"}, + {file = "black-23.12.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d1bd9c210f8b109b1762ec9fd36592fdd528485aadb3f5849b2740ef17e674e"}, + {file = "black-23.12.1-cp312-cp312-win_amd64.whl", hash = "sha256:ae76c22bde5cbb6bfd211ec343ded2163bba7883c7bc77f6b756a1049436fbb9"}, + {file = "black-23.12.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1fa88a0f74e50e4487477bc0bb900c6781dbddfdfa32691e780bf854c3b4a47f"}, + {file = "black-23.12.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a4d6a9668e45ad99d2f8ec70d5c8c04ef4f32f648ef39048d010b0689832ec6d"}, + {file = "black-23.12.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b18fb2ae6c4bb63eebe5be6bd869ba2f14fd0259bda7d18a46b764d8fb86298a"}, + {file = "black-23.12.1-cp38-cp38-win_amd64.whl", hash = "sha256:c04b6d9d20e9c13f43eee8ea87d44156b8505ca8a3c878773f68b4e4812a421e"}, + {file = "black-23.12.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3e1b38b3135fd4c025c28c55ddfc236b05af657828a8a6abe5deec419a0b7055"}, + {file = "black-23.12.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4f0031eaa7b921db76decd73636ef3a12c942ed367d8c3841a0739412b260a54"}, + {file = "black-23.12.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:97e56155c6b737854e60a9ab1c598ff2533d57e7506d97af5481141671abf3ea"}, + {file = "black-23.12.1-cp39-cp39-win_amd64.whl", hash = "sha256:dd15245c8b68fe2b6bd0f32c1556509d11bb33aec9b5d0866dd8e2ed3dba09c2"}, + {file = "black-23.12.1-py3-none-any.whl", hash = "sha256:78baad24af0f033958cad29731e27363183e140962595def56423e626f4bee3e"}, + {file = "black-23.12.1.tar.gz", hash = "sha256:4ce3ef14ebe8d9509188014d96af1c456a910d5b5cbf434a09fef7e024b3d0d5"}, +] + +[package.dependencies] +click = ">=8.0.0" +mypy-extensions = ">=0.4.3" +packaging = ">=22.0" +pathspec = ">=0.9.0" +platformdirs = ">=2" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""} + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] +jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] +uvloop = ["uvloop (>=0.15.2)"] + +[[package]] +name = "click" +version = "8.1.7" +description = "Composable command line interface toolkit" +optional = false +python-versions = ">=3.7" +files = [ + {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"}, + {file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "mypy-extensions" +version = "1.0.0" +description = "Type system extensions for programs checked with the mypy type checker." +optional = false +python-versions = ">=3.5" +files = [ + {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, + {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, +] + +[[package]] +name = "packaging" +version = "23.2" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.7" +files = [ + {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"}, + {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, +] + +[[package]] +name = "pathspec" +version = "0.12.1" +description = "Utility library for gitignore style pattern matching of file paths." +optional = false +python-versions = ">=3.8" +files = [ + {file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"}, + {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, +] + +[[package]] +name = "platformdirs" +version = "4.1.0" +description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +optional = false +python-versions = ">=3.8" +files = [ + {file = "platformdirs-4.1.0-py3-none-any.whl", hash = "sha256:11c8f37bcca40db96d8144522d925583bdb7a31f7b0e37e3ed4318400a8e2380"}, + {file = "platformdirs-4.1.0.tar.gz", hash = "sha256:906d548203468492d432bcb294d4bc2fff751bf84971fbb2c10918cc206ee420"}, +] + +[package.extras] +docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.1)", "sphinx-autodoc-typehints (>=1.24)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)"] + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] + +[[package]] +name = "typing-extensions" +version = "4.9.0" +description = "Backported and Experimental Type Hints for Python 3.8+" +optional = false +python-versions = ">=3.8" +files = [ + {file = "typing_extensions-4.9.0-py3-none-any.whl", hash = "sha256:af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd"}, + {file = "typing_extensions-4.9.0.tar.gz", hash = "sha256:23478f88c37f27d76ac8aee6c905017a143b0b1b886c3c9f66bc2fd94f9f5783"}, +] + +[metadata] +lock-version = "2.0" +python-versions = "^3.10" +content-hash = "b43ae97dfe89e809cffab77f4c3a0676061170fba91b0e01f8cc8fbf6d226b25" diff --git a/localenv/multideployer/pyproject.toml b/localenv/multideployer/pyproject.toml new file mode 100644 index 0000000000..2fa84cfc31 --- /dev/null +++ b/localenv/multideployer/pyproject.toml @@ -0,0 +1,16 @@ +[tool.poetry] +name = "multideployer" +version = "0.1.0" +description = "" +authors = ["Pawel Peregud "] +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.10" + +[tool.poetry.group.dev.dependencies] +black = "^23.12.1" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/localenv/multideployer/server.py b/localenv/multideployer/server.py new file mode 100644 index 0000000000..9582f54290 --- /dev/null +++ b/localenv/multideployer/server.py @@ -0,0 +1,120 @@ +import json +import subprocess +import os +from http.server import BaseHTTPRequestHandler +from urllib.parse import parse_qsl, urlparse +from http.server import HTTPServer + +subgraph_admin_url = os.environ["SUBGRAPH_ADMIN_URL"] +subgraph_query_url = os.environ["SUBGRAPH_QUERY_URL"] +rpc_url = os.environ["RPC_URL"] +ipfs_url = os.environ["IPFS_URL"] + + +def make_env(defs): + os.environ.update(defs) + return os.environ + + +def get_addresses(lines): + def is_address(line): + return "CONTRACT_ADDRESS=" in line + + envs = list(filter(is_address, lines)) + return {var.split("=")[0]: var.split("=")[1] for var in envs} + + +def setup_subgraph(contracts, testname): + env = dict(contracts) + fn = f"/tmp/{testname}_subgraph_networks.json" + env["NETWORK_FILE"] = fn + subprocess.run(["./configure-network.sh", fn], env=make_env(env), check=True) + subprocess.run( + ["yarn", "graph", "build", "--network", "localhost", "--network-file", fn], + check=True, + ) + subprocess.run( + ["yarn", "graph", "create", "--node", subgraph_admin_url, testname], + check=True, + ) + subprocess.run( + [ + "yarn", + "graph", + "deploy", + "--ipfs", + ipfs_url, + "--node", + subgraph_admin_url, + "--network", + "localhost", + "--version-label=v0.0.1", + "--network-file", + fn, + testname, + ], + check=True, + ) + subprocess.run( + ["./wait_for_subgraph.sh", f"{subgraph_query_url}/subgraphs/name/{testname}"], + check=True, + ) + + +class WebRequestHandler(BaseHTTPRequestHandler): + def run_sync(self, query): + return subprocess.run(query, capture_output=True, text=True) + + def get_response(self): + name = self.query_data()["name"] + contracts = subprocess.run( + [ + "npx", + "hardhat", + "--network", + "localhost", + "deploy", + "--reset", + "--write", + "false", + "--tags", + "local", + ], + capture_output=True, + text=True, + cwd="../hardhat/", + ) + addrs = get_addresses(contracts.stdout.split("\n")) + + setup_subgraph(addrs, name) + addrs["SUBGRAPH_NAME"] = name + + return json.dumps(addrs) + + def url(self): + return urlparse(self.path) + + def query_data(self): + return dict(parse_qsl(self.url().query)) + + def do_GET(self): + query = self.query_data() + if "name" not in query: + self.send_response(400) + self.wfile.write('Missing "name" field in GET query fields'.encode("utf-8")) + return + self.send_response(200) + self.send_header("Content-Type", "application/json") + self.end_headers() + self.wfile.write(self.get_response().encode("utf-8")) + + +if __name__ == "__main__": + host = "0.0.0.0" + port = 8022 + print(f"Multideployer listening on http://{host}:{port}") + print( + f"Run GET with appropriate timeout value against http://{host}:{port}/?name=NAMEOFYOURSUBGRAPH" + ) + server = HTTPServer((host, port), WebRequestHandler) + server.serve_forever() diff --git a/localenv/multideployer/wait_for_graph_rpc.sh b/localenv/multideployer/wait_for_graph_rpc.sh new file mode 100755 index 0000000000..e4db928018 --- /dev/null +++ b/localenv/multideployer/wait_for_graph_rpc.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -ueo pipefail + +SUBGRAPH_ENDPOINT=${1-"http://127.0.0.1:8000/subgraphs/name/octant"} + +# Please note that curl will report success after graph is up. +# This command does not check for subgraph status! +curl --retry-connrefused --retry 20 --retry-delay 1 \ + -s -X POST $SUBGRAPH_ENDPOINT \ + -H "Content-Type: application/json" \ + --data '{"query":"{\n epoches {\n id\n }\n}","variables":null,"extensions":{"headers":null}}' +echo "Done waiting for graph RPC" diff --git a/localenv/multideployer/wait_for_subgraph.sh b/localenv/multideployer/wait_for_subgraph.sh new file mode 100755 index 0000000000..c877735752 --- /dev/null +++ b/localenv/multideployer/wait_for_subgraph.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +set -ueo pipefail + +export SUBGRAPH_ENDPOINT=${1-"http://127.0.0.1:8000/subgraphs/name/octant"} + +function retry { + CONTINUE=1 + while : ; do + set -x + curl \ + -X POST "$SUBGRAPH_ENDPOINT" \ + -H "Content-Type: application/json" \ + --data-raw '{"query":"{\n epoches {\n id\n }\n}","variables":null,"extensions":{"headers":null}}' \ + | jq -e '.data.epoches' + CONTINUE=$? + set +x + if [ $CONTINUE -eq 0 ]; then break; fi + sleep 1 + done +} + +export -f retry + +set +e +timeout 20 bash -c retry + +RESULT=$? + +if [ $RESULT -eq 124 ]; then + echo "Waiting for subgraph readiness timeouted." + exit 1 +fi +echo "Done waiting for subgraph readiness. Status OK." diff --git a/localenv/scripts/images.sh b/localenv/scripts/images.sh index 90ee897dbf..1f6d1a9d08 100755 --- a/localenv/scripts/images.sh +++ b/localenv/scripts/images.sh @@ -25,19 +25,19 @@ build_image(){ image_id=$(docker build -q --tag "${DOCKER_IMAGE_PREFIX}/${image}:${DOCKER_TAG}" -f ${dockerfile} "${context_dir}") - echo "Created ${image} image ${image_id}" + echo "Created ${image} image ${image_id}" } build_anvil(){ - echo Building anvil image ... + echo Building anvil image ... - build_image anvil "${OCTANT_ROOT}/localenv/anvil/Dockerfile" "${OCTANT_ROOT}/localenv/anvil" + build_image anvil "${OCTANT_ROOT}/localenv/anvil/Dockerfile" "${OCTANT_ROOT}/localenv/anvil" echo "Finished building anvil image!" } build_contracts_base(){ - echo Building contracts images ... + echo Building contracts images ... dockerfile=$(create_tmp_dockerfile contracts-v1) build_image contracts ${dockerfile} "${OCTANT_ROOT}/contracts-v1" @@ -47,7 +47,7 @@ build_contracts_base(){ } build_subgraph_base(){ - echo Building subgraph images ... + echo Building subgraph images ... dockerfile=$(create_tmp_dockerfile subgraph) build_image subgraph ${dockerfile} "${OCTANT_ROOT}/subgraph" @@ -56,8 +56,8 @@ build_subgraph_base(){ } build_backend(){ - - echo Building backend image ... + + echo Building backend image ... dockerfile=$(create_tmp_dockerfile backend) build_image backend-base ${dockerfile} "${OCTANT_ROOT}/backend" @@ -68,8 +68,8 @@ build_backend(){ } build_client(){ - - echo Building client image ... + + echo Building client image ... dockerfile=$(create_tmp_dockerfile client) build_image client ${dockerfile} "${OCTANT_ROOT}/client" @@ -94,25 +94,36 @@ build_subgraph_deployer(){ echo Finished building subgraph deployer image! } + +build_multideployer(){ + build_contracts_base + build_subgraph_base + echo Building multideployer image ... + + build_image multideployer "${OCTANT_ROOT}/localenv/multideployer/Dockerfile" "${OCTANT_ROOT}/localenv/multideployer" + + echo Finished building multi image! +} + build_control_plane(){ - echo Building control plane image ... + echo Building control plane image ... - build_image control-plane "${OCTANT_ROOT}/localenv/control-plane/Dockerfile" "${OCTANT_ROOT}/localenv/control-plane" + build_image control-plane "${OCTANT_ROOT}/localenv/control-plane/Dockerfile" "${OCTANT_ROOT}/localenv/control-plane" - echo Finished building control plane image! + echo Finished building control plane image! } build_snapshotter(){ - echo Building snapshotter image ... + echo Building snapshotter image ... - build_image snapshotter "${OCTANT_ROOT}/localenv/snapshotter/Dockerfile" "${OCTANT_ROOT}/localenv/snapshotter" + build_image snapshotter "${OCTANT_ROOT}/localenv/snapshotter/Dockerfile" "${OCTANT_ROOT}/localenv/snapshotter" - echo Finished building snapshotter image! + echo Finished building snapshotter image! } build_contracts(){ - build_contracts_base - build_contracts_deployer + build_contracts_base + build_contracts_deployer } build_subgraph(){ @@ -120,15 +131,17 @@ build_subgraph(){ build_subgraph_deployer } + ### Localenv tooling build_control_plane & build_snapshotter & build_anvil & ### PROD-like images -build_subgraph & build_contracts & +build_subgraph & build_backend & build_client & +build_multideployer & wait diff --git a/staking-batch-deposit/hardhat.config.ts b/staking-batch-deposit/hardhat.config.ts index d6e1e3e99f..d79a25b3ee 100644 --- a/staking-batch-deposit/hardhat.config.ts +++ b/staking-batch-deposit/hardhat.config.ts @@ -32,7 +32,7 @@ const config: HardhatUserConfig = { holesky: { accounts: [TESTNET_PRIVATE_KEY], chainId: 17000, - url: HOLESKY_RPC_URL, + url: "https://ethereum-holesky.publicnode.com", }, hardhat: { accounts: { diff --git a/subgraph/configure-network.sh b/subgraph/configure-network.sh index 8b54d41871..f182688f96 100755 --- a/subgraph/configure-network.sh +++ b/subgraph/configure-network.sh @@ -11,13 +11,13 @@ ARTIFACTS_DIR="./generated" mkdir -p "${ARTIFACTS_DIR}" -if [[ -f "${NETWORK_FILE}" ]]; then - echo "Network file ${NETWORK_FILE} already exists. Skipping its generation..." - echo +if [ -f "${NETWORK_FILE}" ]; then + echo "Network file ${NETWORK_FILE} already exists. Skipping its generation..." + echo else - echo "Generating network file ${NETWORK_FILE} from ${NETWORK_TEMPLATE_FILE}" - echo + echo "Generating network file ${NETWORK_FILE} from ${NETWORK_TEMPLATE_FILE}" + echo envsubst <$NETWORK_TEMPLATE_FILE >$NETWORK_FILE fi diff --git a/subgraph/package.json b/subgraph/package.json index d05393d615..114601e498 100644 --- a/subgraph/package.json +++ b/subgraph/package.json @@ -13,6 +13,7 @@ "clean": "docker-compose down -v && docker-compose rm -v && sudo rm -rf data/ipfs data/postgres", "codegen": "graph codegen", "create-subgraph": "graph create --node http://127.0.0.1:8020 octant", + "graph": "graph", "deploy:goerli": "graph deploy --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020 --network goerli octant", "deploy:sepolia": "graph deploy --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020 --network sepolia octant", "deploy:localhost": "graph deploy --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020 octant --network localhost --version-label=v0.0.1", @@ -63,4 +64,4 @@ "eslint --fix" ] } -} \ No newline at end of file +}