diff --git a/.github/workflows/docker-dev.yml b/.github/workflows/docker-dev.yml index 2265f560..7dc46920 100644 --- a/.github/workflows/docker-dev.yml +++ b/.github/workflows/docker-dev.yml @@ -48,7 +48,7 @@ jobs: load: true - name: Test - timeout-minutes: 5 + timeout-minutes: 2 working-directory: docker/${{ matrix.docker_image }} run: ./test.sh diff --git a/docker/common/start.sh b/docker/common/start.sh index 7d50f0bf..4343007f 100755 --- a/docker/common/start.sh +++ b/docker/common/start.sh @@ -8,7 +8,7 @@ # - OASIS_WEB3_GATEWAY: path to oasis-web3-gateway binary # - OASIS_WEB3_GATEWAY_CONFIG_FILE: path to oasis-web3-gateway config file # - OASIS_DEPOSIT: path to oasis-deposit binary -# - SAPPHIRE_BACKEND: uses 'mock' backend by default +# - BEACON_BACKEND: beacon epoch transition mode 'mock' (default) or 'default' # - OASIS_SINGLE_COMPUTE_NODE: (default: true) if non-empty only run a single compute node export OASIS_SINGLE_COMPUTE_NODE=${OASIS_SINGLE_COMPUTE_NODE-1} @@ -18,11 +18,7 @@ VERSION=$(cat /VERSION) echo "${PARATIME_NAME}-dev ${VERSION} (oasis-core: ${OASIS_CORE_VERSION}, ${PARATIME_NAME}-paratime: ${PARATIME_VERSION}, oasis-web3-gateway: ${OASIS_WEB3_GATEWAY_VERSION})" echo -if [[ ${PARATIME_NAME} == 'sapphire' ]]; then -export SAPPHIRE_BACKEND=${SAPPHIRE_BACKEND:-mock} -else -export SAPPHIRE_BACKEND=default -fi +export BEACON_BACKEND=${BEACON_BACKEND:-mock} OASIS_NODE_SOCKET=${OASIS_NODE_DATADIR}/net-runner/network/client-0/internal.sock OASIS_KM_SOCKET=${OASIS_NODE_DATADIR}/net-runner/network/keymanager-0/internal.sock @@ -55,7 +51,7 @@ OASIS_WEB3_GATEWAY_PID=$! # Wait for compute nodes before initiating deposit. echo -n " * Bootstrapping network (this might take a minute)" -if [[ ${SAPPHIRE_BACKEND} == 'mock' ]]; then +if [[ ${BEACON_BACKEND} == 'mock' ]]; then echo -n . ${OASIS_NODE} debug control wait-nodes -n 2 -a unix:${OASIS_NODE_SOCKET} @@ -66,11 +62,13 @@ if [[ ${SAPPHIRE_BACKEND} == 'mock' ]]; then ${OASIS_NODE} debug control set-epoch --epoch 2 -a unix:${OASIS_NODE_SOCKET} # Transition to the final epoch when the KM generates ephemeral secret. - while (${OASIS_NODE} control status -a unix:${OASIS_KM_SOCKET} | jq -e ".keymanager.worker.ephemeral_secrets.last_generated_epoch!=3" >/dev/null); do - sleep 0.5 - done - echo -n . - ${OASIS_NODE} debug control set-epoch --epoch 3 -a unix:${OASIS_NODE_SOCKET} + if [[ ${PARATIME_NAME} == 'sapphire' ]]; then + while (${OASIS_NODE} control status -a unix:${OASIS_KM_SOCKET} | jq -e ".keymanager.worker.ephemeral_secrets.last_generated_epoch!=3" >/dev/null); do + sleep 0.5 + done + echo -n . + ${OASIS_NODE} debug control set-epoch --epoch 3 -a unix:${OASIS_NODE_SOCKET} + fi else ${OASIS_NODE} debug control wait-ready -a unix:${OASIS_NODE_SOCKET} fi @@ -85,7 +83,7 @@ echo "WARNING: The chain is running in ephemeral mode. State will be lost after echo echo "Listening on http://localhost:8545 and ws://localhost:8546" -if [[ ${SAPPHIRE_BACKEND} == 'mock' ]]; then +if [[ ${BEACON_BACKEND} == 'mock' ]]; then # Run background task to switch epochs every 5 minutes while true; do sleep $((60*10)) diff --git a/docker/emerald-dev/Dockerfile b/docker/emerald-dev/Dockerfile index 7bf0d9df..7d12f991 100644 --- a/docker/emerald-dev/Dockerfile +++ b/docker/emerald-dev/Dockerfile @@ -50,7 +50,7 @@ COPY tests/tools/* / # Configure oasis-node and oasis-net-runner. RUN wget --quiet "https://github.com/oasisprotocol/oasis-core/releases/download/v${OASIS_CORE_VERSION}/oasis_core_${OASIS_CORE_VERSION}_linux_amd64.tar.gz" \ - && tar xfvz "oasis_core_${OASIS_CORE_VERSION}_linux_amd64.tar.gz" \ + && tar xfvz "oasis_core_${OASIS_CORE_VERSION}_linux_amd64.tar.gz" \ && mkdir -p "$(dirname ${OASIS_NODE})" "$(dirname ${OASIS_NET_RUNNER})" \ && mv "oasis_core_${OASIS_CORE_VERSION}_linux_amd64/oasis-node" "${OASIS_NODE}" \ && mv "oasis_core_${OASIS_CORE_VERSION}_linux_amd64/oasis-net-runner" "${OASIS_NET_RUNNER}" \ @@ -59,14 +59,14 @@ RUN wget --quiet "https://github.com/oasisprotocol/oasis-core/releases/download/ && echo "" \ && echo "Configure the ParaTime." \ && mkdir -p "$(dirname ${PARATIME})" \ - && wget --quiet "https://github.com/oasisprotocol/${PARATIME_NAME}-paratime/releases/download/v${PARATIME_VERSION}/localnet-${PARATIME_NAME}-paratime.orc" -O "/paratime.orc" \ - && unzip "paratime.orc" \ - && chmod a+x "runtime.elf" \ + && wget --quiet "https://github.com/oasisprotocol/${PARATIME_NAME}-paratime/releases/download/v${PARATIME_VERSION}/localnet-${PARATIME_NAME}-paratime.orc" -O "/paratime.orc" \ + && unzip "paratime.orc" \ + && chmod a+x "runtime.elf" \ && rm "paratime.orc" \ && echo "" \ && echo "Configure oasis-cli." \ && wget --quiet "https://github.com/oasisprotocol/cli/releases/download/v${OASIS_CLI_VERSION}/oasis_cli_${OASIS_CLI_VERSION}_linux_amd64.tar.gz" \ - && tar -xvf "/oasis_cli_${OASIS_CLI_VERSION}_linux_amd64.tar.gz" \ + && tar -xvf "/oasis_cli_${OASIS_CLI_VERSION}_linux_amd64.tar.gz" \ && mv "/oasis_cli_${OASIS_CLI_VERSION}_linux_amd64/oasis" / \ && rm -rf "/oasis_cli_${OASIS_CLI_VERSION}_linux_amd64/" \ && rm -rf "/oasis_cli_${OASIS_CLI_VERSION}_linux_amd64.tar.gz" \ diff --git a/docker/emerald-dev/test.sh b/docker/emerald-dev/test.sh index 9ee958d4..f6137e30 100755 --- a/docker/emerald-dev/test.sh +++ b/docker/emerald-dev/test.sh @@ -1,8 +1,5 @@ #!/bin/bash -# Temporarily disabled. See https://github.com/oasisprotocol/oasis-web3-gateway/issues/471 -exit 0 - set -euo pipefail TAG=${TAG:-ghcr.io/oasisprotocol/emerald-dev:local} diff --git a/tests/tools/spinup-oasis-stack.sh b/tests/tools/spinup-oasis-stack.sh index e159ad14..6a11779a 100755 --- a/tests/tools/spinup-oasis-stack.sh +++ b/tests/tools/spinup-oasis-stack.sh @@ -6,7 +6,7 @@ set -euo pipefail # Supported ENV Variables: # - OASIS_NODE: path to oasis-node binary # - OASIS_NET_RUNNER: path to oasis-net-runner binary -# - SAPPHIRE_BACKEND: choose 'mock' backend (default), or use other behavior +# - BEACON_BACKEND: choose 'mock' backend (default), or use other behavior # - PARATIME: path to ParaTime binary (inside .orc bundle) # - PARATIME_VERSION: version of the binary. e.g. 3.0.0 # - OASIS_NODE_DATADIR: path to temporary oasis-node data dir e.g. /tmp/oasis-localnet @@ -45,8 +45,8 @@ fi if [[ ! -z "${OASIS_SINGLE_COMPUTE_NODE:-}" ]]; then jq " .compute_workers = [.compute_workers[0]] | - .runtimes[1].executor.group_size = 1 | - .runtimes[1].executor.group_backup_size = 0 + .runtimes[${RT_IDX}].executor.group_size = 1 | + .runtimes[${RT_IDX}].executor.group_backup_size = 0 " "$FIXTURE_FILE" >"$FIXTURE_FILE.tmp" mv "$FIXTURE_FILE.tmp" "$FIXTURE_FILE" fi @@ -58,7 +58,7 @@ jq " " "$FIXTURE_FILE" >"$FIXTURE_FILE.tmp" mv "$FIXTURE_FILE.tmp" "$FIXTURE_FILE" -if [[ ${SAPPHIRE_BACKEND-} == 'mock' ]]; then +if [[ ${BEACON_BACKEND-} == 'mock' ]]; then # Set beacon backend to 'debug mock' jq ".network.beacon.debug_mock_backend = true" "$FIXTURE_FILE" >"$FIXTURE_FILE.tmp" mv "$FIXTURE_FILE.tmp" "$FIXTURE_FILE"