diff --git a/README.md b/README.md index 73b4cdef..b3e7df06 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,14 @@ or build the images locally. - Run `docker-compose -f environments/docker-compose-hedera.yaml down` +### Reset network + +- To reset **testnet**: + `docker exec server-latest /home/app/hedera-reset-docker.sh testnet` + +- To reset **previewnet**: + `docker exec server-latest /home/app/hedera-reset-docker.sh previewnet` + ## Test ### Basic non-regression server test @@ -110,6 +118,8 @@ Example contents for `config.json`: "SERVER_URL": "https://server.sourcify-integration.hedera-devops.com", "REPOSITORY_SERVER_URL": "https://repository.sourcify-integration.hedera-devops.com", "EXPLORER_URL": "http://localhost:8080", + "BRAND_PRODUCT_LOGO_URL": "http://example.com/path/to/my-logo.jpg", + "TERMS_OF_SERVICE_URL": http://example.com/path/to/my-terms.html"", "REMOTE_IMPORT": false, "GITHUB_IMPORT": false, "CONTRACT_IMPORT": false, @@ -120,36 +130,38 @@ Example contents for `config.json`: ``` The following properties can be provided in config.json -| Name | Description | -|----------------------------|------------------------------------------------------------------------------| -| `SERVER_URL` | URL of the server (from outside the cluster). | -| `REPOSITORY_SERVER_URL` | HTTP port exposed by container | -| `EXPLORER_URL` | URL of the mirror-node explorer | -| `REMOTE_IMPORT` | Flag to activate mode "Import from remote" | -| `GITHUB_IMPORT` | Flag to activate mode "Import from GitHub" | -| `CONTRACT_IMPORT` | Flag to activate mode "Import from contract's metadata" | -| `JSON_IMPORT` | Flag to activate mode "Import contracts from Solidity's Standard JSON Input" | -| `OPEN_IN_REMIX` | Flag to activate link "Open in Remix" | -| `CREATE2_VERIFICATION` | Flag to activate create2 verification | +| Name | Description | +|-----------------------------|-------------------------------------------------------------------------------------------------| +| `SERVER_URL` | URL of the server (from outside the cluster). | +| `REPOSITORY_SERVER_URL` | HTTP port exposed by container | +| `EXPLORER_URL` | URL of the mirror-node explorer | +| `BRAND_PRODUCT_LOGO_URL` | URL of the header top left product logo (default is Hedera logo) | +| `TERMS_OF_SERVICE_URL` | URL of the terms-of-service document linked from bottom of page (default is no link) | +| `REMOTE_IMPORT` | Flag to activate mode "Import from remote" (default is false) | +| `GITHUB_IMPORT` | Flag to activate mode "Import from GitHub" (default is false) | +| `CONTRACT_IMPORT` | Flag to activate mode "Import from contract's metadata" (default is false) | +| `JSON_IMPORT` | Flag to activate mode "Import contracts from Solidity's Standard JSON Input" (default is false) | +| `OPEN_IN_REMIX` | Flag to activate link "Open in Remix" (default is false) | +| `CREATE2_VERIFICATION` | Flag to activate create2 verification (default is false) | ### _server_ module The following environment variables are needed by the _server_ at runtime: -| Name | Example value | Description | -|-------------------------------|-----------------------------------------------------------|-----------------------------------------------------------------------------------------| -| `REPOSITORY_PATH` | ../../data/repository | DO NOT CHANGE - Path of the contract repository, both inside container and on the host. | -| `SOLC_REPO` | /home/data/solc-bin/linux-amd64 | Path where Solidity compiler binaries will be saved (inside container) | -| `SOLJSON_REPO` | /home/data/solc-bin/soljson | Path where Solidity JS compilers will be saved (inside container) | -| `SOLC_REPO_HOST` | ../../data/solc-bin/linux-amd64 | Path for the Solidity compiler binaries downloaded (on host machine) | -| `SOLJSON_REPO_HOST` | ../../data/solc-bin/soljson | Path for the Solidity JS compilers downloaded (on host machine) | -| `SERVER_PORT` | 80 | HTTP port used inside container | -| `SERVER_EXTERNAL_PORT` | 5002 | HTTP port exposed by container | -| `UI_DOMAIN_NAME` | sourcify-integration.hedera-devops.com | Fully qualified domain name of the host running the ui | -| `SERVER_CREATE2_VERIFICATION` | false | Flag to activate server API endpoints related to create2 {true, false} | -| `REPOSITORY_SERVER_URL` | https://repository.sourcify-integration.hedera-devops.com | URL of repository server (from outside the cluster) | -| `TESTING` | false | DO NOT CHANGE | -| `TAG` | latest | DO NOT CHANGE | +| Name | Example value | Description | +|-------------------------------|---------------------------------|-----------------------------------------------------------------------------------------| +| `REPOSITORY_PATH` | ../../data/repository | DO NOT CHANGE - Path of the contract repository, both inside container and on the host. | +| `SOLC_REPO` | /home/data/solc-bin/linux-amd64 | Path where Solidity compiler binaries will be saved (inside container) | +| `SOLJSON_REPO` | /home/data/solc-bin/soljson | Path where Solidity JS compilers will be saved (inside container) | +| `SOLC_REPO_HOST` | ../../data/solc-bin/linux-amd64 | Path for the Solidity compiler binaries downloaded (on host machine) | +| `SOLJSON_REPO_HOST` | ../../data/solc-bin/soljson | Path for the Solidity JS compilers downloaded (on host machine) | +| `SERVER_PORT` | 80 | HTTP port used inside container | +| `SERVER_EXTERNAL_PORT` | 5002 | HTTP port exposed by container | +| `UI_DOMAIN_NAME` | example.com | Fully qualified domain name of the host running the ui | +| `SERVER_CREATE2_VERIFICATION` | false | Flag to activate server API endpoints related to create2 {true, false} | +| `REPOSITORY_SERVER_URL` | repository.example.com | URL of repository server (from outside the cluster) | +| `TESTING` | false | DO NOT CHANGE | +| `TAG` | latest | Added to the docker image tags (e.g. ui-latest, server-latest, repository-latest) | ### _repository_ module @@ -162,13 +174,13 @@ even though the only useful item for the _repository_ is the following: - The web server part needs the following environment variables at runtime: -| Name | Example value | Description | -|-----------------------------------|----------------------------------------|--------------------------------------------------------| -| `REPOSITORY_PATH` | ../../data/repository | Path of the contract repository on the host. | -| `REPOSITORY_SERVER_EXTERNAL_PORT` | 10000 | HTTP port exposed by container | -| `UI_DOMAIN_NAME` | sourcify-integration.hedera-devops.com | Fully qualified domain name of the host running the ui | -| `TESTING` | false | DO NOT CHANGE | -| `TAG` | latest | DO NOT CHANGE | +| Name | Example value | Description | +|-----------------------------------|-----------------------|----------------------------------------------------------------------------------------| +| `REPOSITORY_PATH` | ../../data/repository | Path of the contract repository on the host. | +| `REPOSITORY_SERVER_EXTERNAL_PORT` | 10000 | HTTP port exposed by container | +| `UI_DOMAIN_NAME` | example.com | Fully qualified domain name of the host running the ui | +| `TESTING` | false | DO NOT CHANGE | +| `TAG` | latest | Added to the docker image tags (e.g. ui-latest, server-latest, repository-latest) | ## Release diff --git a/scripts/hedera-reset-docker.sh b/scripts/hedera-reset-docker.sh new file mode 100755 index 00000000..ef23c3b9 --- /dev/null +++ b/scripts/hedera-reset-docker.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Resets the contract verifications for the given network by removing the 2 directories +# in the repository which store the partial matches and full matches. +# Assumes that the services (server, ui, repository) are shutdown +# + +if [ "$#" -ne 1 ]; then + echo "Usage: hedera-reset-docker.sh testnet | previewnet" + exit 22 +fi + +case ${1} in + previewnet) CHAIN_ID=297 ;; + testnet) CHAIN_ID=296 ;; + *) echo "Usage: hedera-reset-docker.sh testnet | previewnet"; exit 22;; +esac + +CONTRACT_PATH="/home/data/repository/contracts" + +if [ ! -d "${CONTRACT_PATH}" ]; then + echo "Expected contract repository was not found at this path: ${CONTRACT_PATH}" + exit 2 +fi + +PARTIAL_MATCH_PATH="${CONTRACT_PATH}/partial_match/${CHAIN_ID}" +FULL_MATCH_PATH="${CONTRACT_PATH}/full_match/${CHAIN_ID}" + +reset_network () { + NETWORK_PATH=${1} + if [ -d "${NETWORK_PATH}" ]; then + echo " Erasing contents of ${NETWORK_PATH}" + rm -rf "${NETWORK_PATH}" + else + echo " ${NETWORK_PATH} does not exist" + fi +} + +echo "Resetting Hedera ${1} (Chain ID: ${CHAIN_ID})" +reset_network ${PARTIAL_MATCH_PATH} +reset_network ${FULL_MATCH_PATH} \ No newline at end of file diff --git a/src/Dockerfile.server b/src/Dockerfile.server index 363533bc..51304138 100644 --- a/src/Dockerfile.server +++ b/src/Dockerfile.server @@ -8,6 +8,7 @@ COPY packages ./packages COPY src ./src COPY *.json ./ COPY openapi.yaml ./openapi.yaml +COPY scripts/hedera-reset-docker.sh ./ RUN npm config set fetch-retry-mintimeout 20000 RUN npm config set fetch-retry-maxtimeout 120000 diff --git a/ui/public/favicon-16x16.png b/ui/public/favicon-16x16.png index ff92473b..3ae91a26 100644 Binary files a/ui/public/favicon-16x16.png and b/ui/public/favicon-16x16.png differ diff --git a/ui/public/favicon-32x32.png b/ui/public/favicon-32x32.png index 40b6dda5..cd72f6d5 100644 Binary files a/ui/public/favicon-32x32.png and b/ui/public/favicon-32x32.png differ diff --git a/ui/public/favicon.ico b/ui/public/favicon.ico index 6287414b..3304c625 100644 Binary files a/ui/public/favicon.ico and b/ui/public/favicon.ico differ diff --git a/ui/public/manifest.json b/ui/public/manifest.json index 31b4082a..5376e562 100644 --- a/ui/public/manifest.json +++ b/ui/public/manifest.json @@ -1,7 +1,7 @@ { - "short_name": "sourcify.eth", - "name": "sourcify.eth", - "description": "Sourcify: Solidity contract source code and metadata verification tool", + "short_name": "Hedera Verifier", + "name": "Hedera Verifier", + "description": "Hedera Verifier: Solidity contract source code and metadata verification tool", "icons": [ { "src": "favicon.ico",